]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Add the start of the network overview tab
authorValerie Pond <redacted>
Wed, 11 Jan 2023 21:11:07 +0000 (21:11 +0000)
committerValerie Pond <redacted>
Wed, 11 Jan 2023 21:11:07 +0000 (21:11 +0000)
common.php
misc/user-lookup-misc.php
network/details.php [new file with mode: 0644]
network/index.php [new file with mode: 0644]

index 4f29d11983b16d01f120b49a34dd5edd95caca9d..e6df7da64a12ff3a502ebf2950539e53c330c27a 100644 (file)
@@ -22,11 +22,12 @@ function show_nick_only($str)
        return $str;
 }
 
-$pages = Array("Overview"      => "index.php",
-                          "Users"              => "users/index.php",
-                          "Channels"   => "channels/index.php",
+$pages = Array("Overview"      => "",
+                          "Users"              => "users",
+                          "Channels"   => "channels",
                           "Server Bans"        => "server_bans.php",
                           "Spamfilter" => "spamfilter.php",
+                          "Network" => "network",
                           "News"               => "news.php");
 
 
index 7bc997c429ea773d5e6df7d9e0a5cb84aad11d5a..a6d51613f5ca2bb6869fc0784866eb4dfbe99141 100644 (file)
@@ -37,7 +37,7 @@ function generate_html_whois($user)
             </tr><tr>
                 <th>Connected to</th>
                 <td colspan="2"><code><?php echo $user->user->servername; ?></code></td>
-                <td></td>
+
             </tr>
             <tr>
                 <th>Logged in as</th>
@@ -65,7 +65,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Oper</th>
-                                <td colspan="2">
+                                <td>
                                     <table class="table table-responsive caption-top table-hover">
                                         <tr>
                                             <td>Oper Login</td>
@@ -85,7 +85,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 +96,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 +105,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 +114,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 +123,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 +132,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 +141,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 +150,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 +159,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,7 +168,7 @@ function generate_html_usersettings($user)
                         ?>
                             <tr>
                                 <th>Secure</th>
-                                <td colspan="2">
+                                <td>
                                 <table class="table table-responsive caption-top table-hover">
                                         <tr>
                                             <td>Cipher</td>
@@ -176,7 +176,7 @@ function generate_html_usersettings($user)
                                         </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)) ? "".$user->tls->certfp."" : "<span class=\"badge-pill badge-info\">None</span>"; ?></td>
                                         </tr>
                                     </table> 
                                 </td>
diff --git a/network/details.php b/network/details.php
new file mode 100644 (file)
index 0000000..cbe2b76
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+require_once "../common.php";
+require_once "../header.php";
+
+$title = "User Lookup";
+$nickname = "";
+$nick = NULL;
+if (isset($_GET['nick']))
+{
+       $nickname = $_GET['nick'];
+       $nick = $rpc->server()->get($nickname);
+  echo highlight_string("<?php ".var_export($nick, true));
+       if (!$nick)
+       {
+               Message::Fail("Could not find user: \"$nickname\"");
+       } else {
+               $nickname = $nick->name;
+               $title .= " for \"" . $nickname . "\"";
+       }
+}
+?>
+<title><?php echo $title; ?></title>
+<h4><?php echo $title; ?></h4>
+<br>
+<form method="get" action="details.php">
+<div class="input-group short-form-control justify-content-center align-items-center">
+       <input style="margin: 0%; height: 24px;" class="left-pan form-control" id="nick" name="nick" type="text" value=<?php echo $nickname; ?>>
+       <div class="input-group-append">
+               <br><button type="submit" class="btn btn-primary">Go</button>
+       </div>
+</div>
+</form>
+
+<?php if (!$nick)
+       return; ?>
+<br>
+<div class="row">
+  <div class="col-sm-3">
+    <div class="card">
+      <div class="card-body">
+        <h5 class="card-title">Basic Information</h5>
+        <p class="card-text"><?php generate_html_whois($nick); ?></p>
+      </div>
+    </div>
+  </div>
+  <div class="col-sm-4">
+    <div class="card">
+      <div class="card-body">
+        <h5 class="card-title">User Settings</h5>
+        <p class="card-text"><?php generate_html_usersettings($nick); ?></p>
+      </div>
+    </div>
+  </div>
+</div>
+<div class="row">
+  <div class="col-sm-3">
+      <div class="card">
+        <div class="card-body">
+          <h5 class="card-title">User Settings</h5>
+          <p class="card-text"><?php generate_html_usersettings($nick); ?></p>
+        </div>
+      </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/network/index.php b/network/index.php
new file mode 100644 (file)
index 0000000..78412f2
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+require_once "../common.php";
+require_once UPATH . "/header.php";
+
+if (!empty($_POST)) {
+       do_log($_POST);
+}
+
+/* Get the server list */
+$servers = $rpc->server()->getAll();
+?>
+<h4>Servers Overview</h4>
+
+Click on a server name to view more information.
+
+<div id="Servers">
+       
+       <?php
+       if (isset($_POST['sf_name']) && strlen($_POST['sf_name']))
+               Message::Info("Listing servers which match name: \"" . $_POST['sf_name'] . "\"");
+
+       ?>
+       <table class="table table-responsive caption-top table-striped">
+       <thead>
+               <th scope="col"><h5>Filter:</h5></th>
+               <form action="" method="post">
+               <th scope="col" colspan="2">Name<input name="sf_name" type="text" class="form-control short-form-control">
+               <th scope="col"> <input class="btn btn-primary" type="submit" value="Search"></th></form>
+       </thead></table>
+
+       <table class="table table-responsive caption-top table-striped">
+       <thead class="table-primary">
+               <th scope="col"><input type="checkbox" label='selectall' onClick="toggle_server(this)" /></th>
+               <th scope="col">Name</th>
+               <th scope="col">Host / IP</th>
+               <th scope="col"><span data-toggle="tooltip" data-placement="bottom" title="This shows [Secure] if the server is using SSL/TLS or is on localhost." style="border-bottom: 1px dotted #000000">Secure</span></th>
+               <th scope="col">Connected to</th>
+       </thead>
+       
+       <tbody>
+       <form method="post">
+       <?php
+
+               foreach($servers as $server)
+               {
+
+               
+                       /* Some basic filtering for NAME */
+                       if (isset($_POST['sf_name']) && strlen($_POST['sf_name']) && 
+                       strpos(strtolower($server->name), strtolower($_POST['sf_name'])) !== 0 &&
+                       strpos(strtolower($server->name), strtolower($_POST['sf_name'])) == false)
+                               continue;
+
+
+                       echo "<tr>";
+                       echo "<th scope=\"row\"><input type=\"checkbox\" value='" . base64_encode($server->id)."' name=\"serverch[]\"></th>";
+                       $isBot = (strpos($server->server->modes, "B") !== false) ? ' <span class="badge-pill badge-dark">Bot</span>' : "";
+                       echo "<td><a href=\"details.php?nick=".$server->id."\">$server->name$isBot</a></td>";
+                       echo "<td>".$server->hostname." (".$server->ip.")</td>";
+                       $secure = (isset($server->tls)) ? "<span class=\"badge-pill badge-success\">Secure</span>" : "<span class=\"badge-pill badge-danger\">Insecure</span>";
+                       if (strpos($server->server->modes, "S") !== false)
+                               $secure = "";
+                       echo "<td>".$secure."</td>";
+                       echo "<td>".$server->server->uplink."</td>";
+               }
+       ?>
+       </tbody></table>
+</div>
+
+<?php require_once UPATH.'/footer.php'; ?>