-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathforumbansbyuser.php
66 lines (55 loc) · 2.18 KB
/
forumbansbyuser.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
<?php
require "lib/function.php";
$_GET['id'] = filter_int($_GET['id']);
$user = $sql->fetchq("SELECT {$userfields} FROM users u WHERE u.id = {$_GET['id']}");
if (!$user) {
errorpage("This user doesn't exist!");
}
$forumbans = $sql->query("
SELECT b.*, {$userfields} uid, f.title forumname, f.id validforum
FROM forumbans b
LEFT JOIN users u ON b.banner = u.id
LEFT JOIN forums f ON b.forum = f.id
WHERE b.user = {$_GET['id']} AND (!f.minpower OR f.minpower <= {$loguser['powerlevel']})
ORDER BY b.date DESC
");
$modsets = $sql->getresults("SELECT forum FROM forummods WHERE user = {$loguser['id']}");
$txt = "";
for ($i = 0; $x = $sql->fetch($forumbans);) {
if (!$x['validforum']) {
if (!$isadmin) continue;
$x['forumname'] = "(Invalid forum with ID #{$x['forum']})";
}
$bg = ($i++ % 2) + 1;
// Don't show edit/delete links to non mods
if ($ismod || isset($modsets[$x['forum']])) {
$editlink = "<a href='admin-forumbans.php?forum={$x['forum']}&edit={$x['id']}'>Edit</a>";
} else {
$editlink = $i;
}
$txt .= "
<tr>
<td class='tdbg{$bg} center fonts' style='width: 60px'>{$editlink}</td>
<td class='tdbg{$bg} center'><a href='forum.php?id={$x['forum']}'>{$x['forumname']}</a></td>
<td class='tdbg{$bg} center'>".($x['reason'] ? $x['reason'] : "—")."</td>
<td class='tdbg{$bg} center'>".getuserlink(array_column_by_key($x, 1), $x['banner'])."</td>
<td class='tdbg{$bg} center'>".printdate($x['date'])."</td>
<td class='tdbg{$bg} center'>".($x['expire'] ? timeunits2($x['expire'] - ctime()) : "Permanent" )."</td>
</tr>";
}
pageheader("Forum bans to ".htmlspecialchars($user['name']));
?>
<table class="table">
<tr><td class="tdbgh center b" colspan=6>Forum bans for <?= getuserlink($user) ?> (Total: <?= $i ?>)</td></tr>
<tr>
<td class="tdbgc center" style="width: 10px">#</td>
<td class="tdbgc center" style="width: 15%">Forum name</td>
<td class="tdbgc center">Reason</td>
<td class="tdbgc center" style="width: 15%">Banned by</td>
<td class="tdbgc center" style="width: 200px">Date</td>
<td class="tdbgc center" style="width: 300px">Ban duration</td>
</tr>
<?= $txt ?>
</table>
<?php
pagefooter();