This commit is contained in:
NOrtmann1
2026-06-10 16:15:11 +02:00
4 changed files with 18 additions and 24 deletions
+7 -7
View File
@@ -21,7 +21,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
if (!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
$_SESSION["message"] = "missing_parameters";
header("location: ../../index.php?pfad=updateArticle");
header("location: ../../index.php?pfad=updateArticle&id=$id");
exit();
}else{
$title = $_POST["title"];
@@ -33,31 +33,31 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
// -------------------------------- Validierung der Daten: -------------------------
if (!articleAuthorValidator($author)) {
$_SESSION["message"] = "author_not_valid";
header("location: ../../index.php?pfad=updateArticle");
header("location: ../../index.php?pfad=updateArticle&id=$id");
exit();
}
if (!articleTitleValidator($title)) {
$_SESSION["message"] = "invalid_title";
header("location: ../../index.php?pfad=updateArticle");
header("location: ../../index.php?pfad=updateArticle&id=$id");
exit();
}
if (!articleContentValidator($content)) {
$_SESSION["message"] = "invalid_content";
header("location: ../../index.php?pfad=updateArticle");
header("location: ../../index.php?pfad=updateArticle&id=$id");
exit();
}
if (!articleCategoryValidator($category)) {
$_SESSION["message"] = "invalid_category";
header("location: ../../index.php?pfad=updateArticle");
header("location: ../../index.php?pfad=updateArticle&id=$id");
exit();
}
if (!articleTagValidator($tags)) {
$_SESSION["message"] = "invalid_tags";
header("location: ../../index.php?pfad=updateArticle");
header("location: ../../index.php?pfad=updateArticle&id=$id");
exit();
} else {
$cleanedTags = [];
@@ -83,7 +83,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
$articleManager->updateArticle($id ,$article, $author);
} catch (Exception $e){
$_SESSION["message"] = $e->getMessage();
header("location: ../../index.php?pfad=updateArticle");
header("location: ../../index.php?pfad=updateArticle&id=$id");
exit();
}
$_SESSION["message"] = "article_updated";