]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - servers/index.php
Require permission to rehash for rehash and disconnect
[irc/unrealircd/unrealircd-webpanel.git] / servers / index.php
index ec4aa4f6e0b06f2cbb16ab9b9d6c1903658cf15e..d4a232f22e2b3fa2cb62d1e1b5b9d4bfd778ab46 100644 (file)
@@ -1,7 +1,9 @@
 <?php
-require_once "../common.php";
-require_once UPATH . "/header.php";
+require_once "../inc/common.php";
+require_once "../inc/header.php";
+require_once "../inc/connection.php";
 
+$can_rehash = current_user_can(PERMISSION_REHASH);
 $rehash_errors = [];
 $rehash_warnings = [];
 $rehash_success = [];
@@ -9,7 +11,7 @@ $rehash_success = [];
 if (!empty($_POST))
 {
        do_log($_POST);
-       if (isset($_POST['rehash']))
+       if (isset($_POST['rehash']) && $can_rehash)
                foreach ($_POST['serverch'] as $servID)
                        if ($response = $rpc->server()->rehash($servID)) 
                        {
@@ -96,14 +98,14 @@ Click on a server name to view more information.
        
        
        <table class="container-xxl table table-sm table-responsive caption-top table-striped">
-       <thead>
+       <thead class="table-primary">
                <th scope="col"><h5>Filter:</h5></th>
                <form action="" method="post">
                <th scope="col" colspan="2">Name: <input name="sf_name" type="text" class="short-form-control">
                <th scope="col"> <input class="btn btn-primary btn-sm" type="submit" value="Search"></th></form>
        </thead></table>
        <form action="index.php" method="post">
-               <div class="btn btn-sm btn-warning" data-toggle="modal" data-target="#rehash_modal"><i class="fa-solid fa-arrows-rotate"></i> Rehash Selected</div>
+               <div class="btn btn-sm btn-warning <?php echo $can_rehash ? "" : "disabled" ?>" data-toggle="modal" data-target="#rehash_modal"><i class="fa-solid fa-arrows-rotate"></i> Rehash Selected</div>
                <button name="checkforupdates" type="submit" class="btn btn-sm btn-info"><i class="fa-solid fa-cloud-arrow-down"></i> Check for upgrades</div><br>
 
                <div class="modal fade" id="rehash_modal" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true">
@@ -179,4 +181,4 @@ Click on a server name to view more information.
        </tbody></table>
 </div>
 
-<?php require_once UPATH.'/footer.php'; ?>
+<?php require_once UPATH.'/inc/footer.php'; ?>