-require_once "config.php";
-require_once "hook.php";
-require_once "plugins.php";
+
+function get_config($setting)
+{
+ GLOBAL $config;
+
+ $item = $config;
+ foreach(explode("::", $setting) as $x)
+ {
+ if (isset($item[$x]))
+ $item = $item[$x];
+ else
+ return NULL;
+ }
+ return $item;
+}
+
+function page_requires_no_config()
+{
+ if (str_ends_with($_SERVER['SCRIPT_FILENAME'],"install.php") ||
+ str_ends_with($_SERVER['SCRIPT_FILENAME'],"test_connection.php"))
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+/* Load config defaults */
+$config = Array();
+require_once UPATH . "/config/config.defaults.php";
+
+if (!file_exists(UPATH."/config/config.php") && file_exists(UPATH."/config.php"))
+{
+ require_once UPATH . "/config.php";
+ require_once UPATH . "/config/compat.php";
+} else
+if (page_requires_no_config())
+{
+ /* Allow empty conf */
+} else
+{
+ require_once UPATH . "/config/config.php";
+}
+
+if (!get_config("base_url")) die("You need to define the base_url in config/config.php");
+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");