blob: 71c233e12c59dbbbb0dcc01112cf9084c63f77f3 (
plain)
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
|
<?php
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/accounts.php";
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/config.php";
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/partials.php";
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/utils.php";
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/alert.php";
if (!REPORTS_ENABLE) {
generate_alert("/404.php", "Reports are disabled", 403);
exit;
}
if (!authorize_user(true)) {
exit;
}
if (isset($_SESSION["user_role"]) && !$_SESSION["user_role"]["permission_report"]) {
generate_alert("/404.php", "Not enough permissions", 403);
exit;
}
$db = new PDO(DB_URL, DB_USER, DB_PASS);
$stmt = $db->prepare("SELECT * FROM reports WHERE sender_id = ? ORDER BY sent_at DESC");
$stmt->execute([$_SESSION["user_id"]]);
$reports = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<html>
<head>
<title>Report list - <?php echo INSTANCE_NAME ?></title>
<link rel="stylesheet" href="/static/style.css">
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
</head>
<body>
<div class="container">
<div class="wrapper">
<?php html_navigation_bar() ?>
<section class="content">
<section class="box" style="width: 50%;">
<section class="box navtab">
Report list
</section>
<section class="box content">
<table>
<tr>
<th>Contents</th>
<th>Status</th>
<th style="min-width: 96px;"></th>
</tr>
<?php
foreach ($reports as $report) {
echo '<tr>';
echo '<td>' . substr($report["contents"], 0, 20) . "...";
echo ' <span style="font-size:12px; color: gray;">(' . format_timestamp(time() - strtotime($report["sent_at"])) . ' ago)</span>';
echo '</td>';
echo '<td>';
echo $report["resolved_by"] == null ? "<b style='color:red;'>Unresolved</b>" : "<b style='color:green;'>Resolved</b>";
echo '</td>';
echo '<td style="text-align:center;">';
echo '<a href="/report?id=' . $report["id"] . '">[ View ]</a>';
echo '</td>';
echo '</tr>';
}
?>
</table>
</section>
</section>
</section>
</div>
</div>
</body>
</html>
|