aboutsummaryrefslogtreecommitdiff
path: root/actions/user
diff options
context:
space:
mode:
Diffstat (limited to 'actions/user')
-rw-r--r--actions/user/default_access.php71
-rw-r--r--actions/user/language.php68
-rw-r--r--actions/user/name.php68
-rw-r--r--actions/user/password.php79
-rw-r--r--actions/user/passwordreset.php45
-rw-r--r--actions/user/requestnewpassword.php75
-rw-r--r--actions/user/spotlight.php30
7 files changed, 211 insertions, 225 deletions
diff --git a/actions/user/default_access.php b/actions/user/default_access.php
index b79200ad0..2e08631a1 100644
--- a/actions/user/default_access.php
+++ b/actions/user/default_access.php
@@ -1,44 +1,39 @@
<?php
- /**
- * Action for changing a user's default access level
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
+/**
+ * Action for changing a user's default access level
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- global $CONFIG;
-
- if ($CONFIG->allow_user_default_access) {
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
- gatekeeper();
-
- $default_access = get_input('default_access');
- $user_id = get_input('guid');
- $user = "";
-
- if (!$user_id)
- $user = $_SESSION['user'];
- else
- $user = get_entity($user_id);
-
- if ($user)
- {
- $current_default_access = $user->getPrivateSetting('elgg_default_access');
- if ($default_access != $current_default_access)
- {
- if ($user->setPrivateSetting('elgg_default_access',$default_access))
- system_message(elgg_echo('user:default_access:success'));
- else
- register_error(elgg_echo('user:default_access:fail'));
+if ($CONFIG->allow_user_default_access) {
+ gatekeeper();
+
+ $default_access = get_input('default_access');
+ $user_id = get_input('guid');
+ $user = "";
+
+ if (!$user_id) {
+ $user = $_SESSION['user'];
+ } else {
+ $user = get_entity($user_id);
+ }
+
+ if ($user) {
+ $current_default_access = $user->getPrivateSetting('elgg_default_access');
+ if ($default_access != $current_default_access) {
+ if ($user->setPrivateSetting('elgg_default_access',$default_access)) {
+ system_message(elgg_echo('user:default_access:success'));
+ } else {
+ register_error(elgg_echo('user:default_access:fail'));
}
}
- else
- register_error(elgg_echo('user:default_access:fail'));
+ } else {
+ register_error(elgg_echo('user:default_access:fail'));
}
-
- //forward($_SERVER['HTTP_REFERER']);
- //exit;
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/actions/user/language.php b/actions/user/language.php
index cec650d7d..f0837e1e5 100644
--- a/actions/user/language.php
+++ b/actions/user/language.php
@@ -1,41 +1,37 @@
<?php
- /**
- * Action for changing a user's personal language settings
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
+/**
+ * Action for changing a user's personal language settings
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- global $CONFIG;
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
- gatekeeper();
-
- $language = get_input('language');
- $user_id = get_input('guid');
- $user = "";
-
- if (!$user_id)
- $user = $_SESSION['user'];
- else
- $user = get_entity($user_id);
-
- if (($user) && ($language))
- {
- if (strcmp($language, $user->language)!=0)
- {
- $user->language = $language;
- if ($user->save())
- system_message(elgg_echo('user:language:success'));
- else
- register_error(elgg_echo('user:language:fail'));
+gatekeeper();
+
+$language = get_input('language');
+$user_id = get_input('guid');
+$user = "";
+
+if (!$user_id) {
+ $user = $_SESSION['user'];
+} else {
+ $user = get_entity($user_id);
+}
+
+if (($user) && ($language)) {
+ if (strcmp($language, $user->language)!=0) {
+ $user->language = $language;
+ if ($user->save()) {
+ system_message(elgg_echo('user:language:success'));
+ } else {
+ register_error(elgg_echo('user:language:fail'));
}
}
- else
- register_error(elgg_echo('user:language:fail'));
-
- //forward($_SERVER['HTTP_REFERER']);
- //exit;
-?> \ No newline at end of file
+} else {
+ register_error(elgg_echo('user:language:fail'));
+}
diff --git a/actions/user/name.php b/actions/user/name.php
index 1c102c25f..19a3422e8 100644
--- a/actions/user/name.php
+++ b/actions/user/name.php
@@ -1,41 +1,37 @@
<?php
- /**
- * Action for changing a user's name
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
+/**
+ * Action for changing a user's name
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- global $CONFIG;
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
- gatekeeper();
-
- $name = get_input('name');
- $user_id = get_input('guid');
- $user = "";
-
- if (!$user_id)
- $user = $_SESSION['user'];
- else
- $user = get_entity($user_id);
-
- if (($user) && ($name))
- {
- if (strcmp($name, $user->name)!=0)
- {
- $user->name = $name;
- if ($user->save())
- system_message(elgg_echo('user:name:success'));
- else
- register_error(elgg_echo('user:name:fail'));
+gatekeeper();
+
+$name = get_input('name');
+$user_id = get_input('guid');
+$user = "";
+
+if (!$user_id) {
+ $user = $_SESSION['user'];
+} else {
+ $user = get_entity($user_id);
+}
+
+if (($user) && ($name)) {
+ if (strcmp($name, $user->name)!=0) {
+ $user->name = $name;
+ if ($user->save()) {
+ system_message(elgg_echo('user:name:success'));
+ } else {
+ register_error(elgg_echo('user:name:fail'));
}
}
- else
- register_error(elgg_echo('user:name:fail'));
-
- //forward($_SERVER['HTTP_REFERER']);
- //exit;
-?> \ No newline at end of file
+} else {
+ register_error(elgg_echo('user:name:fail'));
+} \ No newline at end of file
diff --git a/actions/user/password.php b/actions/user/password.php
index e8d67a87b..d2fcb95d8 100644
--- a/actions/user/password.php
+++ b/actions/user/password.php
@@ -1,48 +1,43 @@
<?php
- /**
- * Action for changing a user's password
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
+/**
+ * Action for changing a user's password
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- global $CONFIG;
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
- gatekeeper();
-
- $password = get_input('password');
- $password2 = get_input('password2');
- $user_id = get_input('guid');
- $user = "";
-
- if (!$user_id)
- $user = $_SESSION['user'];
- else
- $user = get_entity($user_id);
-
- if (($user) && ($password!=""))
- {
- if (strlen($password)>=4)
- {
- if ($password == $password2)
- {
- $user->salt = generate_random_cleartext_password(); // Reset the salt
- $user->password = generate_user_password($user, $password);
- if ($user->save())
- system_message(elgg_echo('user:password:success'));
- else
- register_error(elgg_echo('user:password:fail'));
+gatekeeper();
+
+$password = get_input('password');
+$password2 = get_input('password2');
+$user_id = get_input('guid');
+$user = "";
+
+if (!$user_id) {
+ $user = $_SESSION['user'];
+} else {
+ $user = get_entity($user_id);
+}
+
+if (($user) && ($password!="")) {
+ if (strlen($password)>=4) {
+ if ($password == $password2) {
+ $user->salt = generate_random_cleartext_password(); // Reset the salt
+ $user->password = generate_user_password($user, $password);
+ if ($user->save()) {
+ system_message(elgg_echo('user:password:success'));
+ } else {
+ register_error(elgg_echo('user:password:fail'));
}
- else
- register_error(elgg_echo('user:password:fail:notsame'));
+ } else {
+ register_error(elgg_echo('user:password:fail:notsame'));
}
- else
- register_error(elgg_echo('user:password:fail:tooshort'));
+ } else {
+ register_error(elgg_echo('user:password:fail:tooshort'));
}
-
- //forward($_SERVER['HTTP_REFERER']);
- //exit;
-?> \ No newline at end of file
+} \ No newline at end of file
diff --git a/actions/user/passwordreset.php b/actions/user/passwordreset.php
index ea744b955..c6d8a70b1 100644
--- a/actions/user/passwordreset.php
+++ b/actions/user/passwordreset.php
@@ -1,25 +1,24 @@
<?php
- /**
- * Action to reset a password and send success email.
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
+/**
+ * Action to reset a password and send success email.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- global $CONFIG;
-
- $user_guid = get_input('u');
- $code = get_input('c');
-
- if (execute_new_password_request($user_guid, $code))
- system_message(elgg_echo('user:password:success'));
- else
- register_error(elgg_echo('user:password:fail'));
-
- forward();
- exit;
-
-?> \ No newline at end of file
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
+
+$user_guid = get_input('u');
+$code = get_input('c');
+
+if (execute_new_password_request($user_guid, $code)) {
+ system_message(elgg_echo('user:password:success'));
+} else {
+ register_error(elgg_echo('user:password:fail'));
+}
+
+forward();
+exit;
diff --git a/actions/user/requestnewpassword.php b/actions/user/requestnewpassword.php
index a54e71b7e..d951e2ede 100644
--- a/actions/user/requestnewpassword.php
+++ b/actions/user/requestnewpassword.php
@@ -1,41 +1,40 @@
<?php
- /**
- * Action to request a new password.
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
+/**
+ * Action to request a new password.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- global $CONFIG;
-
- action_gatekeeper();
-
- $username = get_input('username');
-
- $access_status = access_get_show_hidden_status();
- access_show_hidden_entities(true);
- $user = get_user_by_username($username);
- if ($user)
- {
- if ($user->validated) {
- if (send_new_password_request($user->guid))
- system_message(elgg_echo('user:password:resetreq:success'));
- else
- register_error(elgg_echo('user:password:resetreq:fail'));
- } else if (!trigger_plugin_hook('unvalidated_requestnewpassword','user',array('entity'=>$user))) {
- // if plugins have not registered an action, the default action is to
- // trigger the validation event again and assume that the validation
- // event will display an appropriate message
- trigger_elgg_event('validate', 'user', $user);
- }
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+global $CONFIG;
+
+action_gatekeeper();
+
+$username = get_input('username');
+
+$access_status = access_get_show_hidden_status();
+access_show_hidden_entities(true);
+$user = get_user_by_username($username);
+if ($user) {
+ if ($user->validated) {
+ if (send_new_password_request($user->guid)) {
+ system_message(elgg_echo('user:password:resetreq:success'));
+ } else {
+ register_error(elgg_echo('user:password:resetreq:fail'));
+ }
+ } else if (!trigger_plugin_hook('unvalidated_requestnewpassword','user',array('entity'=>$user))) {
+ // if plugins have not registered an action, the default action is to
+ // trigger the validation event again and assume that the validation
+ // event will display an appropriate message
+ trigger_elgg_event('validate', 'user', $user);
}
- else
- register_error(sprintf(elgg_echo('user:username:notfound'), $username));
-
- access_show_hidden_entities($access_status);
- forward();
- exit;
-?> \ No newline at end of file
+} else {
+ register_error(sprintf(elgg_echo('user:username:notfound'), $username));
+}
+
+access_show_hidden_entities($access_status);
+forward();
+exit; \ No newline at end of file
diff --git a/actions/user/spotlight.php b/actions/user/spotlight.php
index 8f50df2c8..ff111461e 100644
--- a/actions/user/spotlight.php
+++ b/actions/user/spotlight.php
@@ -1,15 +1,21 @@
<?php
+/**
+ * Close or open spotlight.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd
+ * @link http://elgg.org/
+ */
- gatekeeper();
-
- $closed = get_input('closed','true');
- if ($closed != 'true') {
- $closed = false;
- } else {
- $closed = true;
- }
-
- $_SESSION['user']->spotlightclosed = $closed;
- exit;
+gatekeeper();
-?> \ No newline at end of file
+$closed = get_input('closed','true');
+if ($closed != 'true') {
+ $closed = false;
+} else {
+ $closed = true;
+}
+
+$_SESSION['user']->spotlightclosed = $closed;
+exit; \ No newline at end of file