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