require_once "connection.php";
require_once "misc/strings.php";
require_once "misc/user-lookup-misc.php";
+require_once "misc/server-lookup-misc.php";
require_once "Classes/class-log.php";
require_once "Classes/class-message.php";
require_once "Classes/class-rpc.php";
--- /dev/null
+<?php
+
+
+function generate_html_serverinfo($server)
+{
+ ?>
+
+ <table class="table-sm table-responsive caption-top table-hover">
+ <tbody>
+ <tr>
+ <th>Name</th>
+ <td colspan="2"><code><?php echo $server->name; ?></code></td>
+ </tr><tr>
+ <th>Server ID (SID)</th>
+ <td colspan="2"><code><?php echo $server->id; ?></code></td>
+ </tr><tr>
+ <th>Host</th>
+ <td colspan="2"><code><?php echo $server->hostname; ?></code></td>
+ </tr><tr>
+ <th>IP</th>
+ <td colspan="2"><code><?php echo $server->ip." </code> ";
+ if ($cc = (isset($server->geoip->country_code)) ? strtolower($server->geoip->country_code) : "")
+ {
+ ?> <img src="https://flagcdn.com/48x36/<?php echo $cc; ?>.png"
+ width="20"
+ height="15">
+ <?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>
+ </tr><tr>
+ <th>Virtual Host</th>
+ <td colspan="2"><code><?php echo (isset($server->user->vhost)) ? $server->user->vhost : ""; ?></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>
+ </tr>
+
+
+ </tbody>
+ </table>
+
+ <?php
+}
+function generate_html_modlist($srv)
+{
+ global $rpc;
+ $modules = $rpc->server()->module_list($srv->id);
+ ?>
+
+ <table class="table table-sm table-responsive table-hover">
+ <thead class="table-info">
+ <th>Name</th>
+ <th>Description</th>
+ <th>Source</th>
+ <th>Author</th>
+ <th>Version</th>
+ </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>";
+ }
+ ?>
+ </tbody>
+ </table>
+
+ <?php
+}
\ No newline at end of file
<th>Nick</th>
<td colspan="2"><code><?php echo $user->name; ?></code></td>
</tr><tr>
- <th>UID</th>
+ <th>User ID (UID)</th>
<td colspan="2"><code><?php echo $user->id; ?></code></td>
</tr><tr>
<th>Real Host</th>
{
$servername = $_GET['server'];
$srv = $rpc->server()->get($servername);
- echo highlight_string("<?php ".var_export($srv, true));
- $modules = $rpc->server()->module_list($servername);
- $err = $rpc->error;
- echo highlight_string("<?php ".var_export($modules, true). "$err");
if (!$srv)
{
Message::Fail("Could not find server: \"$servername\"");
- } else {
+ }
+
+ else {
$servername = $srv->name;
$title .= " for \"" . $servername . "\"";
}
<br>
<form method="get" action="details.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="nick" name="nick" type="text" value=<?php echo $servername; ?>>
+ <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 class="card">
<div class="card-body">
<h5 class="card-title">Basic Information</h5>
- <p class="card-text"><?php generate_html_whois($srv); ?></p>
+ <p class="card-text"><?php generate_html_serverinfo($srv); ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
-</div>
-<div class="row">
- <div class="col-sm-3">
- <div class="card">
- <div class="card-body">
- <h5 class="card-title">User Settings</h5>
- <p class="card-text"><?php generate_html_usersettings($srv); ?></p>
- </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