|
|
|
@@ -1,7 +1,28 @@
|
|
|
|
|
<?php
|
|
|
|
|
// Standardpfad
|
|
|
|
|
$pfad = $_GET["pfad"] ?? "home";
|
|
|
|
|
|
|
|
|
|
// Allowlist für Content
|
|
|
|
|
if ($pfad === "logout") {
|
|
|
|
|
include_once "php/controller/logout-controller.php";
|
|
|
|
|
exit();
|
|
|
|
|
} elseif ($pfad === "deleteAccount") {
|
|
|
|
|
include_once "php/controller/deleteAccount-controller.php";
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($pfad === "login") {
|
|
|
|
|
include_once "php/controller/login-controller.php";
|
|
|
|
|
} elseif ($pfad === "register") {
|
|
|
|
|
include_once "php/controller/register-controller.php";
|
|
|
|
|
} elseif ($pfad === "password-forgotten") {
|
|
|
|
|
include_once "php/controller/password-forgotten-controller.php";
|
|
|
|
|
} elseif ($pfad === "confirm-register") {
|
|
|
|
|
include_once "php/controller/confirm-register-controller.php";
|
|
|
|
|
} elseif ($pfad === "confirm-password") {
|
|
|
|
|
include_once "php/controller/confirm-password-controller.php";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Whitelist
|
|
|
|
|
$erlaubte_content_seiten = [
|
|
|
|
|
"accessibility", "confirm-password", "confirm-register", "createArticle",
|
|
|
|
|
"datenschutz", "home", "impressum", "login", "nutzungsbedingungen",
|
|
|
|
@@ -9,26 +30,6 @@ $erlaubte_content_seiten = [
|
|
|
|
|
"show-mail", "showArticle", "showCategory", "updateArticle"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// Allowlist für Controller
|
|
|
|
|
$erlaubte_controller = [
|
|
|
|
|
"confirm-password", "confirm-register", "createArticle", "deleteAccount",
|
|
|
|
|
"deleteArticle", "home", "index", "like", "login", "logout",
|
|
|
|
|
"password-forgotten", "profile", "profileArticles", "register",
|
|
|
|
|
"search-results", "showArticle", "showCategory", "updateArticle"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// Validierung der Content-Seite
|
|
|
|
|
if (!in_array($pfad, $erlaubte_content_seiten)) {
|
|
|
|
|
$pfad = "404";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Automatisch den passenden Controller laden, falls erlaubt
|
|
|
|
|
if ($pfad !== "404" && in_array($pfad, $erlaubte_controller)) {
|
|
|
|
|
include_once "../php/controller/" . $pfad . "-controller.php";
|
|
|
|
|
|
|
|
|
|
// Nach Logout oder Account-Löschung das Skript sofort beenden
|
|
|
|
|
if ($pfad === "logout" || $pfad === "deleteAccount") {
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|