Example #1
0
 /**
  * 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);
 }
Example #2
0
 /**
  * @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);
 }
Example #3
0
 /**
  * @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');
 }
Example #4
0
 /**
  * POST: /account/reset-password
  */
 public function resetPasswordPost()
 {
     $model = new AccountResetPasswordModel(Language::$RESET_YOUR_PASSWORD[Config::$LANGUAGE], true);
     if ($model->validation) {
         (new UserDAO())->resetPassword($model->newPassword, $model->forgotPassword);
         parent::redirectToUrlFromAction('account', 'reset-password-confirmation');
     }
     parent::view(new ResetPassword(), $model);
 }
Example #5
0
 /**
  * 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);
 }