60 lines
1.6 KiB
PHP
60 lines
1.6 KiB
PHP
<?php
|
|
|
|
// @todo use a flag for this
|
|
ini_set('display_errors', 'on');
|
|
error_reporting(E_ALL | E_STRICT);
|
|
|
|
define('START', microtime(true)); // start the timer for this execution
|
|
|
|
// adjust session settings
|
|
ini_set('session.gc_maxlifetime', 604800); // 1 week in seconds
|
|
ini_set('session.cookie_lifetime', 604800); // 1 week in seconds
|
|
|
|
// ensure secure session handling
|
|
ini_set('session.use_strict_mode', 1);
|
|
ini_set('session.cookie_httponly', 1);
|
|
ini_set('session.cookie_secure', 1); // only if using HTTPS
|
|
|
|
// start the session
|
|
session_start();
|
|
|
|
// regenerate session ID to prevent session fixation
|
|
if (!isset($_SESSION['initiated'])) {
|
|
session_regenerate_id(true);
|
|
$_SESSION['initiated'] = true;
|
|
}
|
|
|
|
// @todo move these to a settings config somewhere
|
|
const VERSION = '1.1.11';
|
|
const BUILD = '';
|
|
const DB = SERVER.'/database/dragon.db';
|
|
|
|
require_once SERVER.'/library.php'; // include our miscellaneous functions
|
|
|
|
// define whether we are installed or not
|
|
define('INSTALLED', file_exists(SERVER.'/.installed'));
|
|
|
|
// autoloader map
|
|
const MAP = [
|
|
// 'Class' => 'path/to/class.php',
|
|
|
|
// server-level classes
|
|
'App' => SERVER.'/app/app.php',
|
|
'Database' => SERVER.'/app/database.php',
|
|
'Request' => SERVER.'/app/request.php',
|
|
|
|
// modules
|
|
'HomeModule' => SERVER.'/modules/HomeModule.php',
|
|
'InstallModule' => SERVER.'/modules/InstallModule.php',
|
|
|
|
// models
|
|
'Classes' => SERVER.'/models/Classes.php',
|
|
'Player' => SERVER.'/models/Player.php',
|
|
'Spell' => SERVER.'/models/Spell.php',
|
|
];
|
|
|
|
// autoloader
|
|
spl_autoload_register(function($class) {
|
|
if (isset(MAP[$class])) require_once MAP[$class];
|
|
});
|