2019-10-29 14:57:13 +01:00
|
|
|
<?php
|
2019-10-29 18:34:37 +01:00
|
|
|
require_once(__DIR__ . '/descartes/load.php');
|
2019-10-29 14:57:13 +01:00
|
|
|
|
|
|
|
############
|
|
|
|
# SESSIONS #
|
|
|
|
############
|
|
|
|
session_name(SESSION_NAME);
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
//Create csrf token if it didn't exist
|
|
|
|
if (!isset($_SESSION['csrf']))
|
|
|
|
{
|
|
|
|
$_SESSION['csrf'] = str_shuffle(uniqid().uniqid());
|
|
|
|
}
|
|
|
|
|
|
|
|
//Routing current query
|
2020-02-20 03:53:15 +01:00
|
|
|
try
|
|
|
|
{
|
|
|
|
descartes\Router::route(ROUTES, $_SERVER['REQUEST_URI']);
|
|
|
|
}
|
|
|
|
catch (\descartes\exceptions\DescartesException404 $e)
|
|
|
|
{
|
|
|
|
$controller = new \controllers\internals\HttpError();
|
|
|
|
$controller->_404();
|
|
|
|
}
|
2020-06-14 01:39:09 +02:00
|
|
|
catch (\Throwable $e)
|
|
|
|
{
|
2020-06-14 22:17:04 +02:00
|
|
|
error_log($e);
|
2020-06-14 01:39:09 +02:00
|
|
|
$controller = new \controllers\internals\HttpError();
|
|
|
|
$controller->unknown();
|
|
|
|
}
|