]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - misc/server-lookup-misc.php
Users: get rid of "user modes" column. Similar to previous, at least for now.
[irc/unrealircd/unrealircd-webpanel.git] / misc / server-lookup-misc.php
index c93864b05f08af87f99888d34ed14f1490f91ec6..8902ac76049ff608b4923c8957f50451805bcb4a 100644 (file)
@@ -3,16 +3,15 @@
 
 function generate_html_servermodes($server)
 {
-    include UPATH . "/Classes/class-cmodes.php";
     ?>
     <table class="table-sm table-responsive caption-top table-hover">
     <thead>
         <th>Name</th>
+        <th>Mode</th>
         <th>Description</th>
         <th>Requires</th>
     </thead>
        <?php
-
        foreach ($server->server->features->chanmodes as $set)
        {
            if (!$set)
@@ -24,6 +23,7 @@ function generate_html_servermodes($server)
                    ?>
                 <tr>
                     <th><?php echo IRCList::$cmodes[$mode]['name']; ?></th>
+                    <th><code><?php echo $mode; ?></code></th>
                     <td><?php echo IRCList::$cmodes[$mode]['description']; ?></td>
                     <td><div class="badge rounded-pill badge-dark"><?php echo IRCList::$cmodes[$mode]['requires']; ?></div></td>
                 </tr><?php
@@ -80,7 +80,7 @@ function sinfo_conv_version_string($server) : string
         }
         $return = "<span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"$tooltip\"><code>" . $display_string . "</code> <div class=\"badge rounded-pill badge-dark\">$badge</div></a>";
     }
-    if ($server->server->ulined)
+    if (isset($server->server->ulined) && $server->server->ulined)
         $return .= "<div class=\"badge rounded-pill badge-warning\">Services</div>";
     return $return;
 }
@@ -103,7 +103,7 @@ function generate_html_serverinfo($server)
             </tr><tr>
                 <th>Uplink</th>
                 <?php $serverlkup = (isset($server->server->uplink)) ? $rpc->server()->get($server->server->uplink) : "<span class=\"badge rounded-pill badge-info\">None</span>"; ?>
-                <td colspan="2"><code><?php echo "<a href=\"".BASE_URL."servers/details.php?server=".htmlspecialchars($serverlkup->id)."\">".htmlspecialchars($server->server->uplink)."</a>"; ?></code></td>
+                <td colspan="2"><code><?php echo "<a href=\"".get_config("base_url")."servers/details.php?server=".htmlspecialchars($serverlkup->id)."\">".htmlspecialchars($server->server->uplink)."</a>"; ?></code></td>
             </tr><tr>
                 <th>User count</th>
                 <td colspan="2"><code><?php echo htmlspecialchars($server->server->num_users); ?></code></td>
@@ -116,6 +116,259 @@ function generate_html_serverinfo($server)
 
     <?php
 }
+
+function generate_html_usermodes($server)
+{
+    $modes = $server->server->features->usermodes;
+    echo "<table class=\"table-sm table-responsive caption-top table-hover\">";
+    for ($i=0; ($mode = (isset($modes[$i])) ? $modes[$i] : NULL); $i++)
+    {
+    
+        if ($mode == "o")
+        {
+            ?>
+                <tr>
+                    <th>Oper</th>
+                    <td>
+                        User is an IRC Operator.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "S")
+        {
+            ?>
+                <tr>
+                    <th>Service Bot</th>
+                    <td>
+                    User is a Services Bot.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "d")
+        {
+            ?>
+                <tr>
+                    <th>Deaf</th>
+                    <td>User is ignoring channel messages.</td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "i")
+        {
+            ?>
+                <tr>
+                    <th>Invisible</th>
+                    <td>Not shown in /WHO searches.</td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "p")
+        {
+            ?>
+                <tr>
+                    <th>Private channels</th>
+                    <td>Channels hidden in /WHOIS outputs.</td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "r")
+        {
+            ?>
+                <tr>
+                    <th>Registered Nick</th>
+                    <td>User is using a registered nick.</td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "s")
+        {
+            ?>
+                <tr>
+                    <th>Server Notices</th>
+                    <td>User is receiving server notices.</td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "t")
+        {
+            ?>
+                <tr>
+                    <th>Virtual Host</th>
+                    <td>Using a custom hostmask.</td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "w")
+        {
+            ?>
+                <tr>
+                    <th>Wallops</th>
+                    <td>Listening to <code>/WALLOPS</code> notices from IRC Operators.</td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "x")
+        {
+            ?>
+                <tr>
+                    <th>Hostmask</th>
+                    <td>Using a hostmask (hiding their IP from non-IRCops).</td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "z")
+        {
+            ?>
+                <tr>
+                    <th>Secure</th>
+                    <td>
+                    User is using a secure connection.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "B")
+        {
+            ?>
+                <tr>
+                    <th>Bot</th>
+                    <td colspan="2">
+                    User is marked as a Bot.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "D")
+        {
+            ?>
+                <tr>
+                    <th>PrivDeaf</th>
+                    <td colspan="2">
+                    User is rejecting incoming private messages.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "G")
+        {
+            ?>
+                <tr>
+                    <th>Filter</th>
+                    <td colspan="2">
+                    User is filtering Bad Words.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "H")
+        {
+            ?>
+                <tr>
+                    <th>Hide IRCop</th>
+                    <td colspan="2">
+                    User is hiding their IRCop status.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "I")
+        {
+            ?>
+                <tr>
+                    <th>Hide Idle</th>
+                    <td colspan="2">
+                    User is hiding their idle time.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "R")
+        {
+            ?>
+                <tr>
+                    <th>RegOnly Messages</th>
+                    <td colspan="2">
+                    User is only accepting private messages from registered users.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "T")
+        {
+            ?>
+                <tr>
+                    <th>Deny CTCPs</th>
+                    <td colspan="2">
+                    Denying CTCP requests.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "W")
+        {
+            ?>
+                <tr>
+                    <th>View /WHOIS</th>
+                    <td colspan="2">
+                    User is receiving notifications when someone does a <code>/WHOIS</code> on them.
+                    </td>
+                </tr>
+            <?php
+        }
+        elseif ($mode == "Z")
+        {
+            ?>
+                <tr>
+                    <th>Deny Insecure Messages</th>
+                    <td colspan="2">
+                    User is only accepting messages from users using a secure connection.
+                    </td>
+                </tr>
+            <?php
+        }
+    }
+    echo "</table>";
+}
+
+function generate_html_extserverinfo($server)
+{
+   ?>
+    <table class="table-sm table-responsive caption-top table-hover">
+        <tbody>
+            <tr>
+                <th>IP</th>
+                <td colspan="2"><code><?php echo htmlspecialchars($server->ip); ?></code></td>
+            </tr><tr>
+                <th>Boot time</th>
+                <td colspan="2"><code><?php echo htmlspecialchars($server->server->boot_time); ?></code></td>
+            </tr><tr>
+                <th>U-Lined</th>
+                <td colspan="2"><?php echo ($server->server->ulined) ? "<span class=\"badge rounded-pill badge-success\">Yes</span>" : "<span class=\"badge rounded-pill badge-danger\">No</span>"; ?></td>
+            </tr><tr>
+                <th>Protocol</th>
+                <td colspan="2"><a href="https://www.unrealircd.org/docs/Server_protocol:Protocol_version"><code><?php echo htmlspecialchars($server->server->features->protocol); ?></code></a></td>
+            </tr><tr>
+                <th>TLS</th>
+
+                <td colspan="2">
+                    <table>
+                        <tr>
+                            <th>Cert Fingerprint</th>
+                            <td><?php echo "<span class=\"badge rounded-pill badge-info\">".htmlspecialchars($server->tls->certfp)."</span>"; ?></td>
+                        </tr><tr>
+                            <th>TLS Cipher</th>
+                            <td><?php echo "<span class=\"badge rounded-pill badge-info\">".htmlspecialchars($server->tls->cipher)."</span>"; ?></td>
+                        </tr>
+                        
+                    </table>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+    <?php
+}
 function generate_html_modlist($srv)
 {
     global $rpc;
@@ -155,4 +408,29 @@ function generate_html_modlist($srv)
     </table>
 
     <?php
+}
+
+
+function get_unreal_latest_version()
+{
+    $url = "https://www.unrealircd.org/downloads/list.json";
+    $contents = file_get_contents($url);
+    if (!$contents)
+    {
+        Message::Fail("Could not get latest version of UnrealIRCd. Please check again later.");
+        return NULL;
+    }
+    $arr = json_decode($contents, true);
+    $biggest = 0;
+    foreach($arr as $key => $value)
+    {
+        if ($key > $biggest)
+            $biggest = $key;
+    }
+    if (!$biggest)
+    {
+        Message::Fail("Could not get latest version of UnrealIRCd. Please check again later.");
+        return NULL;
+    }
+    return $arr[$biggest]['Stable']['version'];
 }
\ No newline at end of file