]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - users/index.php
Shut up some errors
[irc/unrealircd/unrealircd-webpanel.git] / users / index.php
index 0a3e7eb76ce000505d1832df834ba9c7bca5eb8e..9e9ed9741871c88bd6a79b8e9f98ca8cc1ef407e 100644 (file)
@@ -13,8 +13,8 @@ if (!empty($_GET))
        if (isset($_GET['servicesonly']) && !isset($_POST['servicesonly']))
                $_POST['servicesonly'] = $_GET['servicesonly'];
 }
        if (isset($_GET['servicesonly']) && !isset($_POST['servicesonly']))
                $_POST['servicesonly'] = $_GET['servicesonly'];
 }
-
-if (!empty($_POST))
+$can_ban = current_user_can(PERMISSION_BAN_USERS);
+if (!empty($_POST) && $can_ban)
 {
        require_once "../inc/connection.php";
        do_log($_POST);
 {
        require_once "../inc/connection.php";
        do_log($_POST);
@@ -85,32 +85,11 @@ if (!empty($_POST))
 Click on a username to view more information.
 
 <div class="usertable">
 Click on a username to view more information.
 
 <div class="usertable">
-       
-       <?php
-
-       if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']))
-               Message::Info("Listing users which match nick: \"" . $_POST['uf_nick'] . "\"");
-
-       if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']))
-               Message::Info("Listing users which match IP: \"" . $_POST['uf_ip'] . "\"");
-
-       if (isset($_POST['uf_host']) && strlen($_POST['uf_host']))
-               Message::Info("Listing users which match hostmask: \"" . $_POST['uf_host'] . "\"");
-
-       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'] . "\"");
-
-
-       ?>
-
        <form method="post">
 
        <!-- The user list -->
        <table id="data_list" class="table-striped display responsive nowrap" style="width:100%">
        <form method="post">
 
        <!-- The user list -->
        <table id="data_list" class="table-striped display responsive nowrap" style="width:100%">
-       <thead>
+       <thead class="table-primary">
                <th scope="col"><input type="checkbox" label='selectall' onClick="toggle_user(this)" /></th>
                <th scope="col">Nick</th>
                <th class="countrycol" scope="col">Country</th>
                <th scope="col"><input type="checkbox" label='selectall' onClick="toggle_user(this)" /></th>
                <th scope="col">Nick</th>
                <th class="countrycol" scope="col">Country</th>
@@ -125,66 +104,68 @@ Click on a username to view more information.
        <!-- User Actions -->
        <table class="table table-responsive table-light">
        <tr>
        <!-- User Actions -->
        <table class="table table-responsive table-light">
        <tr>
-       <td colspan="2">
-       <label for="bantype">Apply action: </label>
-       <select name="bantype" id="bantype">
-                       <option value=""></option>
-               <optgroup label="Bans">
-                       <option value="gline">GLine</option>
-                       <option value="gzline">GZLine</option>
-                       <option value="kill">Kill</option>
-               </optgroup>
-       </select></td><td colspan="2">
-       <label for="banlen_w">Duration: </label>
-       <select name="banlen_w" id="banlen_w">
-                       <?php
-                       for ($i = 0; $i <= 56; $i++)
-                       {
-                               if (!$i)
-                                       echo "<option value=\"0w\"></option>";
-                               else
+       <td colspan="2" class="<?php echo $can_ban ? "" : "disabled"?>">
+               <label for="bantype">Apply action: </label>
+               <select name="bantype" id="bantype">
+                               <option value=""></option>
+                       <optgroup label="Bans">
+                               <option value="gline">GLine</option>
+                               <option value="gzline">GZLine</option>
+                               <option value="kill">Kill</option>
+                       </optgroup>
+               </select></td><td colspan="2">
+               <label for="banlen_w">Duration: </label>
+               <select name="banlen_w" id="banlen_w">
+                               <?php
+                               for ($i = 0; $i <= 56; $i++)
                                {
                                {
-                                       $w = ($i == 1) ? "week" : "weeks";
-                                       echo "<option value=\"$i" . "w\">$i $w" . "</option>";
+                                       if (!$i)
+                                               echo "<option value=\"0w\"></option>";
+                                       else
+                                       {
+                                               $w = ($i == 1) ? "week" : "weeks";
+                                               echo "<option value=\"$i" . "w\">$i $w" . "</option>";
+                                       }
                                }
                                }
-                       }
-                       ?>
-       </select>
-       <select name="banlen_d" id="banlen_d">
-                       <?php
-                       for ($i = 0; $i <= 31; $i++)
-                       {
-                               if (!$i)
-                                       echo "<option value=\"0d\"></option>";
-                               else
+                               ?>
+               </select>
+               <select name="banlen_d" id="banlen_d">
+                               <?php
+                               for ($i = 0; $i <= 31; $i++)
                                {
                                {
-                                       $d = ($i == 1) ? "day" : "days";
-                                       echo "<option value=\"$i" . "d\">$i $d" . "</option>";
+                                       if (!$i)
+                                               echo "<option value=\"0d\"></option>";
+                                       else
+                                       {
+                                               $d = ($i == 1) ? "day" : "days";
+                                               echo "<option value=\"$i" . "d\">$i $d" . "</option>";
+                                       }
                                }
                                }
-                       }
-                       ?>
-       </select>
-       <select name="banlen_h" id="banlen_h">
-                       <?php
-                       for ($i = 0; $i <= 24; $i++)
-                       {
-                               if (!$i)
-                                       echo "<option value=\"0d\"></option>";
-                               else
+                               ?>
+               </select>
+               <select name="banlen_h" id="banlen_h">
+                               <?php
+                               for ($i = 0; $i <= 24; $i++)
                                {
                                {
-                                       $h = ($i == 1) ? "hour" : "hours";
-                                       echo "<option value=\"$i" . "h\">$i $h" . "</option>";
+                                       if (!$i)
+                                               echo "<option value=\"0d\"></option>";
+                                       else
+                                       {
+                                               $h = ($i == 1) ? "hour" : "hours";
+                                               echo "<option value=\"$i" . "h\">$i $h" . "</option>";
+                                       }
                                }
                                }
-                       }
-                       
-                       ?>
-       </select>
-       
-       <br></td><tr><td colspan="3">
+                               
+                               ?>
+               </select>
+               
+               <br>
+       </td>
+       <tr><td colspan="3">
        
        <label for="ban_reason">Reason: </label>
        
        <label for="ban_reason">Reason: </label>
-       <input class="form-control" type="text" name="ban_reason" id="ban_reason" value="No reason">
-       <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#ban_confirmation">
+       <input class="form-control <?php echo $can_ban ? "" : "disabled"?>" type="text" name="ban_reason" id="ban_reason" value="No reason">
+       <button type="button" class="btn btn-primary <?php echo $can_ban ? "" : "disabled"?>" data-toggle="modal" data-target="#ban_confirmation">
                        Apply
        </button></td></table>
 
                        Apply
        </button></td></table>