36 lines
970 B
PHP
36 lines
970 B
PHP
<?php
|
|
session_start();
|
|
|
|
ini_set("display_errors", "on");
|
|
error_reporting(E_ALL);
|
|
|
|
// Autoload
|
|
require_once dirname(__DIR__).'/vendor/autoload.php';
|
|
|
|
// Errors Handler
|
|
set_error_handler("Core\Error::errorHandler");
|
|
set_exception_handler("Core\Error::exceptionHandler");
|
|
|
|
if (Core\Session::exists('info')) {
|
|
echo '
|
|
<div id="info" class="top" style="position:fixed;width:100%;">
|
|
<h3 style="text-align:center;" class="top">
|
|
<span class="label";" onclick="fadeOutEffect()">';
|
|
echo Core\Session::flash('info');
|
|
echo '
|
|
</span>
|
|
</h3>
|
|
</div>';
|
|
}
|
|
|
|
$router = new Core\Router();
|
|
|
|
$router->add('', ['controller' => 'posts', 'action' => 'index']);
|
|
$router->add('{controller}/{action}');
|
|
$router->add('{controller}/{action}/{id:\d+}');
|
|
$router->add('{action}', ['controller' => 'home']);
|
|
$router->add('{?status:\d+}', ['controller' => 'posts', 'action' => 'index']);
|
|
|
|
$url = $_SERVER['REQUEST_URI'];
|
|
$router->dispatch($url);
|