diff --git a/php/controller/createArticle-controller.php b/php/controller/createArticle-controller.php index fb0ee8c..e78e730 100644 --- a/php/controller/createArticle-controller.php +++ b/php/controller/createArticle-controller.php @@ -1,3 +1,9 @@ newArticle($_POST['post-title'], $_POST['post-content'], $author); +} catch (PDOException $e) { + //TODO: Exception werfen, wenn das Erstellen des neuen Artikels nicht geklappt hat. +} diff --git a/php/model/Database.php b/php/model/Database.php index 9841aa2..49dc5fa 100644 --- a/php/model/Database.php +++ b/php/model/Database.php @@ -2,6 +2,7 @@ /* * Die Klasse dient als Brücke zwischen der Implementierung des DatenbankDAO und der Geschäftslogik. * Hier kann später die FileDatabase durch die SQL_Database ausgetauscht werden. + * @author Niklas Ortmann */ class Database { diff --git a/php/model/FileDatabase.php b/php/model/FileDatabase.php index 0585044..9a11907 100644 --- a/php/model/FileDatabase.php +++ b/php/model/FileDatabase.php @@ -42,8 +42,8 @@ class FileDatabase implements databaseDAO { $newData = fopen("articles.txt", "xb"); fclose($newData); } - $previousData = file_get_contents("gaestebuch.txt"); - if (file_put_contents("gaestebuch.txt", "$newData\n$previousData")) { + $previousData = file_get_contents("articles.txt"); + if (file_put_contents("articles.txt", "$newData\n$previousData")) { // TODO: Vernünftige Rückmeldung implementieren. echo "Artikel erfolgreich gespeichert!"; } else {