40 lines
982 B
PHP
40 lines
982 B
PHP
<?php
|
|
/** @noinspection PhpIncludeInspection */
|
|
require_once "secrets/config.php";
|
|
require_once "lib/config.php";
|
|
require_once "lib/navigation.php";
|
|
require_once "lib/router.php";
|
|
require_once "lib/page.php";
|
|
require_once "lib/endpoint.php";
|
|
require_once "lib/account.php";
|
|
|
|
$routerConfig = array();
|
|
$routerRequest = array();
|
|
|
|
loadRouterConfig();
|
|
$canRender = initRouter();
|
|
if($canRender) {
|
|
/** @noinspection PhpArrayIsAlwaysEmptyInspection */
|
|
session_set_cookie_params(0, '/', "." . $routerRequest["domain"] . "." . $routerRequest["tld"], true, true);
|
|
session_start();
|
|
|
|
if(!isLoggedIn()){
|
|
setDefaultSessionData();
|
|
}
|
|
|
|
if($routerRequest["type"] == "api") {
|
|
echo getEndpoint($routerRequest["page_name"]);
|
|
|
|
}elseif ($routerRequest["type"] == "page") {
|
|
/** @noinspection PhpArrayIsAlwaysEmptyInspection */
|
|
echo getPage($routerRequest["page_name"]);
|
|
}
|
|
else{
|
|
echo "Unknown request";
|
|
}
|
|
}
|
|
else{
|
|
exit();
|
|
}
|
|
|