-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotification.php
371 lines (333 loc) Β· 13.8 KB
/
notification.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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<?php
include 'core/init.php';
$user_id = $_SESSION['user_id'];
$user = $getFromU->userData($user_id);
$getFromM->notificationViewed($user_id);
$notify = $getFromM->getNotificationCount($user_id);
if($getFromU->loggedIn() === false){
header('Location: index.php');
}
$notification = $getFromM->notification($user_id);
?>
<!DOCTYPE html>
<html>
<head>
<title>Notifications - Tweety</title>
<meta charset="UTF-8" />
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<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"/>
</head>
<!--Helvetica Neue-->
<body>
<div class="wrapper">
<!-- header wrapper -->
<div class="header-wrapper">
<div class="nav-container">
<!-- Nav -->
<div class="nav">
<div class="nav-left">
<ul>
<li><a href="<?php echo BASE_URL;?>home.php"><i class="fa fa-home" aria-hidden="true"></i>Home</a></li>
<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>
</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>
<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>
</ul>
</div><!-- nav right ends-->
</div><!-- nav ends -->
</div><!-- nav container ends -->
</div><!-- header wrapper end -->
<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/like.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/retweet.js"></script>
<!---Inner wrapper-->
<div class="inner-wrapper">
<div class="in-wrapper">
<div class="in-full-wrap">
<div class="in-left">
<div class="in-left-wrap">
<div class="info-box">
<div class="info-inner">
<div class="info-in-head">
<img src="<?php echo BASE_URL.$user->profileCover;?>"/>
</div><!-- info in head end -->
<div class="info-in-body">
<div class="in-b-box">
<div class="in-b-img">
<img src="<?php echo BASE_URL.$user->profileImage;?>"/>
</div>
</div><!-- in b box end-->
<div class="info-body-name">
<div class="in-b-name">
<div><a href="<?php echo BASE_URL.$user->username;?>"><?php echo $user->screenName;?></a></div>
<span><small><a href="<?php echo BASE_URL.$user->username;?>">@<?php echo $user->username;?></a></small></span>
</div><!-- in b name end-->
</div><!-- info body name end-->
</div><!-- info in body end-->
<div class="info-in-footer">
<div class="number-wrapper">
<div class="num-box">
<div class="num-head">
TWEETS
</div>
<div class="num-body">
<?php $getFromT->countTweets($user_id);?>
</div>
</div>
<div class="num-box">
<div class="num-head">
FOLLOWING
</div>
<div class="num-body">
<span class="count-following"><?php echo $user->following;?></span>
</div>
</div>
<div class="num-box">
<div class="num-head">
FOLLOWERS
</div>
<div class="num-body">
<span class="count-followers"><?php echo $user->followers;?></span>
</div>
</div>
</div><!-- mumber wrapper-->
</div><!-- info in footer -->
</div><!-- info inner end -->
</div><!-- info box end-->
<!--==TRENDS==-->
<?php $getFromT->trends();?>
<!--==TRENDS==-->
</div><!-- in left wrap-->
</div><!-- in left end-->
<div class="in-center">
<div class="in-center-wrap">
<!--NOTIFICATION WRAPPER FULL WRAPPER-->
<div class="notification-full-wrapper">
<div class="notification-full-head">
<div>
<a href="#">All</a>
</div>
<div>
<a href="#">Mention</a>
</div>
<div>
<a href="#">settings</a>
</div>
</div>
<?php foreach($notification as $data) :?>
<?php if($data->type == 'follow') :?>
<!-- Follow Notification -->
<!--NOTIFICATION WRAPPER-->
<div class="notification-wrapper">
<div class="notification-inner">
<div class="notification-header">
<div class="notification-img">
<span class="follow-logo">
<i class="fa fa-child" aria-hidden="true"></i>
</span>
</div>
<div class="notification-name">
<div>
<img src="<?php echo BASE_URL.$data->profileImage;?>"/>
</div>
</div>
<div class="notification-tweet">
<a href="<?php echo BASE_URL.$data->username;?>" class="notifi-name"><?php echo $data->screenName;?></a><span> Followed you - <span><?php echo $getFromU->timeAgo($data->time);?></span>
</div>
</div>
</div>
<!--NOTIFICATION-INNER END-->
</div>
<!--NOTIFICATION WRAPPER END-->
<!-- Follow Notification -->
<?php endif;?>
<?php if($data->type == 'like') :?>
<!-- Like Notification -->
<!--NOTIFICATION WRAPPER-->
<div class="notification-wrapper">
<div class="notification-inner">
<div class="notification-header">
<div class="notification-img">
<span class="heart-logo">
<i class="fa fa-heart" aria-hidden="true"></i>
</span>
</div>
<div class="notification-name">
<div>
<img src="<?php echo BASE_URL.$data->profileImage;?>"/>
</div>
</div>
</div>
<div class="notification-tweet">
<a href="<?php echo BASE_URL.$data->profileImage;?>" class="notifi-name"><?php echo $data->screenName;?></a><span> liked your <?php if($data->tweetBy === $user_id){echo 'Tweet';}else{echo 'Retweet';}?> - <span><?php echo $getFromU->timeAgo($data->time);?></span>
</div>
<div class="notification-footer">
<div class="noti-footer-inner">
<div class="noti-footer-inner-left">
<div class="t-h-c-name">
<span><a href="<?php echo BASE_URL.$user->username;?>"><?php echo $user->username;?></a></span>
<span>@<?php echo $user->username;?></span>
<span><?php echo $getFromU->timeAgo($data->postedOn);?></span>
</div>
<div class="noti-footer-inner-right-text">
<?php echo $getFromT->getTweetlinks($data->status);?>
</div>
</div>
<?php if(!empty($data->tweetImage)) :?>
<div class="noti-footer-inner-right">
<img src="<?php echo BASE_URL.$data->tweetImage;?>"/>
</div>
<?php endif;?>
</div><!--END NOTIFICATION-inner-->
</div>
</div>
</div>
<!--NOTIFICATION WRAPPER END-->
<!-- Like Notification -->
<?php endif;?>
<?php if($data->type == 'retweet') :?>
<!-- Retweet Notification -->
<!--NOTIFICATION WRAPPER-->
<div class="notification-wrapper">
<div class="notification-inner">
<div class="notification-header">
<div class="notification-img">
<span class="retweet-logo">
<i class="fa fa-retweet" aria-hidden="true"></i>
</span>
</div>
<div class="notification-tweet">
<a href="<?php echo BASE_URL.$data->username;?>" class="notifi-name"><?php echo $data->screenName;?></a><span> retweet your <?php if($data->tweetBy === $user_id){echo 'Tweet';}else{echo 'Retweet';}?> - <span><?php echo $getFromU->timeAgo($data->time);?></span>
</div>
<div class="notification-footer">
<div class="noti-footer-inner">
<div class="noti-footer-inner-left">
<div class="t-h-c-name">
<span><a href="<?php echo BASE_URL.$user->username;?>"><?php echo $user->screenName;?></a></span>
<span>@<?php echo $user->username;?></span>
<span><?php echo $getFromU->timeAgo($data->postedOn);?></span>
</div>
<div class="noti-footer-inner-right-text">
<?php echo $getFromT->getTweetLinks($data->status)?>
</div>
</div>
<?php if(!empty($data->tweetImage)) :?>
<div class="noti-footer-inner-right">
<img src="<?php echo BASE_URL.$data->tweetImage;?>"/>
</div>
<?php endif;?>
</div><!--END NOTIFICATION-inner-->
</div>
</div>
</div>
</div>
<!--NOTIFICATION WRAPPER END-->
<!-- Retweet Notification -->
<?php endif;?>
<?php if($data->type == 'mention') :?>
<?php
$tweet = $data;
$likes = $getFromT->likes($user_id, $tweet->tweetID);
$retweet = $getFromT->checkRetweet($tweet->tweetID, $user_id);
echo '<div class="all-tweet-inner">
<div class="t-show-wrap">
<div class="t-show-inner">
<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>
<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>' : '').'
</ul>
</div>
</div>
</div>
</div>
</div>';
?>
<?php endif;?>
<?php endforeach;?>
</div>
<!--NOTIFICATION WRAPPER FULL WRAPPER END-->
<div class="loading-div">
<img id="loader" src="<?php echo BASE_URL;?>assets/images/loading.svg" style="display: none;"/>
</div>
<div class="popupTweet"></div>
<!--Tweet END WRAPER-->
<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/hashtag.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/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/notification.js"></script>
</div><!-- in left wrap-->
</div><!-- in center end -->
<div class="in-right" >
<div class="in-right-wrap">
<!--Who To Follow-->
<?php $getFromF->whoToFollow($user_id, $user->user_id);?>
<!--Who To Follow-->
</div><!-- in left wrap-->
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/follow.js"></script>
</div><!-- in right end -->
</div><!--in full wrap end-->
</div><!-- in wrappper ends-->
</div><!-- inner wrapper ends-->
</div><!-- ends wrapper -->
</body>
</html>