remove error handling
This commit is contained in:
parent
04117e3aaa
commit
472c74a0c4
48
index.php
48
index.php
@ -1,24 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
try {
|
require_once 'secrets/config.php';
|
||||||
require_once 'lib/config.php';
|
require_once 'lib/config.php';
|
||||||
global $routerConfig;
|
require_once 'lib/navigation.php';
|
||||||
try {
|
require_once 'lib/router.php';
|
||||||
require_once 'lib/main.php';
|
require_once 'lib/page.php';
|
||||||
} catch (Exception $eMain) {
|
require_once 'lib/endpoint.php';
|
||||||
$page = file_get_contents($routerConfig["template_dir"] . "500.html");
|
require_once 'lib/account.php';
|
||||||
$error_msg = "Error Message";
|
|
||||||
try {
|
$routerConfig = array();
|
||||||
require_once 'lib/account.php';
|
$routerRequest = array();
|
||||||
if (isAdmin()) {
|
|
||||||
$error_msg = $eMain;
|
loadRouterConfig();
|
||||||
}
|
$canRender = initRouter();
|
||||||
} catch (Exception) {
|
|
||||||
} finally {
|
if ($canRender) {
|
||||||
$page = str_replace("__TEMPLATE_ERROR__", $error_msg, $page);
|
session_set_cookie_params(0, '/', "." . $routerRequest["domain"] . "." . $routerRequest["tld"], true, true);
|
||||||
echo $page;
|
session_start();
|
||||||
http_response_code(500);
|
|
||||||
}
|
if (!isLoggedIn()) {
|
||||||
|
setDefaultSessionData();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($routerRequest["type"] == "api") {
|
||||||
|
echo getEndpoint($routerRequest["page_name"]);
|
||||||
|
|
||||||
|
} elseif ($routerRequest["type"] == "page") {
|
||||||
|
echo getPage($routerRequest["page_name"]);
|
||||||
}
|
}
|
||||||
} catch (Exception $e){
|
|
||||||
echo $e;
|
|
||||||
}
|
}
|
37
lib/main.php
37
lib/main.php
@ -1,37 +0,0 @@
|
|||||||
<?php /** @noinspection PhpArrayIsAlwaysEmptyInspection */
|
|
||||||
/** @noinspection PhpArrayIsAlwaysEmptyInspection */
|
|
||||||
/** @noinspection PhpArrayIsAlwaysEmptyInspection */
|
|
||||||
/** @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";
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user