forked from SynapseTechnologies/BuckysRoom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
photos.php
executable file
·93 lines (65 loc) · 3.1 KB
/
photos.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
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;
//When displaying page's photo
$showPagePhotoFlag = false;
$paramPageID = BuckysPost::INDEPENDENT_POST_PAGE_ID;
$pageData = null;
if (isset($_GET['pid'])) {
$paramPageID = $_GET['pid'];
$pageIns = new BuckysPage();
$pageData = $pageIns->getPageByID($paramPageID);
if ($pageData) {
$profileID = $pageData['userID'];
$showPagePhotoFlag = true;
}
}
//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, isset($_GET['post']) ? $_GET['post'] : null, isset($_GET['albumID']) ? $_GET['albumID'] : null, BuckysPost::$images_per_page);
$albums = BuckysAlbum::getAlbumsByUserId($profileID);
//Display
$BUCKYS_GLOBALS['title'] = trim($userData['firstName'] . ' ' . $userData['lastName']) . "'s Photos - BuckysRoom";
$view['photo_type'] = 'profile';
buckys_enqueue_stylesheet('profile.css');
buckys_enqueue_stylesheet('posting.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, isset($_GET['post']) ? $_GET['post'] : null, isset($_GET['albumID']) ? $_GET['albumID'] : null, BuckysPost::$images_per_page);
//$albums = BuckysAlbum::getAlbumsByUserId($profileID);
//Display
$BUCKYS_GLOBALS['title'] = trim($pageData['title']) . "'s Photos - BuckysRoom";
$view['photo_type'] = 'page';
$view['pageData'] = $pageData;
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('stream.css');
buckys_enqueue_stylesheet('posting.css');
buckys_enqueue_stylesheet('uploadify.css');
buckys_enqueue_stylesheet('jquery.Jcrop.css');
buckys_enqueue_stylesheet('page.css');
buckys_enqueue_javascript('uploadify/jquery.uploadify.js');
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');
}
$BUCKYS_GLOBALS['content'] = 'photos';
require(DIR_FS_TEMPLATE . $BUCKYS_GLOBALS['template'] . "/" . $BUCKYS_GLOBALS['layout'] . ".php");