]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Merged r6701:6756 from 1.7 branch into trunk
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 22 Aug 2010 22:37:30 +0000 (22:37 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 22 Aug 2010 22:37:30 +0000 (22:37 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6849 36083f99-b078-4883-b0ff-0f9b5a30f544

32 files changed:
actions/email/save.php
actions/friends/add.php
actions/friends/addcollection.php
actions/friends/deletecollection.php
actions/friends/remove.php
actions/plugins/usersettings/save.php
actions/user/default_access.php
actions/user/language.php
actions/user/name.php
actions/user/password.php
actions/user/spotlight.php
engine/lib/annotations.php
engine/lib/database.php
engine/lib/filestore.php
engine/lib/group.php
engine/lib/metadata.php
engine/lib/plugins.php
engine/lib/relationships.php
engine/lib/tags.php
engine/tests/regression/trac_bugs.php
entities/list.php
mod/categories/listing.php
mod/categories/views/default/categories/list.php
mod/file/search.php
mod/groups/actions/addtogroup.php
mod/groups/languages/en.php
mod/groups/views/default/groups/closedmembership.php
settings/index.php
settings/plugins.php
settings/statistics.php
settings/user.php
views/json/river/item/list.php

index 7493538f97afa5dcfb2a753c0032d9e5fc196a25..34fce3c308dd9ef87a52434863cab687a62f1193 100644 (file)
@@ -8,16 +8,13 @@
  * @link http://elgg.org/
  */
 
-global $CONFIG;
-
 gatekeeper();
 
 $email = get_input('email');
 $user_id = get_input('guid');
-$user = "";
 
 if (!$user_id) {
-       $user = $_SESSION['user'];
+       $user = get_loggedin_user();
 } else {
        $user = get_entity($user_id);
 }
@@ -47,7 +44,3 @@ if ($user) {
 } else {
        register_error(elgg_echo('email:save:fail'));
 }
-
-//forward($_SERVER['HTTP_REFERER']);
-//exit;
-?>
index 934424b5752dbde1a76e4aea42712bcf24f449ff..345a867745c0550f5b5c779a81b0bb04787ebb76 100644 (file)
@@ -19,7 +19,7 @@ $errors = false;
 
 // Get the user
 try {
-       if (!$_SESSION['user']->addFriend($friend_guid)) {
+       if (!get_loggedin_user()->addFriend($friend_guid)) {
                $errors = true;
        }
 } catch (Exception $e) {
@@ -28,7 +28,7 @@ try {
 }
 if (!$errors){
        // add to river
-       add_to_river('friends/river/create','friend',$_SESSION['user']->guid,$friend_guid);
+       add_to_river('friends/river/create','friend',get_loggedin_userid(),$friend_guid);
        system_message(sprintf(elgg_echo("friends:add:successful"),$friend->name));
 }
 
index e5541797b6fc5f4f4b5f9e95807314c26909c822..6124b349613fbd552ae23a8320a31ca9ab816f6f 100644 (file)
@@ -21,7 +21,7 @@ $friends = get_input('friends_collection');
 if($collection_name){
 
        //create the collection
-       $create_collection = create_access_collection($collection_name, $_SESSION['user']->getGUID());
+       $create_collection = create_access_collection($collection_name, get_loggedin_userid());
 
        //if the collection was created and the user passed some friends from the form, add them
        if($create_collection && (!empty($friends))){
@@ -34,7 +34,7 @@ if($collection_name){
        // Success message
        system_message(elgg_echo("friends:collectionadded"));
        // Forward to the collections page
-       forward("pg/collections/" . $_SESSION['user']->username);
+       forward("pg/collections/" . get_loggedin_user()->username);
 
 } else {
        register_error(elgg_echo("friends:nocollectionname"));
index 1e18adcea234c45719368c94f16b0d3d6b5c2330..d4e077a24e032a5c0bfb27ebcc2ae470c8bc273c 100644 (file)
@@ -20,9 +20,9 @@ $collection_id = (int) get_input('collection');
 // Check to see that the access collection exist and grab its owner
 $get_collection = get_access_collection($collection_id);
 
-if($get_collection){
+if ($get_collection) {
 
-       if($get_collection->owner_guid == $_SESSION['user']->getGUID()) {
+       if ($get_collection->owner_guid == get_loggedin_userid()) {
 
                $delete_collection = delete_access_collection($collection_id);
 
@@ -42,4 +42,4 @@ if($get_collection){
 }
 
 // Forward to the collections page
-forward("pg/collections/" . $_SESSION['user']->username);
+forward("pg/collections/" . get_loggedin_user()->username);
index 768291055e381586484c09b5c821efd63bf93ff4..d3d362a92a4aefedb11c7e8cf6c8777435521cef 100644 (file)
@@ -19,7 +19,7 @@ $errors = false;
 // Get the user
 try{
        if ($friend instanceof ElggUser) {
-               $_SESSION['user']->removeFriend($friend_guid);
+               get_loggedin_user()->removeFriend($friend_guid);
        } else{
                register_error(sprintf(elgg_echo("friends:remove:failure"), $friend->name));
                $errors = true;
index d8db3bb1e603d8d6bd11327cf559f91aa0782c9c..0219068e5789e37cead9cef78841cce7f4af9415 100644 (file)
@@ -17,7 +17,7 @@ $result = false;
 
 foreach ($params as $k => $v) {
        // Save
-       $result = set_plugin_usersetting($k, $v, $_SESSION['user']->guid, $plugin);
+       $result = set_plugin_usersetting($k, $v, get_loggedin_userid(), $plugin);
 
        // Error?
        if (!$result) {
index ee8fb9efaea60f57cb49f927706bbe6aff9e3ca3..0aacf209c018b7d2df93dc259c42cdcfa560bec3 100644 (file)
@@ -15,10 +15,9 @@ if ($CONFIG->allow_user_default_access) {
 
        $default_access = get_input('default_access');
        $user_id = get_input('guid');
-       $user = "";
 
        if (!$user_id) {
-               $user = $_SESSION['user'];
+               $user = get_loggedin_user();
        } else {
                $user = get_entity($user_id);
        }
index 1165b196eca644142e3e4b81d7a530b77f1a88bc..83cc10dbd070b7fc11ff69e0daab116abe96d81d 100644 (file)
@@ -8,16 +8,13 @@
  * @link http://elgg.org/
  */
 
-global $CONFIG;
-
 gatekeeper();
 
 $language = get_input('language');
 $user_id = get_input('guid');
-$user = "";
 
 if (!$user_id) {
-       $user = $_SESSION['user'];
+       $user = get_loggedin_user();
 } else {
        $user = get_entity($user_id);
 }
index 3145c5ee7c2513f92b6a4939b7e7d48cbb59a484..69a1b96817393e1832bcbc6b38a609fb6210ba05 100644 (file)
@@ -8,16 +8,13 @@
  * @link http://elgg.org/
  */
 
-global $CONFIG;
-
 gatekeeper();
 
 $name = strip_tags(get_input('name'));
 $user_id = get_input('guid');
-$user = "";
 
 if (!$user_id) {
-       $user = $_SESSION['user'];
+       $user = get_loggedin_user();
 } else {
        $user = get_entity($user_id);
 }
index 6e3ff94471f78978bf33761e859382c435fd8eb9..25723c0b0b2f79f4497c18353a494c865a1119cb 100644 (file)
@@ -8,17 +8,14 @@
  * @link http://elgg.org/
  */
 
-global $CONFIG;
-
 gatekeeper();
 
 $password = get_input('password');
 $password2 = get_input('password2');
 $user_id = get_input('guid');
-$user = "";
 
 if (!$user_id) {
-       $user = $_SESSION['user'];
+       $user = get_loggedin_user();
 } else {
        $user = get_entity($user_id);
 }
index ff111461ee6040d86cc2cdbc0bef8e1c852f9766..d0ebb2226efe5b28878e0a8f83a932c410ed14ee 100644 (file)
@@ -17,5 +17,6 @@ if ($closed != 'true') {
        $closed = true;
 }
 
-$_SESSION['user']->spotlightclosed = $closed;
+get_loggedin_user()->spotlightclosed = $closed;
+// exit as this action is called through Ajax
 exit;
\ No newline at end of file
index 0bb29c408f713bc0fc9d0d3893e6eb2599aed32e..c960da014e433848a675b8b79fc2f2c154822e1f 100644 (file)
@@ -18,7 +18,8 @@ require_once('extender.php');
 /**
  * ElggAnnotation
  *
- * An annotation is similar to metadata each entity can contain more than one of each annotation.
+ * An annotation is similar to metadata.
+ * Each entity can have more than one of each type of annotation.
  *
  * @package Elgg
  * @subpackage Core
@@ -27,7 +28,7 @@ require_once('extender.php');
 class ElggAnnotation extends ElggExtender {
 
        /**
-        * Construct a new site object, optionally from a given id value or db row.
+        * Construct a new annotation, optionally from a given id value or db object.
         *
         * @param mixed $id
         */
@@ -87,14 +88,14 @@ class ElggAnnotation extends ElggExtender {
                                $this->value_type, $this->owner_guid, $this->access_id);
 
                        if (!$this->id) {
-                               throw new IOException(sprintf(elgg_new('IOException:UnableToSaveNew'), get_class()));
+                               throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class()));
                        }
                        return $this->id;
                }
        }
 
        /**
-        * Delete a given site.
+        * Delete the annotation.
         */
        function delete() {
                return delete_annotation($this->id);
@@ -125,7 +126,7 @@ class ElggAnnotation extends ElggExtender {
  * Convert a database row to a new ElggAnnotation
  *
  * @param stdClass $row
- * @return stdClass or ElggAnnotation
+ * @return ElggAnnotation
  */
 function row_to_elggannotation($row) {
        if (!($row instanceof stdClass)) {
@@ -139,6 +140,7 @@ function row_to_elggannotation($row) {
  * Get a specific annotation.
  *
  * @param int $annotation_id
+ * @return ElggAnnotation
  */
 function get_annotation($annotation_id) {
        global $CONFIG;
@@ -158,6 +160,7 @@ function get_annotation($annotation_id) {
  * @param string $value_type
  * @param int $owner_guid
  * @param int $access_id
+ * @return int|bool id on success or false on failure
  */
 function create_annotation($entity_guid, $name, $value, $value_type, $owner_guid, $access_id = ACCESS_PRIVATE) {
        global $CONFIG;
@@ -220,6 +223,7 @@ function create_annotation($entity_guid, $name, $value, $value_type, $owner_guid
  * @param string $value_type
  * @param int $owner_guid
  * @param int $access_id
+ * @return bool
  */
 function update_annotation($annotation_id, $name, $value, $value_type, $owner_guid, $access_id) {
        global $CONFIG;
index 58685bb82af5f05edfb6ac678ed29b6db69cdc27..c8945e2d16a18b48c4dbd9b5e9b70c86263c3407 100644 (file)
@@ -280,6 +280,7 @@ function get_data($query, $callback = "") {
 
        if (empty($resultarray)) {
                elgg_log("DB query \"$query\" returned no results.");
+               // @todo consider changing this to return empty array #1242
                return false;
        }
 
index 4e92fee21395b3def6bca69200d0040b32f4670e..0a30f5551af23d253c03056b1e78e9925f0f3e59 100644 (file)
@@ -951,13 +951,7 @@ function get_image_resize_parameters($width, $height, $options) {
        }
 
        // check for upscaling
-       // @todo This ignores squares, coordinates, and cropping. It's probably not the best idea.
-       // Size checking should be done in action code, but for backward compatibility
-       // this duplicates the previous behavior.
        if (!$upscale && ($height < $new_height || $width < $new_width)) {
-               // zero out offsets
-               $widthoffset = $heightoffset = 0;
-
                // determine if we can scale it down at all
                // (ie, if only one dimension is too small)
                // if not, just use original size.
@@ -968,10 +962,9 @@ function get_image_resize_parameters($width, $height, $options) {
                } elseif ($width < $new_width) {
                        $ratio = $new_height / $height;
                }
+               
                $selection_height = $height;
                $selection_width = $width;
-               $new_height = floor($height * $ratio);
-               $new_width = floor($width * $ratio);
        }
 
        $params = array(
@@ -986,7 +979,6 @@ function get_image_resize_parameters($width, $height, $options) {
        return $params;
 }
 
-
 // putting these here for now
 function file_delete($guid) {
        if ($file = get_entity($guid)) {
index 68829dafb38543f70ff2f68d1d6d4946947b5332..474baf609b4b21493fe2f4142f48e86d92780611 100644 (file)
@@ -460,15 +460,11 @@ function remove_object_from_group($group_guid, $object_guid) {
  * @param unknown_type $offset Where to start, by default 0.
  * @param unknown_type $count Whether to return the entities or a count of them.
  */
-function get_objects_in_group($group_guid, $subtype = "", $owner_guid = 0, $site_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false) {
-       global $CONFIG;
-
-       if ($subtype === false || $subtype === null || $subtype === 0) {
-               return false;
+function get_objects_in_group($group_guid, $subtype = "", $owner_guid = 0, $site_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = FALSE) {
+       if ($subtype === FALSE || $subtype === null || $subtype === 0) {
+               return FALSE;
        }
 
-       $subtype = get_subtype_id('object', $subtype);
-
        if ($order_by == "") {
                $order_by = "e.time_created desc";
        }
@@ -488,7 +484,11 @@ function get_objects_in_group($group_guid, $subtype = "", $owner_guid = 0, $site
        $where = array();
 
        $where[] = "e.type='object'";
-       if ($subtype!=="") {
+       
+       if (!empty($subtype)) {
+               if (!$subtype = get_subtype_id('object', $subtype)) {
+                       return FALSE;
+               }
                $where[] = "e.subtype=$subtype";
        }
        if ($owner_guid != "") {
index a6843e5986456cd8c1d58575fda8cbd060f89e42..a07b0958dab15c81e635588fca1dd2e4ce775a7c 100644 (file)
@@ -88,7 +88,7 @@ class ElggMetadata extends ElggExtender {
                } else {
                        $this->id = create_metadata($this->entity_guid, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id);
                        if (!$this->id) {
-                               throw new IOException(sprintf(elgg_new('IOException:UnableToSaveNew'), get_class()));
+                               throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class()));
                        }
                        return $this->id;
                }
index b8cf5c2d289957fed8ab9a309fed1da652e6da6a..66b22a0aa633d3871bfbb966bfcdd48cbc11beb2 100644 (file)
@@ -131,10 +131,10 @@ function get_plugin_list() {
  * @param array $pluginorder Optionally, a list of existing plugins and their orders
  * @return array The new list of plugins and their orders
  */
-function regenerate_plugin_list($pluginorder = false) {
+function regenerate_plugin_list($pluginorder = FALSE) {
        global $CONFIG;
 
-       $CONFIG->pluginlistcache = null;
+       $CONFIG->pluginlistcache = NULL;
 
        if ($site = get_entity($CONFIG->site_guid)) {
                if (empty($pluginorder)) {
@@ -187,15 +187,10 @@ function regenerate_plugin_list($pluginorder = false) {
 
                $site->pluginorder = $plugins;
 
-               // Regenerate caches
-               elgg_view_regenerate_simplecache();
-               elgg_filepath_cache_reset();
-
                return $plugins;
-
        }
 
-       return false;
+       return FALSE;
 }
 
 
index dd59b8d3f78d17e9e95fba562c8d2ea5e3c2a109..bf55a893266f308ff577312ee5b5bf3f5cd94aaf 100644 (file)
@@ -91,7 +91,7 @@ class ElggRelationship implements
 
                $this->id = add_entity_relationship($this->guid_one, $this->relationship, $this->guid_two);
                if (!$this->id) {
-                       throw new IOException(sprintf(elgg_new('IOException:UnableToSaveNew'), get_class()));
+                       throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class()));
                }
 
                return $this->id;
index ce1fbbf930f25ac3f6fd5ed1295a17ec6b19dea4..1d2b552ada9b13aef7a132dfae4e095ab870f5a1 100644 (file)
@@ -229,7 +229,7 @@ function elgg_get_tags(array $options = array()) {
        $query .= get_access_sql_suffix('e');
 
        $threshold = sanitise_int($options['threshold']);
-       $query .= " GROUP BY msv.string HAVING total > {$threshold} ";
+       $query .= " GROUP BY msv.string HAVING total >= {$threshold} ";
        $query .= " ORDER BY total DESC ";
 
        $limit = sanitise_int($options['limit']);
index 01900b84931167592ab3b3626d4ffa50afdefecb..5765c9c3d08b6336fc8ceb976a5a6b5aa8859804 100644 (file)
@@ -63,4 +63,55 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest {
                // clean up
                $this->entity->delete();
        }
+       
+       /**
+        * #2063 - get_resized_image_from_existing_file() fails asked for image larger than selection and not scaling an image up
+        * Test get_image_resize_parameters().
+        */
+       public function testElggResizeImage() {
+               $orig_width = 100;
+               $orig_height = 150;
+               
+               // test against selection > max
+               $options = array(
+                       'maxwidth' => 50,
+                       'maxheight' => 50,
+                       'square' => TRUE,
+                       'upscale' => FALSE,
+               
+                       'x1' => 25,
+                       'y1' => 75,
+                       'x2' => 100,
+                       'y2' => 150
+               );
+               
+               // should get back the same x/y offset == x1, y1 and an image of 50x50  
+               $params = get_image_resize_parameters($orig_width, $orig_height, $options);
+               
+               $this->assertEqual($params['newwidth'], $options['maxwidth']);
+               $this->assertEqual($params['newheight'], $options['maxheight']);
+               $this->assertEqual($params['xoffset'], $options['x1']);
+               $this->assertEqual($params['yoffset'], $options['y1']);
+               
+               // test against selection < max
+               $options = array(
+                       'maxwidth' => 50,
+                       'maxheight' => 50,
+                       'square' => TRUE,
+                       'upscale' => FALSE,
+               
+                       'x1' => 75,
+                       'y1' => 125,
+                       'x2' => 100,
+                       'y2' => 150
+               );
+               
+               // should get back the same x/y offset == x1, y1 and an image of 50x50
+               $params = get_image_resize_parameters($orig_width, $orig_height, $options);
+               
+               $this->assertEqual($params['newwidth'], $options['maxwidth']);
+               $this->assertEqual($params['newheight'], $options['maxheight']);
+               $this->assertEqual($params['xoffset'], $options['x1']);
+               $this->assertEqual($params['yoffset'], $options['y1']);
+       }
 }
index c121d010c5562ae46c57579c9713a2c5110624ef..280336cef3e694a15b1ce0a5fd8d18934ff5e244 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Activity viewer
+ * Entity viewer
  *
  * @package Elgg
  * @subpackage Core
@@ -9,8 +9,11 @@
  */
 
 require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
+
 set_context('search');
-$area2 = elgg_list_entities("","",0,10,false);
+$area2 = elgg_list_entities();
 set_context('entities');
-$body = elgg_view_layout('two_column_left_sidebar',$area1, $area2);
-page_draw("",$body);
\ No newline at end of file
+
+$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+
+page_draw("", $body);
\ No newline at end of file
index ecc1bede53b6fcd220172b577259d90af641f30f..3a7ca6e8d8234ff9d4c3481fbcbe234bfa79f18c 100644 (file)
@@ -18,17 +18,20 @@ $owner_guid = get_input("owner_guid", 0);
 $subtype = get_input("subtype", ELGG_ENTITIES_ANY_VALUE);
 $type = get_input("type", 'object');
 
-$objects = list_entities_from_metadata('universal_categories',
-                                                                               $category,
-                                                                               $type,
-                                                                               $subtype,
-                                                                               $owner_guid,
-                                                                               $limit,
-                                                                               false,
-                                                                               false,
-                                                                               true,
-                                                                               false);
-
+$params = array(
+       'metadata_name' => 'universal_categories',
+       'metadata_value' => $category,
+       'types' => $type,
+       'subtypes' => $subtype,
+       'owner_guid' => $owner_guid,
+       'limit' => $limit,
+       'full_view' => FALSE,
+       'metadata_case_sensitive' => FALSE,
+);
+$current_context = get_context();
+set_context('search');
+$objects = elgg_list_entities_from_metadata($params);
+set_context($current_context);
 
 $title = sprintf(elgg_echo('categories:results'), $category);
 
index 161a2165522ab7c1c14797efd336fe91cae0a3e0..9b62eff515a14b7aece2e7daf971a31934b77477 100644 (file)
@@ -13,7 +13,18 @@ if ($categories) {
                if (isset($vars['owner_guid'])) {
                        $owner_guid = (int) $vars['owner_guid'];
                }
-               if ($cats = get_tags(0,999,'universal_categories','object',$vars['subtype'],$owner_guid)) {
+
+               elgg_register_tag_metadata_name('universal_categories');
+               $params = array(
+                       'threshold' => 1,
+                       'limit' => 999,
+                       'tag_names' => array('universal_categories'),
+                       'types' => 'object',
+                       'subtypes' => $vars['subtype'],
+                       'owner_guid' => $owner_guid,
+               );
+               $cats = elgg_get_tags($params);         
+               if ($cats) {
                        foreach($cats as $cat) {
                                $flag[] = $cat->tag;
                        }
index 9907b02e3f6dd716a936e7c0cb7dbc1eedcfd5bd..acc1f9cdad3bd5a43f846a14190af7c941ccdcbb 100644 (file)
                $limit = 10;
                if ($search_viewtype == "gallery") $limit = 12;
                if (!empty($tag)) {
-                       $area2 .= list_entities_from_metadata($md_type, $tag, 'object', 'file', $owner_guid, $limit);
+                       $params = array(
+                               'metadata_name' => $md_type,
+                               'metadata_value' => $tag,
+                               'types' => 'object',
+                               'subtypes' => 'file',
+                               'owner_guid' => $owner_guid,
+                               'limit' => $limit,
+                       );
+                       $area2 .= elgg_list_entities_from_metadata($params);
                } else {
                        $area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'file', 'owner_guid' => $owner_guid, 'limit' => $limit, 'offset' => $offset));
                }
index 4ebb4eee036ecbc197b5e871a694e0ec57206fb4..b8f8f9b42fdf5cdd1b9ba209e983152f869198d2 100644 (file)
@@ -56,7 +56,7 @@
                                                        // send welcome email
                                                        notify_user($user->getGUID(), $group->owner_guid,
                                                                sprintf(elgg_echo('groups:welcome:subject'), $group->name),
-                                                               sprintf(elgg_echo('groups:welcome:body'), $user->name, $logged_in_user->name, $group->name, $group->getURL()),
+                                                               sprintf(elgg_echo('groups:welcome:body'), $user->name, $group->name, $group->getURL()),
                                                                NULL);
 
                                                        system_message(elgg_echo('groups:addedtogroup'));
index acd1c9f8b79e5bcc178810496475101c13319605..e986f99feb41cc430ce9596f7b97a87362c704cb 100644 (file)
@@ -83,7 +83,8 @@ $english = array(
         */
        'groups:access:private' => 'Closed - Users must be invited',
        'groups:access:public' => 'Open - Any user may join',
-       'groups:closedgroup' => 'This group has a closed membership. To ask to be added, click the "request membership" link.',
+       'groups:closedgroup' => 'This group has a closed membership.',
+       'groups:closedgroup:request' => 'To ask to be added, click the "request membership" menu link.',
        'groups:visibility' => 'Who can see this group?',
 
        /*
index e714602f15adaa0b95a7c6137e92454e148552e9..b35ef0af75334a073839a4e675bc3fa60b307996 100644 (file)
         */
 
 ?>
-<p class="margin_top"><?php echo elgg_echo('groups:closedgroup'); ?></p>
+<p class="margin_top">
+<?php 
+echo elgg_echo('groups:closedgroup');
+if (isloggedin()) {
+       echo ' ' . elgg_echo('groups:closedgroup:request');
+}
+?>
+</p>
index b5a966dbbf4bd0ba6045f2de9441fccec8b7708e..a786a4e5138c8871430509bf311d3e79676aa511 100644 (file)
 require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
 
 if (!page_owner()) {
-       set_page_owner($_SESSION['guid']);
+       set_page_owner(get_loggedin_userid());
 }
 
 // Make sure we don't open a security hole ...
 if ((!page_owner_entity()) || (!page_owner_entity()->canEdit())) {
-       set_page_owner($_SESSION['guid']);
+       set_page_owner(get_loggedin_userid());
 }
 
 // Forward to the user settings
index 11459a6b70756bb5737d769cef14b36eef09a8cd..719634d52829c3a1941d678a1f54c1c228e97b19 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Elgg user settings functions.
+ * Elgg user plugin settings.
  *
  * @package Elgg
  * @subpackage Core
@@ -8,7 +8,6 @@
  * @link http://elgg.org/
  */
 
-// Get the Elgg framework
 require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
 
 // Make sure only valid users can see this
@@ -16,8 +15,12 @@ gatekeeper();
 
 // Make sure we don't open a security hole ...
 if ((!page_owner_entity()) || (!page_owner_entity()->canEdit())) {
-       set_page_owner($_SESSION['guid']);
+       set_page_owner(get_loggedin_userid());
 }
 
-// Display main admin menu
-page_draw(elgg_echo("usersettings:plugins"),elgg_view_layout('one_column_with_sidebar', elgg_view_title(elgg_echo("usersettings:plugins")) . elgg_view("usersettings/plugins", array('installed_plugins' => get_installed_plugins()))));
+$content = elgg_view_title(elgg_echo("usersettings:plugins"));
+$content .= elgg_view("usersettings/plugins", array('installed_plugins' => get_installed_plugins()));
+
+$body = elgg_view_layout('one_column_with_sidebar', $content);
+
+page_draw(elgg_echo("usersettings:plugins"), $body);
index f354168b469d4ea791281c870c180eacd19e71fe..e0d2edbf5afb40c716b1bcf5001fb4bc6638d701 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Elgg user settings functions.
+ * Elgg user statistics.
  *
  * @package Elgg
  * @subpackage Core
@@ -16,8 +16,12 @@ gatekeeper();
 
 // Make sure we don't open a security hole ...
 if ((!page_owner_entity()) || (!page_owner_entity()->canEdit())) {
-       set_page_owner($_SESSION['guid']);
+       set_page_owner(get_loggedin_userid());
 }
 
-// Display main admin menu
-page_draw(elgg_echo("usersettings:statistics"),elgg_view_layout('one_column_with_sidebar', elgg_view_title(elgg_echo("usersettings:statistics")) . elgg_view("usersettings/statistics")));
\ No newline at end of file
+$content = elgg_view_title(elgg_echo("usersettings:statistics"));
+$content .= elgg_view("usersettings/statistics");
+
+$body = elgg_view_layout('one_column_with_sidebar', $content);
+
+page_draw(elgg_echo("usersettings:statistics"), $body);
index 7e7a3967f6fa4a5950c707398b74512d2d92fc2c..0d5b0e219add7ce045975e4f5028aafbc1c4da22 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Elgg user settings functions.
+ * Elgg user account settings.
  *
  * @package Elgg
  * @subpackage Core
@@ -16,11 +16,12 @@ gatekeeper();
 
 // Make sure we don't open a security hole ...
 if ((!page_owner_entity()) || (!page_owner_entity()->canEdit())) {
-       set_page_owner($_SESSION['guid']);
+       set_page_owner(get_loggedin_userid());
 }
 
-// Display main admin menu
-page_draw(
-       elgg_echo("usersettings:user"),
-       elgg_view_layout("one_column_with_sidebar", elgg_view_title(elgg_echo('usersettings:user')) . elgg_view("usersettings/form"))
-);
\ No newline at end of file
+$content = elgg_view_title(elgg_echo('usersettings:user'));
+$content .= elgg_view("usersettings/form");
+
+$body = elgg_view_layout("one_column_with_sidebar", $content);
+
+page_draw(elgg_echo("usersettings:user"), $body);
index 908ea7a90b1bada01e6f96d3e043ff9e611a265e..4f3f37d92f1f471704073b3192583d50a35a0bdb 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Elgg default layout
+ * JSON river view
  *
  * @package Elgg
  * @subpackage Core
@@ -8,39 +8,34 @@
  * @link http://elgg.org/
  */
 global $jsonexport;
-if (isset($vars['items']) && is_array($vars['items'])) {
 
+$json_items = array();
+
+if (isset($vars['items']) && is_array($vars['items'])) {
        $i = 0;
+       
        if (!empty($vars['items'])) {
                foreach($vars['items'] as $item) {
+                       
+                       $json_entry = array(
+                               'subject'               =>      NULL,
+                               'object'                =>      NULL,
+                               'type'                  =>      NULL,
+                               'subtype'               =>      NULL,
+                               'action_type'   =>      NULL,
+                               'view'                  =>      NULL,
+                               'annotation'    =>      NULL,
+                               'timestamp'     =>      NULL,
+                               'string'                =>      NULL
+                       );
 
-                       // echo elgg_view_river_item($item);
-                       if (elgg_view_exists($item->view,'default')) {
-                               $body = elgg_view($item->view,array('item' => $item), false, false, 'default');
-                               $time = date("r",$item->posted);
-                               if ($entity = get_entity($item->object_guid)) {
-                                       $url = htmlspecialchars($entity->getURL());
-                               } else {
-                                       $url = $vars['url'];
-                               }
-                               $title = strip_tags($body);
-
-                               $jsonitem = $item;
-                               $jsonitem->url = $url;
-                               $jsonitem->description = autop($body);
-                               $jsonitem->title = $title;
-                               unset($jsonitem->view);
-
-                               if ($subject = get_entity($item->subject_guid)) {
-                                       elgg_view_entity($subject);
-                               }
-                               if ($object = get_entity($item->object_guid)) {
-                                       elgg_view_entity($object);
-                               }
-
-                               $jsonexport['activity'][] = $jsonitem;
+                       if (elgg_view_exists($item->view, 'default')) {
+                               $json_entry['string'] = elgg_view($item->view, array('item' => $item), FALSE, FALSE, 'default');
+                               $json_entry['timestamp'] = (int)$item->posted;
                        }
 
+                       $json_items[] = $json_entry;
+                       
                        $i++;
                        if ($i >= $vars['limit']) {
                                break;
@@ -48,4 +43,5 @@ if (isset($vars['items']) && is_array($vars['items'])) {
                }
        }
 }
-echo "!";
\ No newline at end of file
+
+$jsonexport['activity'] = $json_items;