Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 35d4425086 | |||
| d3435d4cde | |||
| f61c548b9e | |||
| 101a2a247b | |||
| 423941e7ed |
@@ -36,7 +36,7 @@ include_once "php/controller/index-controller.php";
|
|||||||
<?php
|
<?php
|
||||||
include_once 'includes/navbar.php';
|
include_once 'includes/navbar.php';
|
||||||
|
|
||||||
// Dynamischer Inhalt (Nutzt das geprüfte $pfad aus dem Index-Controller)
|
// Dynamischer Inhalt
|
||||||
if (isset($pfad) && $pfad !== "404" && file_exists('content/' . $pfad . '.php')) {
|
if (isset($pfad) && $pfad !== "404" && file_exists('content/' . $pfad . '.php')) {
|
||||||
include_once 'content/' . $pfad . '.php';
|
include_once 'content/' . $pfad . '.php';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,7 +2,27 @@
|
|||||||
// Standardpfad
|
// Standardpfad
|
||||||
$pfad = $_GET["pfad"] ?? "home";
|
$pfad = $_GET["pfad"] ?? "home";
|
||||||
|
|
||||||
// Allowlists
|
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 = [
|
$erlaubte_content_seiten = [
|
||||||
"accessibility", "confirm-password", "confirm-register", "createArticle",
|
"accessibility", "confirm-password", "confirm-register", "createArticle",
|
||||||
"datenschutz", "home", "impressum", "login", "nutzungsbedingungen",
|
"datenschutz", "home", "impressum", "login", "nutzungsbedingungen",
|
||||||
@@ -10,24 +30,6 @@ $erlaubte_content_seiten = [
|
|||||||
"show-mail", "showArticle", "showCategory", "updateArticle"
|
"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)) {
|
if (!in_array($pfad, $erlaubte_content_seiten)) {
|
||||||
$pfad = "404";
|
$pfad = "404";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user