2 require_once "../common.php";
3 require_once UPATH
. "/header.php";
12 if (isset($_POST['rehash']))
13 foreach ($_POST['serverch'] as $servID)
14 if ($response = $rpc->server()->rehash($servID))
16 $serb = $rpc->server()->get($servID);
17 do_log($servID, $response);
18 if ($response->success
|| (!isset($response->success
) != false && $response == true))
20 $rehash_success[] = $serb->name
;
21 foreach($response->log
as $log)
24 if ($log->level
== "warn")
25 $rehash_warnings[$log->log_source
][] = $log->msg
;
28 else if (isset($response->success
) && !$response->success
)
30 foreach ($response->log
as $log)
32 if ($log->level
== "error")
33 $rehash_errors[$log->log_source
][] = $log->msg
;
38 $checkforupdates = (isset($_POST['checkforupdates'])) ? true : false;
39 /* Get the server list */
40 $servers = $rpc->server()->getAll();
44 $latest = get_unreal_latest_version();
47 <h4
>Servers Overview
</h4
>
49 if (isset($_POST['rehash']))
51 if (!empty($rehash_success)) {
52 do_log($rehash_success);
53 $servlist_bullet = "<ol>";
55 foreach ($rehash_success as $serv) {
56 $servlist_bullet .= "<li>$serv</li>";
58 $servlist_bullet .= "</ol>";
59 $servlist_err_bullet = "";
60 foreach ($rehash_errors as $serv => $err) {
61 $servlist_err_bullet .= "<h6>$serv</h6><ol>";
63 $servlist_err_bullet .= "<li>$er</li>";
66 $servlist_warn_bullet = ""; foreach ($rehash_warnings as $server => $warning) {
67 $servlist_warn_bullet .= "<h6>$serv</h6><ol>";
68 foreach ($warning as $w)
69 $servlist_warn_bullet .= "<li>$w</li>";
70 $servlist_warn_bullet .= "</ol>";
72 if (!empty($rehash_success))
74 "The following server(s) were successfully rehashed:",
77 if (!empty($rehash_warnings))
79 "The following warning(s) were encountered:",
82 if (!empty($rehash_errors))
84 "The following error(s) were encountered and the server(s) failed to rehash:",
89 if (isset($_POST['sf_name']) && strlen($_POST['sf_name']))
90 Message
::Info("Listing servers which match name: \"" . $_POST['sf_name'] . "\"");
93 Click on a server name to view more information
.
98 <table
class="container-xxl table table-sm table-responsive caption-top table-striped">
100 <th scope
="col"><h5
>Filter
:</h5
></th
>
101 <form action
="" method
="post">
102 <th scope
="col" colspan
="2">Name
<input name
="sf_name" type
="text" class="form-control short-form-control">
103 <th scope
="col"> <input
class="btn btn-primary btn-sm" type
="submit" value
="Search"></th
></form
>
105 <form action
="index.php" method
="post">
106 <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
>
107 <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
>
109 <div
class="modal fade" id
="rehash_modal" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
110 <div
class="modal-dialog modal-dialog-centered" role
="document">
111 <div
class="modal-content">
112 <div
class="modal-header">
113 <h5
class="modal-title" id
="myModalLabel">Rehash Selected Servers
</h5
>
114 <button type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
115 <span aria
-hidden
="true">×
;</span
>
118 <div
class="modal-body">
119 Are you sure you want to rehash the selected servers
?
121 <div
class="modal-footer">
122 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
123 <button type
="submit" class="btn btn-primary" name
="rehash">Rehash Selected
</button
>
128 <table
class="container-xxl table table-sm table-responsive caption-top table-striped">
129 <thead
class="table-primary">
130 <th scope
="col"><input type
="checkbox" label
='selectall' onClick
="toggle_server(this)" /></th
>
131 <th scope
="col">Name
</th
>
132 <th scope
="col">Users
</th
>
133 <th scope
="col">Version
</th
>
134 <th scope
="col">Connected to
</th
>
135 <th scope
="col">Up since
</th
>
141 foreach($servers as $server)
145 /* Some basic filtering for NAME */
146 if (isset($_POST['sf_name']) && strlen($_POST['sf_name']) &&
147 strpos(strtolower($server->name
), strtolower($_POST['sf_name'])) !== 0 &&
148 strpos(strtolower($server->name
), strtolower($_POST['sf_name'])) == false)
152 if ($checkforupdates && $latest)
155 $tok = split($server->server
->features
->software
, "-");
156 if (!strcasecmp($tok[0],"unrealircd"))
158 if ($latest > $tok[1])
159 $update = " <i class=\"fa-solid fa-cloud-arrow-down\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Upgrade available!\"></i>";
164 echo "<th scope=\"row\"><input type=\"checkbox\" value='$server->id' name=\"serverch[]\"></th>";
165 echo "<td><a href=\"details.php?server=".$server->id
."\">$server->name</a> $update</td>";
166 echo "<td>".$server->server
->num_users
."</td>";
168 $s = sinfo_conv_version_string($server);
171 if (isset($server->server
->uplink
))
172 echo "<td>".$server->server
->uplink
."</td>";
174 echo "<td></td>"; /* self */
175 echo "<td>".$server->server
->boot_time
."</td>";
182 <?php
require_once UPATH
.'/footer.php'; ?>