getMessage());
}
if ($_SERVER["REQUEST_METHOD"] === "POST") {
if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
$_SESSION["message"] = "missing_parameters";
header("location: ../../index.php?pfad=createArticle");
} else {
$title = $_POST["title"];
$content = $_POST["content"];
$category = $_POST["category"];
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
$tags = $_POST["tags"];
$articleManager->addArticle($title, $content, $author, $category, $tags);
foreach ($articleManager->getAllArticles() as $article) {
echo htmlspecialchars($article['title'])."
";
echo htmlspecialchars($article['content'])."
";
echo htmlspecialchars($article['author'])."
";
echo htmlspecialchars($article['category'])."
";
echo htmlspecialchars($article['tags'])."
";
}
// Weiterleitung zur Homepage
//header("location: ../../index.php");
exit();
}
}
?>