2 <title
>UnrealIRCd Panel
</title
>
3 <link rel
="icon" type
="image/x-icon" href
="/img/favicon.ico">
4 <link href
="css/unrealircd-admin.css" rel
="stylesheet">
5 <body
class="body-for-sticky">
6 <div id
="headerContainer">
7 <h2
><a href
="">UnrealIRCd
<small
>Administration Panel
</small
></a
></h2
></div
>
8 <script src
="js/unrealircd-admin.js" defer
></script
>
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
>
15 <a data
-tab
-target
="#News" href
="#News">News
</a
>
18 define('UPATH', dirname(__FILE__
));
19 require_once "config.php";
20 require_once UPATH
. '/vendor/autoload.php';
21 require_once "connection.php";
22 require_once "Classes/class-log.php";
23 require_once "Classes/class-message.php";
24 require_once "Classes/class-rpc.php";
29 if (!($bantype = $_POST['bantype']))
32 else if (!($users = $_POST["userch"]))
34 /* check if this came from our Server Bans tab. */
35 if (!($iphost = $_POST['tkl_add']))
36 Message
::Fail("No user was specified");
41 $bantype == "gline" ||
42 $bantype == "gzline" ||
45 ) && strpos($iphost, "@") == false) // doesn't have full mask
46 $iphost = "*@" . $iphost;
48 $soft = ($_POST['soft']) ? true : false;
51 $iphost = "%" . $iphost;
52 /* duplicate code for now [= */
53 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
54 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
55 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
57 if (!$banlen_d && !$banlen_h && !$banlen_w)
63 $duration .= $banlen_w;
65 $duration .= $banlen_d;
67 $duration .= $banlen_h;
69 $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for ".rpc_convert_duration_string($duration);
70 $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason";
71 if ($rpc->serverban()->add($iphost, $bantype, $duration, $reason))
73 Message
::Success("Host / IP: $iphost has been $bantype" . "d
$msg_msg: $reason");
76 Message
::Fail("The $bantype against \"$iphost\" could not be added: $rpc->error");
79 else /* It came from the Users tab */
81 foreach ($_POST["userch"] as $user)
83 $user = base64_decode($user);
84 $bantype = (isset($_POST['bantype'])) ? $_POST['bantype'] : NULL;
85 if (!$bantype) /* shouldn't happen? */
87 Message
::Fail("An error occured");
90 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
91 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
92 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
95 if (!$banlen_d && !$banlen_h && !$banlen_w)
101 $duration .= $banlen_w;
103 $duration .= $banlen_d;
105 $duration .= $banlen_h;
108 $nick = $rpc->user()->get($user);
111 Message
::Fail("Could not find that user. Maybe they disconnected after you clicked this?");
115 $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for ".rpc_convert_duration_string($duration);
116 $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason";
117 if ($rpc->serverban()->add($user, $bantype, $duration, $reason))
120 Message
::Success($c->name
. " (*@".$c->hostname
.") has been $bantype" . "d
$msg_msg: $reason");
125 if (!empty($_POST['tklch']))
126 foreach ($_POST as $key => $value) {
127 foreach ($value as $tok) {
128 $tok = explode(",", $tok);
129 $ban = base64_decode($tok[0]);
130 $type = base64_decode($tok[1]);
131 if ($rpc->serverban()->delete($ban, $type))
132 Message
::Success("$type has been removed for $ban");
134 Message::Fail("Unable to remove
$type on
$ban: $rpc->error
");
138 if (!empty($_POST['sf']))
139 foreach ($_POST as $key => $value) {
140 foreach ($value as $tok) {
141 $tok = explode(",", $tok);
142 $name = base64_decode($tok[0]);
143 $match_type = base64_decode($tok[1]);
144 $spamfilter_targets = base64_decode($tok[2]);
145 $ban_action = base64_decode($tok[3]);
146 if ($rpc->spamfilter()->delete($name, $match_type, $spamfilter_targets, $ban_action))
147 Message::Success("Spamfilter on
$name has been removed
");
149 Message::Fail("Unable to remove spamfilter on
$name: $rpc->error
");
157 <div class="tab
-content\"
>
158 <div id
="overview" data
-tab
-content
class="active">
159 <table
class='unrealircd_overview'>
160 <th
>Chat Overview
</th
><th
></th
>
161 <tr
><td
><b
>Users
</b
></td
><td
><?php
echo count(RPC_List
::$user); ?></td
></tr
>
162 <tr
><td
><b
>Opers
</b
></td
><td
><?php
echo RPC_List
::$opercount; ?></td
></tr
>
163 <tr
><td
><b
>Services
</b
></td
><td
><?php
echo RPC_List
::$services_count; ?></td
></tr
>
164 <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
>
165 <tr
><td
><b
>Channels
</b
></td
><td
><?php
echo count(RPC_List
::$channel); ?></td
></tr
>
166 <tr
><td
><b
>Server bans
</b
></td
><td
><?php
echo count(RPC_List
::$tkl); ?></td
></tr
>
167 <tr
><td
><b
>Spamfilter entries
</b
></td
><td
><?php
echo count(RPC_List
::$spamfilter); ?></td
></tr
></th
>
170 <div
class="tab-content\">
171 <div id="Users
" data-tab-content>
172 <table class='users_filter'>
173 <th class="thuf
">Filter by: </th>
175 <form action="" method="post
">
176 Nick: <input name="uf_nick
" id="uf_nick
" type="text
">
177 <input class="cute_button2
" type="submit
" value="Search
">
181 <form action="" method="post
">
182 Hostname: <input name="uf_host
" id="uf_host
" type="text
">
183 <input class="cute_button2
" type="submit
" value="Search
">
187 <form action="" method="post
">
188 IP: <input name="uf_ip
" id="uf_ip
" type="text
">
189 <input class="cute_button2
" type="submit
" value="Search
">
193 <form action="" method="post
">
194 Account: <input name="uf_account
" id="uf_account
" type="text
">
195 <input class="cute_button2
" type="submit
" value="Search
">
201 if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']))
202 Message::Info("Listing users which match nick
: \"" . $_POST['uf_nick'] . "\"
");
204 if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']))
205 Message::Info("Listing users which match IP
: \"" . $_POST['uf_ip'] . "\"
");
207 if (isset($_POST['uf_host']) && strlen($_POST['uf_host']))
208 Message::Info("Listing users which match hostmask
: \"" . $_POST['uf_host'] . "\"
");
210 if (isset($_POST['uf_account']) && strlen($_POST['uf_account']))
211 Message::Info("Listing users which match account
: \"" . $_POST['uf_account'] . "\"
");
214 <table class='users_overview'>
215 <th><input type="checkbox
" label='selectall' onClick="toggle_user(this
)" />Select all</th>
220 <th>Usermodes<a href="https
://www.unrealircd.org/docs/User_modes" target="_blank">ℹ️</a></th>
223 <th
>Connected to
</th
>
224 <th
>Reputation
<a href
="https://www.unrealircd.org/docs/Reputation_score" target
="_blank">ℹ️
</a
></th
>
226 <form action
="" method
="post">
228 foreach(RPC_List
::$user as $user)
231 /* Some basic filtering for NICK */
232 if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']) &&
233 strpos(strtolower($user->name
), strtolower($_POST['uf_nick'])) !== 0 &&
234 strpos(strtolower($user->name
), strtolower($_POST['uf_nick'])) == false)
237 /* Some basic filtering for HOST */
238 if (isset($_POST['uf_host']) && strlen($_POST['uf_host']) &&
239 strpos(strtolower($user->hostname
), strtolower($_POST['uf_host'])) !== 0 &&
240 strpos(strtolower($user->hostname
), strtolower($_POST['uf_host'])) == false)
243 /* Some basic filtering for IP */
244 if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']) &&
245 strpos(strtolower($user->ip
), strtolower($_POST['uf_ip'])) !== 0 &&
246 strpos(strtolower($user->ip
), strtolower($_POST['uf_ip'])) == false)
249 /* Some basic filtering for ACCOUNT */
250 if (isset($_POST['uf_account']) && strlen($_POST['uf_account']) &&
251 strpos(strtolower($user->user
->account
), strtolower($_POST['uf_account'])) !== 0 &&
252 strpos(strtolower($user->user
->account
), strtolower($_POST['uf_account'])) == false)
256 echo "<td><input type=\"checkbox\" value='" . base64_encode($user->id
)."' name=\"userch[]\"></td>";
257 $isBot = (strpos($user->user
->modes
, "B") !== false) ? ' <span class="label">Bot</span>' : "";
258 echo "<td>".$user->name
.$isBot.'</td>';
259 echo "<td>".$user->id
."</td>";
260 echo "<td>".$user->hostname
." (".$user->ip
.")</td>";
261 $account = (isset($user->user
->account
)) ? $user->user
->account
: '<span class="label noaccount">None</span>';
262 echo "<td>".$account."</td>";
263 $modes = (isset($user->user
->modes
)) ? "+" . $user->user
->modes
: "<none>";
264 echo "<td>".$modes."</td>";
265 $oper = (isset($user->user
->operlogin
)) ? $user->user
->operlogin
." <span class=\"label operclass-label\">".$user->user
->operclass
."</span>" : "";
267 $oper = (strpos($user->user
->modes
, "S") !== false) ? '<span class="label secure-connection">Service</span>' : "";
268 echo "<td>".$oper."</td>";
269 $secure = (isset($user->tls
)) ? "<span class=\"label secure-connection\">Secure</span>" : "<span class=\"label noaccount\">Insecure</span>";
270 echo "<td>".$secure."</td>";
271 echo "<td>".$user->user
->servername
."</td>";
272 echo "<td>".$user->user
->reputation
."</td>";
275 <label
for="bantype">Apply action
: </label
><br
>
276 <select name
="bantype" id
="bantype">
277 <option value
=""></option
>
278 <optgroup label
="Bans">
279 <option value
="gline">GLine
</option
>
280 <option value
="gzline">GZLine
</option
>
284 <label
for="banlen_w">Duration
: </label
><br
>
285 <select name
="banlen_w" id
="banlen_w">
287 for ($i = 0; $i <= 56; $i++
)
290 echo "<option value=\"0w\"></option>";
293 $w = ($i == 1) ? "week" : "weeks";
294 echo "<option value=\"$i" . "w\"
>$i $w" . "</option>";
299 <select name
="banlen_d" id
="banlen_d">
301 for ($i = 0; $i <= 31; $i++
)
304 echo "<option value=\"0d\"></option>";
307 $d = ($i == 1) ? "day" : "days";
308 echo "<option value=\"$i" . "d\"
>$i $d" . "</option>";
313 <select name
="banlen_h" id
="banlen_h">
315 for ($i = 0; $i <= 24; $i++
)
318 echo "<option value=\"0d\"></option>";
321 $h = ($i == 1) ? "hour" : "hours";
322 echo "<option value=\"$i" . "h\"
>$i $h" . "</option>";
327 <br
><label
for="ban_reason">Reason
:<br
></label
>
328 <textarea name
="ban_reason" id
="ban_reason">No reason
</textarea
><br
>
329 <input
class="cute_button" type
="submit" value
="Apply">
334 <div
class="tab-content\">
335 <div id="Channels
" data-tab-content>
337 <table class='users_overview'>
346 foreach(RPC_List::$channel as $channel)
349 echo "<td
>".$channel->name."</td
>";
350 echo "<td
>".$channel->creation_time."</td
>";
351 echo "<td
>".$channel->num_users."</td
>";
352 $topic = (isset($channel->topic)) ? $channel->topic : "";
353 echo "<td
>".$topic."</td
>";
354 $setby = (isset($channel->topic)) ? "By
".$channel->topic_set_by .", at
".$channel->topic_set_at : "";
355 echo "<td
>".$setby."</td
>";
356 $modes = (isset($channel->modes)) ? "+
" . $channel->modes : "<none
>";
357 echo "<td
>".$modes."</td
>";
359 ?></table></div></div>
362 <div class="tab
-content\"
>
363 <div id
="TKL" data
-tab
-content
>
364 <div
class="tkl_add_boxheader">
367 <div
class="tkl_add_form">
369 <form action
="" method
="post">
370 <div
class="align_label">IP
/ Host
:</div
><input
class="input_text" type
="text" id
="tkl_add" name
="tkl_add"><br
>
371 <div
class="align_label">Ban Type
:</div
><select name
="bantype" id
="bantype">
372 <option value
=""></option
>
373 <optgroup label
="Bans">
374 <option value
="kline">Kill
Line (KLine
)</option
>
375 <option value
="gline">Global Kill
Line (GLine
)</option
>
376 <option value
="zline">Zap
Line (ZLine
)</option
>
377 <option value
="gzline">Global Zap
Line (GZLine
)</option
>
380 <optgroup label
="Restrictions">
381 <option value
="local-qline">Reserve Nick
Locally(QLine
)</option
>
382 <option value
="qline">Reserve Nick
Globally (QLine
)</option
>
383 <option value
="shun">Shun
</option
>
386 <optgroup label
="Settings">
387 <option value
="except">Global Exception (ELine
)</option
>
388 <option value
="local-exception">Local
Exception (ELine
)</option
>
391 <div
class="align_label"><label
for="banlen_w">Duration
: </label
></div
>
392 <select name
="banlen_w" id
="banlen_w">
394 for ($i = 0; $i <= 56; $i++
)
397 echo "<option value=\"0w\"></option>";
400 $w = ($i == 1) ? "week" : "weeks";
401 echo "<option value=\"$i" . "w\"
>$i $w" . "</option>";
406 <select name
="banlen_d" id
="banlen_d">
408 for ($i = 0; $i <= 31; $i++
)
411 echo "<option value=\"0d\"></option>";
414 $d = ($i == 1) ? "day" : "days";
415 echo "<option value=\"$i" . "d\"
>$i $d" . "</option>";
420 <select name
="banlen_h" id
="banlen_h">
422 for ($i = 0; $i <= 24; $i++
)
425 echo "<option value=\"0d\"></option>";
428 $h = ($i == 1) ? "hour" : "hours";
429 echo "<option value=\"$i" . "h\"
>$i $h" . "</option>";
434 <br
><div
class="align_label"><label
for="ban_reason">Reason
: </label
></div
>
435 <input
class="input_text" type
="text" id
="ban_reason" name
="ban_reason"><br
>
436 <input
class="input_text" type
="checkbox" id
="soft" name
="soft">Don
't affect logged-in users (soft)
437 <div class="align_right_button_tkl_add"><input class="cute_button" type="submit" id="submit" value="Submit"></div>
440 <table class='users_overview
'>
441 <form action="" method="post">
442 <th><input type="checkbox" label='selectall
' onClick="toggle_tkl(this)" />Select all</th>
452 foreach(RPC_List::$tkl as $tkl)
455 echo "<td><input type=\"checkbox\" value='" . base64_encode($tkl->name).",".base64_encode($tkl->type) . "' name=\"tklch[]\"></td>";
456 echo "<td>".$tkl->name."</td>";
457 echo "<td>".$tkl->type_string."</td>";
458 echo "<td>".$tkl->set_by."</td>";
459 echo "<td>".$tkl->set_at_string."</td>";
460 echo "<td>".$tkl->expire_at_string."</td>";
461 echo "<td>".$tkl->duration_string."</td>";
462 echo "<td>".$tkl->reason."</td>";
464 ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div>
467 <div class="tab-content\">
468 <div id="Spamfilter" data-tab-content>
470 <table class='users_overview
'>
471 <form action="" method="post">
472 <th><input type="checkbox" label='selectall
' onClick="toggle_sf(this)" />Select all</th>
481 <th>Action Duration</th>
486 foreach(RPC_List::$spamfilter as $sf)
489 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>";
490 echo "<td>".$sf->name."</td>";
491 echo "<td>".$sf->type_string."</td>";
492 echo "<td>".$sf->set_by."</td>";
493 echo "<td>".$sf->set_at_string."</td>";
494 echo "<td>".$sf->expire_at_string."</td>";
495 echo "<td>".$sf->duration_string."</td>";
496 echo "<td>".$sf->match_type."</td>";
497 echo "<td>".$sf->ban_action."</td>";
498 echo "<td>".$sf->ban_duration_string."</td>";
499 for ($i = 0, $targs = ""; $i < strlen($sf->spamfilter_targets); $i++)
501 $c = $sf->spamfilter_targets[$i];
503 $targs .= "Channel, ";
505 $targs .= "Private,";
507 $targs .= "Notice, ";
509 $targs .= "Channel notice, ";
511 $targs .= "Part message, ";
513 $targs .= "Quit message, ";
515 $targs .= "DCC filename, ";
517 $targs .= "Away message, ";
519 $targs .= "Channel topic, ";
521 $targs .= "MessageTag, ";
523 $targs .= "Usermask, ";
525 $targs = rtrim($targs,", ");
526 echo "<td>".$targs."</td>";
527 echo "<td>".$sf->reason."</td>";
530 ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div>
534 <div class="tab-content\">
535 <div id="News" data-tab-content>
536 <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>
537 <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>