-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathreport_log.php
More file actions
99 lines (76 loc) · 2.08 KB
/
report_log.php
File metadata and controls
99 lines (76 loc) · 2.08 KB
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
<?php
$pagetitle = 'Report Chat Log';
require 'common.php';
if (!$logged)
{
$tpl->message = 'You must be logged in to view this page.';
$tpl->Execute(null);
exit;
}
if (!$GUIDE)
{
$tpl->message = 'You must be a Light Guide to view this page.';
$tpl->Execute(null);
exit;
}
if (!isset($_GET['reporter'], $_GET['reported'], $_GET['time']))
{
$tpl->message = 'No report specified.';
$tpl->Execute(null);
exit;
}
$report = webcp_db_fetchall("SELECT * FROM reports WHERE reporter = ? AND reported = ? AND time = ?", strtolower($_GET['reporter']), strtolower($_GET['reported']), $_GET['time']);
if (empty($report[0]))
{
$tpl->message = 'Report not found.';
$tpl->Execute(null);
exit;
}
$report = $report[0];
function chat_log_format($log)
{
global $phpext;
static $chat_channels = array(
'' => 'Public',
'!' => 'Private',
'\'' => 'Party',
'&' => 'Guild',
'~' => 'Global',
'@' => 'Announcement',
'+' => 'Admin'
);
$lines = explode("\r\n", htmlentities($log));
$result = "<table class=\"chat_log\">";
foreach ($lines as $line)
{
if (trim($line) == '')
continue;
if ($line[0] == '!')
{
$line = explode(' ', $line, 4);
$line[1] = $line[1] . ' <a href="character' . $phpext . '?name=' . rtrim(ucfirst($line[2]), ':') . '">' . ucfirst($line[2]) . '</a>';
$line[2] = $line[3];
unset($line[3]);
}
else
{
$line = explode(' ', $line, 3);
$line[1] = '<a href="character' . $phpext . '?name=' . rtrim(ucfirst($line[1]), ':') . '">' . ucfirst($line[1]) . '</a>';
}
if (count($line) < 3)
continue;
$chat_channel = '';
if (isset($chat_channels[$line[0]]))
$chat_channel = $chat_channels[$line[0]];
$result .= '<tr><th title="' . $chat_channel . '">' . implode('<td>', $line);
}
$result .= "</table>";
return $result;
}
$report['reporter'] = ucfirst($report['reporter']);
$report['reported'] = ucfirst($report['reported']);
$report['time_ago'] = timeago_full($report['time'], time());
$report['chat_log_html'] = chat_log_format($report['chat_log']);
$tpl->report = $report;
$tpl->pagetitle = $pagetitle;
$tpl->Execute('report_log');