forked from buckyroberts/Social-Network
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_data.php
More file actions
77 lines (59 loc) · 2.97 KB
/
Copy pathget_data.php
File metadata and controls
77 lines (59 loc) · 2.97 KB
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
<?php
require(dirname(__FILE__) . '/includes/bootstrap.php');
$userID = buckys_is_logged_in();
if($_POST['page'] == 'account'){
if(!$userID)
exit;
$stream = BuckysPost::getUserPostsStream($userID, $_POST['lastDate']);
foreach($stream as $post){
echo buckys_get_single_post_html($post, $userID);
}
}else if($_POST['page'] == 'post'){
$profileID = $_POST['user'];
$canViewPrivate = $userID == $profileID || BuckysFriend::isFriend($userID, $profileID) || BuckysFriend::isSentFriendRequest($profileID, $userID);
$postType = isset($_POST['type']) ? $_POST['type'] : 'all';
if(!in_array($postType, ['all', 'user', 'friends'])){
$postType = 'all';
}
$posts = BuckysPost::getPostsByUserID($profileID, $userID, BuckysPost::INDEPENDENT_POST_PAGE_ID, $canViewPrivate, isset($_GET['post']) ? $_GET['post'] : null, $_POST['lastDate'], $postType);
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 echo $row['pageID']?>&post=<?php echo $row['postID']?>" class="photo"><img
src="<?php echo DIR_WS_PHOTO ?>users/<?php echo $row['poster']?>/thumbnail/<?php echo $row['image']?>"
data-posted-date='<?php echo $row['post_date']?>'/></a>
<?php
}
}
}else if($_POST['page'] == 'photo'){
$profileID = $_POST['user'];
$canViewPrivate = $userID == $profileID || BuckysFriend::isFriend($userID, $profileID) || BuckysFriend::isSentFriendRequest($profileID, $userID);
$photos = BuckysPost::getPhotosByUserID($profileID, $userID, BuckysPost::INDEPENDENT_POST_PAGE_ID, $canViewPrivate, null, isset($_POST['albumID']) ? $_POST['albumID'] : null, 5, $_POST['lastDate']);
foreach($photos as $row){
?>
<a href="/posts.php?user=<?php echo $row['poster']?>&post=<?php echo $row['postID']?>" class="photo"><img
src="<?php echo DIR_WS_PHOTO ?>users/<?php echo $row['poster']?>/thumbnail/<?php echo $row['image']?>"
data-posted-date='<?php echo $row['post_date']?>'/></a>
<?php
}
}