|
|
|
<?php
|
|
|
|
|
|
|
|
use App\Router;
|
|
|
|
|
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
|
|
|
|
|
|
/* Initialize pages rounting */
|
|
|
|
$r = new Router();
|
|
|
|
|
|
|
|
$r->addRoute('^/$', function($url) {
|
|
|
|
require __DIR__ . '/../views/home.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
$r->addRoute('^/add/?$', function($url) {
|
|
|
|
require __DIR__ . '/../views/add.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
$r->addRoute('^/alive/?([0-9]+)?/?(?:\?|$)', function($url, $page = 1) {
|
|
|
|
require __DIR__ . '/../views/alive.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
$r->addRoute('^/all/?([0-9]+)?/?', function($url, $page = 1) {
|
|
|
|
require __DIR__ . '/../views/all.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
$r->addRoute('^/jump/?(.*)/?', function($url, $query = "") {
|
|
|
|
require __DIR__ . '/../views/jump.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
$r->addRoute('^/autojump/?(.*)/?', function($url, $query = "") {
|
|
|
|
require __DIR__ . '/../views/autojump.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
$r->addRoute('^/latest/?(?:\?|$)', function($url) {
|
|
|
|
require __DIR__ . '/../views/latest.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
$r->addRoute('^/search/?(.*)/?', function($url, $query = "") {
|
|
|
|
require __DIR__ . '/../views/search.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
$r->addErrorRoute(function() {
|
|
|
|
require __DIR__ . '/../views/404.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
/* Process requests */
|
|
|
|
$r->run();
|