コード例 #1
0
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');
}
$postType = isset($_GET['type']) ? $_GET['type'] : 'all';
if (!in_array($postType, ['all', 'user', 'friends'])) {
    $postType = 'all';
}
//if logged user can see all resources of the current user
$canViewPrivate = $userID == $profileID || BuckysFriend::isFriend($userID, $profileID) || BuckysFriend::isSentFriendRequest($profileID, $userID);
$posts = BuckysPost::getPostsByUserID($profileID, $userID, BuckysPost::INDEPENDENT_POST_PAGE_ID, $canViewPrivate, $postID, null, $postType);
/*if( !buckys_not_null($posts) )
{
    //Goto Index Page
    buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}*/
//Mark the notifications to read
if ($postID) {
    BuckysActivity::markReadNotifications($userID, $postID);
}
buckys_enqueue_stylesheet('profile.css');
buckys_enqueue_stylesheet('posting.css');
buckys_enqueue_stylesheet('uploadify.css');
buckys_enqueue_stylesheet('jquery.Jcrop.css');
buckys_enqueue_stylesheet('publisher.css');
buckys_enqueue_javascript('uploadify/jquery.uploadify.js');
コード例 #2
0
 buckys_enqueue_javascript('jquery.Jcrop.js');
 buckys_enqueue_javascript('jquery.color.js');
 buckys_enqueue_javascript('posts.js');
 buckys_enqueue_javascript('add_post.js');
 buckys_enqueue_javascript('page.js');
 //Get Page Data
 $pageData = $pageIns->getPageByID($paramPageID, false);
 $view['pageData'] = $pageData;
 if (!isset($pageData) || $pageData['userID'] != $userID && $pageData['status'] == BuckysPage::STATUS_INACTIVE) {
     //This page doesn't exist or inactive
     buckys_redirect('/index.php', MSG_NO_SUCH_PAGE, MSG_TYPE_ERROR);
 }
 //Get Posts Belonged to this page
 $postIns = new BuckysPost();
 if (!$paramPostID) {
     $view['posts'] = $postIns->getPostsByUserID($pageData['userID'], $userID, $pageData['pageID']);
     $view['show_only_post'] = false;
 } else {
     $onePostData = $postIns->getPostById($paramPostID, $paramPageID);
     if (!buckys_not_null($onePostData)) {
         buckys_redirect('/index.php');
     }
     $view['posts'][] = $onePostData;
     $view['show_only_post'] = true;
 }
 //Get followers
 $pageFollowerIns = new BuckysPageFollower();
 $view['followers'] = $pageFollowerIns->getFollowers($pageData['pageID'], 1, 18, true);
 //Is this my page?
 $view['isMyPage'] = $pageData['userID'] == $userID;
 $TNB_GLOBALS['title'] = $pageData['title'] . ' - ' . TNB_SITE_NAME;
コード例 #3
0
ファイル: posts.php プロジェクト: kishoreks/BuckysRoom
require dirname(__FILE__) . '/includes/bootstrap.php';
//Getting Current User ID
$userID = buckys_is_logged_in();
//Getting User ID from Parameter
$profileID = isset($_GET['user']) ? $_GET['user'] : 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 logged user can see all resources of the current user
$canViewPrivate = $userID == $profileID || BuckysFriend::isFriend($userID, $profileID) || BuckysFriend::isSentFriendRequest($profileID, $userID);
$posts = BuckysPost::getPostsByUserID($profileID, $userID, BuckysPost::INDEPENDENT_POST_PAGE_ID, $canViewPrivate, isset($_GET['post']) ? $_GET['post'] : null);
/*if( !buckys_not_null($posts) )
{
    //Goto Index Page
    buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}*/
buckys_enqueue_stylesheet('profile.css');
buckys_enqueue_stylesheet('posting.css');
buckys_enqueue_javascript('posts.js');
$BUCKYS_GLOBALS['content'] = 'posts';
if ($userData) {
    $BUCKYS_GLOBALS['title'] = trim($userData['firstName'] . ' ' . $userData['lastName']) . "'s Posts - BuckysRoom";
}
require DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php";
コード例 #4
0
 public function getPostsAction()
 {
     $data = $_POST;
     $token = isset($data['TOKEN']) ? trim($data['TOKEN']) : null;
     $lastDate = isset($data['lastDate']) ? $data['lastDate'] : null;
     $profileID = isset($data['profileId']) ? $data['profileId'] : null;
     if (!$token) {
         return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => buckys_api_get_error_result('Api token should not be blank')];
     }
     if (!($userID = BuckysUsersToken::checkTokenValidity($token, "api"))) {
         return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => buckys_api_get_error_result('Api token is not valid.')];
     }
     $userData = BuckysUser::getUserData($profileID);
     if (!buckys_not_null($profileID) || !buckys_not_null($userData) || !BuckysUser::checkUserID($profileID, true)) {
         return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => buckys_api_get_error_result(MSG_INVALID_REQUEST)];
     }
     $canViewPrivate = $userID == $profileID || BuckysFriend::isFriend($userID, $profileID) || BuckysFriend::isSentFriendRequest($profileID, $userID);
     $postType = "all";
     $posts = BuckysPost::getPostsByUserID($profileID, $userID, BuckysPost::INDEPENDENT_POST_PAGE_ID, $canViewPrivate, null, $lastDate, $postType);
     //Format Result Data
     $result = [];
     foreach ($posts as $post) {
         if ($post['pageID'] != BuckysPost::INDEPENDENT_POST_PAGE_ID) {
             $pageIns = new BuckysPage();
             $pageData = $pageIns->getPageByID($post['pageID']);
         }
         $pagePostFlag = false;
         if (isset($pageData)) {
             $pagePostFlag = true;
         }
         $item = [];
         $item['articleId'] = $post['postID'];
         $item['posterId'] = $post['poster'];
         $item['articleImage'] = "";
         $item['articleVideo'] = "";
         $item['articleVideoId'] = "";
         if ($pagePostFlag) {
             $item['posterName'] = $pageData['title'];
             $item['posterThumbnail'] = buckys_not_null($pageData['logo']) ? THENEWBOSTON_SITE_URL . DIR_WS_PHOTO . "users/" . $pageData['userID'] . "/resized/" . $pageData['logo'] : THENEWBOSTON_SITE_URL . DIR_WS_IMAGE . "newPagePlaceholder.jpg";
         } else {
             $item['posterName'] = $post['posterFullName'];
             $item['posterThumbnail'] = THENEWBOSTON_SITE_URL . BuckysUser::getProfileIcon($post['poster']);
         }
         $item['postedDate'] = buckys_api_format_date($userID, $post['post_date']);
         $item['purePostedDate'] = $post['post_date'];
         $item['articleContent'] = $post['content'];
         if ($post['type'] == 'video') {
             $item['articleVideo'] = $post['youtube_url'];
             $item['articleVideoId'] = buckys_get_youtube_video_id($post['youtube_url']);
         } else {
             if ($post['type'] == 'image') {
                 $item['articleImage'] = THENEWBOSTON_SITE_URL . DIR_WS_PHOTO . 'users/' . $post['poster'] . '/resized/' . $post['image'];
             }
         }
         $item['articleLikes'] = $post['likes'];
         $item['articleComments'] = $post['comments'];
         $item['isLiked'] = !$post['likeID'] ? "no" : "yes";
         $result[] = $item;
     }
     return ['STATUS_CODE' => STATUS_CODE_OK, 'DATA' => ["STATUS" => "SUCCESS", "POSTS" => $result]];
 }
コード例 #5
0
ファイル: get_data.php プロジェクト: kishoreks/BuckysRoom
} else {
    if ($_POST['page'] == 'post') {
        $profileID = $_POST['user'];
        $canViewPrivate = $userID == $profileID || BuckysFriend::isFriend($userID, $profileID) || BuckysFriend::isSentFriendRequest($profileID, $userID);
        $posts = BuckysPost::getPostsByUserID($profileID, $userID, BuckysPost::INDEPENDENT_POST_PAGE_ID, $canViewPrivate, isset($_GET['post']) ? $_GET['post'] : null, $_POST['lastDate']);
        foreach ($posts as $post) {
            echo buckys_get_single_post_html($post, $userID);
        }
    } else {
        if ($_POST['page'] == 'page-post') {
            $paramPageID = $_POST['pageID'];
            $pageIns = new BuckysPage();
            $postIns = new BuckysPost();
            $pageData = $pageIns->getPageByID($paramPageID);
            if ($pageData) {
                $posts = $postIns->getPostsByUserID($pageData['userID'], null, $paramPageID, false, isset($_GET['post']) ? $_GET['post'] : null, $_POST['lastDate']);
                foreach ($posts as $post) {
                    echo buckys_get_single_post_html($post, $userID, false, $pageData);
                }
            }
        } else {
            if ($_POST['page'] == 'page-photo') {
                $paramPageID = $_POST['pageID'];
                $pageIns = new BuckysPage();
                $postIns = new BuckysPost();
                $pageData = $pageIns->getPageByID($paramPageID);
                if ($pageData) {
                    $photos = $postIns->getPhotosByUserID($pageData['userID'], null, $paramPageID, false, null, null, 5, $_POST['lastDate']);
                    foreach ($photos as $row) {
                        ?>
            <a href="/page.php?pid=<?php