本文整理汇总了PHP中SessionUtils::getUserLogged方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionUtils::getUserLogged方法的具体用法?PHP SessionUtils::getUserLogged怎么用?PHP SessionUtils::getUserLogged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionUtils
的用法示例。
在下文中一共展示了SessionUtils::getUserLogged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
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;
}
}
示例2: setAllNotificationsAsRead
public function setAllNotificationsAsRead()
{
if (!is_null(SessionUtils::getUserLogged())) {
$notificationDAO = new NotificationDAO();
$notificationDAO->setAllNotificationsAsRead();
$this->view->setArg('unreadNotification', 0);
}
}
示例3: testSession
public function testSession()
{
try {
$userLogged = SessionUtils::getUserLogged();
$username = $userLogged->getUserName();
$sessionToken = SessionUtils::getSessionToken();
$query = "select * from sat_user where USERNAME = {$username} and SESSION_TOKEN = {$sessionToken}";
return $this->execQuery($query);
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (Exception $e) {
throw $e;
}
}
示例4: insertNewUserAddressVisited
public function insertNewUserAddressVisited(\AddressDTO $addressDTO)
{
try {
$this->userAutentication();
$userLogged = SessionUtils::getUserLogged();
$newAddress = array(":" . USERID => $userLogged->getUserId(), ":" . LONGITUDE => $addressDTO->getLongitude(), ":" . LATITUDE => $addressDTO->getLatitude(), ":" . TIMESTAMP => date(DATE_FORMAT));
$newAddressId = $this->getDB()->insert(USER_ADDRESS_VISITED_TABLE, $newAddress);
return $newAddressId;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (Exception $e) {
throw $e;
}
}
示例5: confirmFriendship
public function confirmFriendship($friendId)
{
$userLogged = SessionUtils::getUserLogged();
$query = "update sat_user_friends set friendssince = '" . date(DATE_FORMAT) . "' where (userid = {$friendId} and friendid = " . $userLogged->getUserId() . ") OR (userid = " . $userLogged->getUserId() . " and friendid = {$friendId} )";
try {
$this->userAutentication();
$result = $this->getDB()->execQuery($query);
return $result;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (Exception $e) {
throw $e;
}
}
示例6: addAlbumModel
function addAlbumModel($albumForm)
{
$formObjRaw = new FormDTO(ADD_ALBUM_FORM, $albumForm);
$responseDTO = new ResponseDTO(ADD_ALBUM_FORM);
try {
$formDataObj = $formObjRaw->getFormData();
$validator = new FormValidator(ADD_ALBUM_FORM, $formDataObj);
$validationError = $validator->checkAll();
// $validationError = array();
if (sizeof($validationError) == 0) {
$userLogged = SessionUtils::getUserLogged();
$uploadedPhoto = FileUtils::uploadPhotoModel($formDataObj[ADD_ALBUM_FORM . COVER], NULL, ADD_ALBUM_FORM);
if (get_class($uploadedPhoto) === PHOTODTO) {
$userDAO = new UserDAO();
$userDTO = $userDAO->getUserByUserId($userLogged->getUserId());
$albumDAO = new AlbumDAO();
$albumDTO = new AlbumDTO(null, date(DATE_FORMAT), $formDataObj[ADD_ALBUM_FORM . TITLE], $uploadedPhoto, $userDTO);
$albumDTO = $albumDAO->insertNewAlbum($albumDTO);
if ($albumDTO->getAlbumId() != 0) {
$photoAlbumPath = FileUtils::createAlbumDirOnServer($userDTO->getUserId(), $albumDTO->getAlbumId());
DataModelUtils::notifyAction($albumDTO->getCover()->getPhotoId() . SEPARATOR . $albumDTO->getCover()->getPhotoUrl() . SEPARATOR . $albumDTO->getAlbumId() . SEPARATOR . $albumDTO->getTitle(), ADD_ALBUM_FORM);
return $albumDTO;
} else {
$responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'inserimento dell'album");
}
} else {
$responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'inserimento della foto profilo");
}
} else {
if (array_key_exists(TITLE, $validationError)) {
$responseDTO->setErrField(TITLE, $validationError[TITLE]);
}
if (array_key_exists(PHOTO, $validationError)) {
$responseDTO->setErrField(COVER, $validationError[PHOTO]);
}
SessionUtils::setFormValue($formDataObj);
}
return $responseDTO;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $authExp) {
throw $authExp;
} catch (Exception $e) {
throw $e;
}
}
示例7: updateProfilePhoto
public function updateProfilePhoto(\PhotoDTO $userProfilePhotoDTO)
{
$userLogged = SessionUtils::getUserLogged();
$set = array(PROFILEPHOTO => $userProfilePhotoDTO->getPhotoId());
$where = array(USERID => $userLogged->getUserId());
try {
$this->userAutentication();
$userPhoto = $this->getDB()->update(USER_TABLE, $set, $where);
DataModelUtils::notifyAction($userProfilePhotoDTO->getPhotoId() . SEPARATOR . $userProfilePhotoDTO->getPhotoUrl(), PROFILE_SETTINGS_PHOTO_FORM);
return $userProfilePhotoDTO;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $authExp) {
throw $authExp;
} catch (Exception $e) {
throw $e;
}
}
示例8: index
function index()
{
try {
$this->getNotifications();
$this->loadDashboardUser();
$userLogged = SessionUtils::getUserLogged();
$view = $this->getView();
$model = $this->getModel();
$view->setArg(LAST_NAV_ITEM_SELECTED, 4);
$view->setArg('userCanWrite', SessionUtils::userCanWrite());
SessionUtils::setLastPageVisited(PROFILE_CONTROLLER);
// $view->uploadJS();
if (SessionUtils::isAdmin()) {
$this->loadProfile($view, $model);
} else {
if (!$view->getArg('userCanWrite')) {
$friendDao = new FriendsDAO();
$isFriendshipLoading = $friendDao->checkFriendship($userLogged->getUserId(), SessionUtils::getDashboardId());
if ($isFriendshipLoading === false) {
$view->setArg('friendship_loading', false);
$view->loadPage('ProfileNotVisible');
} else {
if (substr($isFriendshipLoading[0][FRIENDSSINCE], 0, 4) === "0000") {
$view->setArg('friendship_loading', true);
$view->loadPage('ProfileNotVisible');
} else {
$this->loadProfile($view, $model);
}
}
} else {
$this->loadProfile($view, $model);
}
}
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $authExp) {
SessionUtils::logout();
header("Location:" . URL . LOGIN_CONTROLLER);
} catch (Exception $e) {
throw $e;
}
}
示例9: uploadPhotoModel
public static function uploadPhotoModel($uploadedPhoto, $albumId, $formType, $latitude = NULL, $longitude = NULL)
{
$responseDTO = new ResponseDTO($formType);
try {
$userLogged = SessionUtils::getUserLogged();
$fileName = $uploadedPhoto["name"];
$fileType = $uploadedPhoto["type"];
$tmpFileName = $uploadedPhoto["tmp_name"];
$rawImage = FileUtils::getRawImage($fileType, $tmpFileName);
$fileName = FileUtils::getFileName($fileName, $userLogged->getUserId(), $albumId);
$redimImage = FileUtils::getRedimensionedImage($tmpFileName, $rawImage);
if (imagejpeg($redimImage, $fileName, 100)) {
$photoDAO = new PhotoDAO();
$newPhotoDTO = new PhotoDTO(NULL, $fileName, $latitude, $longitude);
$newPhotoDTO = $photoDAO->insertNewPhoto($newPhotoDTO);
if ($newPhotoDTO->getPhotoId() == 0) {
$responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'inserimento della foto [" . $newPhotoDTO->getPhotoUrl() . "]");
} else {
$albumDAO = new AlbumDAO();
if (is_null($albumId)) {
$albumId = $albumDAO->getDefaultAlbumId($userLogged->getUserId());
}
if ($formType !== ADD_ALBUM_FORM) {
$photoInAlbumId = $albumDAO->insertNewUserPhotoAlbum($userLogged->getUserId(), $albumId, $newPhotoDTO->getPhotoId());
}
if (!is_null($latitude) && !is_null($longitude)) {
$uploadedAddress = FileUtils::saveAddressModel($latitude, $longitude, $formType);
}
return $newPhotoDTO;
}
} else {
$responseDTO->setErrField(ERROR_RESPONSE, "Errore durante la copia del file sul server PHP");
}
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $userAuth) {
throw $userAuth;
} catch (Exception $e) {
throw $e;
}
}
示例10: userAutentication
function userAutentication()
{
try {
$userLogged = SessionUtils::getUserLogged();
$sessionToken = SessionUtils::getSessionToken();
if (!is_null($userLogged)) {
$query = "select * from sat_user where userid = " . $userLogged->getUserId() . " and SESSION_TOKEN = '" . $sessionToken . "'";
$objectArray = $this->getDB()->execQuery($query);
if (is_null($objectArray)) {
$myException = new UserNotAuthenticatedExceptionDTO(URL . LOGIN_CONTROLLER);
throw $myException;
}
}
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $userAuth) {
throw $userAuth;
} catch (Exception $e) {
throw $e;
}
}
示例11: getUnreadNotificationList
public function getUnreadNotificationList($limit = NULL)
{
$userLogged = SessionUtils::getUserLogged();
if (is_null($limit)) {
$query = "select * from sat_notify where SUBJECT_ID = " . $userLogged->getUserId() . " and IS_READ = 0 order by sent_at desc ";
} else {
$query = "select * from sat_notify where SUBJECT_ID = " . $userLogged->getUserId() . " and IS_READ = 0 order by sent_at desc ";
}
try {
$objectArray = $this->getDB()->execQuery($query);
if (is_null($objectArray)) {
return NULL;
} else {
$objectListDTO = DataModelUtils::getObjectList(NOTIFICATIONDTO, $objectArray);
return $objectListDTO;
}
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (Exception $e) {
throw $e;
}
}
示例12: index
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;
}
}
示例13: addFriendModel
function addFriendModel($friendId)
{
try {
$responseDTO = new ResponseDTO(ADD_FRIEND_FORM);
$friendsDAO = new FriendsDAO();
$userDAO = new UserDAO();
$newFriendDTO = $userDAO->getUserByUserId($friendId);
$userLogged = SessionUtils::getUserLogged();
$userDTO = $userDAO->getUserByUserId($userLogged->getUserId());
$newFriend = $friendsDAO->addNewFriend($friendId);
SessionUtils::addFriendInUserLoggedFriendList($newFriendDTO);
DataModelUtils::notifyAction($newFriendDTO->getUserId() . SEPARATOR . $newFriendDTO->getUserName(), ADD_FRIEND_FORM);
$result = DataModelUtils::sendMail($userDTO, ADD_FRIEND_FORM, $newFriendDTO);
$responseDTO->setResponseSucc("friend" . $friendId);
return $responseDTO;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $authExp) {
throw $authExp;
} catch (Exception $e) {
throw $e;
}
}
示例14: foreach
<?php
if (!is_null(SessionUtils::getUserLogged())) {
?>
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3 " id="notificationList" >
<div class="thumbnail">
<button class="btn btn-info btn-block" id="showNotification" name="showNotification" type="button">
<!-- <span class="glyphicon glyphicon-pushpin"></span> -->
<span>Mostra / Nascondi notifiche</span>
</button>
<br>
<?php
$userNotificationList = $this->getArg('userNotificationListFooter');
?>
<table class="table table-striped" id="notificationTable">
<tbody>
<?php
if (!is_null($userNotificationList)) {
$i = 0;
foreach ($userNotificationList as $key => $value) {
$notificationId = $value->getNotificationId();
$userId = $value->getUserId();
$subjectId = $value->getSubjectId();
$message = $value->getMessage();
$isRead = $value->getIsRead();
$sentAt = $value->getSentAt();
$context = $value->getContext();
?>
示例15:
<div id="photoCurtain">
<button class="btn btn-info " id="closePhotoButton" name="closePhotoButton" type="button">
<span class="glyphicon glyphicon-remove"></span>
</button>
<div id="fullScreenPhotoDiv">
<img id="fullScreenImg" src="#" alt=""/>
</div>
</div>
<div id="content" class="container container-fluid">
<div>
<?php
$navigationItemSelected = SessionUtils::getNavigationSelectedItem();
$userLogged = SessionUtils::getUserLogged();
if (!is_null($userLogged)) {
?>
<nav class="navbar">
<ul id="headerNavItem" class="nav nav-tabs">
<li>
<a href="<?php
echo URL . HOME_CONTROLLER;
?>
">
<span class="glyphicon glyphicon-home"></span>
<span class="headerNavItemName"></span>
</a>