]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - index.php
Allow deletion of entries in server bans list and spamfilter list
[irc/unrealircd/unrealircd-webpanel.git] / index.php
1 <!DOCTYPE html>
2 <link href="css/unrealircd-admin.css" rel="stylesheet">
3 <body>
4 <div id="headerContainer">
5 <h2>UnrealIRCd <small>Administration Panel</small></h2><br>
6 </div>
7 <script src="js/unrealircd-admin.js" defer></script>
8 <div class="topnav">
9 <a data-tab-target="#overview" class="active" href="#overview">Overview</a>
10 <a data-tab-target="#Users" href="#Users">Users</a>
11 <a data-tab-target="#Channels" href="#Channels">Channels</a>
12 <a data-tab-target="#TKL" href="#TKL">Server Bans</a>
13 <a data-tab-target="#Spamfilter" href="#Spamfilter">Spamfilter</a>
14 </div>
15 <?php
16 /**
17 * Provide a admin area view for the plugin
18 *
19 * This file is used to markup the admin-facing aspects of the plugin.
20 *
21 * @link https://https://github.com/ValwareIRC
22 * @since 1.0.0
23 *
24 * @package Unrealircd
25 * @subpackage Unrealircd/admin/partials
26 */
27
28 define('UPATH', true);
29 include "Classes/class-rpc.php";
30
31 if (!empty($_POST['tklch']))
32 foreach ($_POST as $key => $value)
33 {
34 foreach ($value as $tok)
35 {
36 $tok = explode(",",$tok);
37 rpc_tkl_del(base64_decode($tok[0]), base64_decode($tok[1]));
38 }
39 }
40
41 rpc_pop_lists(); // populate our static lists (users, channels, tkl, spamfilter)
42 ?>
43
44 <div class="tab-content\">
45 <div id="overview" data-tab-content class="active">
46 <table class='unrealircd_overview'>
47 <th>Chat Overview</th><th></th>
48 <tr><td><b>Users</b></td><td><?php echo count(RPC_List::$user); ?></td></tr>
49 <tr><td><b>Opers</b></td><td><?php echo RPC_List::$opercount; ?></td></tr>
50 <tr><td><b>Services</b></td><td><?php echo RPC_List::$services_count; ?></td></tr>
51 <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>
52 <tr><td><b>Channels</b></td><td><?php echo count(RPC_List::$channel); ?></td></tr>
53 <tr><td><b>Server bans</b></td><td><?php echo count(RPC_List::$tkl); ?></td></tr>
54 <tr><td><b>Spamfilter entries</b></td><td><?php echo count(RPC_List::$spamfilter); ?></td></tr></th>
55 </table></div></div>
56
57 <div class="tab-content\">
58 <div id="Users" data-tab-content>
59 <p></p>
60 <table class='users_overview'>
61 <th>Nick</th>
62 <th>UID</th>
63 <th>Host / IP</th>
64 <th>Account</th>
65 <th>Usermodes</th>
66 <th>Oper</th>
67 <th>Secure</th>
68 <th>Connected to</th>
69 <th>Reputation <a href="https://www.unrealircd.org/docs/Reputation_score"></a>ℹ️</th>
70
71 <?php
72 foreach(RPC_List::$user as $user)
73 {
74 echo "<tr>";
75 echo "<td>".$user['name']."</td>";
76 echo "<td>".$user['id']."</td>";
77 echo "<td>".$user['hostname']." (".$user['ip'].")</td>";
78 $account = (isset($user['user']['account'])) ? $user['user']['account'] : "";
79 echo "<td>".$account."</td>";
80 $modes = (isset($user['user']['modes'])) ? "+" . $user['user']['modes'] : "<none>";
81 echo "<td>".$modes."</td>";
82 $oper = (isset($user['user']['operlogin'])) ? $user['user']['operlogin']." (".$user['user']['operclass'].")" : "";
83 echo "<td>".$oper."</td>";
84 $secure = (isset($user['tls'])) ? "✅" : "❌";
85 echo "<td>".$secure."</td>";
86 echo "<td>".$user['user']['servername']."</td>";
87 echo "<td>".$user['user']['reputation']."</td>";
88 }
89 ?></table></div></div>
90
91 <div class="tab-content\">
92 <div id="Channels" data-tab-content>
93 <p></p>
94 <table class='users_overview'>
95 <th>Name</th>
96 <th>Created</th>
97 <th>User count</th>
98 <th>Topic</th>
99 <th>Topic Set</th>
100 <th>Modes</th>
101
102 <?php
103 foreach(RPC_List::$channel as $channel)
104 {
105 echo "<tr>";
106 echo "<td>".$channel['name']."</td>";
107 echo "<td>".$channel['creation_time']."</td>";
108 echo "<td>".$channel['num_users']."</td>";
109 $topic = (isset($channel['topic'])) ? $channel['topic'] : "";
110 echo "<td>".$topic."</td>";
111 $setby = (isset($channel['topic'])) ? "By ".$channel['topic_set_by'] .", at ".$channel['topic_set_at'] : "";
112 echo "<td>".$setby."</td>";
113 $modes = (isset($channel['modes'])) ? "+" . $channel['modes'] : "<none>";
114 echo "<td>".$modes."</td>";
115 }
116 ?></table></div></div>
117
118
119 <div class="tab-content\">
120 <div id="TKL" data-tab-content>
121
122 <table class='users_overview'>
123 <form action="" method="post">
124 <th><input type="checkbox" label='selectall' onClick="toggle(this)" />Select all</th>
125 <th>Mask</th>
126 <th>Type</th>
127 <th>Set By</th>
128 <th>Set On</th>
129 <th>Expires</th>
130 <th>Duration</th>
131 <th>Reason</th>
132
133 <?php
134 foreach(RPC_List::$tkl as $tkl)
135 {
136 echo "<tr>";
137 echo "<td><input type=\"checkbox\" value='" . base64_encode($tkl['name']).",".base64_encode($tkl['type']) . "' name=\"tklch[]\"></td>";
138 echo "<td>".$tkl['name']."</td>";
139 echo "<td>".$tkl['type_string']."</td>";
140 echo "<td>".$tkl['set_by']."</td>";
141 echo "<td>".$tkl['set_at_string']."</td>";
142 echo "<td>".$tkl['expire_at_string']."</td>";
143 echo "<td>".$tkl['duration_string']."</td>";
144 echo "<td>".$tkl['reason']."</td>";
145 }
146 ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div>
147
148
149 <div class="tab-content\">
150 <div id="Spamfilter" data-tab-content>
151 <p></p>
152 <table class='users_overview'>
153 <th>Mask</th>
154 <th>Type</th>
155 <th>Set By</th>
156 <th>Set On</th>
157 <th>Expires</th>
158 <th>Duration</th>
159 <th>Match Type</th>
160 <th>Action</th>
161 <th>Action Duration</th>
162 <th>Target</th>
163 <th>Reason</th>
164
165 <?php
166 foreach(RPC_List::$spamfilter as $sf)
167 {
168 echo "<tr>";
169 echo "<td>".$sf['name']."</td>";
170 echo "<td>".$sf['type_string']."</td>";
171 echo "<td>".$sf['set_by']."</td>";
172 echo "<td>".$sf['set_at_string']."</td>";
173 echo "<td>".$sf['expire_at_string']."</td>";
174 echo "<td>".$sf['duration_string']."</td>";
175 echo "<td>".$sf['match_type']."</td>";
176 echo "<td>".$sf['ban_action']."</td>";
177 echo "<td>".$sf['ban_duration_string']."</td>";
178 for ($i = 0, $targs = ""; ($c = $sf['spamfilter_targets'][$i]); $i++)
179 {
180 if ($c == "c")
181 $targs .= "Channel, ";
182 else if ($c == "p")
183 $targs .= "Private,";
184 else if ($c == "n")
185 $targs .= "Notice, ";
186 else if ($c == "N")
187 $targs .= "Channel notice, ";
188 else if ($c == "P")
189 $targs .= "Part message, ";
190 else if ($c == "q")
191 $targs .= "Quit message, ";
192 else if ($c == "d")
193 $targs .= "DCC filename, ";
194 else if ($c == "a")
195 $targs .= "Away message, ";
196 else if ($c == "t")
197 $targs .= "Channel topic, ";
198 else if ($c == "T")
199 $targs .= "MessageTag, ";
200 else if ($c == "u")
201 $targs .= "Usermask, ";
202
203 $targs = rtrim($targs,", ");
204 }
205 echo "<td>".$targs."</td>";
206 echo "<td>".$sf['reason']."</td>";
207
208 }
209 ?></table></div></div>
210
211 </body>
212
213 <div class="footer"><p>Copyright 2022-2023 © <a href="https://unrealircd.org/">UnrealIRCd</a></p></div>