]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame - index.php
Fix post paths for new files
[irc/unrealircd/unrealircd-webpanel.git] / index.php
CommitLineData
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
fe2a6f27 18require_once "misc/strings.php";
26971737 19define('UPATH', dirname(__FILE__));
fe2a6f27
VP
20
21define('RELATIVE_PATH', get_relative_path(UPATH));
03ddd26b
BM
22require_once "config.php";
23require_once UPATH . '/vendor/autoload.php';
24require_once "connection.php";
25require_once "Classes/class-log.php";
26require_once "Classes/class-message.php";
27require_once "Classes/class-rpc.php";
28
26971737 29do_log($_POST);
709b97f3 30
26971737 31if (!empty($_POST)) {
2fba9a82
VP
32
33 if ($sf = $_POST['sf_add']) // if it was a spamfilter entry
34 {
35 /* get targets */
36 $targets = []; // empty arrae
37 foreach($_POST as $key => $value)
38 {
39 if (substr($key, 0, 7) == "target_")
40 $targets[] = str_replace(["target_", "_"], ["", "-"], $key);
41 }
42 if (empty($targets))
43 Message::Fail("No target was specified");
44
45 if (!isset($_POST['sf_bantype']))
46 Message::Fail("No action was chosen");
47
48 else
49 {
50
51 $bantype = $_POST['sf_bantype'];
52 $targ_chars = "";
53 foreach($targets as $targ)
54 {
55 switch ($targ) {
56 case "channel":
57 $targ_chars .= "c";
58 break;
59 case "private":
60 $targ_chars .= "p";
61 break;
62 case "channel-notice":
63 $targ_chars .= "N";
64 break;
65 case "private-notice":
66 $targ_chars .= "n";
67 break;
68 case "part":
69 $targ_chars .= "P";
70 break;
71 case "quit":
72 $targ_chars .= "q";
73 break;
74 case "dcc":
75 $targ_chars .= "d";
76 break;
77 case "away":
78 $targ_chars .= "a";
79 break;
80 case "topic":
81 $targ_chars .= "t";
82 break;
83 case "messagetag":
84 $targ_chars .= "T";
85 break;
86 case "user":
87 $targ_chars .= "u";
88 break;
89 }
90 }
91 /* duplicate code for now [= */
92 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
93 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
94 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
95 $duration = "";
96 if (!$banlen_d && !$banlen_h && !$banlen_w)
97 $duration .= "0";
98
99 else
100 {
101 if ($banlen_w)
102 $duration .= $banlen_w;
103 if ($banlen_d)
104 $duration .= $banlen_d;
105 if ($banlen_h)
106 $duration .= $banlen_h;
107 }
108 $match_type = $_POST['matchtype']; // should default to 'simple'
109 $reason = isset($_POST['ban_reason']) ? $_POST['ban_reason'] : "No reason";
110 $soft = (isset($_POST['soft'])) ? true : false;
111 if ($soft)
112 $targ_chars = "%" . $targ_chars;
113 if ($rpc->spamfilter()->add($sf, $match_type, $targ_chars, $bantype, $duration, $reason))
114 Message::Success("Added spamfilter entry \"$sf\" [match type: $match_type] [targets: $targ_chars] [reason: $reason]");
115 else
116 Message::Fail("Could not add spamfilter entry \"$sf\" [match type: $match_type] [targets: $targ_chars] [reason: $reason]: $rpc->error");
117 }
118
119 }
120
121 else if (!($bantype = $_POST['bantype'])) // if it was a ban entry
4a0980ad
VP
122 {
123 }
124 else if (!($users = $_POST["userch"]))
125 {
126 /* check if this came from our Server Bans tab. */
127 if (!($iphost = $_POST['tkl_add']))
128 Message::Fail("No user was specified");
26971737 129
4a0980ad
VP
130 else /* It did */
131 {
dc961139
VP
132 if ((
133 $bantype == "gline" ||
134 $bantype == "gzline" ||
135 $bantype == "shun" ||
136 $bantype == "eline"
137 ) && strpos($iphost, "@") == false) // doesn't have full mask
4a0980ad 138 $iphost = "*@" . $iphost;
dc961139
VP
139
140 $soft = ($_POST['soft']) ? true : false;
141
142 if ($soft)
143 $iphost = "%" . $iphost;
4a0980ad
VP
144 /* duplicate code for now [= */
145 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
146 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
147 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
148 $duration = "";
149 if (!$banlen_d && !$banlen_h && !$banlen_w)
150 $duration .= "0";
151
152 else
153 {
154 if ($banlen_w)
155 $duration .= $banlen_w;
156 if ($banlen_d)
157 $duration .= $banlen_d;
158 if ($banlen_h)
159 $duration .= $banlen_h;
160 }
161 $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for ".rpc_convert_duration_string($duration);
162 $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason";
163 if ($rpc->serverban()->add($iphost, $bantype, $duration, $reason))
164 {
165 Message::Success("Host / IP: $iphost has been $bantype" . "d $msg_msg: $reason");
166 }
167 else
dc961139 168 Message::Fail("The $bantype against \"$iphost\" could not be added: $rpc->error");
4a0980ad
VP
169 }
170 }
171 else /* It came from the Users tab */
172 {
173 foreach ($_POST["userch"] as $user)
174 {
26971737 175 $user = base64_decode($user);
b063b4b2 176 $bantype = (isset($_POST['bantype'])) ? $_POST['bantype'] : NULL;
4a0980ad 177 if (!$bantype) /* shouldn't happen? */
b063b4b2
VP
178 {
179 Message::Fail("An error occured");
180 return;
181 }
182 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
183 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
184 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
185
186 $duration = "";
187 if (!$banlen_d && !$banlen_h && !$banlen_w)
188 $duration .= "0";
189
190 else
191 {
192 if ($banlen_w)
193 $duration .= $banlen_w;
194 if ($banlen_d)
195 $duration .= $banlen_d;
196 if ($banlen_h)
197 $duration .= $banlen_h;
198 }
199
0d0013bb 200 $nick = $rpc->user()->get($user);
b063b4b2
VP
201 if (!$nick)
202 {
203 Message::Fail("Could not find that user. Maybe they disconnected after you clicked this?");
204 return;
205 }
206
ffd01497 207 $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for ".rpc_convert_duration_string($duration);
b3898fc7 208 $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason";
0d0013bb 209 if ($rpc->serverban()->add($user, $bantype, $duration, $reason))
b063b4b2 210 {
0d0013bb
BM
211 $c = $nick->client;
212 Message::Success($c->name . " (*@".$c->hostname.") has been $bantype" . "d $msg_msg: $reason");
b063b4b2 213 }
76200e36
VP
214 }
215 }
216
26971737
VP
217 if (!empty($_POST['tklch']))
218 foreach ($_POST as $key => $value) {
219 foreach ($value as $tok) {
220 $tok = explode(",", $tok);
17311eb0
BM
221 $ban = base64_decode($tok[0]);
222 $type = base64_decode($tok[1]);
223 if ($rpc->serverban()->delete($ban, $type))
224 Message::Success("$type has been removed for $ban");
225 else
226 Message::Fail("Unable to remove $type on $ban: $rpc->error");
26971737
VP
227 }
228 }
229
230 if (!empty($_POST['sf']))
231 foreach ($_POST as $key => $value) {
232 foreach ($value as $tok) {
233 $tok = explode(",", $tok);
17311eb0
BM
234 $name = base64_decode($tok[0]);
235 $match_type = base64_decode($tok[1]);
236 $spamfilter_targets = base64_decode($tok[2]);
237 $ban_action = base64_decode($tok[3]);
238 if ($rpc->spamfilter()->delete($name, $match_type, $spamfilter_targets, $ban_action))
239 Message::Success("Spamfilter on $name has been removed");
240 else
241 Message::Fail("Unable to remove spamfilter on $name: $rpc->error");
26971737
VP
242 }
243 }
244}
245
b063b4b2 246rpc_pop_lists();
709b97f3 247?>
82f5bcbf
VP
248
249<div class="tab-content\">
250<div id="overview" data-tab-content class="active">
896b6cdc
VP
251 <table class='unrealircd_overview'>
252 <th>Chat Overview</th><th></th>
253 <tr><td><b>Users</b></td><td><?php echo count(RPC_List::$user); ?></td></tr>
254 <tr><td><b>Opers</b></td><td><?php echo RPC_List::$opercount; ?></td></tr>
255 <tr><td><b>Services</b></td><td><?php echo RPC_List::$services_count; ?></td></tr>
256 <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>
257 <tr><td><b>Channels</b></td><td><?php echo count(RPC_List::$channel); ?></td></tr>
258 <tr><td><b>Server bans</b></td><td><?php echo count(RPC_List::$tkl); ?></td></tr>
259 <tr><td><b>Spamfilter entries</b></td><td><?php echo count(RPC_List::$spamfilter); ?></td></tr></th>
260 </table></div></div>
b3898fc7 261
ef866d8c
VP
262 <div class="tab-content\">
263 <div id="Users" data-tab-content>
4d834e71
VP
264 <table class='users_filter'>
265 <th class="thuf">Filter by: </th>
266 <th>
267 <form action="" method="post">
268 Nick: <input name="uf_nick" id="uf_nick" type="text">
269 <input class="cute_button2" type="submit" value="Search">
270 </form>
271 </th>
272 <th>
273 <form action="" method="post">
274 Hostname: <input name="uf_host" id="uf_host" type="text">
275 <input class="cute_button2" type="submit" value="Search">
276 </form>
277 </th>
278 <th>
279 <form action="" method="post">
280 IP: <input name="uf_ip" id="uf_ip" type="text">
281 <input class="cute_button2" type="submit" value="Search">
282 </form>
283 </th>
284 <th class="thuffer">
babf1a0e 285 <form action="" method="post">
4d834e71
VP
286 Account: <input name="uf_account" id="uf_account" type="text">
287 <input class="cute_button2" type="submit" value="Search">
288 </form>
289 </th>
290 </form>
291 </table>
292 <?php
babf1a0e
VP
293 if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']))
294 Message::Info("Listing users which match nick: \"" . $_POST['uf_nick'] . "\"");
295
296 if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']))
f63cfca8 297 Message::Info("Listing users which match IP: \"" . $_POST['uf_ip'] . "\"");
babf1a0e
VP
298
299 if (isset($_POST['uf_host']) && strlen($_POST['uf_host']))
300 Message::Info("Listing users which match hostmask: \"" . $_POST['uf_host'] . "\"");
301
302 if (isset($_POST['uf_account']) && strlen($_POST['uf_account']))
303 Message::Info("Listing users which match account: \"" . $_POST['uf_account'] . "\"");
304
4d834e71 305 ?>
896b6cdc 306 <table class='users_overview'>
26971737 307 <th><input type="checkbox" label='selectall' onClick="toggle_user(this)" />Select all</th>
896b6cdc
VP
308 <th>Nick</th>
309 <th>UID</th>
ef866d8c 310 <th>Host / IP</th>
896b6cdc 311 <th>Account</th>
02c4da66 312 <th>Usermodes<a href="https://www.unrealircd.org/docs/User_modes" target="_blank">ℹ️</a></th>
896b6cdc
VP
313 <th>Oper</th>
314 <th>Secure</th>
315 <th>Connected to</th>
02c4da66 316 <th>Reputation <a href="https://www.unrealircd.org/docs/Reputation_score" target="_blank">ℹ️</a></th>
896b6cdc 317
b3898fc7 318 <form action="" method="post">
896b6cdc
VP
319 <?php
320 foreach(RPC_List::$user as $user)
321 {
4d834e71 322
babf1a0e 323 /* Some basic filtering for NICK */
4d834e71 324 if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']) &&
03ddd26b
BM
325 strpos(strtolower($user->name), strtolower($_POST['uf_nick'])) !== 0 &&
326 strpos(strtolower($user->name), strtolower($_POST['uf_nick'])) == false)
4d834e71
VP
327 continue;
328
babf1a0e
VP
329 /* Some basic filtering for HOST */
330 if (isset($_POST['uf_host']) && strlen($_POST['uf_host']) &&
03ddd26b
BM
331 strpos(strtolower($user->hostname), strtolower($_POST['uf_host'])) !== 0 &&
332 strpos(strtolower($user->hostname), strtolower($_POST['uf_host'])) == false)
babf1a0e
VP
333 continue;
334
335 /* Some basic filtering for IP */
336 if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']) &&
03ddd26b
BM
337 strpos(strtolower($user->ip), strtolower($_POST['uf_ip'])) !== 0 &&
338 strpos(strtolower($user->ip), strtolower($_POST['uf_ip'])) == false)
babf1a0e
VP
339 continue;
340
341 /* Some basic filtering for ACCOUNT */
342 if (isset($_POST['uf_account']) && strlen($_POST['uf_account']) &&
03ddd26b
BM
343 strpos(strtolower($user->user->account), strtolower($_POST['uf_account'])) !== 0 &&
344 strpos(strtolower($user->user->account), strtolower($_POST['uf_account'])) == false)
babf1a0e
VP
345 continue;
346
896b6cdc 347 echo "<tr>";
03ddd26b
BM
348 echo "<td><input type=\"checkbox\" value='" . base64_encode($user->id)."' name=\"userch[]\"></td>";
349 $isBot = (strpos($user->user->modes, "B") !== false) ? ' <span class="label">Bot</span>' : "";
350 echo "<td>".$user->name.$isBot.'</td>';
351 echo "<td>".$user->id."</td>";
352 echo "<td>".$user->hostname." (".$user->ip.")</td>";
3f487ee1 353 $account = (isset($user->user->account)) ? $user->user->account : '<span class="label bluelabel ">None</span>';
896b6cdc 354 echo "<td>".$account."</td>";
03ddd26b 355 $modes = (isset($user->user->modes)) ? "+" . $user->user->modes : "<none>";
896b6cdc 356 echo "<td>".$modes."</td>";
4cba2326 357 $oper = (isset($user->user->operlogin)) ? $user->user->operlogin." <span class=\"label bluelabel\">".$user->user->operclass."</span>" : "";
2494eefd 358 if (!strlen($oper))
03ddd26b 359 $oper = (strpos($user->user->modes, "S") !== false) ? '<span class="label secure-connection">Service</span>' : "";
896b6cdc 360 echo "<td>".$oper."</td>";
3f487ee1 361 $secure = (isset($user->tls)) ? "<span class=\"label secure-connection\">Secure</span>" : "<span class=\"label redlabel\">Insecure</span>";
896b6cdc 362 echo "<td>".$secure."</td>";
03ddd26b
BM
363 echo "<td>".$user->user->servername."</td>";
364 echo "<td>".$user->user->reputation."</td>";
896b6cdc 365 }
26971737 366 ?></table>
1d7e7ff8 367 <label for="bantype">Apply action: </label><br>
26971737
VP
368 <select name="bantype" id="bantype">
369 <option value=""></option>
370 <optgroup label="Bans">
371 <option value="gline">GLine</option>
372 <option value="gzline">GZLine</option>
373 </optgroup>
374 </select>
375 <br>
1d7e7ff8 376 <label for="banlen_w">Duration: </label><br>
26971737
VP
377 <select name="banlen_w" id="banlen_w">
378 <?php
379 for ($i = 0; $i <= 56; $i++)
380 {
381 if (!$i)
382 echo "<option value=\"0w\"></option>";
383 else
384 {
385 $w = ($i == 1) ? "week" : "weeks";
386 echo "<option value=\"$i" . "w\">$i $w" . "</option>";
387 }
388 }
389 ?>
390 </select>
391 <select name="banlen_d" id="banlen_d">
392 <?php
393 for ($i = 0; $i <= 31; $i++)
394 {
395 if (!$i)
396 echo "<option value=\"0d\"></option>";
397 else
398 {
399 $d = ($i == 1) ? "day" : "days";
400 echo "<option value=\"$i" . "d\">$i $d" . "</option>";
401 }
402 }
403 ?>
404 </select>
405 <select name="banlen_h" id="banlen_h">
406 <?php
407 for ($i = 0; $i <= 24; $i++)
408 {
409 if (!$i)
410 echo "<option value=\"0d\"></option>";
411 else
412 {
413 $h = ($i == 1) ? "hour" : "hours";
414 echo "<option value=\"$i" . "h\">$i $h" . "</option>";
415 }
416 }
417 ?>
418 </select>
1d7e7ff8
VP
419 <br><label for="ban_reason">Reason:<br></label>
420 <textarea name="ban_reason" id="ban_reason">No reason</textarea><br>
421 <input class="cute_button" type="submit" value="Apply">
26971737
VP
422 </form>
423
424 </div></div>
82f5bcbf 425
ef866d8c
VP
426 <div class="tab-content\">
427 <div id="Channels" data-tab-content>
428 <p></p>
429 <table class='users_overview'>
430 <th>Name</th>
431 <th>Created</th>
432 <th>User count</th>
433 <th>Topic</th>
434 <th>Topic Set</th>
435 <th>Modes</th>
436
437 <?php
438 foreach(RPC_List::$channel as $channel)
439 {
440 echo "<tr>";
03ddd26b
BM
441 echo "<td>".$channel->name."</td>";
442 echo "<td>".$channel->creation_time."</td>";
443 echo "<td>".$channel->num_users."</td>";
444 $topic = (isset($channel->topic)) ? $channel->topic : "";
ef866d8c 445 echo "<td>".$topic."</td>";
03ddd26b 446 $setby = (isset($channel->topic)) ? "By ".$channel->topic_set_by .", at ".$channel->topic_set_at : "";
ef866d8c 447 echo "<td>".$setby."</td>";
03ddd26b 448 $modes = (isset($channel->modes)) ? "+" . $channel->modes : "<none>";
ef866d8c
VP
449 echo "<td>".$modes."</td>";
450 }
451 ?></table></div></div>
452
453
454 <div class="tab-content\">
455 <div id="TKL" data-tab-content>
35ccb286
VP
456 <div class="tkl_add_boxheader">
457 Add Server Ban
458 </div>
459 <div class="tkl_add_form">
460
461 <form action="" method="post">
462 <div class="align_label">IP / Host:</div><input class="input_text" type="text" id="tkl_add" name="tkl_add"><br>
463 <div class="align_label">Ban Type:</div><select name="bantype" id="bantype">
464 <option value=""></option>
465 <optgroup label="Bans">
466 <option value="kline">Kill Line (KLine)</option>
467 <option value="gline">Global Kill Line (GLine)</option>
468 <option value="zline">Zap Line (ZLine)</option>
469 <option value="gzline">Global Zap Line (GZLine)</option>
470
471 </optgroup>
472 <optgroup label="Restrictions">
473 <option value="local-qline">Reserve Nick Locally(QLine)</option>
474 <option value="qline">Reserve Nick Globally (QLine)</option>
475 <option value="shun">Shun</option>
476
477 </optgroup>
478 <optgroup label="Settings">
479 <option value="except">Global Exception (ELine)</option>
480 <option value="local-exception">Local Exception (ELine)</option>
481 </optgroup>
482 </select><br>
483 <div class="align_label"><label for="banlen_w">Duration: </label></div>
484 <select name="banlen_w" id="banlen_w">
485 <?php
486 for ($i = 0; $i <= 56; $i++)
487 {
488 if (!$i)
489 echo "<option value=\"0w\"></option>";
490 else
491 {
492 $w = ($i == 1) ? "week" : "weeks";
493 echo "<option value=\"$i" . "w\">$i $w" . "</option>";
494 }
495 }
496 ?>
497 </select>
498 <select name="banlen_d" id="banlen_d">
499 <?php
500 for ($i = 0; $i <= 31; $i++)
501 {
502 if (!$i)
503 echo "<option value=\"0d\"></option>";
504 else
505 {
506 $d = ($i == 1) ? "day" : "days";
507 echo "<option value=\"$i" . "d\">$i $d" . "</option>";
508 }
509 }
510 ?>
511 </select>
512 <select name="banlen_h" id="banlen_h">
513 <?php
514 for ($i = 0; $i <= 24; $i++)
515 {
516 if (!$i)
517 echo "<option value=\"0d\"></option>";
518 else
519 {
520 $h = ($i == 1) ? "hour" : "hours";
521 echo "<option value=\"$i" . "h\">$i $h" . "</option>";
522 }
523 }
524 ?>
525 </select>
526 <br><div class="align_label"><label for="ban_reason">Reason: </label></div>
527 <input class="input_text" type="text" id="ban_reason" name="ban_reason"><br>
dc961139 528 <input class="input_text" type="checkbox" id="soft" name="soft">Don't affect logged-in users (soft)
35ccb286
VP
529 <div class="align_right_button_tkl_add"><input class="cute_button" type="submit" id="submit" value="Submit"></div>
530 </form>
531 </div>
ef866d8c 532 <table class='users_overview'>
76200e36 533 <form action="" method="post">
26971737 534 <th><input type="checkbox" label='selectall' onClick="toggle_tkl(this)" />Select all</th>
ef866d8c
VP
535 <th>Mask</th>
536 <th>Type</th>
537 <th>Set By</th>
538 <th>Set On</th>
539 <th>Expires</th>
540 <th>Duration</th>
541 <th>Reason</th>
542
543 <?php
544 foreach(RPC_List::$tkl as $tkl)
545 {
546 echo "<tr>";
03ddd26b
BM
547 echo "<td><input type=\"checkbox\" value='" . base64_encode($tkl->name).",".base64_encode($tkl->type) . "' name=\"tklch[]\"></td>";
548 echo "<td>".$tkl->name."</td>";
549 echo "<td>".$tkl->type_string."</td>";
550 echo "<td>".$tkl->set_by."</td>";
551 echo "<td>".$tkl->set_at_string."</td>";
552 echo "<td>".$tkl->expire_at_string."</td>";
553 echo "<td>".$tkl->duration_string."</td>";
554 echo "<td>".$tkl->reason."</td>";
ef866d8c 555 }
76200e36 556 ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div>
ef866d8c
VP
557
558
559 <div class="tab-content\">
560 <div id="Spamfilter" data-tab-content>
561 <p></p>
2fba9a82
VP
562 <div class="tkl_add_boxheader">
563 Add Spamfilter Entry
564 </div>
565 <div class="tkl_add_form">
566
567 <form action="" method="post">
568 <div class="align_label">Entry: </div><input class="input_text" type="text" id="sf_add" name="sf_add"><br>
569 <div class="align_label">MatchType: </div><select name="matchtype" id="matchtype">
570 <option value="simple">Simple</option>
571 <option value="regex">Regular Expression</option>
572 </select><br>
573 <div class="align_label">Action: </div><select name="sf_bantype" id="sf_bantype">
574 <option value=""></option>
575 <optgroup label="Bans">
576 <option value="kline">Kill Line (KLine)</option>
577 <option value="gline">Global Kill Line (GLine)</option>
578 <option value="zline">Zap Line (ZLine)</option>
579 <option value="gzline">Global Zap Line (GZLine)</option>
580
581 </optgroup>
582 <optgroup label="Restrictions">
583 <option value="tempshun">Temporary Shun (Session only)</option>
584 <option value="shun">Shun</option>
585 <option value="block">Block</option>
586 <option value="dccblock">DCC Block</option>
587 <option value="viruschan">Send to "Virus Chan"</option>
588 </optgroup>
589 <optgroup label="Other">
590 <option value="warn">Warn the user</option>
591 </optgroup>
592 </select><br>
593
594 <div class="align_label"><label for="banlen_w">Targets: </label></div>
595 <input type="checkbox" class="input_text" id="target_channel" name="target_channel">Channel messages<br>
596 <div class="align_label"><label></label></div><input type="checkbox" class="input_text" id="target_private" name="target_private">Private messages<br>
597 <div class="align_label"><label></label></div><input type="checkbox" class="input_text" id="target_channel_notice" name="target_channel_notice">Channel notices<br>
598 <div class="align_label"><label></label></div><input type="checkbox" class="input_text" id="target_private_notice" name="target_private_notice">Private notices<br>
599 <div class="align_label"><label></label></div><input type="checkbox" class="input_text" id="target_part" name="target_part">Part reason<br>
600 <div class="align_label"><label></label></div><input type="checkbox" class="input_text" id="target_dcc" name="target_dcc">DCC Filename<br>
601 <div class="align_label"><label></label></div><input type="checkbox" class="input_text" id="target_away" name="target_away">Away messages<br>
602 <div class="align_label"><label></label></div><input type="checkbox" class="input_text" id="target_topic" name="target_topic">Channel topic<br>
603 <div class="align_label"><label></label></div><input type="checkbox" class="input_text" id="target_messagetag" name="target_messagetag">MessageTags<br>
604 <div class="align_label"><label></label></div><input type="checkbox" class="input_text" id="target_user" name="target_user">Userhost (nick!user@host:realname)<br>
605 <div class="align_label"><label for="banlen_w">Duration: </label></div>
606 <select name="banlen_w" id="banlen_w">
607 <?php
608 for ($i = 0; $i <= 56; $i++)
609 {
610 if (!$i)
611 echo "<option value=\"0w\"></option>";
612 else
613 {
614 $w = ($i == 1) ? "week" : "weeks";
615 echo "<option value=\"$i" . "w\">$i $w" . "</option>";
616 }
617 }
618 ?>
619 </select>
620 <select name="banlen_d" id="banlen_d">
621 <?php
622 for ($i = 0; $i <= 31; $i++)
623 {
624 if (!$i)
625 echo "<option value=\"0d\"></option>";
626 else
627 {
628 $d = ($i == 1) ? "day" : "days";
629 echo "<option value=\"$i" . "d\">$i $d" . "</option>";
630 }
631 }
632 ?>
633 </select>
634 <select name="banlen_h" id="banlen_h">
635 <?php
636 for ($i = 0; $i <= 24; $i++)
637 {
638 if (!$i)
639 echo "<option value=\"0d\"></option>";
640 else
641 {
642 $h = ($i == 1) ? "hour" : "hours";
643 echo "<option value=\"$i" . "h\">$i $h" . "</option>";
644 }
645 }
646 ?>
647 </select>
648 <br><div class="align_label"><label for="ban_reason">Reason: </label></div>
649 <input class="input_text" type="text" id="ban_reason" name="ban_reason"><br>
650 <input class="input_text" type="checkbox" id="soft" name="soft">Don't affect logged-in users (soft)
651 <div class="align_right_button_tkl_add"><input class="cute_button" type="submit" id="submit" value="Submit"></div>
652 </form>
653 </div>
ef866d8c 654 <table class='users_overview'>
26971737
VP
655 <form action="" method="post">
656 <th><input type="checkbox" label='selectall' onClick="toggle_sf(this)" />Select all</th>
ef866d8c
VP
657 <th>Mask</th>
658 <th>Type</th>
659 <th>Set By</th>
660 <th>Set On</th>
661 <th>Expires</th>
662 <th>Duration</th>
663 <th>Match Type</th>
664 <th>Action</th>
665 <th>Action Duration</th>
666 <th>Target</th>
667 <th>Reason</th>
668
669 <?php
670 foreach(RPC_List::$spamfilter as $sf)
671 {
672 echo "<tr>";
03ddd26b
BM
673 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>";
674 echo "<td>".$sf->name."</td>";
675 echo "<td>".$sf->type_string."</td>";
676 echo "<td>".$sf->set_by."</td>";
677 echo "<td>".$sf->set_at_string."</td>";
678 echo "<td>".$sf->expire_at_string."</td>";
679 echo "<td>".$sf->duration_string."</td>";
680 echo "<td>".$sf->match_type."</td>";
681 echo "<td>".$sf->ban_action."</td>";
682 echo "<td>".$sf->ban_duration_string."</td>";
683 for ($i = 0, $targs = ""; $i < strlen($sf->spamfilter_targets); $i++)
ef866d8c 684 {
03ddd26b 685 $c = $sf->spamfilter_targets[$i];
ef866d8c
VP
686 if ($c == "c")
687 $targs .= "Channel, ";
688 else if ($c == "p")
689 $targs .= "Private,";
690 else if ($c == "n")
691 $targs .= "Notice, ";
692 else if ($c == "N")
693 $targs .= "Channel notice, ";
694 else if ($c == "P")
695 $targs .= "Part message, ";
696 else if ($c == "q")
697 $targs .= "Quit message, ";
698 else if ($c == "d")
699 $targs .= "DCC filename, ";
700 else if ($c == "a")
701 $targs .= "Away message, ";
702 else if ($c == "t")
703 $targs .= "Channel topic, ";
704 else if ($c == "T")
705 $targs .= "MessageTag, ";
706 else if ($c == "u")
707 $targs .= "Usermask, ";
ef866d8c 708 }
03ddd26b 709 $targs = rtrim($targs,", ");
ef866d8c 710 echo "<td>".$targs."</td>";
03ddd26b 711 echo "<td>".$sf->reason."</td>";
ef866d8c
VP
712
713 }
26971737
VP
714 ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div>
715
716
717
718 <div class="tab-content\">
719 <div id="News" data-tab-content>
720 <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>
721 <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>
722 </div></div>
ef866d8c 723
896b6cdc 724</body>