/** * This action is the default action of the Admin module. It should be triggered * when the user agent request requests to enter the administration panel. */ public function index() { // Session message handling. if (isset($_SESSION['message'])) { $message = $_SESSION['message']; $isError = $_SESSION['isError']; // We consider message and isError session variables as flash variables. unset($_SESSION['message']); unset($_SESSION['isError']); } if (!(Auth::isAuth() && (Auth::isAdmin() || Auth::isGod()))) { // forward to the login script DefaultFC::redirection('users/index?ref=admin'); } else { // Determine if the view must allow the user to manage widgets. $widgetManagement = false; if (Auth::isAdmin() || Auth::isGod()) { $widgetManagement = true; } // View preparation. $categories = $this->buildCategoryList(); $installedWidgets = Widgets::retrieveWidgetList(Auth::getUserId(), Auth::getUserLevel(), 'raw', true); $partial = 'widgets'; require DefaultFC::getView('admin.tpl'); } }
/** * The index action is the default action of this Wall Module. It prepares the widget * wall of the user and render the view according to its preferences. * * If the current user is not authenticated, it will be redirected to the users/index * action that will allows you to acces the login form of the application. * */ public function index($continuePurchase = false, $langage = null, $forcebrowser = false) { # Try to force users to use firefox // if(isset($_SESSION['forcebrowser']) && $_SESSION['forcebrowser'] == true){ // $forcebrowser = true; // } // if(!ereg("Firefox/",$_SERVER['HTTP_USER_AGENT']) && !$forcebrowser){ // require(DefaultFC::getView('compatibility.tpl')); // die(); // }else{ // $_SESSION['forcebrowser'] = true; // } if (Auth::isAuth()) { // Determine if the 'category widget' is installed. if (Widgets::isInstalled('categoryList')) { $widgetCategory = array('id' => 'categoryList', 'name' => 'Widget Categories'); } // Determine if the 'tag cloud widget' is installed. if (Widgets::isInstalled('tagCloud')) { $widgetCloud = array('id' => 'tagCloud', 'name' => 'Widget Tag Cloud'); } // Determine if the view must allow the user to manage widgets. $widgetManagement = false; if (Auth::isAdmin() || Auth::isGod()) { $widgetManagement = true; } // Determine if the view must show the list of installed widgets or // a link to the PALETTE Service Browser. $useServiceBrowser = USE_SERVICE_BROWSER; $serviceBrowserURI = USE_SERVICE_BROWSER ? SERVICE_BROWSER_URI . 'index.php/Services/Widgets?num=1' : null; require DefaultFC::getView('index.tpl'); } else { DefaultFC::redirection('users/index?ref=wall'); } }
public function index() { // Session message handling. if (isset($_SESSION['message'])) { $message = $_SESSION['message']; $isError = $_SESSION['isError']; // We consider message and isError session variables as flash variables. unset($_SESSION['message']); unset($_SESSION['isError']); } $organizationName = Miscellaneous::retrieveOrganizationName(); $widgetManagement = true; $partial = 'misc'; require DefaultFC::getView('admin.tpl'); }
public function index() { // Globals are evil ! $lg = $GLOBALS['lang']; if (!file_exists(dirname(__FILE__) . "/../views/common/onlinehelp/{$lg}.tpl")) { $lg = 'en'; } // Determine if the view must allow the user to manage widgets. $widgetManagement = false; if (Auth::isAdmin() || Auth::isGod()) { $widgetManagement = true; } // Help file to include in the view. $helpInclusion = dirname(__FILE__) . "/../views/common/onlinehelp/{$lg}.tpl"; # Get Avaliable Langue $availableLanguages = Util::getAvailableLanguages(); $userLanguage = Auth::getLanguage(); require_once DefaultFC::getView("help.tpl"); }
/** * This action provides the user features to manage widget categories in the portal. */ public function index() { // Session message handling for category addition/edition/deletion. if (isset($_SESSION['message'])) { $message = $_SESSION['message']; $isError = $_SESSION['isError']; unset($_SESSION['message']); unset($_SESSION['isError']); } // Security check. if (!Auth::isAuth() && (Auth::isAdmin() || Auth::isGod())) { DefaultFC::redirection('users/index?ref=admin'); } // Determine if the view must allow the user to manage widgets. $widgetManagement = false; if (Auth::isAdmin() || Auth::isGod()) { $widgetManagement = true; } $categories = Categories::retrieveCategories('raw'); $partial = 'categories'; require DefaultFC::getView('admin.tpl'); }
public function resetPassword($login = null, $lostKey = null, $lostTime = null) { $r = Auth::userCanChangeHisPassword($login, $lostKey, $lostTime); $passwordIsChanged = false; if ($r === true) { $urlForm = "../../index.php/Users/resetPassword?login="******"&lostKey=" . urlencode($lostKey) . "&lostTime=" . urlencode($lostTime); # Save the new password if (!empty($_POST)) { # Test params isset($_POST['login']) ? $login = $_POST['login'] : ($login = null); isset($_POST['new_password']) ? $newPassword = $_POST['new_password'] : ($newPassword = null); isset($_POST['new_password']) ? $new_password_confirm = $_POST['new_password_confirm'] : ($new_password_confirm = null); # Get user id $userId = UsersManagement::getUserIdByLogin($login); # test if it is ok if ($userId !== null && $newPassword !== null && $newPassword == $new_password_confirm && Util::checkPasswordLength($newPassword)) { $db = DbUtil::accessFactory(); if (!$db->execute("UPDATE users SET password = '******' WHERE id = '" . $userId . "'")) { $message = __('Please reconfirm your password'); $isError = true; } else { $message = __('Your password have been changed'); $isError = false; $passwordIsChanged = true; Auth::removeForgotPasswordState($login); # Now reset the lostKey (for security) } } else { $message = __('Please reconfirm your password'); $isError = true; } //var_dump($_POST); } else { # Display the form to change password # Get Avaliable Langue //$availableLanguages = Util::getAvailableLanguages(); //$userLanguage = Auth::getLanguage(); } require_once DefaultFC::getView('changepassword.tpl'); } else { if ($r == -1) { die(__('Authorized time to change your password has expired, please restart the "forgot your password" process from the portal UI.')); } else { die(__('You are not authorized to view this page.')); } } }
public function editAction($userId) { if (Auth::isAuth() && (Auth::isGod() || Auth::isAdmin())) { // Once more, I prefer use the old school way to retrieve variables here // because the values sent by the form may vary in the future. $userId = $_POST['userId']; $username = $_POST['username']; $password = $_POST['password']; $language = $_POST['language']; $openId = isset($_POST['openid']) ? $_POST['openid'] : ''; $userType = $_POST['rights']; try { $params = array('userid' => $userId, 'username' => $username, 'password' => $password, 'language' => $language, 'openid' => $openId, 'rights' => $userType, 'copname' => Auth::getCopName()); UsersManagement::editUser($params); $_SESSION['isError'] = false; $_SESSION['message'] = __("The user has been successfuly updated."); DefaultFC::redirection('adminUsers/index'); } catch (UsersManagementException $e) { $isError = true; $message = Util::buildAddEditUserErrorMessage($e); // Escaping to reinsert in form ... $username = htmlspecialchars($username, ENT_QUOTES, 'UTF-8'); $password = htmlspecialchars($password, ENT_QUOTES, 'UTF-8'); $language = htmlspecialchars($language, ENT_QUOTES, 'UTF-8'); $openId = htmlspecialchars($openId, ENT_QUOTES, 'UTF-8'); $userType = htmlspecialchars($userType, ENT_QUOTES, 'UTF-8'); $userFormMode = 'edit'; $availableLanguages = Util::getAvailableLanguages(); $availableUserTypes = Util::getAvailableUserTypes(); $displayOldValues = true; $widgetManagement = true; $partial = 'users_form'; require_once DefaultFC::getView('admin.tpl'); } } }