<?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 = [];
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))
{
}
}
}
-
+$checkforupdates = (isset($_POST['checkforupdates'])) ? true : false;
/* Get the server list */
$servers = $rpc->server()->getAll();
+$latest = 0;
+if ($checkforupdates)
+{
+ $latest = get_unreal_latest_version();
+}
?>
<h4>Servers Overview</h4>
<?php
<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="form-control short-form-control">
+ <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">Rehash Selected</div><br><br>
+ <form action="index.php" method="post">
+ <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">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="myModalLabel">Rehash Selected Servers</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- Are you sure you want to rehash the selected servers?
- </div>
- <div class="modal-footer">
- <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
- <button type="submit" class="btn btn-primary" name="rehash">Rehash Selected</button>
- </div>
+ <div class="modal-header">
+ <h5 class="modal-title" id="myModalLabel">Rehash Selected Servers</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ Are you sure you want to rehash the selected servers?
+ </div>
+ <div class="modal-footer">
+ <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
+ <button type="submit" class="btn btn-primary" name="rehash">Rehash Selected</button>
+ </div>
</div>
</div>
</div>
strpos(strtolower($server->name), strtolower($_POST['sf_name'])) == false)
continue;
+ $update = "";
+ if ($checkforupdates && $latest)
+ {
+
+ $tok = split($server->server->features->software, "-");
+ if (!strcasecmp($tok[0],"unrealircd"))
+ {
+ if ($latest > $tok[1])
+ $update = " <i class=\"fa-solid fa-cloud-arrow-down\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Upgrade available!\"></i>";
+ }
+ }
echo "<tr>";
echo "<th scope=\"row\"><input type=\"checkbox\" value='$server->id' name=\"serverch[]\"></th>";
- echo "<td><a href=\"details.php?server=".$server->id."\">$server->name</a></td>";
+ echo "<td><a href=\"details.php?server=".$server->id."\">$server->name</a> $update</td>";
echo "<td>".$server->server->num_users."</td>";
$s = sinfo_conv_version_string($server);
-
+
echo "<td>$s</td>";
if (isset($server->server->uplink))
echo "<td>".$server->server->uplink."</td>";
</tbody></table>
</div>
-<?php require_once UPATH.'/footer.php'; ?>
+<?php require_once UPATH.'/inc/footer.php'; ?>