Compare commits
2 Commits
317f4c0ce9
...
f1986bc3f7
| Author | SHA1 | Date | |
|---|---|---|---|
| f1986bc3f7 | |||
| 75d2f17a3f |
@@ -2,6 +2,7 @@
|
||||
session_start();
|
||||
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!
|
||||
@@ -31,17 +32,18 @@ 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");
|
||||
exit();
|
||||
} else {
|
||||
|
||||
$title = $_POST["title"];
|
||||
$content = $_POST["content"];
|
||||
$category = $_POST["category"];
|
||||
$newTitle = $_POST["title"];
|
||||
$newContent = $_POST["content"];
|
||||
$newCategory = $_POST["category"];
|
||||
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
||||
$tags = $_POST["tags"];
|
||||
$newTags = $_POST["tags"];
|
||||
|
||||
try {
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$articleManager->updateArticle($title, $content, $author, $category, $tags);
|
||||
$articleManager->updateArticle(new Article($newTitle, $newContent, $newCategory, $author, $newTags), $author);
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class LocalArticleManager implements ArticleManagerDAO {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Nur speichern, wenn Beitrag geändert wurde:
|
||||
if ($updated) {
|
||||
$this->saveArticle($articles);
|
||||
|
||||
Reference in New Issue
Block a user