<?php
define('UPATH', dirname(__FILE__));
require_once "config.php";
+if (!defined('BASE_DIR')) die("You need to define BASE_DIR in config.php (see config.php.sample for documentation)");
require_once "Classes/class-hook.php";
if (!is_dir(UPATH . "/vendor"))
die("The vendor/ directory is missing. Most likely the admin forgot to run 'composer install'\n");
require_once "plugins.php";
$pages = Array("Overview" => "index.php",
- "Users" => "users.php",
+ "Users" => "users/index.php",
"Channels" => "channels.php",
"Server Bans" => "tkl.php",
"Spamfilter" => "spamfilter.php",
*
*/
-
if (!defined('UPATH'))
die("Access denied");
+/**
+ * The base URL, how this panel can be accessed.
+ * This would be '/' if you installed in the web root,
+ * or something like '/webpanel/' if you go to http://x.y.z/webpanel
+ * IMPORTANT: needs a trailing slash!
+*/
+define( 'BASE_URL', '/' );
/**
* The RPC User name as defined in your unrealircd.conf
<script src="js/unrealircd-admin.js"></script>
<title>UnrealIRCd Panel</title>
-<link rel="icon" type="image/x-icon" href="img/favicon.ico">
-<link href="css/unrealircd-admin.css" rel="stylesheet">
+<link rel="icon" type="image/x-icon" href="<?php echo BASE_URL; ?>img/favicon.ico">
+<link href="<?php echo BASE_URL; ?>css/unrealircd-admin.css" rel="stylesheet">
</head>
<body role="document">
<div class="container-fluid">
<!-- Fixed navbar -->
<nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top">
<ul class="nav navbar-nav">
- <a class="navbar-brand" href="index.php"><img src="img/favicon.ico" height="25" width="25"> UnrealIRCd Admin Panel</a>
+ <a class="navbar-brand" href="index.php"><img src="<?php echo BASE_URL; ?>img/favicon.ico" height="25" width="25"> UnrealIRCd Admin Panel</a>
<?php
+$active_page = false;
+/* Needs to be a separate step due to multiple matches */
+foreach($pages as $name=>$page)
+ if (str_ends_with($_SERVER['SCRIPT_FILENAME'], $page))
+ $active_page = $page;
+
foreach($pages as $name=>$page)
{
$class = "class=\"nav-item\"";
- if (str_ends_with($_SERVER['SCRIPT_FILENAME'], $page))
+ if ($page == $active_page)
$class = str_replace("\"nav-item\"", "\"nav-item active\"", $class);
- echo " <li $class><a class=\"nav-link\" href=\"$page\">$name</a></li> \n";
+ echo " <li $class><a class=\"nav-link\" href=\"".BASE_URL.$page."\">$name</a></li> \n";
}
?>
<?php
-require_once "common.php";
-require_once "header.php";
+require_once "../common.php";
+require_once "../header.php";
$title = "User Lookup";
$nickname = "";
<title><?php echo $title; ?></title>
<h4><?php echo $title; ?></h4>
<br>
-<form method="get" action="user-lookup.php">
+<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 $nickname; ?>>
<div class="input-group-append">
<?php
-require_once "common.php";
-require_once "header.php";
+require_once "../common.php";
+require_once UPATH . "/header.php";
if (!empty($_POST)) {
do_log($_POST);
</thead>
<tbody>
- <form action="users.php" method="post">
+ <form method="post">
<?php
foreach($users as $user)
echo "<tr>";
echo "<th scope=\"row\"><input type=\"checkbox\" value='" . base64_encode($user->id)."' name=\"userch[]\"></th>";
$isBot = (strpos($user->user->modes, "B") !== false) ? ' <span class="badge-pill badge-dark">Bot</span>' : "";
- echo "<td><a href=\"user-lookup.php?nick=".$user->id."\">$user->name$isBot</a></td>";
+ echo "<td><a href=\"details.php?nick=".$user->id."\">$user->name$isBot</a></td>";
echo "<td>".$user->hostname." (".$user->ip.")</td>";
$account = (isset($user->user->account)) ? $user->user->account : '<span class="badge-pill badge-primary">None</span>';
echo "<td>".$account."</td>";
});
</script>
-<?php require_once 'footer.php'; ?>
+<?php require_once UPATH.'/footer.php'; ?>