]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - misc/user-lookup-misc.php
Move to new style config, with config in config/ directory.
[irc/unrealircd/unrealircd-webpanel.git] / misc / user-lookup-misc.php
index 7bc997c429ea773d5e6df7d9e0a5cb84aad11d5a..27fc7b1a820dd41dbda4ad55618dd35108f58ca0 100644 (file)
@@ -2,46 +2,51 @@
 
 function generate_html_whois($user)
 {
+    global $rpc;
     ?>
 
-    <table class="table table-responsive caption-top table-hover">
+    <table class="table-sm table-responsive caption-top table-hover">
         <tbody>
             <tr>
                 <th>Nick</th>
-                <td colspan="2"><code><?php echo $user->name; ?></code></td>
+                <td colspan="2"><code><?php echo htmlspecialchars($user->name); ?></code></td>
             </tr><tr>
-                <th>UID</th>
-                <td colspan="2"><code><?php echo $user->id; ?></code></td>
+                <th>User ID (UID)</th>
+                <td colspan="2"><code><?php echo htmlspecialchars($user->id); ?></code></td>
             </tr><tr>
                 <th>Real Host</th>
-                <td colspan="2"><code><?php echo $user->hostname; ?></code></td>
+                <td colspan="2"><code><?php echo htmlspecialchars($user->hostname); ?></code></td>
             </tr><tr>
                 <th>IP</th>
-                <td colspan="2"><code><?php echo $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) : "")
                 {
-                   ?>  <img src="https://flagcdn.com/48x36/<?php echo $cc; ?>.png"
+                   ?>  <img src="https://flagcdn.com/48x36/<?php echo htmlspecialchars($cc); ?>.png"
                             width="20"
                             height="15">
                     <?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>
             </tr><tr>
                 <th>Ident</th>
-                <td colspan="2"><code><?php echo $user->user->username; ?></code></td>
+                <td colspan="2"><code><?php echo htmlspecialchars($user->user->username); ?></code></td>
             </tr><tr>
                 <th>GECOS / Real Name</th>
-                <td colspan="2"><code><?php echo $user->user->realname; ?></code></td>
+                <td colspan="2"><code><?php echo htmlspecialchars($user->user->realname); ?></code></td>
             </tr><tr>
                 <th>Virtual Host</th>
-                <td colspan="2"><code><?php echo (isset($user->user->vhost)) ? $user->user->vhost : ""; ?></code></td>
+                <td colspan="2"><code><?php echo (isset($user->user->vhost)) ? htmlspecialchars($user->user->vhost) : ""; ?></code></td>
             </tr><tr>
                 <th>Connected to</th>
-                <td colspan="2"><code><?php echo $user->user->servername; ?></code></td>
-                <td></td>
+                <?php $serverlkup = $rpc->server()->get($user->user->servername); ?>
+                          
+                <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>
+
             </tr>
             <tr>
                 <th>Logged in as</th>
-                <td colspan="2"><code><?php echo (isset($user->user->account)) ? $user->user->account : ""; ?></code></td>
+                <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>
             </tr>
                 
 
@@ -54,7 +59,7 @@ function generate_html_usersettings($user)
 {
     ?>
 
-    <table class="table table-responsive caption-top table-hover">
+    <table class="table-sm table-responsive caption-top table-hover">
         <tbody>
            <?php
                 for ($i=0; ($mode = (isset($user->user->modes[$i])) ? $user->user->modes[$i] : NULL); $i++)
@@ -65,15 +70,18 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Oper</th>
-                                <td colspan="2">
-                                    <table class="table table-responsive caption-top table-hover">
+                                <td>
+                                    <table class="table-sm table-responsive caption-top table-hover">
                                         <tr>
                                             <td>Oper Login</td>
-                                            <td><code><?php echo $user->user->operlogin; ?></code></td>
+                                            <td><code><?php
+                                            $operlogin = (isset($user->user->operlogin)) ? $user->user->operlogin : "";
+                                             echo htmlspecialchars($operlogin); 
+                                             ?></code></td>
                                         </tr>
                                         <tr>
                                             <td>Oper Class</td>
-                                            <td><?php  echo (isset($user->user->operclass)) ? "<span class=\"badge-pill badge-info\">".$user->user->operclass."</span>" : "<span class=\"badge-pill badge-info\">None</span>"; ?></td>
+                                            <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>
                                         </tr>
                                     </table>
                                 </td>
@@ -85,7 +93,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Service Bot</th>
-                                <td colspan="2">
+                                <td>
                                 This user is a Services Bot.
                                 </td>
                             </tr>
@@ -96,7 +104,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Deaf</th>
-                                <td colspan="2">User is ignoring channel messages.</td>
+                                <td>User is ignoring channel messages.</td>
                             </tr>
                         <?php
                     }
@@ -105,7 +113,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Invisible</th>
-                                <td colspan="2">Not shown in /WHO searches.</td>
+                                <td>Not shown in /WHO searches.</td>
                             </tr>
                         <?php
                     }
@@ -114,7 +122,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Private channels</th>
-                                <td colspan="2">Channels hidden in /WHOIS outputs.</td>
+                                <td>Channels hidden in /WHOIS outputs.</td>
                             </tr>
                         <?php
                     }
@@ -123,7 +131,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Registered Nick</th>
-                                <td colspan="2">This user is using a registered nick.</td>
+                                <td>This user is using a registered nick.</td>
                             </tr>
                         <?php
                     }
@@ -132,7 +140,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Server Notices</th>
-                                <td colspan="2">This user is receiving server notices.</td>
+                                <td>This user is receiving server notices.</td>
                             </tr>
                         <?php
                     }
@@ -141,7 +149,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Virtual Host</th>
-                                <td colspan="2">Using a custom hostmask</td>
+                                <td>Using a custom hostmask</td>
                             </tr>
                         <?php
                     }
@@ -150,7 +158,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Wallops</th>
-                                <td colspan="2">Listening to <code>/WALLOPS</code> notices from IRC Operators.</td>
+                                <td>Listening to <code>/WALLOPS</code> notices from IRC Operators.</td>
                             </tr>
                         <?php
                     }
@@ -159,7 +167,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Hostmask</th>
-                                <td colspan="2">Using a hostmask (hiding their IP from non-IRCops).</td>
+                                <td>Using a hostmask (hiding their IP from non-IRCops).</td>
                             </tr>
                         <?php
                     }
@@ -168,15 +176,18 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Secure</th>
-                                <td colspan="2">
-                                <table class="table table-responsive caption-top table-hover">
+                                <td>
+                                <table class="table-sm table-responsive caption-top table-hover">
                                         <tr>
                                             <td>Cipher</td>
-                                            <td><code><?php echo $user->tls->cipher; ?></code></td>
+                                            <td><code><?php
+                                                $cipher = (isset($user->tls->cipher)) ? $user->tls->cipher : "";
+                                                echo htmlspecialchars($cipher);
+                                            ?></code></td>
                                         </tr>
                                         <tr>
                                             <td>Cert Fingerprint</td>
-                                            <td><?php echo (isset($user->tls->certfp)) ? "<span class=\"badge-pill badge-info\">".$user->tls->certfp."</span>" : "<span class=\"badge-pill badge-info\">None</span>"; ?></td>
+                                            <td><?php echo (isset($user->tls->certfp)) ? "<code>".htmlspecialchars($user->tls->certfp)."</code>" : "<span class=\"rounded-pill badge badge-info\">None</span>"; ?></td>
                                         </tr>
                                     </table> 
                                 </td>
@@ -290,4 +301,69 @@ function generate_html_usersettings($user)
     </table>
 
     <?php
-}
\ No newline at end of file
+}
+
+
+function generate_html_userchannels($user)
+{
+    ?>
+
+    <table class="table-sm table-responsive caption-top table-hover table-striped">
+        <thead class="table-info">
+            <th>
+                Channel
+            </th>
+            <th >
+                Status
+            </th>
+        </thead>
+        <tbody>
+            <?php
+                foreach($user->user->channels as $chan)
+                {
+                    ?>
+                    <tr>
+                        <td><?php echo "<a href=\"".get_config("base_url")."channels/details.php?chan=".urlencode($chan->name)."\">$chan->name</a>"; ?></td>
+                        <td>
+                            
+                            <?php
+                                for ($i = 0; isset($chan->level[$i]); $i++)
+                                {
+                                    ?><div class="text-nowrap row mb-1"><?php
+                                    if ($chan->level[$i] == "v")
+                                    {
+                                        ?><span class="rounded-pill badge badge-info" value="Voice">Voice</span><?php
+                                    }
+                                    if ($chan->level[$i] == "h")
+                                    {
+                                        ?><span class="rounded-pill badge badge-info">Half-Op</span><?php
+                                    }
+                                    if ($chan->level[$i] == "o")
+                                    {
+                                        ?><h6><span class="rounded-pill badge badge-info">Operator</span></h6><?php
+                                    }
+                                    if ($chan->level[$i] == "a")
+                                    {
+                                        ?><span class="rounded-pill badge badge-info">Admin</span><?php
+                                    }
+                                    if ($chan->level[$i] == "q")
+                                    {
+                                        ?><span class="rounded-pill badge badge-info">Owner</span><?php
+                                    }
+                                    if ($chan->level[$i] == "Y")
+                                    {
+                                        ?><span class="rounded-pill badge badge-info">OJOIN</span><?php
+                                    }
+                                  ?></div><?php
+                                }
+                            ?>
+                        </td>
+                    </tr>
+                    <?php
+                }
+            ?>
+        </tbody>
+    </table>
+
+    <?php
+}