-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhashtag.php
323 lines (300 loc) Β· 13.9 KB
/
hashtag.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<?php
include 'core/init.php';
if(isset($_GET['hashtag']) && !empty($_GET['hashtag'])){
$hashtag = $getFromU->checkInput($_GET['hashtag']);
$user_id = @$_SESSION['user_id'];
$user = $getFromU->userData($user_id);
$tweets = $getFromT->getTweetsByHash($hashtag);
$accounts = $getFromT->getUsersByHash($hashtag);
$notify = $getFromM->getNotificationCount($user_id);
}else{
header('Location: index.php');
}
?>
<!doctype html>
<html>
<head>
<title>#<?php echo $hashtag;?> Hashtag on Tweety</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css"/>
<link rel="stylesheet" href="<?php echo BASE_URL;?>assets/css/style-complete.css"/>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
</head>
<!--Helvetica Neue-->
<body>
<div class="wrapper">
<!-- header wrapper -->
<div class="header-wrapper">
<div class="nav-container">
<div class="nav">
<div class="nav-left">
<ul>
<li><a href="<?php echo BASE_URL;?>"><i class="fa fa-home" aria-hidden="true"></i>Home</a></li>
<?php if($getFromU->loggedIn()=== true){?>
<li><a href="<?php echo BASE_URL;?>i/notifications"><i class="fa fa-bell" aria-hidden="true"></i>Notifications<span id="notificaiton"><?php if($notify->totalN > 0){echo '<span class="span-i">'.$notify->totalN.'</span>';}?></span></a></li>
<li id="messagePopup"><i class="fa fa-envelope" aria-hidden="true"></i>Messages<span id="messages"><?php if($notify->totalM > 0){echo '<span class="span-i">'.$notify->totalM.'</span>';}?></span></li>
<?php }?>
</ul>
</div><!-- nav left ends-->
<div class="nav-right">
<ul>
<li><input type="text" placeholder="Search" class="search"/><i class="fa fa-search" aria-hidden="true"></i>
<div class="search-result">
</div>
</li>
<?php if($getFromU->loggedIn() === true){?>
<li class="hover"><label class="drop-label" for="drop-wrap1"><img src="<?php echo BASE_URL.$user->profileImage;?>"/></label>
<input type="checkbox" id="drop-wrap1">
<div class="drop-wrap">
<div class="drop-inner">
<ul>
<li><a href="<?php echo BASE_URL.$user->username;?>"><?php echo $user->username;?></a></li>
<li><a href="<?php echo BASE_URL;?>settings/account">Settings</a></li>
<li><a href="<?php echo BASE_URL;?>includes/logout.php">Log out</a></li>
</ul>
</div>
</div>
</li>
<li><label class="addTweetBtn" for="pop-up-tweet">Tweet</label></li>
<?php } else{
echo '<li><a href="'.BASE_URL.'/index.php">Have an account? Log in!</a></li>';
}
?>
</ul>
</div><!-- nav right ends-->
</div><!-- nav ends -->
</div><!-- nav container ends -->
</div><!-- header wrapper end -->
<!--#hash-header-->
<div class="hash-header">
<div class="hash-inner">
<h1>#<?php echo $hashtag;?></h1>
</div>
</div>
<!--#hash-header end-->
<!--hash-menu-->
<div class="hash-menu">
<div class="hash-menu-inner">
<ul>
<li><a href="<?php echo BASE_URL.'hashtag/'.$hashtag;?>">Latest</a></li>
<li><a href="<?php echo BASE_URL.'hashtag/'.$hashtag.'?f=users';?>">Accounts</a></li>
<li><a href="<?php echo BASE_URL.'hashtag/'.$hashtag.'?f=photos';?>">Photos</a></li>
</ul>
</div>
</div>
<!--hash-menu-->
<!---Inner wrapper-->
<div class="in-wrapper">
<div class="in-full-wrap">
<div class="in-left">
<div class="in-left-wrap">
<?php $getFromF->whoToFollow($user_id,$user_id);?>
<?php $getFromT->trends();?>
</div>
<!-- in left wrap-->
</div>
<!-- in left end-->
<?php if(strpos($_SERVER['REQUEST_URI'], '?f=photos')):?>
<!-- TWEETS IMAGES -->
<div class="hash-img-wrapper">
<div class="hash-img-inner">
<?php
foreach ($tweets as $tweet) {
$likes = $getFromT->likes($user_id, $tweet->tweetID);
$retweet = $getFromT->checkRetweet($tweet->tweetID, $user_id);
$user = $getFromT->userData($tweet->retweetBy);
if(!empty($tweet->tweetImage)){
echo '<div class="hash-img-flex">
<img src="'.BASE_URL.$tweet->tweetImage.'" class="imagePopup" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"/>
<div class="hash-img-flex-footer">
<ul>
'.(($getFromU->loggedIn()) ? '
<li><button><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li>'.(((isset($retweet['retweetID'])) ? $tweet->tweetID === $retweet['retweetID'] OR $user_id === $retweet['retweetBy'] : '') ? '<button class="retweeted" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">'.(($tweet->likesCount > 0) ? $tweet->likesCount : '').'</span></button>' : '<button class="retweet" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">'.(($tweet->retweetCount > 0) ? $tweet->retweetCount : '').'</span></button>').'</li>
<li>'.(((isset($likes['likeOn'])) ? $likes['likeOn'] == $tweet->tweetID : '') ? '<button class="unlike-btn" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-heart" aria-hidden="true"></i><span class="likesCounter">'.(($tweet->likesCount > 0) ? $tweet->likesCount : '').'</span></button>' : '<button class="like-btn" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-heart-o" aria-hidden="true"></i><span class="likesCounter">'.(($tweet->likesCount > 0) ? $tweet->likesCount : '').'</span></button>').'</li>
'.(($tweet->tweetBy === $user_id) ? '
<li>
<a href="#" class="more"><i class="fa fa-ellipsis-h" aria-hidden="true"></i></a>
<ul>
<li><label class="deleteTweet" data-tweet="'.$tweet->tweetID.'">Delete Tweet</label></li>
</ul>
</li>' : '').'
' : '
<li><button><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li><button><i class="fa fa-retweet" aria-hidden="true"></i></button></li>
<li><button><i class="fa fa-heart-o" aria-hidden="true"></i></button></li>
').'
</ul>
</div>
</div>';
}
}
?>
</div>
</div>
<!-- TWEETS IMAGES -->
<?php elseif(strpos($_SERVER['REQUEST_URI'], '?f=users')):?>
<!--TWEETS ACCOUTS-->
<div class="wrapper-following">
<div class="wrap-follow-inner">
<?php foreach($accounts AS $users) :?>
<div class="follow-unfollow-box">
<div class="follow-unfollow-inner">
<div class="follow-background">
<img src="<?php echo BASE_URL.$users->profileCover;?>"/>
</div>
<div class="follow-person-button-img">
<div class="follow-person-img">
<img src="<?php echo BASE_URL.$users->profileImage;?>"/>
</div>
<div class="follow-person-button">
<?php echo $getFromF->followBtn($users->user_id, $user_id, $user_id);?>
</div>
</div>
<div class="follow-person-bio">
<div class="follow-person-name">
<a href="<?php echo BASE_URL.$users->username;?>"><?php echo $users->screenName;?></a>
</div>
<div class="follow-person-tname">
<a href="<?php echo BASE_URL.$users->username;?>">@<?php echo $users->username;?></a>
</div>
<div class="follow-person-dis">
<?php echo $getFromT->getTweetLinks($users->bio);?>
</div>
</div>
</div>
</div>
<?php endforeach;?>
</div>
</div>
<!-- TWEETS ACCOUNTS -->
<?php else:?>
<div class="in-center">
<div class="in-center-wrap">
<?php
foreach ($tweets as $tweet) {
$likes = $getFromT->likes($user_id, $tweet->tweetID);
$retweet = $getFromT->checkRetweet($tweet->tweetID, $user_id);
$user = $getFromT->userData($tweet->retweetBy);
echo '<div class="all-tweet">
<div class="t-show-wrap">
<div class="t-show-inner">
'.(((isset($retweet['retweetID'])) ? $retweet['retweetID'] === $tweet->retweetID or $tweet->retweetID > 0 : '') ? '
<div class="t-show-popup" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'">
<div class="t-show-banner">
<div class="t-show-banner-inner">
<span><i class="fa fa-retweet" aria-hidden="true"></i></span><span>'.$user->screenName.'. Retweeted</span>
</div>
</div>' : '').'
'.(((isset($retweet['retweetMsg'])) ? !empty($retweet['retweetMsg']) && $tweet->tweetID === $retweet['tweetID'] or $tweet->retweetID > 0 : '') ? '<div class="t-show-head">
<div class="t-show-img">
<img src="'.BASE_URL.$user->profileImage.'"/>
</div>
<div class="t-s-head-content">
<div class="t-h-c-name">
<span><a href="'.BASE_URL.$user->username.'">'.$user->screenName.'</a></span>
<span>@'.$user->username.' </span>
<span>'.$getFromT->timeAgo(isset($retweet['postedOn'])).'</span>
</div>
<div class="t-h-c-dis">
'.$getFromT->getTweetLinks($tweet->retweetMsg).'
</div>
</div>
</div>
<div class="t-s-b-inner">
<div class="t-s-b-inner-in">
<div class="retweet-t-s-b-inner">
'.((!empty($tweet->tweetImage)) ? '
<div class="retweet-t-s-b-inner-left">
<img src="'.BASE_URL.$tweet->tweetImage.'"/>
</div>' : '').'
<div>
<div class="t-h-c-name">
<span><a href="#">'.$tweet->screenName.'</a></span>
<span>@'.$tweet->username.'</span>
<span>'.$getFromT->timeAgo($tweet->postedOn).'</span>
</div>
<div class="retweet-t-s-b-inner-right-text">
'.$getFromT->getTweetLinks($tweet->status).'
</div>
</div>
</div>
</div>
</div>
</div>
' : '
<div class="t-show-popup" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'">
<div class="t-show-head">
<div class="t-show-img">
<img src="'.BASE_URL.$tweet->profileImage.'"/>
</div>
<div class="t-s-head-co ntent">
<div class="t-h-c-name">
<span><a href="'.BASE_URL.$tweet->username.'">'.$tweet->screenName.'</a></span>
<span>@'.$tweet->username.'</span>
<span>'.$getFromT->timeAgo($tweet->postedOn).'</span>
</div>
<div class="t-h-c-dis">
'.$getFromT->getTweetLinks($tweet->status).'
</div>
</div>
</div>'.
((!empty($tweet->tweetImage)) ?
'<div class="t-show-body">
<div class="t-s-b-inner">
<div class="t-s-b-inner-in">
<img src="'.BASE_URL.$tweet->tweetImage.'" class="imagePopup" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"/>
</div>
</div>
</div>' : '' ) .'
</div>').'
<div class="t-show-footer">
<div class="t-s-f-right">
<ul>
'.(($getFromU->loggedIn()) ? '
<li><button><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li>'.(((isset($retweet['retweetID'])) ? $tweet->tweetID === $retweet['retweetID'] OR $user_id === $retweet['retweetBy'] : '') ? '<button class="retweeted" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">'.(($tweet->retweetCount > 0) ? $tweet->retweetCount : '').'</span></button>' : '<button class="retweet" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">'.(($tweet->retweetCount > 0) ? $tweet->retweetCount : '').'</span></button>').'</li>
<li>'.(((isset($likes['likeOn'])) ? $likes['likeOn'] == $tweet->tweetID : '') ?
'<button class="unlike-btn" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-heart" aria-hidden="true"></i><span class="likesCounter">'.(($tweet->likesCount > 0) ? $tweet->likesCount : '').'</span></button>' :
'<button class="like-btn" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-heart-o" aria-hidden="true"></i><span class="likesCounter">'.(($tweet->likesCount > 0) ? $tweet->likesCount : '').'</span></button>').'
</li>
'.(($tweet->tweetBy === $user_id) ? '
<li>
<a href="#" class="more"><i class="fa fa-ellipsis-h" aria-hidden="true"></i></a>
<ul>
<li><label class="deleteTweet" data-tweet="'.$tweet->tweetID.'">Delete Tweet</label></li>
</ul>
</li>' : '').'
' : '
<li><button><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li><button><i class="fa fa-retweet" aria-hidden="true"></i></button></li>
<li><button><i class="fa fa-heart-o" aria-hidden="true"></i></button></li>
').'
</ul>
</div>
</div>
</div>
</div>
</div>';
}
?>
</div>
</div>
<?php endif;?>
<div class="popupTweet"></div>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/popuptweets.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/delete.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/popupForm.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/follow.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/retweet.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/like.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/messages.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/postMessage.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/hashtag.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/search.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/notification.js"></script>
</div><!--in full wrap end-->
</div><!-- in wrappper ends-->
</div><!-- ends wrapper -->
</body>
</html>