Notifications

This commit is contained in:
2020-04-02 21:19:06 +02:00
parent 541b8563d5
commit d7a5897fc9
24 changed files with 469 additions and 429 deletions

View File

@@ -44,9 +44,9 @@ if(isset($_GET["api"]) && is_string($_GET["api"])) {
header("400 Bad Request");
$response = createError("Invalid Method");
} else {
$apiFunction = strtoupper($apiFunction[0]) . substr($apiFunction, 1);
$apiFunction = str_replace("/", "\\", $apiFunction);
$class = "\\Api\\$apiFunction";
$apiFunction = implode("\\", array_map('ucfirst', explode("/", $apiFunction)));
if($apiFunction[0] !== "\\") $apiFunction = "\\$apiFunction";
$class = "\\Api$apiFunction";
$file = getClassPath($class);
if(!file_exists($file)) {
header("404 Not Found");
@@ -63,10 +63,15 @@ if(isset($_GET["api"]) && is_string($_GET["api"])) {
}
}
} else {
$documentName = $_GET["site"];
if ($installation) {
$document = new Documents\Install($user);
if ($documentName !== "" && $documentName !== "index.php") {
$response = "Redirecting to <a href=\"/\">/</a>";
header("Location: /");
} else {
$document = new Documents\Install($user);
}
} else {
$documentName = $_GET["site"];
if(empty($documentName) || strcasecmp($documentName, "install") === 0) {
$documentName = "home";
} else if(!preg_match("/[a-zA-Z]+(\/[a-zA-Z]+)*/", $documentName)) {