pics/app.php

33 lines
988 B
PHP
Raw 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));
// Do some authentication checks.
Session::start();
$user = Authentication::isLoggedIn() ? Member::fromId($_SESSION['user_id']) : new Guest();
$user->updateAccessTime();
Registry::set('user', $user);
// Handle errors our own way.
2016-09-17 14:40:43 +02:00
set_error_handler('ErrorHandler::handleError');
ini_set("display_errors", DEBUG ? "On" : "Off");
// The real magic starts here!
ob_start(null, 32768);
Dispatcher::dispatch();
ob_end_flush();