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