]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - misc/user-lookup-misc.php
Search: Make vaguely wildcard-y
[irc/unrealircd/unrealircd-webpanel.git] / misc / user-lookup-misc.php
index c1b32c897eb7d20dceb8f0c30ec18166ac76a4e6..cb6a4a730a2ee98e9a094822f22c2ca29223d018 100644 (file)
@@ -3,13 +3,34 @@
 function generate_html_whois($user)
 {
        global $rpc;
+       
+       $notes = Notes::find(["nick" => $user->name, "ip" => $user->ip, "account" => $user->account ?? NULL]);
+       $numnotes = [
+               "ip" => isset($notes['ip']['notes']) ? count($notes["ip"]['notes']) : 0,
+               "nick" => isset($notes['ip']['notes']) ? count($notes["nick"]['notes'] ?? []) : 0,
+               "account" => isset($notes['ip']['notes']) ? count($notes['account']['notes'] ?? []) : 0,
+       ];
+       $cc = (isset($user->geoip->country_code)) ? strtolower($user->geoip->country_code) : "";
+       
+       $asn = $user->geoip->asn ?? "none";
+       $asname = $user->geoip->asname ?? "none";
+       
        ?>
 
        <table class="table-sm table-responsive caption-top table-hover">
+               <span class="badge rounded-pill"
+                       style="position: absolute;
+                       top:25px;
+                       right: 25px;
+                       background-color:lightgrey;
+                       font-size:small;"
+               >Reputation <span class="badge badge-danger" style="font-size:small;"><?php echo $user->user->reputation; ?></span>
+               </span>
                <tbody>
                        <tr>
                                <th>Nick</th>
                                <td colspan="2"><code><?php echo htmlspecialchars($user->name); ?></code></td>
+                               <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>
                        </tr><tr>
                                <th>User ID (UID)</th>
                                <td colspan="2"><code><?php echo htmlspecialchars($user->id); ?></code></td>
@@ -18,9 +39,10 @@ function generate_html_whois($user)
                                <td colspan="2"><code><?php echo htmlspecialchars($user->hostname); ?></code></td>
                        </tr><tr>
                                <th>IP</th>
-                               <td colspan="2"><code><?php echo htmlspecialchars($user->ip); ?></code>
+                               <td colspan="2">
+                                       <code><?php echo htmlspecialchars($user->ip); ?></code>
                                <?php
-                               if ($cc = (isset($user->geoip->country_code)) ? strtolower($user->geoip->country_code) : "")
+                               if (strlen($cc))
                                {
                                   ?>  <img src="https://flagcdn.com/48x36/<?php echo htmlspecialchars($cc); ?>.png"
                                                        width="20"
@@ -28,6 +50,10 @@ function generate_html_whois($user)
                                        <?php } ?>
                                        <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>
                                </td>
+                               <td><button id="ipnotes" class="btn btn-sm btn-secondary fa-solid fa-sticky-note text-nowrap"> <?php echo $numnotes['ip']?></button></td>
+                       </tr><tr>
+                               <th>ASN</th>
+                               <td colspan="2"><code><?php echo "$asname ($asn)"; ?></code></td>
                        </tr><tr>
                                <th>Ident</th>
                                <td colspan="2"><code><?php echo htmlspecialchars($user->user->username); ?></code></td>
@@ -47,6 +73,7 @@ function generate_html_whois($user)
                        <tr>
                                <th>Logged in as</th>
                                <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>
+                               <td><button id="account_notes" class="btn btn-sm btn-secondary fa-solid fa-sticky-note text-nowrap"> <?php echo $numnotes['account']?></button></td>
                        </tr>
                        <tr>
                                <th style="background-color: blanchedalmond;border-radius:5px";>Security Groups</th>
@@ -55,7 +82,6 @@ function generate_html_whois($user)
                                                height:100%;
                                                border-radius:5px;
                                                background-color: blanchedalmond\"><tr>";
-                                               $i = 1;
                                                foreach($user->user->{"security-groups"} as $sg)
                                                {
                                                        echo "<th><div class=\"badge badge-secondary rounded-pill\">$sg</th></tr><tr>";
@@ -63,7 +89,7 @@ function generate_html_whois($user)
                                                echo "</tr></table>"; ?>
                                                </td>
                                        </code>
-                               </td>;
+                               </td>
                        </tr>
 
                </tbody>