]>
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"; | |
d5ffb4bb | 17 | |
c70f7192 | 18 | ?> |
62d4ea03 | 19 | |
c70f7192 | 20 | <table class="table-sm table-responsive caption-top table-hover"> |
f6887c82 VP |
21 | <span class="badge rounded-pill" |
22 | style="position: absolute; | |
23 | top:25px; | |
24 | right: 25px; | |
25 | background-color:lightgrey; | |
d5ffb4bb | 26 | font-size:small;" |
f6887c82 VP |
27 | >Reputation <span class="badge badge-danger" style="font-size:small;"><?php echo $user->user->reputation; ?></span> |
28 | </span> | |
c70f7192 VP |
29 | <tbody> |
30 | <tr> | |
31 | <th>Nick</th> | |
32 | <td colspan="2"><code><?php echo htmlspecialchars($user->name); ?></code></td> | |
d5ffb4bb | 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> |
c70f7192 VP |
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> | |
a15696c8 VP |
42 | <td colspan="2"> |
43 | <code><?php echo htmlspecialchars($user->ip); ?></code> | |
c70f7192 | 44 | <?php |
a15696c8 | 45 | if (strlen($cc)) |
c70f7192 VP |
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> | |
d5ffb4bb | 53 | <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 |
54 | </tr><tr> |
55 | <th>ASN</th> | |
56 | <td colspan="2"><code><?php echo "$asname ($asn)"; ?></code></td> | |
c70f7192 VP |
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); ?> | |
10102cdc | 69 | |
c70f7192 | 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> |
9ffc5134 | 71 | |
c70f7192 VP |
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> | |
d5ffb4bb | 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> |
c70f7192 VP |
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>"; | |
c70f7192 VP |
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> | |
b741b8ef | 92 | </td> |
c70f7192 | 93 | </tr> |
62d4ea03 | 94 | |
c70f7192 VP |
95 | </tbody> |
96 | </table> | |
62d4ea03 | 97 | |
c70f7192 | 98 | <?php |
62d4ea03 VP |
99 | } |
100 | function generate_html_usersettings($user) | |
101 | { | |
c70f7192 | 102 | ?> |
62d4ea03 | 103 | |
c70f7192 VP |
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 | } | |
62d4ea03 VP |
339 | |
340 | ||
c70f7192 VP |
341 | ?> |
342 | </tbody> | |
343 | </table> | |
62d4ea03 | 344 | |
c70f7192 | 345 | <?php |
7b6e57db VP |
346 | } |
347 | ||
348 | ||
349 | function generate_html_userchannels($user) | |
350 | { | |
c70f7192 | 351 | ?> |
7b6e57db | 352 | |
c70f7192 VP |
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> | |
7b6e57db | 409 | |
c70f7192 | 410 | <?php |
11b7f7e4 | 411 | } |