Compare commits

..

2 Commits

Author SHA1 Message Date
niklas.ortmann 625dd35b9e Update createArticle-controller.php 2026-06-01 14:02:31 +02:00
niklas.ortmann f99b7bc8ab Update updateArticle-controller.php 2026-06-01 14:02:11 +02:00
2 changed files with 3 additions and 5 deletions
@@ -2,12 +2,14 @@
session_start(); session_start();
require_once '../model/LocalArticleManager.php'; require_once '../model/LocalArticleManager.php';
require_once '../model/ArticleManager.php'; require_once '../model/ArticleManager.php';
require_once '../validator/article-validator.php';
if ($_SERVER["REQUEST_METHOD"] === "POST") { if ($_SERVER["REQUEST_METHOD"] === "POST") {
$_SESSION["old_title"] = $_POST["title"] ?? ''; $_SESSION["old_title"] = $_POST["title"] ?? '';
$_SESSION["old_content"] = $_POST["content"] ?? ''; $_SESSION["old_content"] = $_POST["content"] ?? '';
$_SESSION["old_category"] = $_POST["category"] ?? ''; $_SESSION["old_category"] = $_POST["category"] ?? '';
$_SESSION["old_tags"] = $_POST["tags"] ?? ''; $_SESSION["old_tags"] = $_POST["tags"] ?? '';
if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){ if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
$_SESSION["message"] = "missing_parameters"; $_SESSION["message"] = "missing_parameters";
header("location: ../../index.php?pfad=createArticle"); header("location: ../../index.php?pfad=createArticle");
+1 -5
View File
@@ -28,11 +28,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$content = $_POST["content"]; $content = $_POST["content"];
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
$category = $_POST["category"]; $category = $_POST["category"];
if (isset($_POST['tags'])) { $tags = $_POST['tags'] ?? '';
$tags = $_POST['tags'];
} else {
$tags = '';
}
// -------------------------------- Validierung der Daten: ------------------------- // -------------------------------- Validierung der Daten: -------------------------
if (!articleAuthorValidator($author)) { if (!articleAuthorValidator($author)) {