34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
// Standardpfad
|
|
$pfad = $_GET["pfad"] ?? "home";
|
|
|
|
// Allowlists
|
|
$erlaubte_content_seiten = [
|
|
"accessibility", "confirm-password", "confirm-register", "createArticle",
|
|
"datenschutz", "home", "impressum", "login", "nutzungsbedingungen",
|
|
"password-forgotten", "profile", "register", "search-results",
|
|
"show-mail", "showArticle", "showCategory", "updateArticle"
|
|
];
|
|
|
|
$erlaubte_controller = [
|
|
"confirm-password", "confirm-register", "createArticle", "deleteAccount",
|
|
"deleteArticle", "home", "index", "like", "login", "logout",
|
|
"password-forgotten", "profile", "profileArticles", "register",
|
|
"search-results", "showArticle", "showCategory", "updateArticle"
|
|
];
|
|
|
|
// Controller laden
|
|
if (in_array($pfad, $erlaubte_controller)) {
|
|
include_once "php/controller/" . $pfad . "-controller.php";
|
|
|
|
// Sofortiger Abbruch bei zerstörenden Aktionen
|
|
if ($pfad === "logout" || $pfad === "deleteAccount") {
|
|
exit();
|
|
}
|
|
}
|
|
|
|
// Content-Validierung: Wenn der Pfad nicht erlaubt ist, dann 404
|
|
if (!in_array($pfad, $erlaubte_content_seiten)) {
|
|
$pfad = "404";
|
|
}
|