2016-09-01 23:13:23 +02:00
|
|
|
<?php
|
|
|
|
/*****************************************************************************
|
|
|
|
* app.php
|
|
|
|
* Initiates key classes and determines which controller to use.
|
|
|
|
*
|
|
|
|
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
// Include the project's configuration.
|
|
|
|
require_once 'config.php';
|
|
|
|
|
|
|
|
// Set up the autoloader.
|
|
|
|
require_once 'vendor/autoload.php';
|
|
|
|
|
|
|
|
// Initialise the database.
|
|
|
|
Registry::set('start', microtime(true));
|
|
|
|
Registry::set('db', new Database(DB_SERVER, DB_USER, DB_PASS, DB_NAME));
|
|
|
|
|
2020-03-11 22:36:21 +01:00
|
|
|
// Handle errors our own way.
|
|
|
|
ErrorHandler::enable();
|
|
|
|
|
2016-09-01 23:13:23 +02:00
|
|
|
// Do some authentication checks.
|
|
|
|
Session::start();
|
|
|
|
$user = Authentication::isLoggedIn() ? Member::fromId($_SESSION['user_id']) : new Guest();
|
|
|
|
$user->updateAccessTime();
|
|
|
|
Registry::set('user', $user);
|
|
|
|
|
|
|
|
// The real magic starts here!
|
|
|
|
ob_start();
|
|
|
|
Dispatcher::dispatch();
|
|
|
|
ob_end_flush();
|