Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 /**
  * @param $args
  * GET: /admin/edit-user
  */
 public function editUser($args)
 {
     if (!Authentication::hasRoles(array('admin'))) {
         parent::redirectToUrlFromAction('admin', 'no-access');
     }
     $userEntity = (new UserDAO())->getUserWithRolesById($args[0]);
     $model = new AdminEditUserModel(Language::$EDIT_USER[Config::$LANGUAGE] . ' "' . $userEntity->email . '"');
     $model->id = $userEntity->id;
     $model->roles = (new RoleDAO())->getRoles();
     $model->lockoutEnabled = $userEntity->lockoutEnabled;
     $model->lockoutEndDate = $userEntity->lockoutEndDate;
     $model->roleNames = $userEntity->roleNames;
     parent::view(new EditUser(), $model);
 }
Exemplo n.º 4
0
 /**
  * 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);
 }
Exemplo n.º 5
0
 /**
  * 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);
 }
Exemplo n.º 6
0
 /**
  * POST: /main/edit-page
  */
 public function editPagePost()
 {
     if (!Authentication::hasRoles(array('manager', 'admin'))) {
         parent::redirectToUrlFromAction('main', 'no-access');
     }
     $model = new MainEditPageModel('', true);
     $pageDAO = new PageDAO();
     $pageEntity = $pageDAO->getPage($model->id);
     $model->title = Language::$EDIT_PAGE[Config::$LANGUAGE] . ' "' . $pageEntity->title . '"';
     array_push($pageEntity->parentIds, $pageEntity->id);
     $model->parentPages = $pageDAO->getParentPages($pageEntity->parentIds);
     $parentPage = $model->parentId != null ? $model->parentPages[$pageEntity->parentId] : null;
     $model->parentMenuView = $parentPage == null || $parentPage->menuView && $parentPage->parentId == null;
     $model->action = "edit-page";
     $model->submit = Language::$SAVE[Config::$LANGUAGE];
     if ($model->parentId != null) {
         $model->hasPage = true;
     }
     if ($model->validation) {
         $pageDAO->editPage($model->id, $model->metaKeywords, $model->metaDescription, $model->pageTitle, $model->body, $model->menuView, $model->menuIndex, $model->homePageWidget, $model->homePageWidgetIndex, $model->homePageCarousel, $model->homePageCarouselIndex, $model->hasPage, $model->feedbackType);
         if ($model->hasPage) {
             parent::redirectToUrlFromAction('main', 'page', $model->id);
         } else {
             parent::redirectToUrlFromAction('main', 'index');
         }
     }
     parent::view(new EditPage(), $model);
 }