-
Notifications
You must be signed in to change notification settings - Fork 37
/
home.php
382 lines (296 loc) · 13.9 KB
/
home.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
372
373
374
375
376
377
378
379
380
381
382
<?php
include 'core/init.php';
$user_id = $_SESSION['user_id'];
$user = User::getData($user_id);
if (User::checkLogIn() === false)
header('location: index.php');
$tweets = Tweet::tweets($user_id);
$who_users = Follow::whoToFollow($user_id);
$notify_count = User::CountNotification($user_id);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home | Twitter</title>
<link rel="shortcut icon" type="image/png" href="assets/images/twitter.svg">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/all.min.css">
<link rel="stylesheet" href="assets/css/home_style.css?v=<?php echo time(); ?>">
</head>
<body>
<!-- This is a modal for welcome the new signup account! -->
<script src="assets/js/jquery-3.5.1.min.js"></script>
<?php if (isset($_SESSION['welcome'])) { ?>
<script>
$(document).ready(function(){
// Open modal on page load
$("#welcome").modal('show');
});
</script>
<!-- Modal -->
<div class="modal fade" id="welcome" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="">
<div class="text-center">
<span class="modal-title font-weight-bold text-center" id="exampleModalLongTitle">
<span style="font-size: 20px;">Welcome <span style="color:#207ce5"><?php echo $user->name; ?></span> </span>
</span>
</div>
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button> -->
</div>
<div class="modal-body">
<div class="text-center">
<h4 style="font-weight: 600; " >You Signup Successfuly!</h4>
</div>
<p>This is Twitter clone made by <span style="font-weight: 700;">Amin Yasser</span> for learning purpose.</p>
<p>The clone includes tweet , retweet , qoute or even qoute the qouted tweet , like tweet and nested comments.
you can mention or add hashtag to yout tweet , change password or username.
Follow or unfollow people. get notificaction if any action happen. Search users by name or username. and more!
</p>
<p>By Signing Up then you followed
<a style="color:#207ce5;" href="amin">@amin</a>
by default to see tweets. you can change it anytime!</p>
</div>
</div>
</div>
</div>
<?php unset($_SESSION['welcome']); } ?>
<!-- End welcome -->
<div id="mine">
<div class="wrapper-left">
<div class="sidebar-left">
<div class="grid-sidebar" style="margin-top: 12px">
<div class="icon-sidebar-align">
<img src="https://i.ibb.co/86d7x4Z/twitter.png" alt="" height="30px" width="30px" />
</div>
</div>
<a href="home.php">
<div class="grid-sidebar bg-active" style="margin-top: 12px">
<div class="icon-sidebar-align">
<img src="https://i.ibb.co/6tKFLWG/home.png" alt="" height="26.25px" width="26.25px" />
</div>
<div class="wrapper-left-elements">
<a class="wrapper-left-active" href="home.php" style="margin-top: 4px;"><strong>Home</strong></a>
</div>
</div>
</a>
<a href="notification.php">
<div class="grid-sidebar">
<div class="icon-sidebar-align position-relative">
<?php if ($notify_count > 0) { ?>
<i class="notify-count"><?php echo $notify_count; ?></i>
<?php } ?>
<img
src="https://i.ibb.co/Gsr7qyX/notification.png"
alt=""
height="26.25px"
width="26.25px"
/>
</div>
<div class="wrapper-left-elements">
<a href="notification.php" style="margin-top: 4px"><strong>Notification</strong></a>
</div>
</div>
</a>
<a href="<?php echo BASE_URL . $user->username; ?>">
<div class="grid-sidebar">
<div class="icon-sidebar-align">
<img src="https://i.ibb.co/znTXjv6/perfil.png" alt="" height="26.25px" width="26.25px" />
</div>
<div class="wrapper-left-elements">
<!-- <a href="/twitter/<?php echo $user->username; ?>" style="margin-top: 4px"><strong>Profile</strong></a> -->
<a href="<?php echo BASE_URL . $user->username; ?>" style="margin-top: 4px"><strong>Profile</strong></a>
</div>
</div>
</a>
<a href="<?php echo BASE_URL . "account.php"; ?>">
<div class="grid-sidebar ">
<div class="icon-sidebar-align">
<img src="https://i.ibb.co/znTXjv6/perfil.png" alt="" height="26.25px" width="26.25px" />
</div>
<div class="wrapper-left-elements">
<a href="<?php echo BASE_URL . "account.php"; ?>" style="margin-top: 4px"><strong>Settings</strong></a>
</div>
</div>
</a>
<a href="includes/logout.php">
<div class="grid-sidebar">
<div class="icon-sidebar-align">
<i style="font-size: 26px; color:red" class="fas fa-sign-out-alt"></i>
</div>
<div class="wrapper-left-elements">
<a style="color:red" href="includes/logout.php" style="margin-top: 4px"><strong>Logout</strong></a>
</div>
</div>
</a>
<button class="button-twittear">
<strong>Tweet</strong>
</button>
<div class="box-user">
<div class="grid-user">
<div>
<img
src="assets/images/users/<?php echo $user->img ?>"
alt="user"
class="img-user"
/>
</div>
<div>
<p class="name"><strong><?php if($user->name !== null) {
echo $user->name; } ?></strong></p>
<p class="username">@<?php echo $user->username; ?></p>
</div>
<div class="mt-arrow">
<img
src="https://i.ibb.co/mRLLwdW/arrow-down.png"
alt=""
height="18.75px"
width="18.75px"
/>
</div>
</div>
</div>
</div>
</div>
<div class="grid-posts">
<div class="border-right">
<div class="grid-toolbar-center">
<div class="center-input-search">
<div class="input-group-login" id="whathappen">
<div class="container">
<div class="part-1">
<div class="header">
<div class="home">
<h2>Home</h2>
</div>
<!-- <div class="icon">
<button type="button" name="button">+</button>
</div> -->
</div>
<div class="text">
<form class="" action="handle/handleTweet.php" method="post" enctype="multipart/form-data">
<div class="inner">
<img src="assets/images/users/<?php echo $user->img ?>" alt="profile photo">
<label>
<textarea class="text-whathappen" name="status" rows="8" cols="80" placeholder="What's happening?"></textarea>
</label>
</div>
<!-- tmp image upload place -->
<div class="position-relative upload-photo">
<img class="img-upload-tmp" src="assets/images/tweets/tweet-60666d6b426a1.jpg" alt="">
<div class="icon-bg">
<i id="#upload-delete-tmp" class="fas fa-times position-absolute upload-delete"></i>
</div>
</div>
<div class="bottom">
<div class="bottom-container">
<label for="tweet_img" class="ml-3 mb-2 uni">
<i class="fa fa-image item1-pair"></i>
</label>
<input class="tweet_img" id="tweet_img" type="file" name="tweet_img">
</div>
<div class="hash-box">
<ul style="margin-bottom: 0;">
</ul>
</div>
<?php if (isset($_SESSION['errors_tweet'])) {
foreach($_SESSION['errors_tweet'] as $t) {?>
<div class="alert alert-danger">
<span class="item2-pair"> <?php echo $t; ?> </span>
</div>
<?php } } unset($_SESSION['errors_tweet']); ?>
<div>
<span class="bioCount" id="count">140</span>
<input id="tweet-input" type="submit" name="tweet" value="Tweet" class="submit"
>
</div>
</div>
</form>
</div>
</div>
<div class="part-2">
</div>
</div>
</div>
</div>
<!-- <div class="mt-icon-settings">
<img src="https://i.ibb.co/W5T9ycN/settings.png" alt="" />
</div> -->
</div>
<div class="box-fixed" id="box-fixed"></div>
<?php include 'includes/tweets.php'; ?>
</div>
<div class="wrapper-right">
<div style="width: 90%;" class="container">
<div class="input-group py-2 m-auto pr-5 position-relative">
<i id="icon-search" class="fas fa-search tryy"></i>
<input type="text" class="form-control search-input" placeholder="Search Twitter">
<div class="search-result">
</div>
</div>
</div>
<div class="box-share">
<p class="txt-share"><strong>Who to follow</strong></p>
<?php
foreach($who_users as $user) {
// $u = User::getData($user->user_id);
$user_follow = Follow::isUserFollow($user_id , $user->id) ;
?>
<div class="grid-share">
<a style="position: relative; z-index:5; color:black" href="<?php echo $user->username; ?>">
<img
src="assets/images/users/<?php echo $user->img; ?>"
alt=""
class="img-share"
/>
</a>
<div>
<p>
<a style="position: relative; z-index:5; color:black" href="<?php echo $user->username; ?>">
<strong><?php echo $user->name; ?></strong>
</a>
</p>
<p class="username">@<?php echo $user->username; ?>
<?php if (Follow::FollowsYou($user->id , $user_id)) { ?>
<span class="ml-1 follows-you">Follows You</span></p>
<?php } ?></p>
</div>
<div>
<button class="follow-btn follow-btn-m
<?= $user_follow ? 'following' : 'follow' ?>"
data-follow="<?php echo $user->id; ?>"
data-user="<?php echo $user_id; ?>"
data-profile="<?php echo $u_id; ?>"
style="font-weight: 700;">
<?php if($user_follow) { ?>
Following
<?php } else { ?>
Follow
<?php } ?>
</button>
</div>
</div>
<?php }?>
</div>
</div>
</div>
</div>
<script src="assets/js/search.js"></script>
<script src="assets/js/photo.js?v=<?php echo time(); ?>"></script>
<script type="text/javascript" src="assets/js/hashtag.js"></script>
<script type="text/javascript" src="assets/js/like.js"></script>
<script type="text/javascript" src="assets/js/comment.js?v=<?php echo time(); ?>"></script>
<script type="text/javascript" src="assets/js/retweet.js?v=<?php echo time(); ?>"></script>
<script type="text/javascript" src="assets/js/follow.js?v=<?php echo time(); ?>"></script>
<script src="https://kit.fontawesome.com/38e12cc51b.js" crossorigin="anonymous"></script>
<!-- <script src="assets/js/jquery-3.4.1.slim.min.js"></script> -->
<script src="assets/js/jquery-3.5.1.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
</body>
</html>