private function deleteUser() { // Get data $username = $this->pageState['userToDelete']; $conf = $this->pageState['confirm']; // Make sure that the user confirmed the deletion if (strtolower($conf) == 'yes' || strtolower($conf) == '"yes"') { // Remove the user's config file $userFile = Constants::$ROOT_DIR . 'config/users/' . $username . '.user'; unlink($userFile); // Remove the user from the login list $loginList = User::getUserLoginList(); unset($loginList[$username]); $updatedLL = ''; foreach ($loginList as $uname => $fname) { $updatedLL .= $uname . '|' . $fname . "\n"; } $userFile = Constants::$ROOT_DIR . 'config/users.php'; file_put_contents($userFile, $updatedLL); // Redirect to the User Mgmt page with message header('Location:/manage/userMgmt/showMessage/msg/userDeleted/user/' . $username); } else { // Redirect to User Mgmt page header("Location:/manage/userMgmt"); } }
/** get - Default handler for HTTP GET of this page */ public function get() { // Get the list of users that can manage the site and sort by full name $userList = User::getUserLoginList(); asort($userList); // Make the userlist accessible to the view $this->view->userList = $userList; // Render the view $this->view->setMainTemplate('PageTemplate'); $this->renderView('IndexView'); }