--- /dev/null
+<?php
+
+/**
+ * A set of reference lists
+ */
+class IRCList {
+ static $cmodes =
+ [
+ "a" => [
+ "name" => "Admin",
+ "description" => "Marks someone as channel admin (&)",
+ "requires" => "Admin"
+ ],
+ "b" => [
+ "name" => "Ban",
+ "description" => "Marks a ban from a channel",
+ "requires" => "HalfOp"
+ ],
+ "c" => [
+ "name" => "No CTCPs",
+ "description" => "Prevents users from sending CTCP's to the channel",
+ "requires" => "HalfOp"
+ ],
+ "e" => [
+ "name" => "Ban Exemption",
+ "description" => "Marks an exemption from channel bans",
+ "requires" => "HalfOp"
+ ],
+ "f" => [
+ "name" => "Flood Protection",
+ "description" => "Implements channel flood protection",
+ "requires" => "Operator"
+ ],
+ "h" => [
+ "name" => "Half Op",
+ "description" => "Marks someone as channel admin (%)",
+ "requires" => "Operator"
+ ],
+ "i" => [
+ "name" => "Invite Only",
+ "description" => "requires an invitation to join",
+ "requires" => "HalfOp"
+ ],
+ "k" => [
+ "name" => "Key",
+ "description" => "Requires a key/password to join",
+ "requires" => "HalfOp"
+ ],
+ "l" => [
+ "name" => "Limit",
+ "description" => "Limits a channel to a specific amount of users",
+ "requires" => "HalfOp"
+ ],
+ "m" => [
+ "name" => "Moderation",
+ "description" => "Prevents non-voiced users from speaking in a channel",
+ "requires" => "HalfOp"
+ ],
+ "n" => [
+ "name" => "No External Messages",
+ "description" => "Messages cannot be sent to the channel from outside it",
+ "requires" => "HalfOp"
+ ],
+ "o" => [
+ "name" => "Operator",
+ "description" => "Marks someone as channel operator (@)",
+ "requires" => "Operator"
+ ],
+ "p" => [
+ "name" => "Private",
+ "description" => "Prevents the channel from showing up in /WHOIS outputs and is replaces with \"*\" in /LIST outputs",
+ "requires" => "Operator"
+ ],
+ "q" => [
+ "name" => "Owner",
+ "description" => "Marks someone as channel owner (~)",
+ "requires" => "Owner"
+ ],
+ "r" => [
+ "name" => "Registered",
+ "description" => "Channel has been registered to an account",
+ "requires" => "Services"
+ ],
+ "s" => [
+ "name" => "Secret",
+ "description" => "Prevents the channel from showing up in <code>/WHOIS</code> and <code>/LIST</code> outputs",
+ "requires" => "Operator"
+ ],
+ "t" => [
+ "name" => "Topic",
+ "description" => "Only HalfOps and above may set the topic.",
+ "requires" => "HalfOp"
+ ],
+ "v" => [
+ "name" => "Voice",
+ "description" => "Marks someone as voiced in the channel (+)",
+ "requires" => "HalfOp"
+ ],
+ "z" => [
+ "name" => "Secure Only",
+ "description" => "Only users using a secure connection may join this channel.",
+ "requires" => "Operator"
+ ],
+ "C" => [
+ "name" => "No CTCPs",
+ "description" => "CTCP messages are not allowed on the channel.",
+ "requires" => "Operator"
+ ],
+ "D" => [
+ "name" => "Delay Join",
+ "description" => "Delay showing joins until someone actually speaks.",
+ "requires" => "Operator"
+ ],
+ "G" => [
+ "name" => "Filter",
+ "description" => "Filters out all Bad words in messages with \"<censored></pre>\".",
+ "requires" => "Operator"
+ ],
+ "H" => [
+ "name" => "History",
+ "description" => "Record channel history with specified maximums.",
+ "requires" => "Operator"
+ ],
+ "I" => [
+ "name" => "Invitation",
+ "description" => "Marks an inviation to a channel.",
+ "requires" => "HalOp"
+ ],
+ "K" => [
+ "name" => "No Knock",
+ "description" => "Users may not knock on this channel.",
+ "requires" => "HalfOp"
+ ],
+ "L" => [
+ "name" => "Link",
+ "description" => "Link to another channel when unable to join",
+ "requires" => "Operator"
+ ],
+ "M" => [
+ "name" => "Auth Moderated",
+ "description" => "Only users who have voice or are authenticated may talk in this channel.",
+ "requires" => "HalfOp"
+ ],
+ "N" => [
+ "name" => "No Nick Changes",
+ "description" => "Nickname changes are not permitted on the channel.",
+ "requires" => "HalfOp"
+ ],
+ "O" => [
+ "name" => "IRCOps Only",
+ "description" => "Only IRC Operators may join this channel.",
+ "requires" => "IRC Operator"
+ ],
+ "P" => [
+ "name" => "Permanent",
+ "description" => "This channel will exist even when nobody is inside.",
+ "requires" => "IRC Operator"
+ ],
+ "Q" => [
+ "name" => "No Kicks",
+ "description" => "Kicks are not allowed in this channel.",
+ "requires" => "Operator"
+ ],
+ "R" => [
+ "name" => "Reg Only",
+ "description" => "Only registered/authenticated users may join the channel.",
+ "requires" => "Operator"
+ ],
+ "S" => [
+ "name" => "Strip Color",
+ "description" => "All color is stripped from channel messages.",
+ "requires" => "IRC Operator"
+ ],
+ "T" => [
+ "name" => "No Notices",
+ "description" => "Notices are not permitted on the channel.",
+ "requires" => "IRC Operator"
+ ],
+ "V" => [
+ "name" => "No Invites",
+ "description" => "Users are not allowed to <code>/INVITE</code> others to the channel.",
+ "requires" => "IRC Operator"
+ ],
+ "Z" => [
+ "name" => "Is Secure",
+ "description" => "Indication that all users on the channel are on a Secure connection.",
+ "requires" => "Server"
+ ]
+ ];
+}
\ No newline at end of file
<?php
-function generate_html_serverinfo($server)
+function generate_html_servermodes($server)
{
+ include UPATH . "/Classes/class-cmodes.php";
?>
+ <table class="table-sm table-responsive caption-top table-hover">
+ <thead>
+ <th>Name</th>
+ <th>Description</th>
+ <th>Requires</th>
+ </thead>
+ <?php
+
+ foreach ($server->server->features->chanmodes as $set)
+ {
+ if (!$set)
+ break;
+ for ($i = 0; isset($set[$i]); $i++)
+ {
+ $mode = $set[$i];
+ if (isset(IRCList::$cmodes[$mode])) {
+ ?>
+ <tr>
+ <th><?php echo IRCList::$cmodes[$mode]['name']; ?></th>
+ <td><?php echo IRCList::$cmodes[$mode]['description']; ?></td>
+ <td><div class="badge rounded-pill badge-dark"><?php echo IRCList::$cmodes[$mode]['requires']; ?></div></td>
+ </tr><?php
+ }
+ else {
+ ?>
+ <tr>
+ <th>Unknown</th>
+ <td>Mode "<?php echo $mode; ?>"</td>
+ <td></td>
+ </tr><?php
+ }
+
+ }
+ }
+ ?>
+ </table><?php
+}
+function sinfo_conv_version_string($server) : string
+{
+ $string = (isset($server->server->features->software)) ? $server->server->features->software : "";
+ if (strlen($string) && strpos($string,"-"))
+ {
+ $tok = split($string, "-");
+ $return = "<code>" . $tok[1] . "</code> <label class=\"badge label rounded-pill badge-dark\">" . $tok[2] . "</div>";
+ }
+ if ($server->server->ulined)
+ $return .= "<div class=\"label rounded-pill badge-warning\">Services</div>";
+ return $return;
+}
+
+function generate_html_serverinfo($server)
+{
+ ?>
<table class="table-sm table-responsive caption-top table-hover">
<tbody>
<tr>
</tr><tr>
<th>Server ID (SID)</th>
<td colspan="2"><code><?php echo $server->id; ?></code></td>
+ </tr><tr>
+ <th>Info</th>
+ <td colspan="2"><code><?php echo $server->server->info; ?></code></td>
</tr><tr>
<th>Host</th>
<td colspan="2"><code><?php echo $server->hostname; ?></code></td>
<?php } ?>
</td>
</tr><tr>
- <th>Ident</th>
- <td colspan="2"><code><?php echo $server->user->username; ?></code></td>
- </tr><tr>
- <th>GECOS / Real Name</th>
- <td colspan="2"><code><?php echo $server->user->realname; ?></code></td>
+ <th>Uplink</th>
+ <td colspan="2"><code><?php echo "<a href=\"".BASE_URL."servers/details.php?server=".$server->server->uplink."\">".$server->server->uplink."</a>"; ?></code></td>
</tr><tr>
- <th>Virtual Host</th>
- <td colspan="2"><code><?php echo (isset($server->user->vhost)) ? $server->user->vhost : ""; ?></code></td>
+ <th>User count</th>
+ <td colspan="2"><code><?php echo $server->server->num_users; ?></code></td>
</tr><tr>
- <th>Connected to</th>
- <td colspan="2"><code><?php echo $server->user->servername; ?></code></td>
-
- </tr>
- <tr>
- <th>Logged in as</th>
- <td colspan="2"><code><?php echo (isset($server->user->account)) ? $server->user->account : ""; ?></code></td>
+ <th>Version</th>
+ <td colspan="2"><?php echo sinfo_conv_version_string($server); ?></td>
</tr>
-
-
</tbody>
</table>
{
global $rpc;
$modules = $rpc->server()->module_list($srv->id);
- ?>
+ if (!$modules || !$modules->list)
+ {
+ echo $rpc->error;
+ } else {
+ ?>
<table class="table table-sm table-responsive table-hover">
<thead class="table-info">
</thead>
<tbody>
<?php
- foreach($modules->list as $module)
- {
- echo "<tr>\n";
- echo "<td><code>$module->name</code></td>";
- $desc = $module->description;
- $short_desc = substr($desc, 0, 70); // truncate to 80 chars
- if (strlen($desc) > strlen($short_desc))
- $short_desc .= "...";
- echo "<td><span href='#' data-toggle='tooltip' title=\"$desc\">$short_desc</span></td>";
- $source = (!$module->third_party) ? "<div class=\"badge rounded-pill badge-success\">Official</div>" : "<div class=\"badge rounded-pill badge-info\">Third-Party</div>";
- echo "<td>$source</td>";
- echo "<td>$module->author</td>";
- echo "<td>$module->version</td>";
- }
+ foreach ($modules->list as $module) {
+ echo "<tr>\n";
+ echo "<td><code>$module->name</code></td>";
+ $desc = $module->description;
+ $short_desc = substr($desc, 0, 70); // truncate to 80 chars
+ if (strlen($desc) > strlen($short_desc))
+ $short_desc .= "...";
+ echo "<td><span href='#' data-toggle='tooltip' title=\"$desc\">$short_desc</span></td>";
+ $source = (!$module->third_party) ? "<div class=\"badge rounded-pill badge-success\">Official</div>" : "<div class=\"badge rounded-pill badge-info\">Third-Party</div>";
+ echo "<td>$source</td>";
+ echo "<td>$module->author</td>";
+ echo "<td>$module->version</td>";
+ }
+ }
?>
</tbody>
</table>
$title = "Server Lookup";
$servername = "";
$srv = NULL;
+if (isset($_POST))
+{
+ if (isset($_POST['disconnect']))
+ {
+ if ($rpc->server()->disconnect($_POST['disconnect'], $_POST['reason']))
+ Message::Success("Server \"".$_POST['disconnect']."\" has been successfully disconnected from the network.");
+ else
+ Message::Fail($rpc->error);
+ }
+
+}
if (isset($_GET['server']))
{
$servername = $_GET['server'];
<?php if (!$srv)
return; ?>
<br>
+<div class="row">
+ <div class="col-sm-3">
+ <div class="btn btn-sm btn-info" data-toggle="modal" data-target="#module_modal">Modules</div>
+ <div class="btn btn-sm btn-danger" data-toggle="modal" data-target="#disconnect_modal">Disconnect</div>
+ </div>
+</div>
+<br>
<div class="row">
<div class="col-sm-3">
<div class="card">
<div class="card">
<div class="card-body">
<h5 class="card-title">Server Settings</h5>
- <p class="card-text"><?php generate_html_usersettings($srv); ?></p>
+ <p class="card-text"><?php generate_html_servermodes($srv); ?></p>
</div>
</div>
</div>
+</div>
+
+<div class="modal fade" id="disconnect_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">Disconnect Server<?php echo $srv->name; ?></h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <form method="post">
+ Please enter a reason for disconnecting "<?php echo $srv->name; ?>"?
+ <input type="text" class="short-form-control form-control" id="reason" name="reason" value="No reason">
+ </div>
+ <div class="modal-footer">
+ <input type="hidden" id="server" name="disconnect" value="<?php echo $srv->name; ?>"></input>
+ <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
+ <button type="submit" action="post" class="btn btn-danger">Disconnect</button>
+ </form>
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="modal fade" id="module_modal" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true">
+ <div class="modal-dialog modal-lg modal-dialog-scrollable modal-dialog-centered container-fluid" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title" id="myModalLabel">Server Modules</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <?php generate_html_modlist($srv); ?>
+ </div>
+ <div class="modal-footer">
+ <button id="CloseButton" action="post" type="submit" class="btn btn-secondary" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="modal fade" id="module_modal" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true">
+ <div class="modal-dialog modal-lg modal-dialog-scrollable modal-dialog-centered container-fluid" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title" id="myModalLabel">Rehash Server"</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <?php generate_html_modlist($srv); ?>
+ </div>
+ <div class="modal-footer">
+ <button id="CloseButton" action="post" type="submit" class="btn btn-secondary" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+ </div>
</div>
\ No newline at end of file
+++ /dev/null
-<?php
-require_once "../common.php";
-require_once "../header.php";
-
-$title = "Modules";
-$servername = "";
-$srv = NULL;
-if (isset($_GET['server']))
-{
- $servername = $_GET['server'];
- $srv = $rpc->server()->get($servername);
- if (!$srv)
- {
- Message::Fail("Could not find server: \"$servername\"");
- } else {
-
- $modules = $rpc->server()->module_list($srv->id);
- if (!$modules->list)
- {
- Message::Fail("$rpc->error");
- }
- $servername = $srv->name;
- $title .= " for \"" . $servername . "\"";
- }
-}
-?>
-<title><?php echo $title; ?></title>
-<h4><?php echo $title; ?></h4>
-<br>
-<form method="get" action="modules.php">
-<div class="input-group short-form-control justify-content-center align-items-center">
- <input style="margin: 0%; height: 24px;" class="left-pan form-control" id="server" name="server" type="text" value=<?php echo $servername; ?>>
- <div class="input-group-append">
- <br><button type="submit" class="btn btn-primary">Go</button>
- </div>
-</div>
-</form>
-
-<?php if (!$srv)
- return; ?>
-<br>
-<?php generate_html_modlist($srv); ?>
\ No newline at end of file