Пример #1
0
 public function index($userId = NULL, $responseDTO = NULL)
 {
     try {
         $this->getNotifications();
         $view = $this->getView();
         $model = $this->getModel();
         SessionUtils::setDashboardId($userId);
         $this->getNotifications();
         $view->uploadJS();
         if (!is_null(SessionUtils::getError())) {
             $view->setResponse(SessionUtils::getError());
             SessionUtils::setError(NULL);
         }
         $userList = $model->getUserList();
         $view->setArg('userList', $userList);
         SessionUtils::setLastPageVisited(USERLIST_CONTROLLER);
         SessionUtils::setNavigationSelectedItem(6);
         $view->loadPage();
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #2
0
 public function index()
 {
     try {
         $this->getNotifications();
         $this->loadDashboardUser();
         $view = $this->getView();
         $model = $this->getModel();
         $view->uploadJS();
         if (!is_null(SessionUtils::getError())) {
             $view->setResponse(SessionUtils::getError());
             SessionUtils::setError(NULL);
         } else {
             $view->setArg("searchFriendsList", NULL);
         }
         $userLogged = SessionUtils::getUserLogged();
         $userProfile = SessionUtils::getDashboardId() !== $userLogged->getUserId() ? SessionUtils::getDashboardId() : $userLogged->getUserId();
         $friendList = $model->getUserFriendsList($userProfile);
         $view->setArg('friendsList', $friendList);
         SessionUtils::setLastPageVisited(FRIENDS_CONTROLLER);
         $view->setArg(LAST_NAV_ITEM_SELECTED, 6);
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #3
0
 function userNotLogged($authExp)
 {
     SessionUtils::logout();
     if (isset($_POST[JAVASCRIPT_ON]) && $_POST[JAVASCRIPT_ON] === "Y" || isset($_POST["commentAPostForm"]) || isset($_POST["deletePhotoForm"]) || isset($_POST["updateProfilePhotoForm"]) || isset($_POST["commentAPostForm"]) || isset($_POST["changeUserInfoForm"]) || isset($_POST["changeUserPassword"]) || isset($_GET["searchForm"])) {
         echo json_encode($authExp->jsonSerialize());
     } else {
         header("Location:" . URL . LOGIN_CONTROLLER);
     }
 }
Пример #4
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;
     }
 }
Пример #5
0
 function index()
 {
     try {
         $this->getNotifications();
         $userLogged = SessionUtils::getUserLogged();
         $view = $this->getView();
         $model = $this->getModel();
         SessionUtils::setDashboardId($userLogged->getUserId());
         $view->uploadJS();
         if (!is_null(SessionUtils::getError())) {
             $view->setResponse(SessionUtils::getError());
             SessionUtils::setError(NULL);
         }
         SessionUtils::setLastPageVisited(HOME_CONTROLLER);
         $homePostList = $model->getHomePostsListModel($userLogged->getUserId());
         $view->setArg('homePostList', $homePostList);
         if (!is_null($homePostList)) {
             for ($i = 0; $i < sizeof($homePostList); $i++) {
                 $index = 'post' . $i;
                 $postId = $homePostList[$index]->getPostId();
                 $commentPostList = $model->getCommentPostList($postId);
                 $commentListIndex = 'commentPostList' . $postId;
                 $view->setArg($commentListIndex, $commentPostList);
             }
         }
         $userInfo = $model->getUserInfoModel(SessionUtils::getDashboardId());
         $view->setArg('userInfo', $userInfo);
         $view->setArg(LAST_NAV_ITEM_SELECTED, 0);
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #6
0
 public function index()
 {
     try {
         $this->getNotifications();
         $this->loadDashboardUser();
         SessionUtils::setLastPageVisited(ALBUM_CONTROLLER);
         $view = $this->getView();
         $model = $this->getModel();
         $view->uploadJS();
         $view->setArg('userCanWrite', SessionUtils::userCanWrite());
         $view->setArg('albumOwnerId', SessionUtils::getDashboardId());
         if (!is_null(SessionUtils::getAlbumId())) {
             $albumDTO = $model->getAlbumModel(SessionUtils::getAlbumId());
             $view->setArg("notificationAlbum", $albumDTO);
             SessionUtils::setAlbumId(NULL);
         } else {
             $userAlbums = $model->getUserAlbumsModel(SessionUtils::getDashboardId());
             $view->setArg('userAlbumList', $userAlbums);
             if (!is_null(SessionUtils::getError())) {
                 $view->setResponse(SessionUtils::getError());
                 $view->setFormData(SessionUtils::getFormValue(), ADD_ALBUM_FORM);
                 SessionUtils::setError(NULL);
                 SessionUtils::setFormValue(NULL);
             }
         }
         $view->setArg(LAST_NAV_ITEM_SELECTED, 5);
         $view->loadPage();
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         header("Location:" . URL . LOGIN_CONTROLLER);
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #7
0
 function logout()
 {
     SessionUtils::logout();
     header("Location: " . URL . LOGIN_CONTROLLER);
     exit;
 }
Пример #8
0
/*
	Copyright 2014-2015 Cédric Levieux, Jérémy Collot, ArmagNet

	This file is part of VPN.

    VPN is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    VPN is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with VPN.  If not, see <http://www.gnu.org/licenses/>.
*/
session_start();
include_once "config/database.php";
require_once "engine/utils/SessionUtils.php";
$data = array();
SessionUtils::logout($_SESSION);
if (isset($_COOKIE['userId'])) {
    unset($_COOKIE['userId']);
    unset($_COOKIE['userCode']);
    setcookie('userId', "", -1);
    setcookie('userCode', "", -1);
}
$data["ok"] = "ok";
echo json_encode($data);
Пример #9
0
 function deleteFriend($friendId)
 {
     try {
         $model = $this->getModel();
         $deletedFriendship = $model->deleteFriendModel($friendId);
         if (isset($_POST[JAVASCRIPT_ON]) && $_POST[JAVASCRIPT_ON] === "Y") {
             echo json_encode($deletedFriendship->jsonSerialize());
         } else {
             header("Location: " . URL . PROFILE_CONTROLLER);
             exit;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         SessionUtils::logout();
         if (isset($_POST[JAVASCRIPT_ON]) && $_POST[JAVASCRIPT_ON] === "Y") {
             echo json_encode($authExp->jsonSerialize());
         } else {
             header("Location:" . URL . LOGIN_CONTROLLER);
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Пример #10
0
 public function deleteUserForm()
 {
     try {
         $model = $this->getModel();
         $deletedUser = $model->deleteUserModel();
         $userLogged = SessionUtils::getUserLogged();
         FileUtils::deleteAlbumDirOnServer($userLogged->getUserId(), NULL);
         SessionUtils::logout();
         if (isset($_POST[JAVASCRIPT_ON]) && $_POST[JAVASCRIPT_ON] === "Y") {
             echo json_encode($deletedUser->jsonSerialize());
         } else {
             header("Location: " . URL . LOGIN_CONTROLLER);
             exit;
         }
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         parent::userNotLogged($authExp);
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }