2015-05-22 12:36:26 -04:00
|
|
|
<?php
|
2015-06-16 11:11:35 -04:00
|
|
|
/**
|
|
|
|
* Here begins everything!
|
|
|
|
*/
|
2015-05-22 12:36:26 -04:00
|
|
|
|
2015-06-25 17:00:29 -04:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// ! Start config
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2015-06-16 11:43:30 -04:00
|
|
|
/**
|
|
|
|
* Well, whose list is it?
|
|
|
|
*/
|
|
|
|
define('WHOSE', "Tim's");
|
|
|
|
|
2015-06-25 17:00:29 -04:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// ! End config
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Work around the silly timezone error
|
|
|
|
$timezone = ini_get('date.timezone');
|
|
|
|
if ($timezone === '' || $timezone === FALSE)
|
|
|
|
{
|
|
|
|
ini_set('date.timezone', 'GMT');
|
|
|
|
}
|
2015-06-11 16:44:52 -04:00
|
|
|
|
|
|
|
define('ROOT_DIR', __DIR__);
|
2015-06-25 17:00:29 -04:00
|
|
|
define('APP_DIR', ROOT_DIR . DIRECTORY_SEPARATOR . 'app');
|
|
|
|
define('CONF_DIR', APP_DIR . DIRECTORY_SEPARATOR . 'config');
|
|
|
|
define('BASE_DIR', APP_DIR . DIRECTORY_SEPARATOR . 'base');
|
|
|
|
require BASE_DIR . DIRECTORY_SEPARATOR . 'pre_conf_functions.php';
|
2015-06-11 16:44:52 -04:00
|
|
|
|
|
|
|
// Load config and global functions
|
|
|
|
$config = require _dir(APP_DIR, '/config/config.php');
|
|
|
|
require _dir(BASE_DIR, '/functions.php');
|
|
|
|
|
|
|
|
// Setup autoloaders
|
2015-06-25 17:00:29 -04:00
|
|
|
_setup_autoloaders();
|
2015-05-22 12:36:26 -04:00
|
|
|
|
2015-05-27 09:03:42 -04:00
|
|
|
session_start();
|
|
|
|
|
2015-05-22 12:36:26 -04:00
|
|
|
use \Whoops\Handler\PrettyPageHandler;
|
|
|
|
use \Whoops\Handler\JsonResponseHandler;
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Setup error handling
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
$whoops = new \Whoops\Run();
|
|
|
|
|
|
|
|
// Set up default handler for general errors
|
|
|
|
$defaultHandler = new PrettyPageHandler();
|
|
|
|
$whoops->pushHandler($defaultHandler);
|
|
|
|
|
|
|
|
// Set up json handler for ajax errors
|
|
|
|
$jsonHandler = new JsonResponseHandler();
|
|
|
|
$jsonHandler->onlyForAjaxRequests(true);
|
|
|
|
$whoops->pushHandler($jsonHandler);
|
|
|
|
|
|
|
|
$whoops->register();
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Router
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
$router = new Router();
|
2015-06-11 16:44:52 -04:00
|
|
|
$defaultHandler->addDataTable('route', (array)$router->get_route());
|
2015-05-22 12:36:26 -04:00
|
|
|
$router->dispatch();
|
|
|
|
|
|
|
|
// End of index.php
|