56 lines
1.3 KiB
PHP
56 lines
1.3 KiB
PHP
<?php
|
|
|
|
session_start();
|
|
|
|
// SRC is defined as the path to the src/ directory from public/
|
|
|
|
// Source libraries
|
|
require_once SRC . '/helpers.php';
|
|
require_once SRC . '/env.php';
|
|
require_once SRC . '/database.php';
|
|
require_once SRC . '/auth.php';
|
|
require_once SRC . '/router.php';
|
|
require_once SRC . '/components.php';
|
|
require_once SRC . '/render.php';
|
|
|
|
// Database models
|
|
require_once SRC . '/models/user.php';
|
|
require_once SRC . '/models/session.php';
|
|
require_once SRC . '/models/token.php';
|
|
require_once SRC . '/models/char.php';
|
|
|
|
// Controllers
|
|
require_once SRC . '/controllers/char.php';
|
|
require_once SRC . '/controllers/auth.php';
|
|
|
|
// Track the start time of the request
|
|
define('START_TIME', microtime(true));
|
|
|
|
/*
|
|
Load env, set error reporting, etc.
|
|
*/
|
|
env_load(SRC . '/../.env');
|
|
|
|
if (env('debug') === 'true') {
|
|
ini_set('display_errors', '1');
|
|
ini_set('display_startup_errors', '1');
|
|
error_reporting(E_ALL);
|
|
}
|
|
|
|
stopwatch_start('bootstrap'); // Start the bootstrap stopwatch
|
|
|
|
// Generate a new CSRF token. (if one doesn't exist, that is)
|
|
csrf();
|
|
|
|
// Have global counters for queries
|
|
$GLOBALS['queries'] = 0;
|
|
$GLOBALS['query_time'] = 0;
|
|
|
|
// Set the default page layout
|
|
page_layout('basic');
|
|
|
|
// Run auth_check to see if we're logged in, since it populates the user data in SESSION
|
|
auth_check();
|
|
|
|
stopwatch_stop('bootstrap'); // Stop the bootstrap stopwatch
|