-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmessages.php
50 lines (43 loc) · 1.12 KB
/
messages.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
<?php
require_once 'config.php';
require_once 'php/Fakebook.php';
$pageTitle = 'Homepage';
$fakebook = new Fakebook();
// if the user is not logged, redirect to the login page
if (!$fakebook->getLoggedUserId()) {
header("location: index.php");
}
$messages = $fakebook->getMessages();
?>
<!DOCTYPE html>
<html lang="en">
<?php include 'head.inc.php'; ?>
<body>
<?php
$topBarSelectedIcon = 2;
include 'topbar.inc.php';
?>
<div id="container">
<?php include 'sidebar.inc.php' ?>
<section id="content">
<h1 style="margin-top: 0;">Messages:</h1>
<?php if (!$messages) {
echo 'Sorry but there are no messages.';
}?>
<?php
foreach ($messages as $message) {
$aux = explode('|',$message); ?>
<div class="message">
<div class="author"><a href="user.php?id=<?= $aux[0] ?>"><?= $fakebook->getFullName($aux[0]) ?></a></div>
<div class="text"><?= $aux[1] ?></div>
<div class="time"><?= $fakebook->timeAgo($aux[2]) ?></div>
<div class="actions">
<a href="send-message.php?to=<?= $aux[0] ?>">Reply</a>
</div>
<hr>
</div>
<?php } ?>
</section>
</div>
</body>
</html>