aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/email/save.php9
-rw-r--r--actions/friends/add.php4
-rw-r--r--actions/friends/addcollection.php4
-rw-r--r--actions/friends/deletecollection.php6
-rw-r--r--actions/friends/remove.php2
-rw-r--r--actions/plugins/usersettings/save.php2
-rw-r--r--actions/user/default_access.php3
-rw-r--r--actions/user/language.php5
-rw-r--r--actions/user/name.php5
-rw-r--r--actions/user/password.php5
-rw-r--r--actions/user/spotlight.php3
-rw-r--r--engine/lib/annotations.php14
-rw-r--r--engine/lib/database.php1
-rw-r--r--engine/lib/filestore.php10
-rw-r--r--engine/lib/group.php16
-rw-r--r--engine/lib/metadata.php2
-rw-r--r--engine/lib/plugins.php11
-rw-r--r--engine/lib/relationships.php2
-rw-r--r--engine/lib/tags.php2
-rw-r--r--engine/tests/regression/trac_bugs.php51
-rw-r--r--entities/list.php11
-rw-r--r--mod/categories/listing.php25
-rw-r--r--mod/categories/views/default/categories/list.php13
-rw-r--r--mod/file/search.php10
-rw-r--r--mod/groups/actions/addtogroup.php2
-rw-r--r--mod/groups/languages/en.php3
-rw-r--r--mod/groups/views/default/groups/closedmembership.php9
-rw-r--r--settings/index.php4
-rw-r--r--settings/plugins.php13
-rw-r--r--settings/statistics.php12
-rw-r--r--settings/user.php15
-rw-r--r--views/json/river/item/list.php52
32 files changed, 195 insertions, 131 deletions
diff --git a/actions/email/save.php b/actions/email/save.php
index 7493538f9..34fce3c30 100644
--- a/actions/email/save.php
+++ b/actions/email/save.php
@@ -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;
-?>
diff --git a/actions/friends/add.php b/actions/friends/add.php
index 934424b57..345a86774 100644
--- a/actions/friends/add.php
+++ b/actions/friends/add.php
@@ -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));
}
diff --git a/actions/friends/addcollection.php b/actions/friends/addcollection.php
index e5541797b..6124b3496 100644
--- a/actions/friends/addcollection.php
+++ b/actions/friends/addcollection.php
@@ -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"));
diff --git a/actions/friends/deletecollection.php b/actions/friends/deletecollection.php
index 1e18adcea..d4e077a24 100644
--- a/actions/friends/deletecollection.php
+++ b/actions/friends/deletecollection.php
@@ -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);
diff --git a/actions/friends/remove.php b/actions/friends/remove.php
index 768291055..d3d362a92 100644
--- a/actions/friends/remove.php
+++ b/actions/friends/remove.php
@@ -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;
diff --git a/actions/plugins/usersettings/save.php b/actions/plugins/usersettings/save.php
index d8db3bb1e..0219068e5 100644
--- a/actions/plugins/usersettings/save.php
+++ b/actions/plugins/usersettings/save.php
@@ -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) {
diff --git a/actions/user/default_access.php b/actions/user/default_access.php
index ee8fb9efa..0aacf209c 100644
--- a/actions/user/default_access.php
+++ b/actions/user/default_access.php
@@ -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);
}
diff --git a/actions/user/language.php b/actions/user/language.php
index 1165b196e..83cc10dbd 100644
--- a/actions/user/language.php
+++ b/actions/user/language.php
@@ -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);
}
diff --git a/actions/user/name.php b/actions/user/name.php
index 3145c5ee7..69a1b9681 100644
--- a/actions/user/name.php
+++ b/actions/user/name.php
@@ -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);
}
diff --git a/actions/user/password.php b/actions/user/password.php
index 6e3ff9447..25723c0b0 100644
--- a/actions/user/password.php
+++ b/actions/user/password.php
@@ -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);
}
diff --git a/actions/user/spotlight.php b/actions/user/spotlight.php
index ff111461e..d0ebb2226 100644
--- a/actions/user/spotlight.php
+++ b/actions/user/spotlight.php
@@ -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
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 0bb29c408..c960da014 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -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;
diff --git a/engine/lib/database.php b/engine/lib/database.php
index 58685bb82..c8945e2d1 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -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;
}
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php
index 4e92fee21..0a30f5551 100644
--- a/engine/lib/filestore.php
+++ b/engine/lib/filestore.php
@@ -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)) {
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 68829dafb..474baf609 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -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 != "") {
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index a6843e598..a07b0958d 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -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;
}
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index b8cf5c2d2..66b22a0aa 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -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;
}
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index dd59b8d3f..bf55a8932 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -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;
diff --git a/engine/lib/tags.php b/engine/lib/tags.php
index ce1fbbf93..1d2b552ad 100644
--- a/engine/lib/tags.php
+++ b/engine/lib/tags.php
@@ -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']);
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php
index 01900b849..5765c9c3d 100644
--- a/engine/tests/regression/trac_bugs.php
+++ b/engine/tests/regression/trac_bugs.php
@@ -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']);
+ }
}
diff --git a/entities/list.php b/entities/list.php
index c121d010c..280336cef 100644
--- a/entities/list.php
+++ b/entities/list.php
@@ -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
diff --git a/mod/categories/listing.php b/mod/categories/listing.php
index ecc1bede5..3a7ca6e8d 100644
--- a/mod/categories/listing.php
+++ b/mod/categories/listing.php
@@ -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);
diff --git a/mod/categories/views/default/categories/list.php b/mod/categories/views/default/categories/list.php
index 161a21655..9b62eff51 100644
--- a/mod/categories/views/default/categories/list.php
+++ b/mod/categories/views/default/categories/list.php
@@ -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;
}
diff --git a/mod/file/search.php b/mod/file/search.php
index 9907b02e3..acc1f9cda 100644
--- a/mod/file/search.php
+++ b/mod/file/search.php
@@ -79,7 +79,15 @@
$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));
}
diff --git a/mod/groups/actions/addtogroup.php b/mod/groups/actions/addtogroup.php
index 4ebb4eee0..b8f8f9b42 100644
--- a/mod/groups/actions/addtogroup.php
+++ b/mod/groups/actions/addtogroup.php
@@ -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'));
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index acd1c9f8b..e986f99fe 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -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?',
/*
diff --git a/mod/groups/views/default/groups/closedmembership.php b/mod/groups/views/default/groups/closedmembership.php
index e714602f1..b35ef0af7 100644
--- a/mod/groups/views/default/groups/closedmembership.php
+++ b/mod/groups/views/default/groups/closedmembership.php
@@ -10,4 +10,11 @@
*/
?>
-<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>
diff --git a/settings/index.php b/settings/index.php
index b5a966dbb..a786a4e51 100644
--- a/settings/index.php
+++ b/settings/index.php
@@ -12,12 +12,12 @@
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
diff --git a/settings/plugins.php b/settings/plugins.php
index 11459a6b7..719634d52 100644
--- a/settings/plugins.php
+++ b/settings/plugins.php
@@ -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);
diff --git a/settings/statistics.php b/settings/statistics.php
index f354168b4..e0d2edbf5 100644
--- a/settings/statistics.php
+++ b/settings/statistics.php
@@ -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);
diff --git a/settings/user.php b/settings/user.php
index 7e7a3967f..0d5b0e219 100644
--- a/settings/user.php
+++ b/settings/user.php
@@ -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);
diff --git a/views/json/river/item/list.php b/views/json/river/item/list.php
index 908ea7a90..4f3f37d92 100644
--- a/views/json/river/item/list.php
+++ b/views/json/river/item/list.php
@@ -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;