]>
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 | ||
36470548 BM |
27 | function page_requires_no_config() |
28 | { | |
29 | if (str_ends_with($_SERVER['SCRIPT_FILENAME'],"install.php") || | |
30 | str_ends_with($_SERVER['SCRIPT_FILENAME'],"test_connection.php")) | |
31 | { | |
32 | return TRUE; | |
33 | } | |
34 | return FALSE; | |
35 | } | |
36 | ||
37 | ||
ea90b321 BM |
38 | /* Load config defaults */ |
39 | $config = Array(); | |
40 | require_once UPATH . "/config/config.defaults.php"; | |
41 | ||
42 | if (!file_exists(UPATH."/config/config.php") && file_exists(UPATH."/config.php")) | |
43 | { | |
44 | require_once UPATH . "/config.php"; | |
45 | require_once UPATH . "/config/compat.php"; | |
fc51fb47 | 46 | } else |
36470548 | 47 | if (page_requires_no_config()) |
fc51fb47 BM |
48 | { |
49 | /* Allow empty conf */ | |
50 | } else | |
51 | { | |
ea90b321 BM |
52 | require_once UPATH . "/config/config.php"; |
53 | } | |
54 | ||
55 | if (!get_config("base_url")) die("You need to define the base_url in config/config.php"); | |
55fd88eb | 56 | require_once "Classes/class-hook.php"; |
c4f272ad BM |
57 | if (!is_dir(UPATH . "/vendor")) |
58 | die("The vendor/ directory is missing. Most likely the admin forgot to run 'composer install'\n"); | |
e98b5a51 | 59 | require_once UPATH . '/vendor/autoload.php'; |
e92763ac | 60 | require_once UPATH . "/Classes/class-cmodes.php"; |
d72d1923 | 61 | require_once UPATH . "/cfg/defines.php"; |
d72d1923 | 62 | require_once UPATH . "/misc/strings.php"; |
e92763ac | 63 | require_once UPATH . "/misc/channel-lookup-misc.php"; |
d72d1923 VP |
64 | require_once UPATH . "/misc/user-lookup-misc.php"; |
65 | require_once UPATH . "/misc/server-lookup-misc.php"; | |
66 | require_once UPATH . "/misc/ip-whois-misc.php"; | |
67 | require_once UPATH . "/Classes/class-log.php"; | |
68 | require_once UPATH . "/Classes/class-message.php"; | |
69 | require_once UPATH . "/Classes/class-rpc.php"; | |
6930484c | 70 | require_once UPATH . "/Classes/class-paneluser.php"; |
d72d1923 | 71 | require_once UPATH . "/plugins.php"; |
1e6ffd06 | 72 | |
5a7f0cde | 73 | $pages = [ |
69f605af BM |
74 | "Overview" => "", |
75 | "Users" => "users", | |
76 | "Channels" => "channels", | |
77 | "Servers" => "servers", | |
d6f10d25 BM |
78 | "Server Bans" => [ |
79 | "Server Bans" => "server-bans", | |
80 | "Name Bans" => "server-bans/name-bans.php", | |
81 | "Ban Exceptions" => "server-bans/ban-exceptions.php" | |
82 | ], | |
69f605af | 83 | "Spamfilter" => "spamfilter.php", |
d6f10d25 BM |
84 | "Tools" => [ |
85 | "IP WHOIS" => "tools/ip-whois.php", | |
86 | ], | |
87 | "Settings" => [ | |
88 | "Plugins" => "settings/plugins.php", | |
89 | ], | |
180b8ec1 | 90 | |
c00c34d2 | 91 | "News" => "news.php", |
5a7f0cde | 92 | ]; |
c00c34d2 VP |
93 | |
94 | if (is_auth_provided()) | |
180b8ec1 | 95 | { |
d6f10d25 | 96 | $pages["Settings"]["Panel Access"] = "settings"; |
90dc8f2b | 97 | |
c00c34d2 VP |
98 | $user = unreal_get_current_user(); |
99 | if ($user) | |
100 | { | |
101 | /* Add logout page, if logged in */ | |
102 | $pages["Logout"] = "login/?logout=true"; | |
103 | } | |
104 | } | |
90dc8f2b VP |
105 | Hook::run(HOOKTYPE_NAVBAR, $pages); |
106 | ||
107 | /* Example to add new menu item: | |
90dc8f2b VP |
108 | * |
109 | * class MyPlugin | |
110 | * { | |
111 | * | |
55fd88eb VP |
112 | * function __construct() |
113 | * { | |
114 | * Hook::func(HOOKTYPE_NAVBAR, [$this, 'add_menu']) | |
115 | * } | |
90dc8f2b | 116 | * |
55fd88eb VP |
117 | * function add_menu(&$pages) // this should pass by reference (using the & prefix) |
118 | * { | |
119 | * $page_name = "My New Page"; | |
120 | * $page_link = "link/to/page.php"; | |
121 | * $pages[$page_name] = $page_link; | |
122 | * } | |
90dc8f2b VP |
123 | * } |
124 | */ |