]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - common.php
automatically go to login page on session timeout
[irc/unrealircd/unrealircd-webpanel.git] / common.php
1 <?php
2 if (version_compare(PHP_VERSION, '8.0.0', '<'))
3 die("This webserver is using PHP version ".PHP_VERSION." but we require at least PHP 8.0.0.<br>".
4 "If you already installed PHP8 but are still seeing this error, then it means ".
5 "apache/nginx/.. is loading an older PHP version. Eg. on Debian/Ubuntu you need ".
6 "<code>apt-get install libapache2-mod-php8.2</code> (or a similar version) and ".
7 "<code>apt-get remove libapache2-mod-php7.4</code> (or a similar version). ".
8 "You may also need to choose again the PHP module to load in apache via <code>a2enmod php8.2</code>");
9
10 define('UPATH', dirname(__FILE__));
11 require_once UPATH . "/config.php";
12 if (!defined('BASE_URL')) die("You need to define BASE_URL in config.php (see config.php.sample for documentation)");
13 require_once "Classes/class-hook.php";
14 if (!is_dir(UPATH . "/vendor"))
15 die("The vendor/ directory is missing. Most likely the admin forgot to run 'composer install'\n");
16 require_once UPATH . '/vendor/autoload.php';
17 require_once UPATH . "/Classes/class-cmodes.php";
18 require_once UPATH . "/cfg/defines.php";
19 require_once UPATH . "/misc/strings.php";
20 require_once UPATH . "/misc/channel-lookup-misc.php";
21 require_once UPATH . "/misc/user-lookup-misc.php";
22 require_once UPATH . "/misc/server-lookup-misc.php";
23 require_once UPATH . "/misc/ip-whois-misc.php";
24 require_once UPATH . "/Classes/class-log.php";
25 require_once UPATH . "/Classes/class-message.php";
26 require_once UPATH . "/Classes/class-rpc.php";
27 require_once UPATH . "/Classes/class-paneluser.php";
28 require_once UPATH . "/plugins.php";
29
30 $pages = [
31 "Overview" => "",
32 "Users" => "users",
33 "Channels" => "channels",
34 "Servers" => "servers",
35 "Server Bans" => [
36 "Server Bans" => "server-bans",
37 "Name Bans" => "server-bans/name-bans.php",
38 "Ban Exceptions" => "server-bans/ban-exceptions.php"
39 ],
40 "Spamfilter" => "spamfilter.php",
41 "Tools" => [
42 "IP WHOIS" => "tools/ip-whois.php",
43 ],
44 "Settings" => [
45 "Plugins" => "settings/plugins.php",
46 ],
47
48 "News" => "news.php",
49 ];
50
51 if (is_auth_provided())
52 {
53 $pages["Settings"]["Panel Access"] = "settings";
54
55 $user = unreal_get_current_user();
56 if ($user)
57 {
58 /* Add logout page, if logged in */
59 $pages["Logout"] = "login/?logout=true";
60 }
61 }
62 Hook::run(HOOKTYPE_NAVBAR, $pages);
63
64 /* Example to add new menu item:
65 *
66 * class MyPlugin
67 * {
68 *
69 * function __construct()
70 * {
71 * Hook::func(HOOKTYPE_NAVBAR, [$this, 'add_menu'])
72 * }
73 *
74 * function add_menu(&$pages) // this should pass by reference (using the & prefix)
75 * {
76 * $page_name = "My New Page";
77 * $page_link = "link/to/page.php";
78 * $pages[$page_name] = $page_link;
79 * }
80 * }
81 */