]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - misc/user-lookup-misc.php
Remove stray semi-colon lol
[irc/unrealircd/unrealircd-webpanel.git] / misc / user-lookup-misc.php
1 <?php
2
3 function generate_html_whois($user)
4 {
5 global $rpc;
6 ?>
7
8 <table class="table-sm table-responsive caption-top table-hover">
9 <tbody>
10 <tr>
11 <th>Nick</th>
12 <td colspan="2"><code><?php echo htmlspecialchars($user->name); ?></code></td>
13 </tr><tr>
14 <th>User ID (UID)</th>
15 <td colspan="2"><code><?php echo htmlspecialchars($user->id); ?></code></td>
16 </tr><tr>
17 <th>Real Host</th>
18 <td colspan="2"><code><?php echo htmlspecialchars($user->hostname); ?></code></td>
19 </tr><tr>
20 <th>IP</th>
21 <td colspan="2"><code><?php echo htmlspecialchars($user->ip); ?></code>
22 <?php
23 if ($cc = (isset($user->geoip->country_code)) ? strtolower($user->geoip->country_code) : "")
24 {
25 ?> <img src="https://flagcdn.com/48x36/<?php echo htmlspecialchars($cc); ?>.png"
26 width="20"
27 height="15">
28 <?php } ?>
29 <a href="<?php echo htmlspecialchars(get_config("base_url")."tools/ip-whois.php?ip=$user->ip"); ?>"><button class="btn-sm btn-primary">WHOIS IP</button></a>
30 </td>
31 </tr><tr>
32 <th>Ident</th>
33 <td colspan="2"><code><?php echo htmlspecialchars($user->user->username); ?></code></td>
34 </tr><tr>
35 <th>GECOS / Real Name</th>
36 <td colspan="2"><code><?php echo htmlspecialchars($user->user->realname); ?></code></td>
37 </tr><tr>
38 <th>Virtual Host</th>
39 <td colspan="2"><code><?php echo (isset($user->user->vhost)) ? htmlspecialchars($user->user->vhost) : ""; ?></code></td>
40 </tr><tr>
41 <th>Connected to</th>
42 <?php $serverlkup = $rpc->server()->get($user->user->servername); ?>
43
44 <td colspan="2"><a href="<?php echo get_config("base_url")."servers/details.php?server=$serverlkup->id"; ?>"><code><?php echo htmlspecialchars($user->user->servername); ?></code></td>
45
46 </tr>
47 <tr>
48 <th>Logged in as</th>
49 <td colspan="2"><code><?php echo (isset($user->user->account)) ? "<a href=\"".get_config("base_url")."users/?account=".htmlspecialchars($user->user->account)."\">".htmlspecialchars($user->user->account)."</a>" : ""; ?></code></td>
50 </tr>
51 <tr>
52 <th style="background-color: blanchedalmond;border-radius:5px";>Security Groups</th>
53 <td colspan="2"><code><?php
54 echo "<table style=\"margin-left:-15px;
55 height:100%;
56 border-radius:5px;
57 background-color: blanchedalmond\"><tr>";
58 foreach($user->user->{"security-groups"} as $sg)
59 {
60 echo "<th><div class=\"badge badge-secondary rounded-pill\">$sg</th></tr><tr>";
61 }
62 echo "</tr></table>"; ?>
63 </td>
64 </code>
65 </td>
66 </tr>
67
68 </tbody>
69 </table>
70
71 <?php
72 }
73 function generate_html_usersettings($user)
74 {
75 ?>
76
77 <table class="table-sm table-responsive caption-top table-hover">
78 <tbody>
79 <?php
80 for ($i=0; ($mode = (isset($user->user->modes[$i])) ? $user->user->modes[$i] : NULL); $i++)
81 {
82
83 if ($mode == "o")
84 {
85 ?>
86 <tr>
87 <th>Oper</th>
88 <td>
89 <table class="table-sm table-responsive caption-top table-hover">
90 <tr>
91 <td>Oper Login</td>
92 <td><code><?php
93 $operlogin = (isset($user->user->operlogin)) ? $user->user->operlogin : "";
94 echo htmlspecialchars($operlogin);
95 ?></code></td>
96 </tr>
97 <tr>
98 <td>Oper Class</td>
99 <td><?php echo (isset($user->user->operclass)) ? "<span class=\"rounded-pill badge badge-info\">".htmlspecialchars($user->user->operclass)."</span>" : "<span class=\"rounded-pill badge badge-info\">None</span>"; ?></td>
100 </tr>
101 </table>
102 </td>
103 </tr>
104 <?php
105 }
106 elseif ($mode == "S")
107 {
108 ?>
109 <tr>
110 <th>Service Bot</th>
111 <td>
112 This user is a Services Bot.
113 </td>
114 </tr>
115 <?php
116 }
117 elseif ($mode == "d")
118 {
119 ?>
120 <tr>
121 <th>Deaf</th>
122 <td>User is ignoring channel messages.</td>
123 </tr>
124 <?php
125 }
126 elseif ($mode == "i")
127 {
128 ?>
129 <tr>
130 <th>Invisible</th>
131 <td>Not shown in /WHO searches.</td>
132 </tr>
133 <?php
134 }
135 elseif ($mode == "p")
136 {
137 ?>
138 <tr>
139 <th>Private channels</th>
140 <td>Channels hidden in /WHOIS outputs.</td>
141 </tr>
142 <?php
143 }
144 elseif ($mode == "r")
145 {
146 ?>
147 <tr>
148 <th>Registered Nick</th>
149 <td>This user is using a registered nick.</td>
150 </tr>
151 <?php
152 }
153 elseif ($mode == "s")
154 {
155 ?>
156 <tr>
157 <th>Server Notices</th>
158 <td>This user is receiving server notices.</td>
159 </tr>
160 <?php
161 }
162 elseif ($mode == "t")
163 {
164 ?>
165 <tr>
166 <th>Virtual Host</th>
167 <td>Using a custom hostmask</td>
168 </tr>
169 <?php
170 }
171 elseif ($mode == "w")
172 {
173 ?>
174 <tr>
175 <th>Wallops</th>
176 <td>Listening to <code>/WALLOPS</code> notices from IRC Operators.</td>
177 </tr>
178 <?php
179 }
180 elseif ($mode == "x")
181 {
182 ?>
183 <tr>
184 <th>Hostmask</th>
185 <td>Using a hostmask (hiding their IP from non-IRCops).</td>
186 </tr>
187 <?php
188 }
189 elseif ($mode == "z")
190 {
191 ?>
192 <tr>
193 <th>Secure</th>
194 <td>
195 <table class="table-sm table-responsive caption-top table-hover">
196 <tr>
197 <td>Cipher</td>
198 <td><code><?php
199 $cipher = (isset($user->tls->cipher)) ? $user->tls->cipher : "";
200 echo htmlspecialchars($cipher);
201 ?></code></td>
202 </tr>
203 <tr>
204 <td>Cert Fingerprint</td>
205 <td><?php echo (isset($user->tls->certfp)) ? "<code>".htmlspecialchars($user->tls->certfp)."</code>" : "<span class=\"rounded-pill badge badge-info\">None</span>"; ?></td>
206 </tr>
207 </table>
208 </td>
209 </tr>
210 <?php
211 }
212 elseif ($mode == "B")
213 {
214 ?>
215 <tr>
216 <th>Bot</th>
217 <td colspan="2">
218 User is marked as a Bot.
219 </td>
220 </tr>
221 <?php
222 }
223 elseif ($mode == "D")
224 {
225 ?>
226 <tr>
227 <th>PrivDeaf</th>
228 <td colspan="2">
229 User is rejecting incoming private messages.
230 </td>
231 </tr>
232 <?php
233 }
234 elseif ($mode == "G")
235 {
236 ?>
237 <tr>
238 <th>Filter</th>
239 <td colspan="2">
240 User is filtering Bad Words.
241 </td>
242 </tr>
243 <?php
244 }
245 elseif ($mode == "H")
246 {
247 ?>
248 <tr>
249 <th>Hide IRCop</th>
250 <td colspan="2">
251 User is hiding their IRCop status.
252 </td>
253 </tr>
254 <?php
255 }
256 elseif ($mode == "I")
257 {
258 ?>
259 <tr>
260 <th>Hide Idle</th>
261 <td colspan="2">
262 User is hiding their idle time.
263 </td>
264 </tr>
265 <?php
266 }
267 elseif ($mode == "R")
268 {
269 ?>
270 <tr>
271 <th>RegOnly Messages</th>
272 <td colspan="2">
273 User is only accepting private messages from registered users.
274 </td>
275 </tr>
276 <?php
277 }
278 elseif ($mode == "T")
279 {
280 ?>
281 <tr>
282 <th>Deny CTCPs</th>
283 <td colspan="2">
284 Denying CTCP requests.
285 </td>
286 </tr>
287 <?php
288 }
289 elseif ($mode == "W")
290 {
291 ?>
292 <tr>
293 <th>View /WHOIS</th>
294 <td colspan="2">
295 User is receiving notifications when someone does a <code>/WHOIS</code> on them.
296 </td>
297 </tr>
298 <?php
299 }
300 elseif ($mode == "Z")
301 {
302 ?>
303 <tr>
304 <th>Deny Insecure Messages</th>
305 <td colspan="2">
306 User is only accepting messages from users using a secure connection.
307 </td>
308 </tr>
309 <?php
310 }
311 }
312
313
314 ?>
315 </tbody>
316 </table>
317
318 <?php
319 }
320
321
322 function generate_html_userchannels($user)
323 {
324 ?>
325
326 <table class="table-sm table-responsive caption-top table-hover table-striped">
327 <thead class="table-info">
328 <th>
329 Channel
330 </th>
331 <th >
332 Status
333 </th>
334 </thead>
335 <tbody>
336 <?php
337 foreach($user->user->channels as $chan)
338 {
339 ?>
340 <tr>
341 <td><?php echo "<a href=\"".get_config("base_url")."channels/details.php?chan=".urlencode($chan->name)."\">$chan->name</a>"; ?></td>
342 <td>
343
344 <?php
345 for ($i = 0; isset($chan->level[$i]); $i++)
346 {
347 ?><div class="text-nowrap row mb-1"><?php
348 if ($chan->level[$i] == "v")
349 {
350 ?><span class="rounded-pill badge badge-info" value="Voice">Voice</span><?php
351 }
352 if ($chan->level[$i] == "h")
353 {
354 ?><span class="rounded-pill badge badge-info">Half-Op</span><?php
355 }
356 if ($chan->level[$i] == "o")
357 {
358 ?><h6><span class="rounded-pill badge badge-info">Operator</span></h6><?php
359 }
360 if ($chan->level[$i] == "a")
361 {
362 ?><span class="rounded-pill badge badge-info">Admin</span><?php
363 }
364 if ($chan->level[$i] == "q")
365 {
366 ?><span class="rounded-pill badge badge-info">Owner</span><?php
367 }
368 if ($chan->level[$i] == "Y")
369 {
370 ?><span class="rounded-pill badge badge-info">OJOIN</span><?php
371 }
372 ?></div><?php
373 }
374 ?>
375 </td>
376 </tr>
377 <?php
378 }
379 ?>
380 </tbody>
381 </table>
382
383 <?php
384 }