]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #2124: Using get_loggedin_user functions instead of $vars['user'], $_SESSION...
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 30 Oct 2010 21:32:54 +0000 (21:32 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 30 Oct 2010 21:32:54 +0000 (21:32 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7139 36083f99-b078-4883-b0ff-0f9b5a30f544

54 files changed:
engine/lib/filestore.php
mod/bookmarks/actions/add.php
mod/bookmarks/bookmarklet.php
mod/bookmarks/views/default/bookmarks/form.php
mod/diagnostics/actions/download.php
mod/file/actions/delete.php
mod/file/actions/save.php
mod/file/world.php
mod/groups/actions/delete.php
mod/groups/actions/forums/addtopic.php
mod/groups/actions/forums/edittopic.php
mod/groups/actions/leave.php
mod/groups/groupprofile.php
mod/groups/membership.php
mod/groups/start.php
mod/groups/views/default/forum/topics.php
mod/groups/views/default/forum/viewposts.php
mod/groups/views/default/groups/forum_latest.php
mod/groups/views/default/groups/side_menu.php
mod/members/index.php
mod/messages/actions/delete.php
mod/messages/send.php
mod/messages/sent.php
mod/messages/start.php
mod/messages/views/default/messages/messages.php
mod/messages/views/default/messages/topbar.php
mod/messages/views/default/messages/view.php
mod/notifications/views/default/notifications/subscriptions/collections.php
mod/notifications/views/default/notifications/subscriptions/forminternals.php
mod/notifications/views/default/notifications/subscriptions/groupsform.php
mod/notifications/views/default/notifications/subscriptions/personal.php
mod/pages/actions/pages/edit.php
mod/pages/edit.php
mod/pages/new.php
mod/pages/start.php
mod/pages/welcome.php
mod/pages/world.php
mod/profile/actions/addcomment.php
mod/profile/actions/edit.php
mod/profile/start.php
mod/profile/views/default/profile/editicon.php
mod/profile/views/default/profile/icon.php
mod/profile/views/default/profile/profile_ownerblock.php
mod/reportedcontent/actions/add.php
mod/reportedcontent/add.php
mod/reportedcontent/views/default/reportedcontent/form.php
mod/riverdashboard/actions/add.php
mod/riverdashboard/index.php
mod/riverdashboard/views/default/riverdashboard/ecml/activity.php
mod/riverdashboard/views/default/riverdashboard/welcome.php
mod/thewire/index.php
mod/thewire/start.php
views/default/canvas/layouts/widgets.php
views/foaf/page_shells/default.php

index bbede0415ba536416a9bdc8cf72b23736dd396af..23b10c24cd73d3c604837e80a743751db3998ae3 100644 (file)
@@ -376,8 +376,8 @@ function file_get_general_file_type($mimetype) {
 
 /**
  * Delete a directory and all its contents
- *
- * @param str $directory Directory to delete
+ *\r
+ * @param str $directory Directory to delete\r
  *
  * @return bool
  */
index 5b0ce91c4efb81ca0d460fff71cee58f91cf2aa0..e633244c12d06e630d32f74c801d00070d48f976 100644 (file)
@@ -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
index e717970261c8b40b0ebf819ca496045d69412b5b..e1ff3c6dfe0e0a0c9631740195ed5ee231efb626 100644 (file)
@@ -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());
 }
                
index a49fcc088f2cc1a8fa54821056af4156265d6bc7..b779116fdce9490114159d827fca6de3d0669bd6 100644 (file)
@@ -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";
 }
 ?>
index bf3ede42dfc735ba619a356471e59db6cdc386fb..32ef5cbed70094172edcbcacd690785638d96c06 100644 (file)
@@ -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");
index e7ad90289a227a641d005eeec30fdb0d0dd61009..9357d4955c06c2e83c2f7cca5b118f9a37e0eb78 100644 (file)
@@ -49,7 +49,7 @@
 
                        } else {
                                
-                               $container = $_SESSION['user'];
+                               $container = get_loggedin_user();
                                register_error(elgg_echo("file:deletefailed"));
                                
                        }
index 5e2045ae8b8068d72d49af65efceb54042e4f85f..923bc043b1f08b67a21c1685766c4323115a5830 100644 (file)
@@ -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;
        }
        
index eee3609fb2c0f0cc45a452882d40ab5a248c1e5e..21e741184fa669be4590b74aaba85c3315e28e9b 100644 (file)
@@ -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']);
                }
        
index b4bc71838eb8ef235abce2ea26c0a2fe2c576fbf..7d66b2a254a27d400167cb2899d3111b7f63e373 100644 (file)
@@ -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
index a0b9acc1038bc4143a288f783dd2d1a2efad565e..5f9c8e70963b02b4ce85225ac360fcbbb7ba9512 100644 (file)
@@ -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"));
index c7da084da2867894671846d6af5c61f929cef536..59c46af734d6e192eb42c64f3c819d7fdab9da28 100644 (file)
@@ -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'));
index 721bff2c8e1c2fc634602295456ab7bd76922cd8..58f2655ad08f0f2d84b9746f588bb8dd34437121 100644 (file)
@@ -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);
                
index f0e6854ee05f99f27bcdb5b9705188782b0b01d9..a64ca55db6a6e2731c215c890184e591cab1a36c 100644 (file)
@@ -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);
index 7f9cfdbf55b3a1f6ac0f83783ddb62120e14f368..0085033fa10f83598b86ca5a4c26f72a506b12c1 100644 (file)
@@ -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");
 
index b87acbaec0a1140ddbd1da4d647cbbfa2d128461..689e24863ea2fb3e35d62554d72e131543bb3731 100644 (file)
                                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();
                                }
 
                        }
        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.
        {
 
                //logged in user
-               $user = $_SESSION['user']->guid;
+               $user = get_loggedin_userid();
 
                if (($entity->owner_guid == $user) || $group_owner == $user || isadminloggedin()) {
                        return true;
index 91834aa08c2b3f924f04454fc69a4d3d1bd3a2a1..d5e533f8105136031ae5bc86678e207328658066 100644 (file)
@@ -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>
index aa8b334f25ec789ce194226b886c06ea36777f7c..f0810ba18701ac3d827b583a2732b7f4aae09eb1 100644 (file)
@@ -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{
index 1614557036644beacd575795c1ef541adddd0694..2a9ddaf423a91e7321b953ad205c7a11fe7a3aaa 100644 (file)
@@ -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{
index a86cd8adb821c682d7bafa11b807d0bdb2adb66c..3048ea4318b4d759a545e6f9cc348b4ab2bc7ed5 100644 (file)
@@ -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
index b10f41e2943d8d7a4d08774b287319cee5e2e5d8..30d6102e3b5c3fe31726b79079914987539f2fe8 100644 (file)
@@ -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());
 }
 
index 395b5528b9bd93b9b54e5ca6ff07816e9f82a9fd..0f5bb28134c8755997537190e7f3b0245570a57f 100644 (file)
@@ -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"));
index 51ad3059270df01b8e3f1e293f5d8b3609b63203..0435974ce7afeeab1dca979707ac362be52ee4ce 100644 (file)
@@ -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());
 }
 
index 0cd65d87be04bd51e8ba96990bc467fdac9c121c..36a054e86fca18f691deed5e56abc9c66bb741c6 100644 (file)
@@ -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
index bd8d0680e060c418960cb2209829789332ab79bf..a340169c18e8f39033719e372f677d24d0fce4ea 100644 (file)
@@ -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,
index 364a80b4f518f4113ea466b6ccf3d3c3517f9036..e2bce0f445745599c99fd281c6b7de9a462c5405 100644 (file)
@@ -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');
index 4af635612ecc68a82ba121ab2f6eca51278c1769..4aa23b91ae1c8048780ab1e3d72cd4bff8551566 100644 (file)
@@ -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" >&nbsp;</a>
+       <a href="<?php echo $vars['url']; ?>pg/messages/<?php echo get_loggedin_user()->username; ?>" class="privatemessages" >&nbsp;</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
     }
index feaf6c0c210b4beb5feda5137c29d67b13ceb400..41ad11104563ab79c87fe8f80d1f17a733ca0aa3 100644 (file)
@@ -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'
index 4c5a0425a51ac82509aabea7b360bc558d53b7c6..713dff7652cbb53feb6006ebc79b839f05b82963 100644 (file)
@@ -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);
                                        }
index 113d4b0fa9f9dd6f0f7f39ac6b8ae9ebd95b01c5..7cc393442cad15af45de0cf5dccf83820ab4b457 100644 (file)
@@ -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();
index 7840ba2ccd2dcd822878e9b70f463e30028e80ca..b89350acbabfd25b330812fb122f2eedd9ee64bc 100644 (file)
@@ -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) {
index e70207aa3c2a293d83e187ab62099372ec5cae8f..46c932f0bc344b493b8e08cb492f9d11da21c384 100644 (file)
@@ -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 {
index 396dd7e420eaf26ae1192a2b0377b71e578623a5..db308b5d766cb2fc24bd100ddf923cb4bbd6d36d 100644 (file)
@@ -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
index e7ce48e54401332f9b0182fa2bd4951ad78b957a..cc9955bc9b6ecde6ced296179467c4e41c685980 100644 (file)
@@ -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());
 }
 
index 7c3f12e36668e0e15a74c15fbb2c3b29892032d0..bf26403012133733ae1f281692229edc7cd03a27 100644 (file)
@@ -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());
 }
 
index 1deaec76bdfa2442adc2fb84dcc21d84ad7f2120..80c1607a248db3c55d0d2bd85fefdf2b95b531e0 100644 (file)
@@ -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;
index f486f646d149859019b33c839595bc44f795fb88..10628b175b06cec2648f2f0a58672c26d130bebe 100644 (file)
@@ -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());
 }
 
index 7f32fbdec4dadbd81898d1a36309d671595669fd..8a8ede68d7b9fc8cdd0c7d3078757441875ad3de 100644 (file)
@@ -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']);
 }
 
index 5850efe2563cecbb6a41d5a9df1ac2cf99256163..0e241db0ac1e48795f02af91fd8064a7676cfd23 100644 (file)
@@ -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"));
index c21a43fbfc325c2e7a63985a60ed8bb28469aa20..b9cc8e19d1612260c782affb9d559b32a62a4683 100644 (file)
@@ -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"));
index 1d73b66320dbb56990dac5230fe91aba5eb48941..48547c0bfc607cc652e15c182581deab5c50d430 100644 (file)
@@ -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
index 316c42d2083ea5150c9f40252bebc36007125c7d..53de19c5981d7b8a338babbfb7bef136a94b9589 100644 (file)
@@ -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>
 
index 14017d618c9e8b80198ace26e09647af5c1fc636..1423070d4d4f41ae961b67234fdb3e662646353b 100644 (file)
@@ -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);
index 3837bd3f2a7c34fd26cd2ca8fc3d700f163798d5..58386fc04c300ea520b76a677733cd4c24893f33 100755 (executable)
@@ -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>";
index 6e86c4cf6289184465bc0dcea1b310d4ae26aee9..0611f74026afcc563b107c2fdd724552d6391dbf 100644 (file)
@@ -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;
index fd90e0f5ea6d52751bb5adef20f6eb00875fdc33..9b6032d0412fd9c08de437e9d77c82c9088cebd0 100644 (file)
@@ -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());
 }
        
index e21a4408bd674da4388825d3cb7f6ef8c8c84cfa..fe428788857e19b4c0f7db7a59741519961f8bbe 100644 (file)
@@ -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">
index 22fdd7377647d78b0258392ad8d7427cb7dadf07..8e19db6364e9093f6db5a3bb4e2ba5f0305a19b8 100644 (file)
@@ -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/");
index c4a567a8dbd44ff2095ca49949428bcd7c97accb..e0aa21b1bc865c8a1065a8302e265db7a0f29985 100644 (file)
@@ -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;
index cfec67c7d703575dc7ac1bcd289f4ab88c019e92..d24a8ffc280537ec785ff413c25d0ecbaf397425 100644 (file)
@@ -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;
index 394e84f7b78b1bbb0d770cd98f02998bb7650f3a..3c9778eda321d4587d46113b1b35cfcedcd4e2de 100644 (file)
@@ -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
index a7a24a36ef836d3e97e070d322c2168eb34f8f7c..489427975633c0068a44d1c19da4dba82807e31a 100644 (file)
@@ -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());
                }
                
index 13e14ace3ee89d1eec2c66da4564d47ae49675ee..5091f5e5c72a833bf84859296f87c81b4955a1b4 100644 (file)
@@ -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");
                                        } 
index d56b009d57c2563b727643d5a5263f688978d799..8526b9d9212fd02285b892a53255e223d637856c 100644 (file)
@@ -23,7 +23,7 @@
 
                        
                
-               if($_SESSION['user']->guid == page_owner() || ($owner instanceof ElggGroup && $owner->canEdit())){
+               if(get_loggedin_userid() == page_owner() || ($owner instanceof ElggGroup && $owner->canEdit())){
                
                        if(get_context() == "profile") {
                ?>
@@ -270,7 +270,7 @@ if(get_context() != "profile"){ /* on groups */
     <td rowspan="2" align="left" valign="top" height="100%">
 
        <?php   
-               if($_SESSION['user']->guid == page_owner() || ($owner instanceof ElggGroup && $owner->canEdit())){
+               if(get_loggedin_userid() == page_owner() || ($owner instanceof ElggGroup && $owner->canEdit())){
                
                        if(get_context() != "profile") {
                ?>
index 62655ccfd6f9fd524c876397a679db0e1b506185..cd74ce0fe60c647f3126347a3f9fb9612b42f9c8 100644 (file)
@@ -16,7 +16,7 @@ if (!$owner = page_owner_entity()) {
        if (!isloggedin()) {
                exit;
        } else {
-               $owner = $vars['user'];
+               $owner = get_loggedin_user();
        }
 }