From e096774233b487842c3c0411083ba41bad0692aa Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:29:24 +0100 Subject: [PATCH] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 26 +-------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 93e303b..b506d27 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -4,30 +4,6 @@ require_once '../model/LocalArticleManager.php'; require_once '../model/ArticleManager.php'; require_once '../model/Article.php'; -// Angaben aus übergebener ID setzen: -if (isset($_GET["id"])){ // TODO: Später aus Session den Nutzer auslesen und Autorenrechte prüfen! - try { - $articleManager = ArticleManager::getInstance(); - $article = $articleManager->getArticle($_GET["id"]); - if($article != null){ - $title = $article->getTitle(); - $content = $article->getContent(); - $category = $article->getCategory(); - $author = $article->getAuthor(); - $tags = $article->getTags(); - }else{ - $_SESSION["message"] = "article_not_found"; - echo "article_not_found"; - } - } catch (Exception $e){ - $_SESSION["message"] = "internal_error"; - echo "Fehler aufgetreten: " . $e->getMessage(); - } -}else{ - $_SESSION["message"] = "article_not_found"; -} - -// Wenn "speichern" gedrückt wurde: if ($_SERVER["REQUEST_METHOD"] === "POST") { if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){ $_SESSION["message"] = "missing_parameters"; @@ -42,7 +18,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { $newTags = $_POST["tags"]; try { - $articleManager = ArticleManager::getInstance(); + $articleManager = ArticleManager::getInstance(); // TODO: Später aus Session den Nutzer auslesen und Autorenrechte prüfen! $articleManager->updateArticle(new Article($newTitle, $newContent, $newCategory, $author, $newTags), $author); } catch (Exception $e){ $_SESSION["message"] = "internal_error";