33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
session_start();
|
|
require_once '../model/LocalArticleManager.php';
|
|
require_once '../model/ArticleManager.php';
|
|
|
|
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"];
|
|
|
|
try {
|
|
$articleManager = ArticleManager::getInstance();
|
|
//$articleManager->addArticle($title, $content, $author, $category, $tags);
|
|
$articleManager->addArticle("Test", "Testkontent", "informatik", "max.mustermann", "Apfel, Birne");
|
|
} catch (Exception $e){
|
|
$_SESSION["message"] = "internal_error";
|
|
}
|
|
$_SESSION["message"] = "new_article";
|
|
// Weiterleitung zur Homepage
|
|
//header("location: ../../index.php");
|
|
exit();
|
|
|
|
}
|
|
}
|
|
|
|
?>
|