diff options
Diffstat (limited to 'mod')
51 files changed, 92 insertions, 92 deletions
diff --git a/mod/bookmarks/actions/add.php b/mod/bookmarks/actions/add.php index 5b0ce91c4..e633244c1 100644 --- a/mod/bookmarks/actions/add.php +++ b/mod/bookmarks/actions/add.php @@ -23,8 +23,8 @@ if (!$title || !$address) { //create a new bookmark object $entity = new ElggObject; $entity->subtype = "bookmarks"; -$entity->owner_guid = get_loggedin_user()->getGUID(); -$entity->container_guid = (int)get_input('container_guid', get_loggedin_user()->getGUID()); +$entity->owner_guid = get_loggedin_userid(); +$entity->container_guid = (int)get_input('container_guid', get_loggedin_userid()); $entity->title = $title; $entity->description = $notes; $entity->address = $address; @@ -35,9 +35,9 @@ $entity->tags = $tagarray; if ($entity->save()) { system_message(elgg_echo('bookmarks:save:success')); //add to river - add_to_river('river/object/bookmarks/create','create',$_SESSION['user']->guid,$entity->guid); + add_to_river('river/object/bookmarks/create','create',get_loggedin_userid(),$entity->guid); } else { register_error(elgg_echo('bookmarks:save:failed')); } -$account = get_entity((int)get_input('container_guid', get_loggedin_user()->getGUID())); +$account = get_entity((int)get_input('container_guid', get_loggedin_userid())); forward("pg/bookmarks/" . $account->username);
\ No newline at end of file diff --git a/mod/bookmarks/bookmarklet.php b/mod/bookmarks/bookmarklet.php index e71797026..e1ff3c6df 100644 --- a/mod/bookmarks/bookmarklet.php +++ b/mod/bookmarks/bookmarklet.php @@ -13,8 +13,8 @@ gatekeeper(); // Get the current page's owner $page_owner = page_owner_entity(); -if ($page_owner === false || is_null($page_owner) && ($_SESSION['user'])) { - $page_owner = $_SESSION['user']; +if ($page_owner === false || is_null($page_owner) && (get_loggedin_user())) { + $page_owner = get_loggedin_user(); set_page_owner($page_owner->getGUID()); } diff --git a/mod/bookmarks/views/default/bookmarks/form.php b/mod/bookmarks/views/default/bookmarks/form.php index a49fcc088..b779116fd 100644 --- a/mod/bookmarks/views/default/bookmarks/form.php +++ b/mod/bookmarks/views/default/bookmarks/form.php @@ -31,7 +31,7 @@ if(isset($vars['entity'])){ }else{ $access_id = get_default_access(get_loggedin_user()); } - $owner = $vars['user']; + $owner = get_loggedin_user(); $url = "action/bookmarks/add"; } ?> diff --git a/mod/diagnostics/actions/download.php b/mod/diagnostics/actions/download.php index bf3ede42d..32ef5cbed 100644 --- a/mod/diagnostics/actions/download.php +++ b/mod/diagnostics/actions/download.php @@ -7,7 +7,7 @@ admin_gatekeeper(); - $output = sprintf(elgg_echo('diagnostics:header'), date('r'), $_SESSION['user']->name); + $output = sprintf(elgg_echo('diagnostics:header'), date('r'), get_loggedin_user()->name); $output = trigger_plugin_hook('diagnostics:report', 'system', null, $output); header("Cache-Control: public"); diff --git a/mod/file/actions/delete.php b/mod/file/actions/delete.php index e7ad90289..9357d4955 100644 --- a/mod/file/actions/delete.php +++ b/mod/file/actions/delete.php @@ -49,7 +49,7 @@ } else { - $container = $_SESSION['user']; + $container = get_loggedin_user(); register_error(elgg_echo("file:deletefailed")); } diff --git a/mod/file/actions/save.php b/mod/file/actions/save.php index 5e2045ae8..923bc043b 100644 --- a/mod/file/actions/save.php +++ b/mod/file/actions/save.php @@ -17,7 +17,7 @@ if (!$file = get_entity($guid)) { register_error(elgg_echo("file:uploadfailed")); - forward($CONFIG->wwwroot . "pg/file/" . $_SESSION['user']->username); + forward($CONFIG->wwwroot . "pg/file/" . get_loggedin_user()->username); exit; } diff --git a/mod/file/world.php b/mod/file/world.php index eee3609fb..21e741184 100644 --- a/mod/file/world.php +++ b/mod/file/world.php @@ -13,7 +13,7 @@ // Get the current page's owner $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; + $page_owner = get_loggedin_user(); set_page_owner($_SESSION['guid']); } diff --git a/mod/groups/actions/delete.php b/mod/groups/actions/delete.php index b4bc71838..7d66b2a25 100644 --- a/mod/groups/actions/delete.php +++ b/mod/groups/actions/delete.php @@ -14,6 +14,6 @@ else register_error(elgg_echo('group:notdeleted')); - $url_name = $_SESSION['user']->username; + $url_name = get_loggedin_user()->username; forward("{$vars['url']}pg/groups/member/{$url_name}"); ?>
\ No newline at end of file diff --git a/mod/groups/actions/forums/addtopic.php b/mod/groups/actions/forums/addtopic.php index a0b9acc10..5f9c8e709 100644 --- a/mod/groups/actions/forums/addtopic.php +++ b/mod/groups/actions/forums/addtopic.php @@ -11,7 +11,7 @@ // Check the user is a group member $group_entity = get_entity(get_input('group_guid')); - if (!$group_entity->isMember($vars['user'])) forward(); + if (!$group_entity->isMember(get_loggedin_user())) forward(); // Get input data $title = strip_tags(get_input('topictitle')); @@ -19,7 +19,7 @@ $tags = get_input('topictags'); $access = get_input('access_id'); $group_guid = (int) get_input('group_guid'); - $user = $_SESSION['user']->getGUID(); // you need to be logged in to comment on a group forum + $user = get_loggedin_userid(); // you need to be logged in to comment on a group forum $status = get_input('status'); // sticky, resolved, closed // Convert string of tags into a preformatted array @@ -60,7 +60,7 @@ $grouptopic->status = $status; // the current status i.e sticky, closed, resolved, open // add to river - add_to_river('river/forum/topic/create','create',$_SESSION['user']->guid,$grouptopic->guid); + add_to_river('river/forum/topic/create','create',get_loggedin_userid(),$grouptopic->guid); // Success message system_message(elgg_echo("grouptopic:created")); diff --git a/mod/groups/actions/forums/edittopic.php b/mod/groups/actions/forums/edittopic.php index c7da084da..59c46af73 100644 --- a/mod/groups/actions/forums/edittopic.php +++ b/mod/groups/actions/forums/edittopic.php @@ -8,7 +8,7 @@ if (!isloggedin()) forward(); // Check the user is a group member $group_entity = get_entity(get_input('group_guid')); -if (!$group_entity->isMember($vars['user'])) forward(); +if (!$group_entity->isMember(get_loggedin_user())) forward(); // Get input data $title = strip_tags(get_input('topictitle')); diff --git a/mod/groups/actions/leave.php b/mod/groups/actions/leave.php index 721bff2c8..58f2655ad 100644 --- a/mod/groups/actions/leave.php +++ b/mod/groups/actions/leave.php @@ -14,7 +14,7 @@ $group_guid = get_input('group_guid'); $user = NULL; - if (!$user_guid) $user = $_SESSION['user']; + if (!$user_guid) $user = get_loggedin_user(); else $user = get_entity($user_guid); diff --git a/mod/groups/groupprofile.php b/mod/groups/groupprofile.php index f0e6854ee..a64ca55db 100644 --- a/mod/groups/groupprofile.php +++ b/mod/groups/groupprofile.php @@ -33,7 +33,7 @@ //group members $area3 = elgg_view('groups/members',array('entity' => $group)); } else { - $area2 .= elgg_view('groups/closedmembership', array('entity' => $group, 'user' => $_SESSION['user'], 'full' => true)); + $area2 .= elgg_view('groups/closedmembership', array('entity' => $group, 'user' => get_loggedin_user(), 'full' => true)); } $body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); diff --git a/mod/groups/membership.php b/mod/groups/membership.php index 7f9cfdbf5..0085033fa 100644 --- a/mod/groups/membership.php +++ b/mod/groups/membership.php @@ -14,7 +14,7 @@ $limit = get_input("limit", 10); $offset = get_input("offset", 0); - if (page_owner() == $_SESSION['user']->guid) { + if (page_owner() == get_loggedin_userid()) { $title = elgg_echo("groups:yours"); } else $title = elgg_echo("groups:owned"); diff --git a/mod/groups/start.php b/mod/groups/start.php index b87acbaec..689e24863 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -152,7 +152,7 @@ if ($method == 'sms') { return elgg_echo("groupforumtopic:new") . ': ' . $url . " ({$owner->name}: {$title})"; } else { - return $_SESSION['user']->name . ' ' . elgg_echo("groups:viagroups") . ': ' . $title . "\n\n" . $msg . "\n\n" . $entity->getURL(); + return get_loggedin_user()->name . ' ' . elgg_echo("groups:viagroups") . ': ' . $title . "\n\n" . $msg . "\n\n" . $entity->getURL(); } } @@ -373,7 +373,7 @@ function groups_read_acl_plugin_hook($hook, $entity_type, $returnvalue, $params) { //error_log("READ: " . var_export($returnvalue)); - $user = $_SESSION['user']; + $user = get_loggedin_user(); if ($user) { // Not using this because of recursion. @@ -517,7 +517,7 @@ { //logged in user - $user = $_SESSION['user']->guid; + $user = get_loggedin_userid(); if (($entity->owner_guid == $user) || $group_owner == $user || isadminloggedin()) { return true; diff --git a/mod/groups/views/default/forum/topics.php b/mod/groups/views/default/forum/topics.php index 91834aa08..d5e533f81 100644 --- a/mod/groups/views/default/forum/topics.php +++ b/mod/groups/views/default/forum/topics.php @@ -9,7 +9,7 @@ <h2><?php echo elgg_echo("groups:forum"); ?></h2> </div> <?php // only show the add topic button if the user is a member - if(page_owner_entity()->isMember($vars['user'])) { + if(page_owner_entity()->isMember(get_loggedin_user())) { ?> <div class="content_header_options"> <a class="action_button" href="<?php echo $vars['url']; ?>mod/groups/addtopic.php?group_guid=<?php echo $vars['group_guid']; ?>"><?php echo elgg_echo("groups:addtopic"); ?></a> diff --git a/mod/groups/views/default/forum/viewposts.php b/mod/groups/views/default/forum/viewposts.php index aa8b334f2..f0810ba18 100644 --- a/mod/groups/views/default/forum/viewposts.php +++ b/mod/groups/views/default/forum/viewposts.php @@ -39,7 +39,7 @@ echo elgg_view('navigation/pagination',array( echo "<h3>" . elgg_echo("groups:topicisclosed") . "</h3>"; echo "<p>" . elgg_echo("groups:topiccloseddesc") . "</p>"; - }elseif(page_owner_entity()->isMember($vars['user'])){ + }elseif(page_owner_entity()->isMember(get_loggedin_user())){ //comments are on and the user viewing is a member echo elgg_view_comments($vars['entity']); }else{ diff --git a/mod/groups/views/default/groups/forum_latest.php b/mod/groups/views/default/groups/forum_latest.php index 161455703..2a9ddaf42 100644 --- a/mod/groups/views/default/groups/forum_latest.php +++ b/mod/groups/views/default/groups/forum_latest.php @@ -23,7 +23,7 @@ if($vars['entity']->forum_enable != 'no'){ echo "</div>"; } } else { - if(page_owner_entity()->isMember($vars['user'])){ + if(page_owner_entity()->isMember(get_loggedin_user())){ $create_discussion = $vars['url'] . "mod/groups/addtopic.php?group_guid=" . page_owner(); echo "<p class='margin_top'><a href=\"{$create_discussion}\">".elgg_echo("groups:addtopic")."</a></p>"; }else{ diff --git a/mod/groups/views/default/groups/side_menu.php b/mod/groups/views/default/groups/side_menu.php index a86cd8adb..3048ea431 100644 --- a/mod/groups/views/default/groups/side_menu.php +++ b/mod/groups/views/default/groups/side_menu.php @@ -1,8 +1,8 @@ <ul class="submenu page_navigation"> <?php if(isloggedin()){ - echo "<li><a href=\"{$vars['url']}pg/groups/member/{$_SESSION['user']->username}\">". elgg_echo('groups:yours') ."</a></li>"; - echo "<li><a href=\"{$vars['url']}pg/groups/invitations/{$_SESSION['user']->username}\">". elgg_echo('groups:invitations') ."</a></li>"; + echo "<li><a href=\"{$vars['url']}pg/groups/member/{get_loggedin_user()->username}\">". elgg_echo('groups:yours') ."</a></li>"; + echo "<li><a href=\"{$vars['url']}pg/groups/invitations/{get_loggedin_user()->username}\">". elgg_echo('groups:invitations') ."</a></li>"; } ?> </ul>
\ No newline at end of file diff --git a/mod/members/index.php b/mod/members/index.php index b10f41e29..30d6102e3 100644 --- a/mod/members/index.php +++ b/mod/members/index.php @@ -10,7 +10,7 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); // Get the current page's owner $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; + $page_owner = get_loggedin_user(); //set_page_owner($page_owner->getGUID()); } diff --git a/mod/messages/actions/delete.php b/mod/messages/actions/delete.php index 395b5528b..0f5bb2813 100644 --- a/mod/messages/actions/delete.php +++ b/mod/messages/actions/delete.php @@ -57,7 +57,7 @@ if ($success) { if($type == 'sent'){ forward("mod/messages/sent.php?offset={$offset}"); }else{ - forward("mod/messages/?username=" . $_SESSION['user']->username . "&offset={$offset}"); + forward("mod/messages/?username=" . get_loggedin_user()->username . "&offset={$offset}"); } } else { register_error(elgg_echo("messages:notfound")); diff --git a/mod/messages/send.php b/mod/messages/send.php index 51ad30592..0435974ce 100644 --- a/mod/messages/send.php +++ b/mod/messages/send.php @@ -14,7 +14,7 @@ gatekeeper(); // Get the current page's owner $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; + $page_owner = get_loggedin_user(); set_page_owner($page_owner->getGUID()); } diff --git a/mod/messages/sent.php b/mod/messages/sent.php index 0cd65d87b..36a054e86 100644 --- a/mod/messages/sent.php +++ b/mod/messages/sent.php @@ -22,7 +22,7 @@ $limit = 10; // Display all the messages a user owns, these will make up the sentbox // @todo - fix hack where limit + 1 is passed -$messages = elgg_get_entities_from_metadata(array('metadata_name' => 'fromId', 'metadata_value' => $_SESSION['user']->guid, 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $page_owner->guid, 'limit' => $limit + 1, 'offset' => $offset)); +$messages = elgg_get_entities_from_metadata(array('metadata_name' => 'fromId', 'metadata_value' => get_loggedin_userid(), 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $page_owner->guid, 'limit' => $limit + 1, 'offset' => $offset)); // Set the page title diff --git a/mod/messages/start.php b/mod/messages/start.php index bd8d0680e..a340169c1 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -114,7 +114,7 @@ function messages_notification_msg($hook_name, $entity_type, $return_value, $par strip_tags($parameters['entity']->description), $CONFIG->wwwroot . "pg/messages/" . $user->username, get_loggedin_user()->name, - $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_user()->guid + $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_userid() ); } else if ($parameters['method'] == 'site') return false;*/ } @@ -165,7 +165,7 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify // If $from == 0, set to current user if ($from == 0) - $from = (int) get_loggedin_user()->guid; + $from = (int) get_loggedin_userid(); // Initialise a new ElggObject $message_to = new ElggObject(); @@ -174,7 +174,7 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify $message_to->subtype = "messages"; $message_sent->subtype = "messages"; // Set its owner to the current user - // $message_to->owner_guid = $_SESSION['user']->getGUID(); + // $message_to->owner_guid = get_loggedin_userid(); $message_to->owner_guid = $send_to; $message_to->container_guid = $send_to; $message_sent->owner_guid = $from; @@ -226,14 +226,14 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify global $CONFIG; $message_contents = strip_tags($body); if ($send_to != get_loggedin_user() && $notify) - notify_user($send_to, get_loggedin_user()->guid, elgg_echo('messages:email:subject'), + notify_user($send_to, get_loggedin_userid(), elgg_echo('messages:email:subject'), sprintf( elgg_echo('messages:email:body'), get_loggedin_user()->name, $message_contents, $CONFIG->wwwroot . "pg/messages/" . $user->username, get_loggedin_user()->name, - $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_user()->guid + $CONFIG->wwwroot . "mod/messages/send.php?send_to=" . get_loggedin_userid() ) ); @@ -284,7 +284,7 @@ function messages_url($message) { function count_unread_messages() { //get the users inbox messages - //$num_messages = get_entities_from_metadata("toId", $_SESSION['user']->getGUID(), "object", "messages", 0, 10, 0, "", 0, false); + //$num_messages = get_entities_from_metadata("toId", get_loggedin_userid(), "object", "messages", 0, 10, 0, "", 0, false); $num_messages = elgg_get_entities_from_metadata(array('metadata_name_value_pairs' => array( 'toId' => get_loggedin_userid(), 'readYet' => 0, diff --git a/mod/messages/views/default/messages/messages.php b/mod/messages/views/default/messages/messages.php index 364a80b4f..e2bce0f44 100644 --- a/mod/messages/views/default/messages/messages.php +++ b/mod/messages/views/default/messages/messages.php @@ -19,7 +19,7 @@ if(get_input("type") == "sent"){ $type = "sent"; } else { //send back to the users inbox - $url = $vars['url'] . "pg/messages/" . $vars['user']->username; + $url = $vars['url'] . "pg/messages/" . get_loggedin_user()->username; // set up breadcrumbs context elgg_push_breadcrumb(elgg_echo('messages:inbox'), $url); //this is used on the delete link so we know which type of message it is @@ -34,8 +34,8 @@ if (strncmp($reply_title, "RE:", 3) != 0) { if (isloggedin()) if (isset($vars['entity'])) { - if ($vars['entity']->toId == $vars['user']->guid - || $vars['entity']->owner_guid == $vars['user']->guid) { + if ($vars['entity']->toId == get_loggedin_userid() + || $vars['entity']->owner_guid == get_loggedin_userid()) { // display breadcrumbs elgg_push_breadcrumb($vars['entity']->title); echo elgg_view('navigation/breadcrumbs'); diff --git a/mod/messages/views/default/messages/topbar.php b/mod/messages/views/default/messages/topbar.php index 4af635612..4aa23b91a 100644 --- a/mod/messages/views/default/messages/topbar.php +++ b/mod/messages/views/default/messages/topbar.php @@ -17,10 +17,10 @@ if($num_messages){ if($num == 0) { ?> - <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo $_SESSION['user']->username; ?>" class="privatemessages" > </a> + <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo get_loggedin_user()->username; ?>" class="privatemessages" > </a> <?php }else{ ?> - <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo $_SESSION['user']->username; ?>" class="privatemessages new" ><span><?php echo $num; ?></span></a> + <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo get_loggedin_user()->username; ?>" class="privatemessages new" ><span><?php echo $num; ?></span></a> <?php } diff --git a/mod/messages/views/default/messages/view.php b/mod/messages/views/default/messages/view.php index feaf6c0c2..41ad11104 100644 --- a/mod/messages/views/default/messages/view.php +++ b/mod/messages/views/default/messages/view.php @@ -22,7 +22,7 @@ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) { $counter = 0; foreach($vars['entity'] as $message) { - if ($message->owner_guid == $vars['user']->guid || $message->toId == $vars['user']->guid) { + if ($message->owner_guid == get_loggedin_userid() || $message->toId == get_loggedin_userid()) { //make sure to only display the messages that have not been 'deleted' (1 = deleted) if($message->hiddenFrom != 1){ @@ -71,7 +71,7 @@ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) { echo "<div class='message sent clearfloat'>"; //get the icon for the user the message was sent to echo "<div class='entity_listing_icon'>".elgg_view("profile/icon",array('entity' => $user, 'size' => 'tiny'))."</div>"; - echo "<div class='entity_listing_info'><div class='message_sender'>".$_SESSION['user']->name."<p class='entity_subtext'>".elgg_view_friendly_time($message->time_created)."</p></div>"; + echo "<div class='entity_listing_info'><div class='message_sender'>".get_loggedin_user()->name."<p class='entity_subtext'>".elgg_view_friendly_time($message->time_created)."</p></div>"; // display message subject echo "<div class='message_subject'>"; //display the link to 'delete' diff --git a/mod/notifications/views/default/notifications/subscriptions/collections.php b/mod/notifications/views/default/notifications/subscriptions/collections.php index 4c5a0425a..713dff765 100644 --- a/mod/notifications/views/default/notifications/subscriptions/collections.php +++ b/mod/notifications/views/default/notifications/subscriptions/collections.php @@ -40,7 +40,7 @@ </tr> <?php $members = array(); - if ($friends = get_user_friends($vars['user']->guid, '', 9999, 0)) { + if ($friends = get_user_friends(get_loggedin_userid(), '', 9999, 0)) { foreach($friends as $friend) { $members[] = $friend->guid; } @@ -61,7 +61,7 @@ $i = 0; foreach($NOTIFICATION_HANDLERS as $method => $foo) { $metaname = 'collections_notifications_preferences_' . $method; - if ($collections_preferences = $vars['user']->$metaname) { + if ($collections_preferences = get_loggedin_user()->$metaname) { if (!empty($collections_preferences) && !is_array($collections_preferences)) { $collections_preferences = array($collections_preferences); } @@ -93,7 +93,7 @@ END; @todo collections removed from notifications - they are no longer used and will be replaced with shared access collections - if ($collections = get_user_access_collections($vars['user']->guid)) { + if ($collections = get_user_access_collections(get_loggedin_userid())) { foreach($collections as $collection) { $members = get_members_of_access_collection($collection->id, true); $memberno = sizeof($members); @@ -113,7 +113,7 @@ END; $i = 0; foreach($NOTIFICATION_HANDLERS as $method => $foo) { $metaname = 'collections_notifications_preferences_' . $method; - if ($collections_preferences = $vars['user']->$metaname) { + if ($collections_preferences = get_loggedin_user()->$metaname) { if (!empty($collections_preferences) && !is_array($collections_preferences)) { $collections_preferences = array($collections_preferences); } diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php index 113d4b0fa..7cc393442 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -9,11 +9,11 @@ <?php // Get friends and subscriptions -$friends = get_user_friends($vars['user']->guid,'',9999,0); +$friends = get_user_friends(get_loggedin_userid(),'',9999,0); global $NOTIFICATION_HANDLERS; foreach($NOTIFICATION_HANDLERS as $method => $foo) { - $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => $vars['user']->guid, 'types' => 'user', 'limit' => 99999)); + $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => get_loggedin_userid(), 'types' => 'user', 'limit' => 99999)); } $subs = array(); diff --git a/mod/notifications/views/default/notifications/subscriptions/groupsform.php b/mod/notifications/views/default/notifications/subscriptions/groupsform.php index 7840ba2cc..b89350acb 100644 --- a/mod/notifications/views/default/notifications/subscriptions/groupsform.php +++ b/mod/notifications/views/default/notifications/subscriptions/groupsform.php @@ -7,7 +7,7 @@ global $NOTIFICATION_HANDLERS; foreach($NOTIFICATION_HANDLERS as $method => $foo) { - $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => $vars['user']->guid, 'types' => 'group', 'limit' => 99999)); + $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => get_loggedin_userid(), 'types' => 'group', 'limit' => 99999)); $tmparray = array(); if ($subsbig[$method]) { foreach($subsbig[$method] as $tmpent) { diff --git a/mod/notifications/views/default/notifications/subscriptions/personal.php b/mod/notifications/views/default/notifications/subscriptions/personal.php index e70207aa3..46c932f0b 100644 --- a/mod/notifications/views/default/notifications/subscriptions/personal.php +++ b/mod/notifications/views/default/notifications/subscriptions/personal.php @@ -38,7 +38,7 @@ foreach($NOTIFICATION_HANDLERS as $method => $foo) { $fields = ''; $i = 0; foreach($NOTIFICATION_HANDLERS as $method => $foo) { - if ($notification_settings = get_user_notification_settings($vars['user']->guid)) { + if ($notification_settings = get_user_notification_settings(get_loggedin_userid())) { if ($notification_settings->$method) { $personalchecked[$method] = 'checked="checked"'; } else { diff --git a/mod/pages/actions/pages/edit.php b/mod/pages/actions/pages/edit.php index 396dd7e42..db308b5d7 100644 --- a/mod/pages/actions/pages/edit.php +++ b/mod/pages/actions/pages/edit.php @@ -49,7 +49,7 @@ if ($pages_guid) { } // New instance, so set container_guid - $container_guid = get_input('container_guid', $_SESSION['user']->getGUID()); + $container_guid = get_input('container_guid', get_loggedin_userid()); $page->container_guid = $container_guid; // cache data in session in case data from form does not validate @@ -77,7 +77,7 @@ if ($page instanceof ElggObject) { $page->access_id = (int)get_input('access_id', ACCESS_PRIVATE); $page->write_access_id = (int)get_input('write_access_id', ACCESS_PRIVATE); $page->parent_guid = $parent_guid; - $page->owner_guid = ($page->owner_guid ? $page->owner_guid : $_SESSION['user']->guid); + $page->owner_guid = ($page->owner_guid ? $page->owner_guid : get_loggedin_userid()); if ($page->save()) { @@ -94,9 +94,9 @@ if ($page instanceof ElggObject) { //add to river if ($which_river == 'new') { - add_to_river('river/object/page/create','create',$_SESSION['user']->guid,$page->guid); + add_to_river('river/object/page/create','create',get_loggedin_userid(),$page->guid); } else { - add_to_river('river/object/page/update','update',$_SESSION['user']->guid,$page->guid); + add_to_river('river/object/page/update','update',get_loggedin_userid(),$page->guid); } // Forward to the user's profile diff --git a/mod/pages/edit.php b/mod/pages/edit.php index e7ce48e54..cc9955bc9 100644 --- a/mod/pages/edit.php +++ b/mod/pages/edit.php @@ -18,7 +18,7 @@ if ($container = $pages->container_guid) { $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; + $page_owner = get_loggedin_user(); set_page_owner($page_owner->getGUID()); } diff --git a/mod/pages/new.php b/mod/pages/new.php index 7c3f12e36..bf2640301 100644 --- a/mod/pages/new.php +++ b/mod/pages/new.php @@ -15,7 +15,7 @@ if ($container = (int) get_input('container_guid')) { } $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; + $page_owner = get_loggedin_user(); set_page_owner($page_owner->getGUID()); } diff --git a/mod/pages/start.php b/mod/pages/start.php index 1deaec76b..80c1607a2 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -133,7 +133,7 @@ function pages_page_handler($page) { $entity = get_entity($page[1]); add_submenu_item(elgg_echo('pages:label:view'), $CONFIG->url . "pg/pages/view/{$page[1]}", 'pageslinks'); - // add_submenu_item(elgg_echo('pages:user'), $CONFIG->wwwroot . "pg/pages/owned/" . $_SESSION['user']->username, 'pageslinksgeneral'); + // add_submenu_item(elgg_echo('pages:user'), $CONFIG->wwwroot . "pg/pages/owned/" . get_loggedin_user()->username, 'pageslinksgeneral'); if (($entity) && ($entity->canEdit())) { add_submenu_item(elgg_echo('pages:label:edit'), $CONFIG->url . "pg/pages/edit/{$page[1]}", 'pagesactions'); } @@ -311,7 +311,7 @@ function pages_container_permission_check($hook, $entity_type, $returnvalue, $pa if (get_context() == "pages") { if (page_owner()) { - if (can_write_to_container($_SESSION['user']->guid, page_owner())) return true; + if (can_write_to_container(get_loggedin_userid(), page_owner())) return true; } if ($page_guid = get_input('page_guid',0)) { $entity = get_entity($page_guid); @@ -320,7 +320,7 @@ function pages_container_permission_check($hook, $entity_type, $returnvalue, $pa } if ($entity instanceof ElggObject) { if ( - can_write_to_container($_SESSION['user']->guid, $entity->container_guid) + can_write_to_container(get_loggedin_userid(), $entity->container_guid) || in_array($entity->write_access_id,get_access_list()) ) { return true; diff --git a/mod/pages/welcome.php b/mod/pages/welcome.php index f486f646d..10628b175 100644 --- a/mod/pages/welcome.php +++ b/mod/pages/welcome.php @@ -17,7 +17,7 @@ if ($container = (int) get_input('container_guid')) { $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; + $page_owner = get_loggedin_user(); set_page_owner($page_owner->getGUID()); } diff --git a/mod/pages/world.php b/mod/pages/world.php index 7f32fbdec..8a8ede68d 100644 --- a/mod/pages/world.php +++ b/mod/pages/world.php @@ -12,7 +12,7 @@ global $CONFIG; // Get the current page's owner $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; + $page_owner = get_loggedin_user(); set_page_owner($_SESSION['guid']); } diff --git a/mod/profile/actions/addcomment.php b/mod/profile/actions/addcomment.php index 5850efe25..0e241db0a 100644 --- a/mod/profile/actions/addcomment.php +++ b/mod/profile/actions/addcomment.php @@ -16,25 +16,25 @@ $user = get_entity($page_owner); // the commentwall owner details if ($user && !empty($message_content)) { // If posting the comment was successful, say so - if ($user->annotate('commentwall',$message_content,$user->access_id, $_SESSION['user']->getGUID())) { + if ($user->annotate('commentwall',$message_content,$user->access_id, get_loggedin_userid())) { global $CONFIG; - if ($user->getGUID() != $_SESSION['user']->getGUID()) - notify_user($user->getGUID(), $_SESSION['user']->getGUID(), elgg_echo('profile:comment:subject'), + if ($user->getGUID() != get_loggedin_userid()) + notify_user($user->getGUID(), get_loggedin_userid(), elgg_echo('profile:comment:subject'), sprintf( elgg_echo('profile:comment:body'), - $_SESSION['user']->name, + get_loggedin_user()->name, $message_content, $CONFIG->wwwroot . "pg/profile/" . $user->username, - $_SESSION['user']->name, - $_SESSION['user']->getURL() + get_loggedin_user()->name, + get_loggedin_user()->getURL() ) ); system_message(elgg_echo("profile:commentwall:posted")); // add to river - add_to_river('river/object/profile/commentwall/create','commentwall',$_SESSION['user']->guid,$user->guid); + add_to_river('river/object/profile/commentwall/create','commentwall',get_loggedin_userid(),$user->guid); } else { register_error(elgg_echo("profile:commentwall:failure")); diff --git a/mod/profile/actions/edit.php b/mod/profile/actions/edit.php index c21a43fbf..b9cc8e19d 100644 --- a/mod/profile/actions/edit.php +++ b/mod/profile/actions/edit.php @@ -102,7 +102,7 @@ if (sizeof($input) > 0) { //add to river if edited by self if (get_loggedin_userid() == $user->guid) { - add_to_river('river/user/default/profileupdate','update',$_SESSION['user']->guid,$_SESSION['user']->guid,get_default_access($_SESSION['user'])); + add_to_river('river/user/default/profileupdate','update',get_loggedin_userid(),get_loggedin_userid(),get_default_access(get_loggedin_user())); } system_message(elgg_echo("profile:saved")); diff --git a/mod/profile/start.php b/mod/profile/start.php index 1d73b6632..48547c0bf 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -21,7 +21,7 @@ function profile_init() { // Set up the menu for logged-in users elgg_extend_view('elgg_topbar/extend', 'profile/topbar_extend'); //if (isloggedin()) { - // add_menu(elgg_echo('profile:yours'), $_SESSION['user']->getURL() . '/extend'); + // add_menu(elgg_echo('profile:yours'), get_loggedin_user()->getURL() . '/extend'); //} // Metadata on users needs to be independent diff --git a/mod/profile/views/default/profile/editicon.php b/mod/profile/views/default/profile/editicon.php index 316c42d20..53de19c59 100644 --- a/mod/profile/views/default/profile/editicon.php +++ b/mod/profile/views/default/profile/editicon.php @@ -9,7 +9,7 @@ */ // user is passed to view and set by caller (normally the page editicon) -$currentuser = $vars['user']; +$currentuser = get_loggedin_user(); ?> <div id="edit_profile_avatar"> <!-- grab the required js for icon cropping --> @@ -129,11 +129,11 @@ $currentuser = $vars['user']; <form action="<?php echo $vars['url']; ?>action/profile/cropicon" method="post" /> <?php echo elgg_view('input/securitytoken'); ?> - <input type="hidden" name="username" value="<?php echo $vars['user']->username; ?>" /> - <input type="hidden" name="x_1" value="<?php echo $vars['user']->x1; ?>" id="x_1" /> - <input type="hidden" name="x_2" value="<?php echo $vars['user']->x2; ?>" id="x_2" /> - <input type="hidden" name="y_1" value="<?php echo $vars['user']->y1; ?>" id="y_1" /> - <input type="hidden" name="y_2" value="<?php echo $vars['user']->y2; ?>" id="y_2" /> + <input type="hidden" name="username" value="<?php echo get_loggedin_user()->username; ?>" /> + <input type="hidden" name="x_1" value="<?php echo get_loggedin_user()->x1; ?>" id="x_1" /> + <input type="hidden" name="x_2" value="<?php echo get_loggedin_user()->x2; ?>" id="x_2" /> + <input type="hidden" name="y_1" value="<?php echo get_loggedin_user()->y1; ?>" id="y_1" /> + <input type="hidden" name="y_2" value="<?php echo get_loggedin_user()->y2; ?>" id="y_2" /> <input type="submit" name="submit" value="<?php echo elgg_echo("profile:createicon"); ?>" /> </form> diff --git a/mod/profile/views/default/profile/icon.php b/mod/profile/views/default/profile/icon.php index 14017d618..1423070d4 100644 --- a/mod/profile/views/default/profile/icon.php +++ b/mod/profile/views/default/profile/icon.php @@ -11,7 +11,7 @@ // Get entity if (empty($vars['entity'])) { - $vars['entity'] = $vars['user']; + $vars['entity'] = get_loggedin_user(); } if ($vars['entity'] instanceof ElggUser) { @@ -54,7 +54,7 @@ if ($vars['entity'] instanceof ElggUser) { echo "<ul class='sub_menu_list'>"; if (isloggedin()) { // if not looking at your own avatar menu - if ($vars['entity']->getGUID() != $vars['user']->getGUID()) { + if ($vars['entity']->getGUID() != get_loggedin_userid()) { // Add / Remove friend link $friendlinks = elgg_view('profile/menu/friendlinks',$vars); diff --git a/mod/profile/views/default/profile/profile_ownerblock.php b/mod/profile/views/default/profile/profile_ownerblock.php index 3837bd3f2..58386fc04 100755 --- a/mod/profile/views/default/profile/profile_ownerblock.php +++ b/mod/profile/views/default/profile/profile_ownerblock.php @@ -36,7 +36,7 @@ if ($section == 'details') { $more_info .= "</div>"; } $profile_actions = ""; -if (isloggedin() && (get_loggedin_user()->getGuid() == page_owner())) { +if (isloggedin() && (get_loggedin_userid() == page_owner())) { $profile_actions = "<div class='clearfloat profile_actions'>"; $profile_actions .= "<a href='{$vars['url']}pg/profile/{$user->username}/edit/details' class='action_button'>". elgg_echo('profile:edit') ."</a>"; $profile_actions .= "<a href='{$vars['url']}pg/profile/{$user->username}/edit/icon' class='action_button'>". elgg_echo('profile:editicon') ."</a>"; diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php index 6e86c4cf6..0611f7402 100644 --- a/mod/reportedcontent/actions/add.php +++ b/mod/reportedcontent/actions/add.php @@ -15,7 +15,7 @@ $report = new ElggObject; $report->subtype = "reported_content"; - $report->owner_guid = $_SESSION['user']->getGUID(); + $report->owner_guid = get_loggedin_userid(); $report->title = $title; $report->address = $address; $report->description = $description; diff --git a/mod/reportedcontent/add.php b/mod/reportedcontent/add.php index fd90e0f5e..9b6032d04 100644 --- a/mod/reportedcontent/add.php +++ b/mod/reportedcontent/add.php @@ -14,7 +14,7 @@ gatekeeper(); // Get the current page's owner $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; + $page_owner = get_loggedin_user(); set_page_owner($page_owner->getGUID()); } diff --git a/mod/reportedcontent/views/default/reportedcontent/form.php b/mod/reportedcontent/views/default/reportedcontent/form.php index e21a4408b..fe4287888 100644 --- a/mod/reportedcontent/views/default/reportedcontent/form.php +++ b/mod/reportedcontent/views/default/reportedcontent/form.php @@ -15,7 +15,7 @@ if ($address == "previous") { $tags = array(); $access_id = ACCESS_PRIVATE; $shares = array(); -$owner = $vars['user']; +$owner = get_loggedin_user(); ?> <form action="<?php echo $vars['url']; ?>action/reportedcontent/add" method="post" class="margin_top"> diff --git a/mod/riverdashboard/actions/add.php b/mod/riverdashboard/actions/add.php index 22fdd7377..8e19db636 100644 --- a/mod/riverdashboard/actions/add.php +++ b/mod/riverdashboard/actions/add.php @@ -26,7 +26,7 @@ if (empty($message)) { // Tell the system it's a site wide message $sitemessage->subtype = "sitemessage"; // Set its owner to the current user - $sitemessage->owner_guid = $_SESSION['user']->getGUID(); + $sitemessage->owner_guid = get_loggedin_userid(); // For now, set its access to logged in users $sitemessage->access_id = 1; // this is for all logged in users // Set description appropriately @@ -41,7 +41,7 @@ if (empty($message)) { system_message(elgg_echo("sitemessages:posted")); // add to river - add_to_river('river/sitemessage/create','create',$_SESSION['user']->guid,$sitemessage->guid); + add_to_river('river/sitemessage/create','create',get_loggedin_userid(),$sitemessage->guid); // Forward to the activity page forward("mod/riverdashboard/"); diff --git a/mod/riverdashboard/index.php b/mod/riverdashboard/index.php index c4a567a8d..e0aa21b1b 100644 --- a/mod/riverdashboard/index.php +++ b/mod/riverdashboard/index.php @@ -23,12 +23,12 @@ $body = ''; switch($orient) { case 'mine': - $subject_guid = $_SESSION['user']->guid; + $subject_guid = get_loggedin_userid(); $relationship_type = ''; $title_wording = elgg_echo('river:mine'); break; case 'friends': - $subject_guid = $_SESSION['user']->guid; + $subject_guid = get_loggedin_userid(); $relationship_type = 'friend'; $title_wording = elgg_echo('river:friends'); break; diff --git a/mod/riverdashboard/views/default/riverdashboard/ecml/activity.php b/mod/riverdashboard/views/default/riverdashboard/ecml/activity.php index cfec67c7d..d24a8ffc2 100644 --- a/mod/riverdashboard/views/default/riverdashboard/ecml/activity.php +++ b/mod/riverdashboard/views/default/riverdashboard/ecml/activity.php @@ -5,7 +5,7 @@ * @package ECML */ -// $vars['user'] is apparently the loggedin user. +// get_loggedin_user() is apparently the loggedin user. $owner = (isset($vars['owner'])) ? $vars['owner'] : NULL; $type = (isset($vars['type'])) ? $vars['type'] : NULL; $subtype = (isset($vars['subtype'])) ? $vars['subtype'] : NULL; diff --git a/mod/riverdashboard/views/default/riverdashboard/welcome.php b/mod/riverdashboard/views/default/riverdashboard/welcome.php index 394e84f7b..3c9778eda 100644 --- a/mod/riverdashboard/views/default/riverdashboard/welcome.php +++ b/mod/riverdashboard/views/default/riverdashboard/welcome.php @@ -5,4 +5,4 @@ */ ?> -<h2><?php echo sprintf(elgg_echo('welcome:user'), $_SESSION['user']->name); ?></h2>
\ No newline at end of file +<h2><?php echo sprintf(elgg_echo('welcome:user'), get_loggedin_user()->name); ?></h2>
\ No newline at end of file diff --git a/mod/thewire/index.php b/mod/thewire/index.php index a7a24a36e..489427975 100644 --- a/mod/thewire/index.php +++ b/mod/thewire/index.php @@ -12,7 +12,7 @@ // Get the current page's owner $page_owner = page_owner_entity(); if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; + $page_owner = get_loggedin_user(); set_page_owner($page_owner->getGUID()); } diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 13e14ace3..5091f5e5c 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -61,7 +61,7 @@ //add submenu options if (get_context() == "thewire") { if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) { - add_submenu_item(elgg_echo('thewire:read'),$CONFIG->wwwroot."pg/thewire/" . $_SESSION['user']->username); + add_submenu_item(elgg_echo('thewire:read'),$CONFIG->wwwroot."pg/thewire/" . get_loggedin_user()->username); add_submenu_item(elgg_echo('thewire:everyone'),$CONFIG->wwwroot."mod/thewire/everyone.php"); //add_submenu_item(elgg_echo('thewire:add'),$CONFIG->wwwroot."mod/thewire/add.php"); } |