From 59cd40235bf4746a119421609b25d7e9b7f65f83 Mon Sep 17 00:00:00 2001 From: Geo Halkiadakis Date: Mon, 15 May 2023 18:15:37 +0300 Subject: refactoring framework defaults --- public/index.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'public/index.php') diff --git a/public/index.php b/public/index.php index 92b825a..5c84e97 100644 --- a/public/index.php +++ b/public/index.php @@ -12,20 +12,30 @@ * And as long as you write code using secure practices, * it will be secure. * - * Copyleft: George Halkiadalos + * Copyleft: George Halkiadakis * Licence: BSD * \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * ----------------------------------------------------------------------------- */ -// Load parametres: -// contants and constant arrays + + +// specify base paths // ----------------------------------------------------------------------------- -require_once '../core/config/constants.php'; // general constants +$dir = explode('/', __DIR__); +$pub = array_pop($dir); -require_once '../core/config/anom_settings.php'; // core framework constants +define('APP_ROOT', implode('/',$dir)); // root of application (public's parent) -require_once 'app/config/app_constants.php'; // application constants +define('WEB_ROOT', APP_ROOT.'/'.$pub); // root of public directory + + + +// Load parametres: +// contants and constant arrays +// ----------------------------------------------------------------------------- + +require_once WEB_ROOT.'/app/config/setup-framework.php'; // application constants @@ -34,17 +44,20 @@ require_once 'app/config/app_constants.php'; // application constants require_once AUTOLOADER; + // Enable sessions // ----------------------------------------------------------------------------- $session = new (SESSION_DRIVER)(); // Start a new session + // prepare output control and benchmarking // ----------------------------------------------------------------------------- ob_start(); // handle output if (!PRODUCTION) Benchmark::add_spot('start'); // benchmark request's life + // Initialize Application // finalize framework; handle credentials; setup app-engine; insert routes // ----------------------------------------------------------------------------- @@ -58,6 +71,7 @@ require_once INIT_APPLICATION; Route::run(Registry::get('REQUEST')); // Run baby, run! + if (!PRODUCTION) Benchmark::add_spot('end'); // request ended if (!PRODUCTION) Benchmark::render_report(); // echo benchmark report ob_flush(); // flush output -- cgit v1.2.3