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