diff options
Diffstat (limited to 'actions/user')
| -rw-r--r-- | actions/user/default_access.php | 39 | ||||
| -rw-r--r-- | actions/user/language.php | 37 | ||||
| -rw-r--r-- | actions/user/name.php | 37 | ||||
| -rw-r--r-- | actions/user/password.php | 43 | ||||
| -rw-r--r-- | actions/user/passwordreset.php | 5 | ||||
| -rw-r--r-- | actions/user/requestnewpassword.php | 37 | ||||
| -rw-r--r-- | actions/user/spotlight.php | 14 |
7 files changed, 18 insertions, 194 deletions
diff --git a/actions/user/default_access.php b/actions/user/default_access.php deleted file mode 100644 index 2e08631a1..000000000 --- a/actions/user/default_access.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * 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) { - 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')); - } -}
\ No newline at end of file diff --git a/actions/user/language.php b/actions/user/language.php deleted file mode 100644 index f0837e1e5..000000000 --- a/actions/user/language.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * 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; - -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')); -} diff --git a/actions/user/name.php b/actions/user/name.php deleted file mode 100644 index 19a3422e8..000000000 --- a/actions/user/name.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * 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; - -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')); -}
\ No newline at end of file diff --git a/actions/user/password.php b/actions/user/password.php deleted file mode 100644 index d2fcb95d8..000000000 --- a/actions/user/password.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * 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; - -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:tooshort')); - } -}
\ No newline at end of file diff --git a/actions/user/passwordreset.php b/actions/user/passwordreset.php index c6d8a70b1..201d6abcf 100644 --- a/actions/user/passwordreset.php +++ b/actions/user/passwordreset.php @@ -4,13 +4,8 @@ * * @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'); diff --git a/actions/user/requestnewpassword.php b/actions/user/requestnewpassword.php index d951e2ede..f1d4fa43c 100644 --- a/actions/user/requestnewpassword.php +++ b/actions/user/requestnewpassword.php @@ -2,39 +2,26 @@ /** * Action to request a new password. * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ + * @package Elgg.Core + * @subpackage User.Account */ -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); +// allow email addresses +if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) { + $username = $users[0]->username; +} + $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); + 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 { - register_error(sprintf(elgg_echo('user:username:notfound'), $username)); + register_error(elgg_echo('user:username:notfound', array($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 ff111461e..202dde387 100644 --- a/actions/user/spotlight.php +++ b/actions/user/spotlight.php @@ -2,20 +2,18 @@ /** * Close or open spotlight. * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ + * @package Elgg.Core + * @subpackage Spotlight + * @todo This is deprecated in 1.8 */ -gatekeeper(); - -$closed = get_input('closed','true'); +$closed = get_input('closed', 'true'); if ($closed != 'true') { $closed = false; } else { $closed = true; } -$_SESSION['user']->spotlightclosed = $closed; +elgg_get_logged_in_user_entity()->spotlightclosed = $closed; +// exit as this action is called through Ajax exit;
\ No newline at end of file |
