Merge pull request 'Deiteiincludes ($pfad) per whitelist prüfen' (#53) from AllowistDateiincludes into dev
Reviewed-on: #53
This commit was merged in pull request #53.
This commit is contained in:
@@ -2,99 +2,49 @@
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
ob_start();
|
||||
include_once("php/controller/index.php");
|
||||
|
||||
$pfad = $_GET["pfad"] ?? "home";
|
||||
|
||||
/*
|
||||
Controller für Aktionen werden vor der HTML-Ausgabe geladen,
|
||||
damit Weiterleitungen mit header() funktionieren.
|
||||
*/
|
||||
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();
|
||||
}
|
||||
include_once "php/controller/index-controller.php";
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="EduForge">
|
||||
<meta name="author" content="Niklas Ortmann">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="images/logos/logo_icon.ico">
|
||||
|
||||
<!--
|
||||
Seite: Index der Lernplattform
|
||||
Funktion: Webseitengerüst, Anzeigen von Content
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/navbar.css">
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<link rel="stylesheet" href="css/search-results.css">
|
||||
<link rel="stylesheet" href="css/createArticle.css">
|
||||
<link rel="stylesheet" href="css/profile.css">
|
||||
<link rel="stylesheet" href="css/showArticle.css">
|
||||
<link rel="stylesheet" href="css/message.css">
|
||||
<link rel="stylesheet" href="css/showCategory.css">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="EduForge">
|
||||
<meta name="author" content="Niklas Ortmann">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="images/logos/logo_icon.ico">
|
||||
<script src="js/paginator.js" async></script>
|
||||
<script src="js/sorter.js" async></script>
|
||||
<script src="js/comments.js" defer></script>
|
||||
<script src="js/editor.js" async></script>
|
||||
<script src="js/filter.js" async></script>
|
||||
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/navbar.css">
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<link rel="stylesheet" href="css/search-results.css">
|
||||
<link rel="stylesheet" href="css/createArticle.css">
|
||||
<link rel="stylesheet" href="css/profile.css">
|
||||
<link rel="stylesheet" href="css/showArticle.css">
|
||||
<link rel="stylesheet" href="css/message.css">
|
||||
<link rel="stylesheet" href="css/showCategory.css">
|
||||
|
||||
<script src="js/paginator.js" async></script>
|
||||
<script src="js/sorter.js" async></script>
|
||||
<script src="js/comments.js" defer></script>
|
||||
<script src="js/editor.js" async></script>
|
||||
<script src="js/filter.js" async></script>
|
||||
|
||||
<title>EduForge</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php
|
||||
include_once 'includes/navbar.php';
|
||||
|
||||
/*
|
||||
Dynamischer Inhalt:
|
||||
Je nach pfad-Parameter wird die passende Datei aus content geladen.
|
||||
*/
|
||||
if (file_exists('content/' . $pfad . '.php')) {
|
||||
include_once 'content/' . $pfad . '.php';
|
||||
} else {
|
||||
include_once 'content/404.php';
|
||||
}
|
||||
|
||||
include_once 'includes/footer.php';
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<title>EduForge</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
ob_end_flush();
|
||||
?>
|
||||
include_once 'includes/navbar.php';
|
||||
|
||||
// Dynamischer Inhalt
|
||||
if (isset($pfad) && $pfad !== "404" && file_exists('content/' . $pfad . '.php')) {
|
||||
include_once 'content/' . $pfad . '.php';
|
||||
} else {
|
||||
include_once 'content/404.php';
|
||||
}
|
||||
|
||||
include_once 'includes/footer.php';
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,3 +1,35 @@
|
||||
<?php
|
||||
// Standardpfad
|
||||
$pfad = $_GET["pfad"] ?? "home";
|
||||
|
||||
?>
|
||||
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",
|
||||
"password-forgotten", "profile", "register", "search-results",
|
||||
"show-mail", "showArticle", "showCategory", "updateArticle"
|
||||
];
|
||||
|
||||
if (!in_array($pfad, $erlaubte_content_seiten)) {
|
||||
$pfad = "404";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user