]>
Commit | Line | Data |
---|---|---|
896b6cdc | 1 | <!DOCTYPE html> |
4d834e71 | 2 | <title>UnrealIRCd Panel</title> |
26971737 | 3 | <link rel="icon" type="image/x-icon" href="/img/favicon.ico"> |
46b1c955 | 4 | <link href="css/unrealircd-admin.css" rel="stylesheet"> |
26971737 | 5 | <body class="body-for-sticky"> |
82f5bcbf | 6 | <div id="headerContainer"> |
babf1a0e | 7 | <h2><a href="">UnrealIRCd <small>Administration Panel</small></a></h2></div> |
709b97f3 VP |
8 | <script src="js/unrealircd-admin.js" defer></script> |
9 | <div class="topnav"> | |
10 | <a data-tab-target="#overview" class="active" href="#overview">Overview</a> | |
11 | <a data-tab-target="#Users" href="#Users">Users</a> | |
12 | <a data-tab-target="#Channels" href="#Channels">Channels</a> | |
13 | <a data-tab-target="#TKL" href="#TKL">Server Bans</a> | |
14 | <a data-tab-target="#Spamfilter" href="#Spamfilter">Spamfilter</a> | |
26971737 | 15 | <a data-tab-target="#News" href="#News">News</a> |
709b97f3 VP |
16 | </div> |
17 | <?php | |
26971737 VP |
18 | define('UPATH', dirname(__FILE__)); |
19 | include "config.php"; | |
20 | include "Classes/class-log.php"; | |
21 | include "Classes/class-message.php"; | |
709b97f3 | 22 | include "Classes/class-rpc.php"; |
26971737 | 23 | do_log($_POST); |
709b97f3 | 24 | |
26971737 | 25 | if (!empty($_POST)) { |
b063b4b2 | 26 | if (!($bantype = $_POST['bantype'])) { |
26971737 VP |
27 | |
28 | } else if (!($users = $_POST["userch"])) { | |
29 | Message::Fail("No user was specified"); | |
30 | } else { | |
31 | foreach ($_POST["userch"] as $user) { | |
32 | $user = base64_decode($user); | |
b063b4b2 VP |
33 | $bantype = (isset($_POST['bantype'])) ? $_POST['bantype'] : NULL; |
34 | if (!$bantype) | |
35 | { | |
36 | Message::Fail("An error occured"); | |
37 | return; | |
38 | } | |
39 | $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL; | |
40 | $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL; | |
41 | $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL; | |
42 | ||
43 | $duration = ""; | |
44 | if (!$banlen_d && !$banlen_h && !$banlen_w) | |
45 | $duration .= "0"; | |
46 | ||
47 | else | |
48 | { | |
49 | if ($banlen_w) | |
50 | $duration .= $banlen_w; | |
51 | if ($banlen_d) | |
52 | $duration .= $banlen_d; | |
53 | if ($banlen_h) | |
54 | $duration .= $banlen_h; | |
55 | } | |
56 | ||
57 | $rpc = new RPC(); | |
58 | $rpc->set_method("user.get"); | |
59 | $rpc->set_params(["nick" => "$user"]); | |
60 | $rpc->execute(); | |
61 | $nick = ($rpc->result) ? $rpc->fetch_assoc() : NULL; | |
62 | if (!$nick) | |
63 | { | |
64 | Message::Fail("Could not find that user. Maybe they disconnected after you clicked this?"); | |
65 | return; | |
66 | } | |
67 | ||
d4a2999b | 68 | $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for $duration"; |
b3898fc7 VP |
69 | $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason"; |
70 | if (rpc_tkl_add($user, $bantype, $duration, $reason)) | |
b063b4b2 VP |
71 | { |
72 | $c = $nick['result']['client']; | |
babf1a0e | 73 | Message::Success($c['name'] . " (*@".$c['hostname'].") has been $bantype" . "d $msg_msg: $reason"); |
b063b4b2 | 74 | } |
76200e36 VP |
75 | } |
76 | } | |
77 | ||
26971737 VP |
78 | if (!empty($_POST['tklch'])) |
79 | foreach ($_POST as $key => $value) { | |
80 | foreach ($value as $tok) { | |
81 | $tok = explode(",", $tok); | |
b063b4b2 VP |
82 | if (rpc_tkl_del(base64_decode($tok[0]), base64_decode($tok[1]))) |
83 | Message::Success(base64_decode($tok[1])." has been removed for ".base64_decode($tok[0])); | |
26971737 VP |
84 | } |
85 | } | |
86 | ||
87 | if (!empty($_POST['sf'])) | |
88 | foreach ($_POST as $key => $value) { | |
89 | foreach ($value as $tok) { | |
90 | $tok = explode(",", $tok); | |
91 | rpc_sf_del(base64_decode($tok[0]), base64_decode($tok[1]), base64_decode($tok[2]), base64_decode($tok[3])); | |
92 | } | |
93 | } | |
94 | } | |
95 | ||
b063b4b2 | 96 | rpc_pop_lists(); |
709b97f3 | 97 | ?> |
82f5bcbf VP |
98 | |
99 | <div class="tab-content\"> | |
100 | <div id="overview" data-tab-content class="active"> | |
896b6cdc VP |
101 | <table class='unrealircd_overview'> |
102 | <th>Chat Overview</th><th></th> | |
103 | <tr><td><b>Users</b></td><td><?php echo count(RPC_List::$user); ?></td></tr> | |
104 | <tr><td><b>Opers</b></td><td><?php echo RPC_List::$opercount; ?></td></tr> | |
105 | <tr><td><b>Services</b></td><td><?php echo RPC_List::$services_count; ?></td></tr> | |
106 | <tr><td><b>Most popular channel</b></td><td><?php echo RPC_List::$most_populated_channel; ?> (<?php echo RPC_List::$channel_pop_count; ?> users)</td></tr> | |
107 | <tr><td><b>Channels</b></td><td><?php echo count(RPC_List::$channel); ?></td></tr> | |
108 | <tr><td><b>Server bans</b></td><td><?php echo count(RPC_List::$tkl); ?></td></tr> | |
109 | <tr><td><b>Spamfilter entries</b></td><td><?php echo count(RPC_List::$spamfilter); ?></td></tr></th> | |
110 | </table></div></div> | |
b3898fc7 | 111 | |
ef866d8c VP |
112 | <div class="tab-content\"> |
113 | <div id="Users" data-tab-content> | |
4d834e71 VP |
114 | <table class='users_filter'> |
115 | <th class="thuf">Filter by: </th> | |
116 | <th> | |
117 | <form action="" method="post"> | |
118 | Nick: <input name="uf_nick" id="uf_nick" type="text"> | |
119 | <input class="cute_button2" type="submit" value="Search"> | |
120 | </form> | |
121 | </th> | |
122 | <th> | |
123 | <form action="" method="post"> | |
124 | Hostname: <input name="uf_host" id="uf_host" type="text"> | |
125 | <input class="cute_button2" type="submit" value="Search"> | |
126 | </form> | |
127 | </th> | |
128 | <th> | |
129 | <form action="" method="post"> | |
130 | IP: <input name="uf_ip" id="uf_ip" type="text"> | |
131 | <input class="cute_button2" type="submit" value="Search"> | |
132 | </form> | |
133 | </th> | |
134 | <th class="thuffer"> | |
babf1a0e | 135 | <form action="" method="post"> |
4d834e71 VP |
136 | Account: <input name="uf_account" id="uf_account" type="text"> |
137 | <input class="cute_button2" type="submit" value="Search"> | |
138 | </form> | |
139 | </th> | |
140 | </form> | |
141 | </table> | |
142 | <?php | |
babf1a0e VP |
143 | if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick'])) |
144 | Message::Info("Listing users which match nick: \"" . $_POST['uf_nick'] . "\""); | |
145 | ||
146 | if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip'])) | |
f63cfca8 | 147 | Message::Info("Listing users which match IP: \"" . $_POST['uf_ip'] . "\""); |
babf1a0e VP |
148 | |
149 | if (isset($_POST['uf_host']) && strlen($_POST['uf_host'])) | |
150 | Message::Info("Listing users which match hostmask: \"" . $_POST['uf_host'] . "\""); | |
151 | ||
152 | if (isset($_POST['uf_account']) && strlen($_POST['uf_account'])) | |
153 | Message::Info("Listing users which match account: \"" . $_POST['uf_account'] . "\""); | |
154 | ||
4d834e71 | 155 | ?> |
896b6cdc | 156 | <table class='users_overview'> |
26971737 | 157 | <th><input type="checkbox" label='selectall' onClick="toggle_user(this)" />Select all</th> |
896b6cdc VP |
158 | <th>Nick</th> |
159 | <th>UID</th> | |
ef866d8c | 160 | <th>Host / IP</th> |
896b6cdc | 161 | <th>Account</th> |
02c4da66 | 162 | <th>Usermodes<a href="https://www.unrealircd.org/docs/User_modes" target="_blank">ℹ️</a></th> |
896b6cdc VP |
163 | <th>Oper</th> |
164 | <th>Secure</th> | |
165 | <th>Connected to</th> | |
02c4da66 | 166 | <th>Reputation <a href="https://www.unrealircd.org/docs/Reputation_score" target="_blank">ℹ️</a></th> |
896b6cdc | 167 | |
b3898fc7 | 168 | <form action="" method="post"> |
896b6cdc VP |
169 | <?php |
170 | foreach(RPC_List::$user as $user) | |
171 | { | |
4d834e71 | 172 | |
babf1a0e | 173 | /* Some basic filtering for NICK */ |
4d834e71 VP |
174 | if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']) && |
175 | strpos(strtolower($user['name']), strtolower($_POST['uf_nick'])) !== 0 && | |
176 | strpos(strtolower($user['name']), strtolower($_POST['uf_nick'])) == false) | |
177 | continue; | |
178 | ||
babf1a0e VP |
179 | /* Some basic filtering for HOST */ |
180 | if (isset($_POST['uf_host']) && strlen($_POST['uf_host']) && | |
181 | strpos(strtolower($user['hostname']), strtolower($_POST['uf_host'])) !== 0 && | |
182 | strpos(strtolower($user['hostname']), strtolower($_POST['uf_host'])) == false) | |
183 | continue; | |
184 | ||
185 | /* Some basic filtering for IP */ | |
186 | if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']) && | |
187 | strpos(strtolower($user['ip']), strtolower($_POST['uf_ip'])) !== 0 && | |
188 | strpos(strtolower($user['ip']), strtolower($_POST['uf_ip'])) == false) | |
189 | continue; | |
190 | ||
191 | /* Some basic filtering for ACCOUNT */ | |
192 | if (isset($_POST['uf_account']) && strlen($_POST['uf_account']) && | |
193 | strpos(strtolower($user['user']['account']), strtolower($_POST['uf_account'])) !== 0 && | |
194 | strpos(strtolower($user['user']['account']), strtolower($_POST['uf_account'])) == false) | |
195 | continue; | |
196 | ||
896b6cdc | 197 | echo "<tr>"; |
26971737 | 198 | echo "<td><input type=\"checkbox\" value='" . base64_encode($user['id'])."' name=\"userch[]\"></td>"; |
896b6cdc VP |
199 | echo "<td>".$user['name']."</td>"; |
200 | echo "<td>".$user['id']."</td>"; | |
201 | echo "<td>".$user['hostname']." (".$user['ip'].")</td>"; | |
d0657557 | 202 | $account = (isset($user['user']['account'])) ? '<span class="label">'.$user['user']['account'].'</span>' : '<span class="label noaccount">None</span>'; |
896b6cdc VP |
203 | echo "<td>".$account."</td>"; |
204 | $modes = (isset($user['user']['modes'])) ? "+" . $user['user']['modes'] : "<none>"; | |
205 | echo "<td>".$modes."</td>"; | |
f829edfb | 206 | $oper = (isset($user['user']['operlogin'])) ? '<span class="label">'.$user['user']['operlogin']."</span> <span class=\"label operclass-label\">".$user['user']['operclass']."</span>" : ""; |
896b6cdc | 207 | echo "<td>".$oper."</td>"; |
1a28c5b0 | 208 | $secure = (isset($user['tls'])) ? "<span class=\"label secure-connection\">Secure</span>" : "<span class=\"label noaccount\">Insecure</span>"; |
896b6cdc VP |
209 | echo "<td>".$secure."</td>"; |
210 | echo "<td>".$user['user']['servername']."</td>"; | |
211 | echo "<td>".$user['user']['reputation']."</td>"; | |
212 | } | |
26971737 | 213 | ?></table> |
1d7e7ff8 | 214 | <label for="bantype">Apply action: </label><br> |
26971737 VP |
215 | <select name="bantype" id="bantype"> |
216 | <option value=""></option> | |
217 | <optgroup label="Bans"> | |
218 | <option value="gline">GLine</option> | |
219 | <option value="gzline">GZLine</option> | |
220 | </optgroup> | |
221 | </select> | |
222 | <br> | |
1d7e7ff8 | 223 | <label for="banlen_w">Duration: </label><br> |
26971737 VP |
224 | <select name="banlen_w" id="banlen_w"> |
225 | <?php | |
226 | for ($i = 0; $i <= 56; $i++) | |
227 | { | |
228 | if (!$i) | |
229 | echo "<option value=\"0w\"></option>"; | |
230 | else | |
231 | { | |
232 | $w = ($i == 1) ? "week" : "weeks"; | |
233 | echo "<option value=\"$i" . "w\">$i $w" . "</option>"; | |
234 | } | |
235 | } | |
236 | ?> | |
237 | </select> | |
238 | <select name="banlen_d" id="banlen_d"> | |
239 | <?php | |
240 | for ($i = 0; $i <= 31; $i++) | |
241 | { | |
242 | if (!$i) | |
243 | echo "<option value=\"0d\"></option>"; | |
244 | else | |
245 | { | |
246 | $d = ($i == 1) ? "day" : "days"; | |
247 | echo "<option value=\"$i" . "d\">$i $d" . "</option>"; | |
248 | } | |
249 | } | |
250 | ?> | |
251 | </select> | |
252 | <select name="banlen_h" id="banlen_h"> | |
253 | <?php | |
254 | for ($i = 0; $i <= 24; $i++) | |
255 | { | |
256 | if (!$i) | |
257 | echo "<option value=\"0d\"></option>"; | |
258 | else | |
259 | { | |
260 | $h = ($i == 1) ? "hour" : "hours"; | |
261 | echo "<option value=\"$i" . "h\">$i $h" . "</option>"; | |
262 | } | |
263 | } | |
264 | ?> | |
265 | </select> | |
1d7e7ff8 VP |
266 | <br><label for="ban_reason">Reason:<br></label> |
267 | <textarea name="ban_reason" id="ban_reason">No reason</textarea><br> | |
268 | <input class="cute_button" type="submit" value="Apply"> | |
26971737 VP |
269 | </form> |
270 | ||
271 | </div></div> | |
82f5bcbf | 272 | |
ef866d8c VP |
273 | <div class="tab-content\"> |
274 | <div id="Channels" data-tab-content> | |
275 | <p></p> | |
276 | <table class='users_overview'> | |
277 | <th>Name</th> | |
278 | <th>Created</th> | |
279 | <th>User count</th> | |
280 | <th>Topic</th> | |
281 | <th>Topic Set</th> | |
282 | <th>Modes</th> | |
283 | ||
284 | <?php | |
285 | foreach(RPC_List::$channel as $channel) | |
286 | { | |
287 | echo "<tr>"; | |
288 | echo "<td>".$channel['name']."</td>"; | |
289 | echo "<td>".$channel['creation_time']."</td>"; | |
290 | echo "<td>".$channel['num_users']."</td>"; | |
291 | $topic = (isset($channel['topic'])) ? $channel['topic'] : ""; | |
292 | echo "<td>".$topic."</td>"; | |
293 | $setby = (isset($channel['topic'])) ? "By ".$channel['topic_set_by'] .", at ".$channel['topic_set_at'] : ""; | |
294 | echo "<td>".$setby."</td>"; | |
295 | $modes = (isset($channel['modes'])) ? "+" . $channel['modes'] : "<none>"; | |
296 | echo "<td>".$modes."</td>"; | |
297 | } | |
298 | ?></table></div></div> | |
299 | ||
300 | ||
301 | <div class="tab-content\"> | |
302 | <div id="TKL" data-tab-content> | |
76200e36 | 303 | |
ef866d8c | 304 | <table class='users_overview'> |
76200e36 | 305 | <form action="" method="post"> |
26971737 | 306 | <th><input type="checkbox" label='selectall' onClick="toggle_tkl(this)" />Select all</th> |
ef866d8c VP |
307 | <th>Mask</th> |
308 | <th>Type</th> | |
309 | <th>Set By</th> | |
310 | <th>Set On</th> | |
311 | <th>Expires</th> | |
312 | <th>Duration</th> | |
313 | <th>Reason</th> | |
314 | ||
315 | <?php | |
316 | foreach(RPC_List::$tkl as $tkl) | |
317 | { | |
318 | echo "<tr>"; | |
76200e36 | 319 | echo "<td><input type=\"checkbox\" value='" . base64_encode($tkl['name']).",".base64_encode($tkl['type']) . "' name=\"tklch[]\"></td>"; |
ef866d8c VP |
320 | echo "<td>".$tkl['name']."</td>"; |
321 | echo "<td>".$tkl['type_string']."</td>"; | |
322 | echo "<td>".$tkl['set_by']."</td>"; | |
323 | echo "<td>".$tkl['set_at_string']."</td>"; | |
324 | echo "<td>".$tkl['expire_at_string']."</td>"; | |
325 | echo "<td>".$tkl['duration_string']."</td>"; | |
326 | echo "<td>".$tkl['reason']."</td>"; | |
327 | } | |
76200e36 | 328 | ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div> |
ef866d8c VP |
329 | |
330 | ||
331 | <div class="tab-content\"> | |
332 | <div id="Spamfilter" data-tab-content> | |
333 | <p></p> | |
334 | <table class='users_overview'> | |
26971737 VP |
335 | <form action="" method="post"> |
336 | <th><input type="checkbox" label='selectall' onClick="toggle_sf(this)" />Select all</th> | |
ef866d8c VP |
337 | <th>Mask</th> |
338 | <th>Type</th> | |
339 | <th>Set By</th> | |
340 | <th>Set On</th> | |
341 | <th>Expires</th> | |
342 | <th>Duration</th> | |
343 | <th>Match Type</th> | |
344 | <th>Action</th> | |
345 | <th>Action Duration</th> | |
346 | <th>Target</th> | |
347 | <th>Reason</th> | |
348 | ||
349 | <?php | |
350 | foreach(RPC_List::$spamfilter as $sf) | |
351 | { | |
352 | echo "<tr>"; | |
26971737 | 353 | echo "<td><input type=\"checkbox\" value='" . base64_encode($sf['name']).",".base64_encode($sf['match_type']).",".base64_encode($sf['spamfilter_targets']).",".base64_encode($sf['ban_action']) . "' name=\"sf[]\"></td>"; |
ef866d8c VP |
354 | echo "<td>".$sf['name']."</td>"; |
355 | echo "<td>".$sf['type_string']."</td>"; | |
356 | echo "<td>".$sf['set_by']."</td>"; | |
357 | echo "<td>".$sf['set_at_string']."</td>"; | |
358 | echo "<td>".$sf['expire_at_string']."</td>"; | |
359 | echo "<td>".$sf['duration_string']."</td>"; | |
360 | echo "<td>".$sf['match_type']."</td>"; | |
361 | echo "<td>".$sf['ban_action']."</td>"; | |
362 | echo "<td>".$sf['ban_duration_string']."</td>"; | |
363 | for ($i = 0, $targs = ""; ($c = $sf['spamfilter_targets'][$i]); $i++) | |
364 | { | |
365 | if ($c == "c") | |
366 | $targs .= "Channel, "; | |
367 | else if ($c == "p") | |
368 | $targs .= "Private,"; | |
369 | else if ($c == "n") | |
370 | $targs .= "Notice, "; | |
371 | else if ($c == "N") | |
372 | $targs .= "Channel notice, "; | |
373 | else if ($c == "P") | |
374 | $targs .= "Part message, "; | |
375 | else if ($c == "q") | |
376 | $targs .= "Quit message, "; | |
377 | else if ($c == "d") | |
378 | $targs .= "DCC filename, "; | |
379 | else if ($c == "a") | |
380 | $targs .= "Away message, "; | |
381 | else if ($c == "t") | |
382 | $targs .= "Channel topic, "; | |
383 | else if ($c == "T") | |
384 | $targs .= "MessageTag, "; | |
385 | else if ($c == "u") | |
386 | $targs .= "Usermask, "; | |
387 | ||
388 | $targs = rtrim($targs,", "); | |
389 | } | |
390 | echo "<td>".$targs."</td>"; | |
391 | echo "<td>".$sf['reason']."</td>"; | |
392 | ||
393 | } | |
26971737 VP |
394 | ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div> |
395 | ||
396 | ||
397 | ||
398 | <div class="tab-content\"> | |
399 | <div id="News" data-tab-content> | |
400 | <iframe style="border:none;" height="1000" width="600" data-tweet-url="https://twitter.com/Unreal_IRCd" src="data:text/html;charset=utf-8,%3Ca%20class%3D%22twitter-timeline%22%20href%3D%22https%3A//twitter.com/Unreal_IRCd%3Fref_src%3Dtwsrc%255Etfw%22%3ETweets%20by%20Unreal_IRCd%3C/a%3E%0A%3Cscript%20async%20src%3D%22https%3A//platform.twitter.com/widgets.js%22%20charset%3D%22utf-8%22%3E%3C/script%3E%0A%3Cstyle%3Ehtml%7Boverflow%3Ahidden%20%21important%3B%7D%3C/style%3E"></iframe> | |
401 | <iframe style="border:none;" height="1000" width="600" data-tweet-url="https://twitter.com/irc_stats" src="data:text/html;charset=utf-8,%3Ca%20class%3D%22twitter-timeline%22%20href%3D%22https%3A//twitter.com/irc_stats%3Fref_src%3Dtwsrc%255Etfw%22%3ETweets%20by%20IRC%20Stats%3C/a%3E%0A%3Cscript%20async%20src%3D%22https%3A//platform.twitter.com/widgets.js%22%20charset%3D%22utf-8%22%3E%3C/script%3E%0A%3Cstyle%3Ehtml%7Boverflow%3Ahidden%20%21important%3B%7D%3C/style%3E"></iframe> | |
402 | </div></div> | |
ef866d8c | 403 | |
896b6cdc | 404 | </body> |