]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame - index.php
Update README.md
[irc/unrealircd/unrealircd-webpanel.git] / index.php
CommitLineData
896b6cdc 1<!DOCTYPE html>
26971737 2<link rel="icon" type="image/x-icon" href="/img/favicon.ico">
46b1c955 3<link href="css/unrealircd-admin.css" rel="stylesheet">
26971737 4<body class="body-for-sticky">
82f5bcbf 5<div id="headerContainer">
26971737 6<h2><a href="">UnrealIRCd</a> <small>Administration Panel</small></h2><br>
82f5bcbf 7</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
18define('UPATH', dirname(__FILE__));
19include "config.php";
20include "Classes/class-log.php";
21include "Classes/class-message.php";
709b97f3 22include "Classes/class-rpc.php";
26971737 23do_log($_POST);
709b97f3 24
26971737
VP
25if (!empty($_POST)) {
26 if (!($bantype = $_POST["bantype"])) {
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);
33 $bantype = $_POST["bantype"];
34 rpc_tkl_add($user, $bantype, "2h", "You have been banned lol");
35 Message::Success($user . " has been banned");
76200e36
VP
36 }
37 }
38
26971737
VP
39 if (!empty($_POST['tklch']))
40 foreach ($_POST as $key => $value) {
41 foreach ($value as $tok) {
42 $tok = explode(",", $tok);
43 rpc_tkl_del(base64_decode($tok[0]), base64_decode($tok[1]));
44 }
45 }
46
47 if (!empty($_POST['sf']))
48 foreach ($_POST as $key => $value) {
49 foreach ($value as $tok) {
50 $tok = explode(",", $tok);
51 rpc_sf_del(base64_decode($tok[0]), base64_decode($tok[1]), base64_decode($tok[2]), base64_decode($tok[3]));
52 }
53 }
54}
55
896b6cdc 56rpc_pop_lists(); // populate our static lists (users, channels, tkl, spamfilter)
709b97f3 57?>
82f5bcbf
VP
58
59<div class="tab-content\">
60<div id="overview" data-tab-content class="active">
896b6cdc
VP
61 <table class='unrealircd_overview'>
62 <th>Chat Overview</th><th></th>
63 <tr><td><b>Users</b></td><td><?php echo count(RPC_List::$user); ?></td></tr>
64 <tr><td><b>Opers</b></td><td><?php echo RPC_List::$opercount; ?></td></tr>
65 <tr><td><b>Services</b></td><td><?php echo RPC_List::$services_count; ?></td></tr>
66 <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>
67 <tr><td><b>Channels</b></td><td><?php echo count(RPC_List::$channel); ?></td></tr>
68 <tr><td><b>Server bans</b></td><td><?php echo count(RPC_List::$tkl); ?></td></tr>
69 <tr><td><b>Spamfilter entries</b></td><td><?php echo count(RPC_List::$spamfilter); ?></td></tr></th>
70 </table></div></div>
26971737 71 <form action="" method="post">
ef866d8c
VP
72 <div class="tab-content\">
73 <div id="Users" data-tab-content>
896b6cdc
VP
74 <p></p>
75 <table class='users_overview'>
26971737 76 <th><input type="checkbox" label='selectall' onClick="toggle_user(this)" />Select all</th>
896b6cdc
VP
77 <th>Nick</th>
78 <th>UID</th>
ef866d8c 79 <th>Host / IP</th>
896b6cdc
VP
80 <th>Account</th>
81 <th>Usermodes</th>
82 <th>Oper</th>
83 <th>Secure</th>
84 <th>Connected to</th>
26971737 85 <th>Reputation <a href="https://www.unrealircd.org/docs/Reputation_score">ℹ️</a></th>
896b6cdc
VP
86
87 <?php
88 foreach(RPC_List::$user as $user)
89 {
90 echo "<tr>";
26971737 91 echo "<td><input type=\"checkbox\" value='" . base64_encode($user['id'])."' name=\"userch[]\"></td>";
896b6cdc
VP
92 echo "<td>".$user['name']."</td>";
93 echo "<td>".$user['id']."</td>";
94 echo "<td>".$user['hostname']." (".$user['ip'].")</td>";
76200e36 95 $account = (isset($user['user']['account'])) ? $user['user']['account'] : "";
896b6cdc
VP
96 echo "<td>".$account."</td>";
97 $modes = (isset($user['user']['modes'])) ? "+" . $user['user']['modes'] : "<none>";
98 echo "<td>".$modes."</td>";
99 $oper = (isset($user['user']['operlogin'])) ? $user['user']['operlogin']." (".$user['user']['operclass'].")" : "";
100 echo "<td>".$oper."</td>";
101 $secure = (isset($user['tls'])) ? "✅" : "❌";
102 echo "<td>".$secure."</td>";
103 echo "<td>".$user['user']['servername']."</td>";
104 echo "<td>".$user['user']['reputation']."</td>";
105 }
26971737
VP
106 ?></table>
107
108 <label for="bantype">Apply action:
109 <select name="bantype" id="bantype">
110 <option value=""></option>
111 <optgroup label="Bans">
112 <option value="gline">GLine</option>
113 <option value="gzline">GZLine</option>
114 </optgroup>
115 </select>
116 <br>
117 <label for="banlen_w">Duration:
118 <select name="banlen_w" id="banlen_w">
119 <?php
120 for ($i = 0; $i <= 56; $i++)
121 {
122 if (!$i)
123 echo "<option value=\"0w\"></option>";
124 else
125 {
126 $w = ($i == 1) ? "week" : "weeks";
127 echo "<option value=\"$i" . "w\">$i $w" . "</option>";
128 }
129 }
130 ?>
131 </select>
132 <select name="banlen_d" id="banlen_d">
133 <?php
134 for ($i = 0; $i <= 31; $i++)
135 {
136 if (!$i)
137 echo "<option value=\"0d\"></option>";
138 else
139 {
140 $d = ($i == 1) ? "day" : "days";
141 echo "<option value=\"$i" . "d\">$i $d" . "</option>";
142 }
143 }
144 ?>
145 </select>
146 <select name="banlen_h" id="banlen_h">
147 <?php
148 for ($i = 0; $i <= 24; $i++)
149 {
150 if (!$i)
151 echo "<option value=\"0d\"></option>";
152 else
153 {
154 $h = ($i == 1) ? "hour" : "hours";
155 echo "<option value=\"$i" . "h\">$i $h" . "</option>";
156 }
157 }
158 ?>
159 </select>
160 <br>
161 <input type="submit" value="Apply">
162 </form>
163
164 </div></div>
82f5bcbf 165
ef866d8c
VP
166 <div class="tab-content\">
167 <div id="Channels" data-tab-content>
168 <p></p>
169 <table class='users_overview'>
170 <th>Name</th>
171 <th>Created</th>
172 <th>User count</th>
173 <th>Topic</th>
174 <th>Topic Set</th>
175 <th>Modes</th>
176
177 <?php
178 foreach(RPC_List::$channel as $channel)
179 {
180 echo "<tr>";
181 echo "<td>".$channel['name']."</td>";
182 echo "<td>".$channel['creation_time']."</td>";
183 echo "<td>".$channel['num_users']."</td>";
184 $topic = (isset($channel['topic'])) ? $channel['topic'] : "";
185 echo "<td>".$topic."</td>";
186 $setby = (isset($channel['topic'])) ? "By ".$channel['topic_set_by'] .", at ".$channel['topic_set_at'] : "";
187 echo "<td>".$setby."</td>";
188 $modes = (isset($channel['modes'])) ? "+" . $channel['modes'] : "<none>";
189 echo "<td>".$modes."</td>";
190 }
191 ?></table></div></div>
192
193
194 <div class="tab-content\">
195 <div id="TKL" data-tab-content>
76200e36 196
ef866d8c 197 <table class='users_overview'>
76200e36 198 <form action="" method="post">
26971737 199 <th><input type="checkbox" label='selectall' onClick="toggle_tkl(this)" />Select all</th>
ef866d8c
VP
200 <th>Mask</th>
201 <th>Type</th>
202 <th>Set By</th>
203 <th>Set On</th>
204 <th>Expires</th>
205 <th>Duration</th>
206 <th>Reason</th>
207
208 <?php
209 foreach(RPC_List::$tkl as $tkl)
210 {
211 echo "<tr>";
76200e36 212 echo "<td><input type=\"checkbox\" value='" . base64_encode($tkl['name']).",".base64_encode($tkl['type']) . "' name=\"tklch[]\"></td>";
ef866d8c
VP
213 echo "<td>".$tkl['name']."</td>";
214 echo "<td>".$tkl['type_string']."</td>";
215 echo "<td>".$tkl['set_by']."</td>";
216 echo "<td>".$tkl['set_at_string']."</td>";
217 echo "<td>".$tkl['expire_at_string']."</td>";
218 echo "<td>".$tkl['duration_string']."</td>";
219 echo "<td>".$tkl['reason']."</td>";
220 }
76200e36 221 ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div>
ef866d8c
VP
222
223
224 <div class="tab-content\">
225 <div id="Spamfilter" data-tab-content>
226 <p></p>
227 <table class='users_overview'>
26971737
VP
228 <form action="" method="post">
229 <th><input type="checkbox" label='selectall' onClick="toggle_sf(this)" />Select all</th>
ef866d8c
VP
230 <th>Mask</th>
231 <th>Type</th>
232 <th>Set By</th>
233 <th>Set On</th>
234 <th>Expires</th>
235 <th>Duration</th>
236 <th>Match Type</th>
237 <th>Action</th>
238 <th>Action Duration</th>
239 <th>Target</th>
240 <th>Reason</th>
241
242 <?php
243 foreach(RPC_List::$spamfilter as $sf)
244 {
245 echo "<tr>";
26971737 246 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
247 echo "<td>".$sf['name']."</td>";
248 echo "<td>".$sf['type_string']."</td>";
249 echo "<td>".$sf['set_by']."</td>";
250 echo "<td>".$sf['set_at_string']."</td>";
251 echo "<td>".$sf['expire_at_string']."</td>";
252 echo "<td>".$sf['duration_string']."</td>";
253 echo "<td>".$sf['match_type']."</td>";
254 echo "<td>".$sf['ban_action']."</td>";
255 echo "<td>".$sf['ban_duration_string']."</td>";
256 for ($i = 0, $targs = ""; ($c = $sf['spamfilter_targets'][$i]); $i++)
257 {
258 if ($c == "c")
259 $targs .= "Channel, ";
260 else if ($c == "p")
261 $targs .= "Private,";
262 else if ($c == "n")
263 $targs .= "Notice, ";
264 else if ($c == "N")
265 $targs .= "Channel notice, ";
266 else if ($c == "P")
267 $targs .= "Part message, ";
268 else if ($c == "q")
269 $targs .= "Quit message, ";
270 else if ($c == "d")
271 $targs .= "DCC filename, ";
272 else if ($c == "a")
273 $targs .= "Away message, ";
274 else if ($c == "t")
275 $targs .= "Channel topic, ";
276 else if ($c == "T")
277 $targs .= "MessageTag, ";
278 else if ($c == "u")
279 $targs .= "Usermask, ";
280
281 $targs = rtrim($targs,", ");
282 }
283 echo "<td>".$targs."</td>";
284 echo "<td>".$sf['reason']."</td>";
285
286 }
26971737
VP
287 ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div>
288
289
290
291 <div class="tab-content\">
292 <div id="News" data-tab-content>
293 <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>
294 <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>
295 </div></div>
ef866d8c 296
896b6cdc 297</body>
82f5bcbf 298
76200e36 299<div class="footer"><p>Copyright 2022-2023 © <a href="https://unrealircd.org/">UnrealIRCd</a></p></div>