2015-08-02 14:47:04 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* Load all the files into memory, sanitise the environment, but don't
|
|
|
|
* actually do anything as far as the app is concerned
|
|
|
|
*/
|
|
|
|
|
2017-09-21 04:00:59 +00:00
|
|
|
global $config, $database, $user, $page, $_shm_ctx;
|
2015-08-02 18:29:25 +00:00
|
|
|
|
2018-11-05 22:30:18 +00:00
|
|
|
require_once "core/sys_config.php";
|
|
|
|
require_once "core/polyfills.php";
|
|
|
|
require_once "core/util.php";
|
2017-09-21 04:00:59 +00:00
|
|
|
require_once "vendor/shish/libcontext-php/context.php";
|
2016-05-11 22:27:42 +00:00
|
|
|
require_once "vendor/autoload.php";
|
2015-08-02 14:47:04 +00:00
|
|
|
|
|
|
|
// set up and purify the environment
|
|
|
|
_version_check();
|
|
|
|
_sanitise_environment();
|
|
|
|
|
|
|
|
// load base files
|
2017-09-21 04:00:59 +00:00
|
|
|
$_shm_ctx->log_start("Opening files");
|
2017-09-17 18:37:30 +00:00
|
|
|
$_shm_files = array_merge(
|
2019-05-28 16:59:38 +00:00
|
|
|
zglob("core/*.php"),
|
|
|
|
zglob("core/{".ENABLED_MODS."}/*.php"),
|
|
|
|
zglob("ext/{".ENABLED_EXTS."}/main.php")
|
2015-08-02 14:47:04 +00:00
|
|
|
);
|
2019-05-28 16:59:38 +00:00
|
|
|
foreach ($_shm_files as $_shm_filename) {
|
|
|
|
if (basename($_shm_filename)[0] != "_") {
|
|
|
|
require_once $_shm_filename;
|
|
|
|
}
|
2015-08-02 14:47:04 +00:00
|
|
|
}
|
2017-09-17 18:37:30 +00:00
|
|
|
unset($_shm_files);
|
|
|
|
unset($_shm_filename);
|
2017-09-21 04:00:59 +00:00
|
|
|
$_shm_ctx->log_endok();
|
2015-08-02 14:47:04 +00:00
|
|
|
|
|
|
|
// connect to the database
|
2017-09-21 04:00:59 +00:00
|
|
|
$_shm_ctx->log_start("Connecting to DB");
|
2015-08-02 14:47:04 +00:00
|
|
|
$database = new Database();
|
|
|
|
$config = new DatabaseConfig($database);
|
2017-09-21 04:00:59 +00:00
|
|
|
$_shm_ctx->log_endok();
|
2015-08-02 14:47:04 +00:00
|
|
|
|
|
|
|
// load the theme parts
|
2017-09-21 04:00:59 +00:00
|
|
|
$_shm_ctx->log_start("Loading themelets");
|
2019-05-28 16:59:38 +00:00
|
|
|
foreach (_get_themelet_files(get_theme()) as $themelet) {
|
|
|
|
require_once $themelet;
|
2015-08-02 14:47:04 +00:00
|
|
|
}
|
2015-08-02 18:29:25 +00:00
|
|
|
unset($themelet);
|
2015-08-02 14:47:04 +00:00
|
|
|
$page = class_exists("CustomPage") ? new CustomPage() : new Page();
|
2017-09-21 04:00:59 +00:00
|
|
|
$_shm_ctx->log_endok();
|
2015-08-02 14:47:04 +00:00
|
|
|
|
|
|
|
// hook up event handlers
|
2015-08-02 19:54:41 +00:00
|
|
|
_load_event_listeners();
|
2015-08-03 14:40:20 +00:00
|
|
|
send_event(new InitExtEvent());
|