Пример #1
0
 function index()
 {
     //$albumId=NULL,$photoId=NULL, $responseDTO = NULL
     try {
         $this->getNotifications();
         $this->loadDashboardUser();
         $view = $this->getView();
         $model = $this->getModel();
         $view->setArg(LAST_NAV_ITEM_SELECTED, 5);
         $view->uploadJS();
         SessionUtils::setLastPageVisited(PHOTO_CONTROLLER);
         $view->setArg('userCanWrite', SessionUtils::userCanWrite());
         $albumPhotoListDTO = $model->getAlbumPhotoListModel(SessionUtils::getAlbumId());
         $view->setArg('albumPhotoList', $albumPhotoListDTO);
         if (!is_null(SessionUtils::getPhotoId()) && !is_null(SessionUtils::getAlbumId())) {
             SessionUtils::setPhotoId(NULL);
             SessionUtils::setAlbumId(NULL);
         } else {
             if (!is_null(SessionUtils::getAlbumId())) {
                 if (!is_null(SessionUtils::getError())) {
                     $view->setResponse(SessionUtils::getError());
                     SessionUtils::setError(NULL);
                 }
                 //                    if (!$view->getArg('userCanWrite')) {
                 SessionUtils::setAlbumId(NULL);
                 //                    }
             }
         }
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #2
0
 private function init()
 {
     $urlArray = $this->getUrlArray();
     if (is_null($urlArray)) {
         $userLogged = SessionUtils::getUserLogged();
         if (!is_null($userLogged)) {
             //
             header('Location: ' . URL . SessionUtils::getLastPageVisited());
             exit;
         } else {
             if (isset($_COOKIE[SHAREATRIPCOOKIE])) {
                 header('Location: ' . URL . LOGIN_CONTROLLER . 'autoLogin');
                 exit;
             } else {
                 header('Location: ' . URL . LOGIN_CONTROLLER);
                 exit;
             }
         }
     } else {
         if ($urlArray[1] === 'index') {
             if ($urlArray[0] === 'Profile') {
                 if (!is_null($urlArray[5])) {
                     SessionUtils::setPost($urlArray[2]);
                     SessionUtils::setAuthorId($urlArray[3]);
                     SessionUtils::setDashboardId($urlArray[4]);
                     SessionUtils::setComment($urlArray[5]);
                 } else {
                     if (!is_null($urlArray[4])) {
                         SessionUtils::setPost($urlArray[2]);
                         SessionUtils::setAuthorId($urlArray[3]);
                         SessionUtils::setDashboardId($urlArray[4]);
                     } else {
                         if (!is_null($urlArray[2])) {
                             SessionUtils::setPost(NULL);
                             SessionUtils::setAuthorId(NULL);
                             SessionUtils::setDashboardId($urlArray[2]);
                         }
                     }
                 }
                 header("Location: " . URL . PROFILE_CONTROLLER);
                 exit;
             } else {
                 if ($urlArray[0] === 'Photo') {
                     if (!is_null($urlArray[4])) {
                         SessionUtils::setAlbumId($urlArray[2]);
                         SessionUtils::setPhotoId($urlArray[3]);
                         SessionUtils::setDashboardId($urlArray[4]);
                     } else {
                         if (!is_null($urlArray[3])) {
                             SessionUtils::setAlbumId($urlArray[2]);
                             SessionUtils::setDashboardId($urlArray[3]);
                         } else {
                             if (!is_null($urlArray[2])) {
                                 SessionUtils::setAlbumId($urlArray[2]);
                             }
                         }
                     }
                     header("Location: " . URL . PHOTO_CONTROLLER);
                     exit;
                 } else {
                     if ($urlArray[0] === 'Album') {
                         if (!is_null($urlArray[3])) {
                             SessionUtils::setAlbumId($urlArray[2]);
                             SessionUtils::setDashboardId($urlArray[3]);
                         }
                         header("Location: " . URL . ALBUM_CONTROLLER);
                         exit;
                     } else {
                         if ($urlArray[0] === 'ProfileSettings') {
                             SessionUtils::setDashboardId($urlArray[2]);
                             header("Location: " . URL . PROFILE_SETTINGS_CONTROLLER);
                             exit;
                         }
                     }
                 }
             }
         }
         $url = new UrlDTO($urlArray);
         $this->loadController($url->getController());
         $this->callControllerMethod($url);
     }
 }