diff options
Diffstat (limited to 'actions/user')
| -rw-r--r-- | actions/user/language.php | 40 | ||||
| -rw-r--r-- | actions/user/name.php | 40 | ||||
| -rw-r--r-- | actions/user/password.php | 49 | ||||
| -rw-r--r-- | actions/user/passwordreset.php | 19 | ||||
| -rw-r--r-- | actions/user/requestnewpassword.php | 27 | ||||
| -rw-r--r-- | actions/user/spotlight.php | 19 |
6 files changed, 65 insertions, 129 deletions
diff --git a/actions/user/language.php b/actions/user/language.php deleted file mode 100644 index f0b91791e..000000000 --- a/actions/user/language.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - /** - * Action for changing a user's personal language settings - * - * @package Elgg - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Marcus Povey - * @copyright Curverider Ltd 2008 - * @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)) - { - $user->language = $language; - if ($user->save()) - system_message(elgg_echo('user:language:success')); - else - system_message(elgg_echo('user:language:fail')); - } - else - system_message(elgg_echo('user:language:fail')); - - //forward($_SERVER['HTTP_REFERER']); - //exit; -?>
\ No newline at end of file diff --git a/actions/user/name.php b/actions/user/name.php deleted file mode 100644 index b93c804b3..000000000 --- a/actions/user/name.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - /** - * Action for changing a user's name - * - * @package Elgg - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Marcus Povey - * @copyright Curverider Ltd 2008 - * @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)) - { - $user->name = $name; - if ($user->save()) - system_message(elgg_echo('user:name:success')); - else - system_message(elgg_echo('user:name:fail')); - } - else - system_message(elgg_echo('user:name:fail')); - - //forward($_SERVER['HTTP_REFERER']); - //exit; -?>
\ No newline at end of file diff --git a/actions/user/password.php b/actions/user/password.php deleted file mode 100644 index ec3252644..000000000 --- a/actions/user/password.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - /** - * Action for changing a user's password - * - * @package Elgg - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Marcus Povey - * @copyright Curverider Ltd 2008 - * @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->password = generate_user_password($user, $password); - if ($user->save()) - system_message(elgg_echo('user:password:success')); - else - system_message(elgg_echo('user:password:fail')); - } - else - system_message(elgg_echo('user:password:fail:notsame')); - } - else - system_message(elgg_echo('user:password:fail:tooshort')); - } - - //forward($_SERVER['HTTP_REFERER']); - //exit; -?>
\ No newline at end of file diff --git a/actions/user/passwordreset.php b/actions/user/passwordreset.php new file mode 100644 index 000000000..201d6abcf --- /dev/null +++ b/actions/user/passwordreset.php @@ -0,0 +1,19 @@ +<?php +/** + * Action to reset a password and send success email. + * + * @package Elgg + * @subpackage Core + */ + +$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 new file mode 100644 index 000000000..f1d4fa43c --- /dev/null +++ b/actions/user/requestnewpassword.php @@ -0,0 +1,27 @@ +<?php +/** + * Action to request a new password. + * + * @package Elgg.Core + * @subpackage User.Account + */ + +$username = get_input('username'); + +// 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 (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(elgg_echo('user:username:notfound', array($username))); +} + +forward(); diff --git a/actions/user/spotlight.php b/actions/user/spotlight.php new file mode 100644 index 000000000..202dde387 --- /dev/null +++ b/actions/user/spotlight.php @@ -0,0 +1,19 @@ +<?php +/** + * Close or open spotlight. + * + * @package Elgg.Core + * @subpackage Spotlight + * @todo This is deprecated in 1.8 + */ + +$closed = get_input('closed', 'true'); +if ($closed != 'true') { + $closed = false; +} else { + $closed = true; +} + +elgg_get_logged_in_user_entity()->spotlightclosed = $closed; +// exit as this action is called through Ajax +exit;
\ No newline at end of file |
