-
Notifications
You must be signed in to change notification settings - Fork 0
/
managemods.php
126 lines (116 loc) · 2.72 KB
/
managemods.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
<?php
// AcmlmBoard XD - Local moderator assignment tool
// Access: administrators only
$noAutoHeader = TRUE;
include("lib/common.php");
$title = __("Manage localmod assignments");
AssertForbidden("editMods");
if($loguser['powerlevel'] < 3)
Kill(__("You're not an admin."));
if(!isset($_GET['action']))
{
include("lib/header.php");
$qFora = "select * from forums order by catid, forder";
$rFora = Query($qFora);
while($forum = Fetch($rFora))
{
$modList = "";
$qMods = "select * from forummods where forum=".$forum['id'];
$rMods = Query($qMods);
while($mods = Fetch($rMods))
{
$qMod = "select name, displayname, id, powerlevel, sex from users where id=".$mods['user'];
$rMod = Query($qMod);
$mod = Fetch($rMod);
$modList .= format(
"
<li>
{0}
<sup>
<a href=\"managemods.php?action=delete&fid={1}&mid={2}\">✘</a>
</sup>
</li>
", UserLink($mod), $forum['id'], $mods['user']);
}
$theList .= format(
"
<li>
{0}
<ul>
{2}
<li>
<a href=\"managemods.php?action=add&fid={1}\">".__("Add")."</a>
</li>
</ul>
</li>
", $forum['title'], $forum['id'], $modList);
}
write(
"
<div class=\"faq outline margin\">
<h3>".__("Moderators as of {0}")."</h3>
<ul>
{1}
</ul>
</div>
", gmdate("F jS Y"), $theList);
}
elseif($_GET['action'] == "delete")
{
include("lib/header.php");
if(!isset($_GET['fid']))
Kill(__("Forum ID unspecified."));
if(!isset($_GET['mid']))
Kill(__("Mod ID unspecified."));
$fid = (int)$_GET['fid'];
$mid = (int)$_GET['mid'];
$qMod = "delete from forummods where forum=".$fid." and user=".$mid;
$rMod = Query($qMod);
Redirect(__("Removed!"), "managemods.php", __("the mod manager"));
}
elseif($_GET['action'] == "add")
{
include("lib/header.php");
if(!isset($_GET['fid']))
Kill(__("Forum ID unspecified."));
$fid = (int)$_GET['fid'];
if(!isset($_GET['mid']))
{
$modList = "";
$qMod = "select * from users where powerlevel=1 order by name asc";
$rMod = Query($qMod);
while($mod = Fetch($rMod))
{
$qCheck = "select user from forummods where forum=".$fid." and user=".$mod['id'];
$rCheck = Query($qCheck);
if(NumRows($rCheck))
$add = __("already there");
else
$add = format("<a href=\"managemods.php?action=add&fid={0}&mid={1}\">".__("add")."</a>", $fid, $mod['id']);
$modList .= format(
"
<li>
{0}
<sup>[{1}]</sup>
</li>
", UserLink($mod), $add);
}
write(
"
<div class=\"faq outline margin\">
".__("Pick a mod, any mod.")."
<ul>
{0}
</ul>
</div>
", $modList);
}
else
{
$mid = (int)$_GET['mid'];
$qMod = "insert into forummods (forum , user) values (".$fid.", ".$mid.")";
$rMod = Query($qMod);
Redirect(__("Added!"), "managemods.php", __("the mod manager"));
}
}
?>