aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-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
11 files changed, 16 insertions, 32 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