function userManagementPageHandler($page) { switch ($page[0]) { case 'users': include elgg_get_plugins_path() . 'userManagement/pages/users.php'; break; case 'deactivate': $userMgmt = new UserManagement(); $userMgmt->getInactiveUsers(); $userMgmt->deactivateUsers(); break; //activate account form //activate account form case 'activate': $userMgmt = new UserManagement(); //check if user doesnt have forces email send them to different form if ($userMgmt->validEmail(get_input('email'))) { include elgg_get_plugins_path() . 'userManagement/pages/activate.php'; } else { include elgg_get_plugins_path() . 'userManagement/pages/changeEmail.php'; } break; //activate account action //activate account action case 'activation': $userMgmt = new UserManagement(); $userGuid = get_input('u'); $code = get_input('c'); $user = get_entity($userGuid); if (!$user) { register_error(elgg_echo('activate:error')); forward(REFERER); } $userMgmt->setUser($user); if (!$userMgmt->validateCode($code)) { register_error(elgg_echo('activate:error')); forward(REFERER); } //activate user if ($userMgmt->activateUser()) { system_message(elgg_echo('activate:success')); forward(REFERER); } break; case 'import': admin_gatekeeper(); elgg_admin_add_plugin_settings_menu(); elgg_set_context('admin'); elgg_unregister_css('elgg'); elgg_load_js('elgg.admin'); elgg_load_js('jquery.jeditable'); $vars = array('page' => $page); $view = 'usermanagement/' . implode('/', $page); $title = "Import Users"; $content = elgg_view($view); $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title)); echo elgg_view_page($title, $body, 'admin'); break; case 'resetPassword': set_input('guid', $_SESSION['userId']); include elgg_get_plugins_path() . "userManagement/pages/resetPassword.php"; break; case 'registerEmails': include elgg_get_plugins_path() . "userManagement/pages/registerEmails.php"; break; case 'admin': if ($page[1] == activate) { include elgg_get_plugins_path() . "userManagement/pages/admin/activate.php"; } break; default: return false; } return true; }
register_error($result); forward(REFERER); } $user = get_user_by_username($username); if (!$user) { register_error(elgg_echo('login:baduser')); forward(REFERER); } $userMgmt = new UserManagement(); $encryptedPswd = md5("changeme2015" . $user->salt); if ($user->password == $encryptedPswd) { //forward to change password form $_SESSION['userId'] = $user->guid; forward("usermgmt/resetPassword"); } if ($user->deactivated || !$userMgmt->validEmail($user->email)) { forward("usermgmt/activate?email={$user->email}&guid={$user->guid}"); } try { login($user, $persistent); // re-register at least the core language file for users with language other than site default register_translations(dirname(dirname(__FILE__)) . "/languages/"); } catch (LoginException $e) { register_error($e->getMessage()); forward(REFERER); } // elgg_echo() caches the language and does not provide a way to change the language. // @todo we need to use the config object to store this so that the current language // can be changed. Refs #4171 if ($user->language) { $message = elgg_echo('loginok', array(), $user->language);