/** * GET: /'any controller'/no-access */ public function noAccess() { $model = new SharedErrorModel(Language::$ERROR[Config::$LANGUAGE]); $model->code = '!'; $model->message = Language::$NO_ACCESS[Config::$LANGUAGE]; Controller::view(new Error(), $model); }
/** * POST: /manage/delete */ public function deletePost() { $model = new ManageDeleteModel(Language::$DELETE_ACCOUNT[Config::$LANGUAGE], true); if ($model->validation) { $userDAO = new UserDAO(); $errorMessage = $userDAO->passwordVerify($model->authenticatedUserEntity->id, $model->password, $model->authenticatedUserEntity->passwordHash, $model->authenticatedUserEntity->lockoutEnabled, $model->authenticatedUserEntity->lockoutEndDate, $model->authenticatedUserEntity->accessFailedCount); if ($errorMessage == '') { $userDAO->delete($model->authenticatedUserEntity->id); Authentication::signOut(); parent::redirectToUrlFromAction('main', 'index'); } $model->passwordValidation = Language::$INVALID_PASSWORD[Config::$LANGUAGE] . " {$errorMessage}"; $model->validation = false; } parent::view(new Delete(), $model); }
/** * @param $args * GET: /file-tiny-mce/create-folder */ public function createFolder($args) { $path = implode('/', $args); $dir = $_SERVER['DOCUMENT_ROOT'] . Config::$SUB_FOLDER . '/' . $path; $folders = scandir($dir); $folderName = 'new_folder'; for ($i = 2; in_array($folderName, $folders); $i++) { $folderName = 'new_folder_' . $i; } mkdir($dir . '/' . $folderName); parent::redirectToUrlFromAction('file-tiny-mce', 'index', $path); }
/** * @param $args * GET: /admin/delete-user */ public function deleteUser($args) { if (!Authentication::hasRoles(array('admin'))) { parent::redirectToUrlFromAction('admin', 'no-access'); } (new UserDAO())->delete($args[0]); parent::redirectToUrlFromAction('admin', 'users'); }
/** * GET: /account/reset-password-confirmation */ public function resetPasswordConfirmation() { $model = new AccountResetPasswordConfirmationModel(Language::$CONFIRMATION[Config::$LANGUAGE]); $model->message = Language::$YOUR_PASSWORD_HAS_BEEN_RESET[Config::$LANGUAGE]; parent::view(new ResetPasswordConfirmation(), $model); }
/** * POST: /file/edit */ public function editPost() { $model = new FileEditModel('', true); $args = explode('/', $model->path); $model->parentFolders = array(); $path = '/file/index'; $model->parentFolders[0] = array($path, 'root'); for ($i = 0; $i < count($args); $i++) { $path .= '/' . $args[$i]; $model->parentFolders[$i + 1] = array($path, $args[$i]); if ($i == count($args) - 1) { $model->title = $args[$i]; } } $dir = $_SERVER['DOCUMENT_ROOT'] . Config::$SUB_FOLDER . '/' . $model->path; file_put_contents($dir, $model->file); parent::view(new Edit(), $model); }
/** * POST: /main/send-email */ public function sendEmailPost() { $id = $_REQUEST['Id']; $subject = $_REQUEST['Subject']; $body = $_REQUEST['Body']; if ($subject != '' && $body != '') { $userEntities = (new UserDAO())->getUsersWithRolesByRoles(array('admin')); $email = new Email(); foreach ($userEntities as $userEntity) { $email->send($userEntity->email, $subject, $body); } } parent::redirectToUrlFromAction('main', 'page', $id); }
/** * @param $args * GET: /misc/theme */ public function theme($args) { Theme::setTheme($args[0]); unset($args[0]); parent::redirectToUrlFromArray($args); }