pics/app.php

32 lines
904 B
PHP
Raw Permalink Normal View History

<?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));
// Handle errors our own way.
ErrorHandler::enable();
// 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();