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' : '';
|
|
|
|
}
|
|
|
|
|
2015-06-09 18:18:53 -04:00
|
|
|
$config = require_once(__DIR__ . '/app/config/config.php');
|
|
|
|
|
2015-05-22 12:36:26 -04:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// 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-09 18:18:53 -04:00
|
|
|
//$defaultHandler->addDataTable('route', (array)$router->get_route());
|
2015-05-22 12:36:26 -04:00
|
|
|
$router->dispatch();
|
|
|
|
|
|
|
|
// End of index.php
|