예제 #1
0
require dirname(__FILE__) . '/includes/bootstrap.php';
//Getting Current User ID
if (!($userID = buckys_is_logged_in())) {
    buckys_redirect('/index.php', MSG_NOT_LOGGED_IN_USER, MSG_TYPE_ERROR);
}
//Getting UserData from Id
$userData = BuckysUser::getUserData($userID);
//If Photo ID is empty, goto photo management page
if (!isset($_REQUEST['photoID'])) {
    buckys_redirect('/photo_manage.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
$photoId = $_REQUEST['photoID'];
$photo = BuckysPost::getPostById($photoId);
//Getting User Albums
$albums = BuckysAlbum::getAlbumsByUserId($userID);
//Getting Photo Albums
$photoAlbums = BuckysAlbum::getAlbumsByPostId($photoId);
if (!$photoAlbums) {
    $photoAlbums = array();
}
//If photo id is not correct or the owner is not the current user, goto photo management page
if (!$photo || $photo['poster'] != $userID) {
    buckys_redirect('/photo_manage.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
if (isset($_POST['action'])) {
    //Create New Album
    if ($_POST['action'] == 'save-photo') {
        if ($photo['poster'] != $userID) {
            buckys_redirect('/photo_manage.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
        }
예제 #2
0
}
//If the parameter is null, goto homepage
if (!$profileID) {
    buckys_redirect('/index.php');
}
//Getting UserData from Id
$userData = BuckysUser::getUserData($profileID);
//Goto Homepage if the userID is not correct
if (!buckys_not_null($userData) || !BuckysUser::checkUserID($profileID, true)) {
    buckys_redirect('/index.php');
}
if (!$showPagePhotoFlag) {
    //if logged user can see all resources of the current user
    $canViewPrivate = $userID == $profileID || BuckysFriend::isFriend($userID, $profileID) || BuckysFriend::isSentFriendRequest($profileID, $userID);
    $photos = BuckysPost::getPhotosByUserID($profileID, $userID, $paramPageID, $canViewPrivate, $postID, $albumID, BuckysPost::$images_per_page);
    $albums = BuckysAlbum::getAlbumsByUserId($profileID);
    //Display
    $TNB_GLOBALS['title'] = trim($userData['firstName'] . ' ' . $userData['lastName']) . "'s Photos - " . TNB_SITE_NAME;
    $view['photo_type'] = 'profile';
    buckys_enqueue_stylesheet('profile.css');
    buckys_enqueue_stylesheet('posting.css');
    buckys_enqueue_stylesheet('publisher.css');
    buckys_enqueue_javascript('posts.js');
} else {
    //Show page photos if logged user can see all resources of the current user
    $photos = BuckysPost::getPhotosByUserID($profileID, null, $paramPageID, false, $postID, $albumID, BuckysPost::$images_per_page);
    //Display
    $TNB_GLOBALS['title'] = trim($pageData['title']) . "'s Photos - " . TNB_SITE_NAME;
    $view['photo_type'] = 'page';
    $view['pageData'] = $pageData;
    buckys_enqueue_stylesheet('account.css');