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