]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - users/index.php
Users: add field to filter by server
[irc/unrealircd/unrealircd-webpanel.git] / users / index.php
index 98421d9faf9c140ba21e1a0d81d958bb29f46295..b95d70a07a9fe2282ec50a9fe1c769ff8b696099 100644 (file)
@@ -77,6 +77,9 @@ Click on a username to view more information.
        if (isset($_POST['uf_account']) && strlen($_POST['uf_account']))
                Message::Info("Listing users which match account: \"" . $_POST['uf_account'] . "\"");
 
+       if (isset($_POST['uf_server']) && strlen($_POST['uf_server']))
+               Message::Info("Listing users connected to servers matching: \"" . $_POST['uf_server'] . "\"");
+
 
        ?>
        <table class="container-xxl table table-responsive caption-top table-striped">
@@ -87,6 +90,7 @@ Click on a username to view more information.
                <th scope="col" colspan="2">Host <input name="uf_host" type="text" class="form-control short-form-control"></th>
                <th scope="col" colspan="2">IP <input name="uf_ip" type="text" class="form-control short-form-control"></th>
                <th scope="col" colspan="2">Account <input name="uf_account" type="text" class="form-control short-form-control"></th>
+               <th scope="col" colspan="2">Server <input name="uf_server" type="text" class="form-control short-form-control"></th>
                <th scope="col" colspan="2"><input <?php echo (isset($_POST['operonly'])) ? "checked" : ""; ?> name="operonly" type="checkbox" value=""> Opers Only</th>
                <th scope="col"> <input class="btn btn-primary" type="submit" value="Search"></th></form>
        </thead></table>
@@ -136,9 +140,15 @@ Click on a username to view more information.
                        strpos(strtolower($user->user->account), strtolower($_POST['uf_account'])) == false)
                                continue;
 
+                       /* Some basic filtering for ACCOUNT */
+                       if (isset($_POST['uf_server']) && strlen($_POST['uf_server']) && 
+                       strpos(strtolower($user->user->servername), strtolower($_POST['uf_server'])) !== 0 &&
+                       strpos(strtolower($user->user->servername), strtolower($_POST['uf_server'])) == false)
+                               continue;
+
                        /* Some basic filtering for OPER */
                        if (isset($_POST['operonly']) &&
-                       strpos($user->user->modes, "o") == false || strpos($user->user->modes,"S") !== false)
+                       (strpos($user->user->modes, "o") == false || strpos($user->user->modes,"S") !== false))
                                continue;
 
                        echo "\n<tr>";
@@ -159,8 +169,7 @@ Click on a username to view more information.
                        if (strpos($user->user->modes, "S") !== false)
                                $secure = "";
                        echo "<td>".$secure."</td>";
-               $serverlkup = $rpc->server()->get($user->user->servername);
-                       echo "<td><a href=\"".BASE_URL."servers/details.php?server=$serverlkup->id\">".$user->user->servername."</a></td>";
+                       echo "<td><a href=\"".BASE_URL."servers/details.php?server=".substr($user->id, 0, 3)."\">".$user->user->servername."</a></td>";
                        echo "<td>".$user->user->reputation."</td>";
                        echo "</tr>";
                }