2021-02-21 16:37:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use App\Router;
|
|
|
|
|
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
|
|
|
|
|
|
/* Initialize pages rounting */
|
|
|
|
$r = new Router();
|
|
|
|
|
2021-09-13 17:21:23 +00:00
|
|
|
$r->addRoute('^/?(?:\?|$)', function($url) {
|
2021-02-21 16:37:27 +00:00
|
|
|
require __DIR__ . '/../views/home.php';
|
|
|
|
});
|
|
|
|
|
2021-09-13 17:21:23 +00:00
|
|
|
$r->addRoute('^/add/?(?:\?|$)', function($url) {
|
2021-02-21 16:37:27 +00:00
|
|
|
require __DIR__ . '/../views/add.php';
|
|
|
|
});
|
|
|
|
|
2021-07-15 22:37:33 +00:00
|
|
|
$r->addRoute('^/alive/?([0-9]+)?/?(?:\?|$)', function($url, $page = 1) {
|
2021-02-21 16:37:27 +00:00
|
|
|
require __DIR__ . '/../views/alive.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
$r->addRoute('^/all/?([0-9]+)?/?', function($url, $page = 1) {
|
|
|
|
require __DIR__ . '/../views/all.php';
|
|
|
|
});
|
|
|
|
|
2021-09-13 17:21:23 +00:00
|
|
|
$r->addRoute('^/jump/?([^\?/]*)/?(?:\?|$)', function($url, $query = "") {
|
2021-02-21 16:37:27 +00:00
|
|
|
require __DIR__ . '/../views/jump.php';
|
|
|
|
});
|
|
|
|
|
2021-06-13 04:55:08 +00:00
|
|
|
$r->addRoute('^/autojump/?(.*)/?', function($url, $query = "") {
|
|
|
|
require __DIR__ . '/../views/autojump.php';
|
|
|
|
});
|
|
|
|
|
2021-07-15 22:37:33 +00:00
|
|
|
$r->addRoute('^/latest/?(?:\?|$)', function($url) {
|
2021-02-21 16:37:27 +00:00
|
|
|
require __DIR__ . '/../views/latest.php';
|
|
|
|
});
|
|
|
|
|
2021-09-13 17:21:23 +00:00
|
|
|
$r->addRoute('^/search/?([^\?/]*)/?(?:\?|$)', function($url, $query = "") {
|
2021-02-21 16:37:27 +00:00
|
|
|
require __DIR__ . '/../views/search.php';
|
|
|
|
});
|
|
|
|
|
2021-09-13 17:21:23 +00:00
|
|
|
$r->addRoute('^/hidden/?([0-9]+)?/?(?:\?|$)', function($url, $page = 1) {
|
|
|
|
require __DIR__ . '/../views/hidden.php';
|
|
|
|
});
|
|
|
|
|
2021-02-21 16:37:27 +00:00
|
|
|
$r->addErrorRoute(function() {
|
|
|
|
require __DIR__ . '/../views/404.php';
|
|
|
|
});
|
|
|
|
|
|
|
|
/* Process requests */
|
|
|
|
$r->run();
|