diff --git a/php/controller/index-controller.php b/php/controller/index-controller.php index acca836..7d598f7 100644 --- a/php/controller/index-controller.php +++ b/php/controller/index-controller.php @@ -2,7 +2,27 @@ // Standardpfad $pfad = $_GET["pfad"] ?? "home"; -// Allowlist für alle gültigen Content-Seiten +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", @@ -10,33 +30,6 @@ $erlaubte_content_seiten = [ "show-mail", "showArticle", "showCategory", "updateArticle" ]; -// Content-Validierung if (!in_array($pfad, $erlaubte_content_seiten)) { $pfad = "404"; } - -// Controller laden -if ($pfad === "login") { - include_once "php/controller/login-controller.php"; -} -if ($pfad === "register") { - include_once "php/controller/register-controller.php"; -} -if ($pfad === "password-forgotten") { - include_once "php/controller/password-forgotten-controller.php"; -} -if ($pfad === "confirm-register") { - include_once "php/controller/confirm-register-controller.php"; -} -if ($pfad === "confirm-password") { - include_once "php/controller/confirm-password-controller.php"; -} -if ($pfad === "logout") { - include_once "php/controller/logout-controller.php"; - exit(); -} -if ($pfad === "deleteAccount") { - include_once "php/controller/deleteAccount-controller.php"; - exit(); -} -