]>
Commit | Line | Data |
---|---|---|
e98b5a51 | 1 | <?php |
81fe28b9 | 2 | if (version_compare(PHP_VERSION, '8.0.0', '<')) |
fcd08f14 | 3 | die("This webserver is using PHP version ".PHP_VERSION." but we require at least PHP 8.0.0.<br>". |
81fe28b9 BM |
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 | ||
e98b5a51 | 10 | define('UPATH', dirname(__FILE__)); |
ea90b321 BM |
11 | |
12 | function get_config($setting) | |
13 | { | |
14 | GLOBAL $config; | |
15 | ||
16 | $item = $config; | |
17 | foreach(explode("::", $setting) as $x) | |
18 | { | |
19 | if (isset($item[$x])) | |
20 | $item = $item[$x]; | |
21 | else | |
22 | return NULL; | |
23 | } | |
24 | return $item; | |
25 | } | |
26 | ||
27 | /* Load config defaults */ | |
28 | $config = Array(); | |
29 | require_once UPATH . "/config/config.defaults.php"; | |
30 | ||
31 | if (!file_exists(UPATH."/config/config.php") && file_exists(UPATH."/config.php")) | |
32 | { | |
33 | require_once UPATH . "/config.php"; | |
34 | require_once UPATH . "/config/compat.php"; | |
35 | } else { | |
36 | require_once UPATH . "/config/config.php"; | |
37 | } | |
38 | ||
39 | if (!get_config("base_url")) die("You need to define the base_url in config/config.php"); | |
55fd88eb | 40 | require_once "Classes/class-hook.php"; |
c4f272ad BM |
41 | if (!is_dir(UPATH . "/vendor")) |
42 | die("The vendor/ directory is missing. Most likely the admin forgot to run 'composer install'\n"); | |
e98b5a51 | 43 | require_once UPATH . '/vendor/autoload.php'; |
e92763ac | 44 | require_once UPATH . "/Classes/class-cmodes.php"; |
d72d1923 | 45 | require_once UPATH . "/cfg/defines.php"; |
d72d1923 | 46 | require_once UPATH . "/misc/strings.php"; |
e92763ac | 47 | require_once UPATH . "/misc/channel-lookup-misc.php"; |
d72d1923 VP |
48 | require_once UPATH . "/misc/user-lookup-misc.php"; |
49 | require_once UPATH . "/misc/server-lookup-misc.php"; | |
50 | require_once UPATH . "/misc/ip-whois-misc.php"; | |
51 | require_once UPATH . "/Classes/class-log.php"; | |
52 | require_once UPATH . "/Classes/class-message.php"; | |
53 | require_once UPATH . "/Classes/class-rpc.php"; | |
6930484c | 54 | require_once UPATH . "/Classes/class-paneluser.php"; |
d72d1923 | 55 | require_once UPATH . "/plugins.php"; |
1e6ffd06 | 56 | |
5a7f0cde | 57 | $pages = [ |
69f605af BM |
58 | "Overview" => "", |
59 | "Users" => "users", | |
60 | "Channels" => "channels", | |
61 | "Servers" => "servers", | |
d6f10d25 BM |
62 | "Server Bans" => [ |
63 | "Server Bans" => "server-bans", | |
64 | "Name Bans" => "server-bans/name-bans.php", | |
65 | "Ban Exceptions" => "server-bans/ban-exceptions.php" | |
66 | ], | |
69f605af | 67 | "Spamfilter" => "spamfilter.php", |
d6f10d25 BM |
68 | "Tools" => [ |
69 | "IP WHOIS" => "tools/ip-whois.php", | |
70 | ], | |
71 | "Settings" => [ | |
72 | "Plugins" => "settings/plugins.php", | |
73 | ], | |
180b8ec1 | 74 | |
c00c34d2 | 75 | "News" => "news.php", |
5a7f0cde | 76 | ]; |
c00c34d2 VP |
77 | |
78 | if (is_auth_provided()) | |
180b8ec1 | 79 | { |
d6f10d25 | 80 | $pages["Settings"]["Panel Access"] = "settings"; |
90dc8f2b | 81 | |
c00c34d2 VP |
82 | $user = unreal_get_current_user(); |
83 | if ($user) | |
84 | { | |
85 | /* Add logout page, if logged in */ | |
86 | $pages["Logout"] = "login/?logout=true"; | |
87 | } | |
88 | } | |
90dc8f2b VP |
89 | Hook::run(HOOKTYPE_NAVBAR, $pages); |
90 | ||
91 | /* Example to add new menu item: | |
90dc8f2b VP |
92 | * |
93 | * class MyPlugin | |
94 | * { | |
95 | * | |
55fd88eb VP |
96 | * function __construct() |
97 | * { | |
98 | * Hook::func(HOOKTYPE_NAVBAR, [$this, 'add_menu']) | |
99 | * } | |
90dc8f2b | 100 | * |
55fd88eb VP |
101 | * function add_menu(&$pages) // this should pass by reference (using the & prefix) |
102 | * { | |
103 | * $page_name = "My New Page"; | |
104 | * $page_link = "link/to/page.php"; | |
105 | * $pages[$page_name] = $page_link; | |
106 | * } | |
90dc8f2b VP |
107 | * } |
108 | */ |