2015-05-22 12:36:26 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
|
|
require __DIR__ . '/app/base/autoloader.php';
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
function is_selected($a, $b)
|
|
|
|
{
|
|
|
|
return ($a === $b) ? 'selected' : '';
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// 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();
|
|
|
|
$defaultHandler->addDataTable('route', (array)$router->get_route());
|
|
|
|
$router->dispatch();
|
|
|
|
|
|
|
|
// End of index.php
|