From 524dc2a399abd3ec2feb196df728c792b6e00fcc Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 09:57:34 +0200 Subject: [PATCH 01/18] DataBaseArticleManager + Methoden search-Methode muss noch implementiert werden... --- .../315cb5c9-2b0f-435b-b602-59823b160908.xml | 1833 +++++++++++++++++ .../storage_v2/_src_/schema/main.uQUzAA.meta | 2 + .../a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml | 1833 +++++++++++++++++ .../storage_v2/_src_/schema/main.uQUzAA.meta | 2 + .idea/dataSources/data_sources_history.xml | 42 + db/articles | 0 php/model/ArticleManagerDAO.php | 19 +- php/model/DatabaseArticleManager.php | 306 +++ php/model/LocalArticleManager.php | 1 + 9 files changed, 4028 insertions(+), 10 deletions(-) create mode 100644 .idea/dataSources/315cb5c9-2b0f-435b-b602-59823b160908.xml create mode 100644 .idea/dataSources/315cb5c9-2b0f-435b-b602-59823b160908/storage_v2/_src_/schema/main.uQUzAA.meta create mode 100644 .idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml create mode 100644 .idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba/storage_v2/_src_/schema/main.uQUzAA.meta create mode 100644 .idea/dataSources/data_sources_history.xml create mode 100644 db/articles create mode 100644 php/model/DatabaseArticleManager.php diff --git a/.idea/dataSources/315cb5c9-2b0f-435b-b602-59823b160908.xml b/.idea/dataSources/315cb5c9-2b0f-435b-b602-59823b160908.xml new file mode 100644 index 0000000..4fccad1 --- /dev/null +++ b/.idea/dataSources/315cb5c9-2b0f-435b-b602-59823b160908.xml @@ -0,0 +1,1833 @@ + + + + + 3.51.1 + + + + + + + + + + + + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + + window + + + 1 + + + 1 + + + 1 + + + + 1 + 1 + + + + + 1 + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + + + 1 + + + + + window + + + window + + + window + + + + + + 1 + 1 + + + 1 + 1 + + + 1 + + + window + + + + 1 + + + window + + + 1 + + + 1 + 1 + + + + + + 1 + + + + + 1 + + + 1 + + + window + + + window + + + 1 + + + 1 + + + 1 + 1 + + + 1 + + + 1 + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + window + + + 1 + window + + + 1 + 1 + + + 1 + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + window + + + 1 + window + + + 1 + 1 + + + 1 + 1 + + + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + 1 + + + window + + + window + + + window + + + + window + + + window + + + window + + + window + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + aggregate + + + 1 + + + 1 + + + + + + 1 + 1 + + + window + + + aggregate + + + 1 + 1 + + + window + + + 1 + + + aggregate + + + window + + + window + + + 1 + + + 1 + + + + + + + + window + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + + 1 + + + 1 + + + + + window + + + 1 + + + 1 + + + + + + 1 + + + 1 + + + window + + + 1 + + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + + + 1 + + + + aggregate + + + + 1 + 1 + + + window + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + window + + + 1 + + + 1 + + + 1 + 1 + + + 1 + + + window + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + + + 1 + + + aggregate + + + aggregate + + + 1 + + + 1 + 2026-06-05.07:13:27 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + R + + + R + + + R + + + R + + + R + + + R + + + 1 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + R + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 1 +
+ + 1 + TEXT|0s + + + 2 + TEXT|0s + + + 3 + TEXT|0s + + + 4 + INT|0s + + + 5 + TEXT|0s + +
+
\ No newline at end of file diff --git a/.idea/dataSources/315cb5c9-2b0f-435b-b602-59823b160908/storage_v2/_src_/schema/main.uQUzAA.meta b/.idea/dataSources/315cb5c9-2b0f-435b-b602-59823b160908/storage_v2/_src_/schema/main.uQUzAA.meta new file mode 100644 index 0000000..8dab49c --- /dev/null +++ b/.idea/dataSources/315cb5c9-2b0f-435b-b602-59823b160908/storage_v2/_src_/schema/main.uQUzAA.meta @@ -0,0 +1,2 @@ +#n:main +! [0, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml b/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml new file mode 100644 index 0000000..9fc8217 --- /dev/null +++ b/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml @@ -0,0 +1,1833 @@ + + + + + 3.51.1 + + + + + + + + + + + + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + + window + + + 1 + + + 1 + + + 1 + + + + 1 + 1 + + + + + 1 + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + + + 1 + + + + + window + + + window + + + window + + + + + + 1 + 1 + + + 1 + 1 + + + 1 + + + window + + + + 1 + + + window + + + 1 + + + 1 + 1 + + + + + + 1 + + + + + 1 + + + 1 + + + window + + + window + + + 1 + + + 1 + + + 1 + 1 + + + 1 + + + 1 + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + window + + + 1 + window + + + 1 + 1 + + + 1 + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + window + + + 1 + window + + + 1 + 1 + + + 1 + 1 + + + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + 1 + + + 1 + 1 + + + window + + + window + + + window + + + + window + + + window + + + window + + + window + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + aggregate + + + 1 + + + 1 + + + + + + 1 + 1 + + + window + + + aggregate + + + 1 + 1 + + + window + + + 1 + + + aggregate + + + window + + + window + + + 1 + + + 1 + + + + + + + + window + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + + 1 + + + 1 + + + + + window + + + 1 + + + 1 + + + + + + 1 + + + 1 + + + window + + + 1 + + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + + + 1 + + + + aggregate + + + + 1 + 1 + + + window + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + window + + + 1 + + + 1 + + + 1 + 1 + + + 1 + + + window + + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + 1 + + + 1 + + + 1 + + + aggregate + + + aggregate + + + 1 + + + 1 + 2026-06-05.07:12:20 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + R + + + R + + + R + + + R + + + R + + + R + + + 1 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + R + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + 2 + + + 3 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 2 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + R + + + 1 + + + 1 +
+ + 1 + TEXT|0s + + + 2 + TEXT|0s + + + 3 + TEXT|0s + + + 4 + INT|0s + + + 5 + TEXT|0s + +
+
\ No newline at end of file diff --git a/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba/storage_v2/_src_/schema/main.uQUzAA.meta b/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba/storage_v2/_src_/schema/main.uQUzAA.meta new file mode 100644 index 0000000..8dab49c --- /dev/null +++ b/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba/storage_v2/_src_/schema/main.uQUzAA.meta @@ -0,0 +1,2 @@ +#n:main +! [0, 0, null, null, -2147483648, -2147483648] diff --git a/.idea/dataSources/data_sources_history.xml b/.idea/dataSources/data_sources_history.xml new file mode 100644 index 0000000..3f0c640 --- /dev/null +++ b/.idea/dataSources/data_sources_history.xml @@ -0,0 +1,42 @@ + + + + + " + + + sqlite.xerial + true + org.sqlite.JDBC + jdbc:sqlite:$PROJECT_DIR$/db/articles + master_key + no-auth + + + + + + $ProjectFileDir$ + + + + + + " + + + sqlite.xerial + true + org.sqlite.JDBC + jdbc:sqlite:$PROJECT_DIR$/db/articles + master_key + no-auth + + + + + + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/db/articles b/db/articles new file mode 100644 index 0000000..e69de29 diff --git a/php/model/ArticleManagerDAO.php b/php/model/ArticleManagerDAO.php index d33df23..01826e1 100644 --- a/php/model/ArticleManagerDAO.php +++ b/php/model/ArticleManagerDAO.php @@ -20,8 +20,7 @@ interface ArticleManagerDAO * @param $category string Kategorie des Beitrages * @param $tags string optionale Schlagworte für eine bessere Suche * - * Mögliche Exceptions: - * TODO: Exceptions implementieren. + * @throws InternalServerErrorException */ public function addArticle($title, $content, $author, $category, $tags); @@ -37,16 +36,17 @@ interface ArticleManagerDAO * @throws InternalServerErrorException * @throws NotFoundException * @throws UnauthorizedAccessException - * / */ public function updateArticle($id, $article, $author); /** * Löscht einen Beitrag aus übergebener ID. + * TODO: sollte auch die Autorisierung prüfen... * @param $id * @return void - * - * TODO: Exceptions implementieren. + * @throws InternalServerErrorException + * @throws NotFoundException + * @throws UnauthorizedAccessException */ public function deleteArticle($id); @@ -55,16 +55,14 @@ interface ArticleManagerDAO * $id ID des Beitrags * * @return Article - * Mögliche Exceptions: - * TODO: Exceptions implementieren. + * @throws InternalServerErrorException */ public function getArticle($id); /** * Alle Beiträge aufrufen. * - * Mögliche Exceptions: - * TODO: Exceptions implementieren. + * @throws InternalServerErrorException */ public function getAllArticles(); @@ -72,7 +70,7 @@ interface ArticleManagerDAO * Gibt alle Beiträge eines Nutzer mit einer gegebenen ID aus. * @param $author * @return Article[] - * TODO: Exceptions implementieren. + * @throws InternalServerErrorException */ public function getArticlesByAuthor($author); @@ -89,6 +87,7 @@ interface ArticleManagerDAO * Gibt alle Beiträge einer gegebenen Kategorie aus. * @param $category * @return mixed + * @throws InternalServerErrorException */ public function getArticlesByCategory($category); diff --git a/php/model/DatabaseArticleManager.php b/php/model/DatabaseArticleManager.php new file mode 100644 index 0000000..8eb1fed --- /dev/null +++ b/php/model/DatabaseArticleManager.php @@ -0,0 +1,306 @@ +exec(" + CREATE TABLE articles ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + title TEXT, + content TEXT, + author TEXT, + category TEXT, + tags TEXT, + created TIMESTAMP DEFAULT CURRENT_TIMESTAMP + );"); + unset($db); + } catch (PDOException $e) { + throw new InternalServerErrorException($e->getMessage()); + } + } + } + + /** + * Baut die Verbindung zur Datenbank auf. + * @throws InternalServerErrorException + */ + private function getConnection() + { + try { + $user = 'root'; + $pw = null; + $dsn = 'sqlite: ../../db/gaestebuch.db'; + return new PDO($dsn, $user, $pw); + } catch (PDOException $e) { + throw new InternalServerErrorException($e->getMessage()); + } + } + + /** + * Gibt die DatabaseArticleManager-Instanz zurück. + * @return DatabaseArticleManager + */ + public static function getInstance() + { + if (self::$instance == null) { + self::$instance = new DatabaseArticleManager(); + } + return self::$instance; + } + + public function addArticle($title, $content, $author, $category, $tags) + { + try { + $db = $this->getConnection(); + + $sql = "INSERT INTO articles (title, content, author, category, tags) + VALUES (:title, :content, :author, :category, :tags);"; + + $command = $db->prepare($sql); + if (!$command) { + throw new InternalServerErrorException("internal_error"); + } + + // Verknüpft die übergebenen Parameter exakt mit den SQL-Platzhaltern + $success = $command->execute([ + ":title" => $title, + ":content" => $content, + ":author" => $author, + ":category" => $category, + ":tags" => $tags + ]); + + if (!$success) { + throw new InternalServerErrorException("internal_error"); + } + + return intval($db->lastInsertId()); + + } catch (PDOException $e) { + throw new InternalServerErrorException($e->getMessage()); + } + } + + public function updateArticle($id, $article, $author) + { + if (empty($article)) { + throw new InternalServerErrorException("internal_error"); + } + + // Berechtigungsprüfung analog zur lokalen Implementierung: + if ($article->getAuthor() !== $author) { + throw new UnauthorizedAccessException("unauthorized_access"); + } + + try { + $db = $this->getConnection(); + + $sql = "UPDATE articles + SET title = :title, content = :content, author = :author, category = :category, tags = :tags + WHERE id = :id;"; + + $command = $db->prepare($sql); + if (!$command) { + throw new InternalServerErrorException("internal_error"); + } + + $success = $command->execute([ + ":id" => $id, + ":title" => $article->getTitle(), + ":content" => $article->getContent(), + ":author" => $author, + ":category" => $article->getCategory(), + ":tags" => $article->getTags() + ]); + + // rowCount() prüft, ob eine Zeile mit dieser ID existierte und geändert werden konnte + if (!$success || $command->rowCount() === 0) { + // Falls die ID nicht existiert, prüfen wir, ob sie überhaupt da ist + if (!$this->getArticle($id)) { + throw new NotFoundException("missing_id"); + } + } + } catch (PDOException $e) { + throw new InternalServerErrorException("internal_error"); + } + } + + public function deleteArticle($id) + { + // TODO: Sollte auch die Autorisierung prüfen... + try { + $db = $this->getConnection(); + $sql = "DELETE FROM articles WHERE id = :id;"; + + $command = $db->prepare($sql); + if (!$command) { + throw new InternalServerErrorException("internal_error"); + } + + if (!$command->execute([":id" => $id])) { + throw new InternalServerErrorException("internal_error"); + } + } catch (PDOException $exc) { + throw new InternalServerErrorException("internal_error"); + } + } + + public function getArticle($id) + { + try { + $db = $this->getConnection(); + $sql = "SELECT * FROM articles WHERE id = :id;"; + + $command = $db->prepare($sql); + if (!$command) { + throw new InternalServerErrorException("internal_error"); + } + + $command->execute([":id" => $id]); + $row = $command->fetch(PDO::FETCH_ASSOC); + + if ($row) { + return new Article( + intval($row['id']), + $row['title'], + $row['content'], + $row['author'], + $row['category'], + $row['tags'], + $row['created'] + ); + } + + return null; + } catch (PDOException $e) { + throw new InternalServerErrorException("internal_error"); + } + } + + public function getAllArticles() + { + try { + $db = $this->getConnection(); + $sql = "SELECT * FROM articles;"; + + $command = $db->query($sql); + if (!$command) { + throw new InternalServerErrorException("internal_error"); + } + + $rows = $command->fetchAll(PDO::FETCH_ASSOC); + $articles = []; + + foreach ($rows as $row) { + $articles[] = new Article( + intval($row['id']), + $row['title'], + $row['content'], + $row['author'], + $row['category'], + $row['tags'], + $row['created'] + ); + } + + return $articles; + } catch (PDOException $e) { + throw new InternalServerErrorException("internal_error"); + } + } + + public function getArticlesByAuthor($author) + { + try { + $db = $this->getConnection(); + $sql = "SELECT * FROM articles WHERE author = :author;"; + + $command = $db->prepare($sql); + if (!$command) { + throw new InternalServerErrorException("internal_error"); + } + + $command->execute([":author" => $author]); + $rows = $command->fetchAll(PDO::FETCH_ASSOC); + $filteredArticles = []; + + foreach ($rows as $row) { + $filteredArticles[] = new Article( + intval($row['id']), + $row['title'], + $row['content'], + $row['author'], + $row['category'], + $row['tags'], + $row['created'] + ); + } + + return $filteredArticles; + } catch (PDOException $e) { + throw new InternalServerErrorException("internal_error"); + } + } + + public function getArticlesByCategory($category) + { + try { + $db = $this->getConnection(); + $sql = "SELECT * FROM articles WHERE category = :category;"; + + $command = $db->prepare($sql); + if (!$command) { + throw new InternalServerErrorException("internal_error"); + } + + $command->execute([":category" => $category]); + $rows = $command->fetchAll(PDO::FETCH_ASSOC); + $filteredArticles = []; + + foreach ($rows as $row) { + $filteredArticles[] = new Article( + intval($row['id']), + $row['title'], + $row['content'], + $row['author'], + $row['category'], + $row['tags'], + $row['created'] + ); + } + + return $filteredArticles; + } catch (PDOException $exc) { + throw new InternalServerErrorException("internal_error"); + } + } + + public function search(string $keyword): array + { + // TODO: implement search() + return []; + } + +} \ No newline at end of file diff --git a/php/model/LocalArticleManager.php b/php/model/LocalArticleManager.php index 2ee8ce9..62879e9 100644 --- a/php/model/LocalArticleManager.php +++ b/php/model/LocalArticleManager.php @@ -104,6 +104,7 @@ class LocalArticleManager implements ArticleManagerDAO { public function deleteArticle($id) { + // TODO: Sollte auch die Autorisierung prüfen... $articles = $this->getAllArticles(); $articleFound = false; From caa9a9ff8f0721509384082bb503eb81a508a677 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 10:22:30 +0200 Subject: [PATCH 02/18] Update DatabaseArticleManager.php --- php/model/DatabaseArticleManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/model/DatabaseArticleManager.php b/php/model/DatabaseArticleManager.php index 8eb1fed..79f53ca 100644 --- a/php/model/DatabaseArticleManager.php +++ b/php/model/DatabaseArticleManager.php @@ -22,7 +22,7 @@ class DatabaseArticleManager implements ArticleManagerDAO { try { $user = 'root'; $pw = null; - $dsn = 'sqlite: ../../db/articles.db'; + $dsn = 'sqlite:../../db/articles.db'; $db = new PDO($dsn, $user, $pw); $db->exec(" @@ -51,7 +51,7 @@ class DatabaseArticleManager implements ArticleManagerDAO { try { $user = 'root'; $pw = null; - $dsn = 'sqlite: ../../db/gaestebuch.db'; + $dsn = 'sqlite:../../db/articles.db'; return new PDO($dsn, $user, $pw); } catch (PDOException $e) { throw new InternalServerErrorException($e->getMessage()); From f63b8c6506330285efd4050708e65c221ee501a5 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 10:43:07 +0200 Subject: [PATCH 03/18] DatabaseUserManager --- php/model/DatabaseUserManager.php | 26 ++++++++++++++++++++++++++ php/model/LocalUserManager.php | 4 ++++ php/model/UserManager.php | 11 +++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 php/model/DatabaseUserManager.php diff --git a/php/model/DatabaseUserManager.php b/php/model/DatabaseUserManager.php new file mode 100644 index 0000000..cd27d99 --- /dev/null +++ b/php/model/DatabaseUserManager.php @@ -0,0 +1,26 @@ + Date: Fri, 5 Jun 2026 10:45:25 +0200 Subject: [PATCH 04/18] Update ArticleManager.php --- php/model/ArticleManager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/php/model/ArticleManager.php b/php/model/ArticleManager.php index 8962aa3..488ad30 100644 --- a/php/model/ArticleManager.php +++ b/php/model/ArticleManager.php @@ -1,5 +1,6 @@ Date: Fri, 5 Jun 2026 10:45:50 +0200 Subject: [PATCH 05/18] Update ArticleManager.php --- php/model/ArticleManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/model/ArticleManager.php b/php/model/ArticleManager.php index 488ad30..55f4bb9 100644 --- a/php/model/ArticleManager.php +++ b/php/model/ArticleManager.php @@ -8,7 +8,7 @@ require_once 'Article.php'; * * @author Niklas Ortmann */ -class ArticleManager +class ArticleManager extends LocalArticleManager { public static function getInstance() { From a029314bc90a3ecede4784f9d45e6beb7193e129 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 10:46:21 +0200 Subject: [PATCH 06/18] Update ArticleManager.php --- php/model/ArticleManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/model/ArticleManager.php b/php/model/ArticleManager.php index 55f4bb9..915431e 100644 --- a/php/model/ArticleManager.php +++ b/php/model/ArticleManager.php @@ -1,6 +1,6 @@ Date: Fri, 5 Jun 2026 10:47:03 +0200 Subject: [PATCH 07/18] Umstellung auf DatabaseArticleManager --- php/model/ArticleManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/model/ArticleManager.php b/php/model/ArticleManager.php index 915431e..3beddd3 100644 --- a/php/model/ArticleManager.php +++ b/php/model/ArticleManager.php @@ -12,7 +12,7 @@ class ArticleManager { public static function getInstance() { - $articleManager = LocalArticleManager::getInstance(); // TODO: später durch DataBaseArticleManager ersetzen. + $articleManager = DatabaseArticleManager::getInstance(); // TODO: später durch DataBaseArticleManager ersetzen. // Erstellen von Dummy-Beiträgen: if($articleManager->getArticle(1) == null ){ From c662369259457e6c741218d7146d78883c14ea7f Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 10:58:39 +0200 Subject: [PATCH 08/18] Create .htaccess --- db/.htaccess | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 db/.htaccess diff --git a/db/.htaccess b/db/.htaccess new file mode 100644 index 0000000..437a11a --- /dev/null +++ b/db/.htaccess @@ -0,0 +1,3 @@ + + deny from all + \ No newline at end of file From e22d97e15a93dc31c82ecc8233c43b7a130689dc Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 11:09:36 +0200 Subject: [PATCH 09/18] Update ArticleManager.php --- php/model/ArticleManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/model/ArticleManager.php b/php/model/ArticleManager.php index 3beddd3..be9029f 100644 --- a/php/model/ArticleManager.php +++ b/php/model/ArticleManager.php @@ -5,7 +5,7 @@ require_once 'Article.php'; /** * Die Klasse beinhaltet alle Methoden für die Operation mit den Artikel-Daten. - * + * Test * @author Niklas Ortmann */ class ArticleManager From c798bbd230e8e865984717c4d281b5e95883d553 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 11:16:21 +0200 Subject: [PATCH 10/18] Update DatabaseArticleManager.php --- php/model/DatabaseArticleManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/model/DatabaseArticleManager.php b/php/model/DatabaseArticleManager.php index 79f53ca..739b622 100644 --- a/php/model/DatabaseArticleManager.php +++ b/php/model/DatabaseArticleManager.php @@ -18,11 +18,11 @@ class DatabaseArticleManager implements ArticleManagerDAO { */ public function __construct() { - if (!file_exists("../../db/articles.db")) { + if (!file_exists("/db/articles.db")) { try { $user = 'root'; $pw = null; - $dsn = 'sqlite:../../db/articles.db'; + $dsn = 'sqlite:/db/articles.db'; $db = new PDO($dsn, $user, $pw); $db->exec(" From 981e78ff7eca6727cf0574d6a15b756e41257de6 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 11:18:46 +0200 Subject: [PATCH 11/18] Update DatabaseArticleManager.php --- php/model/DatabaseArticleManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/model/DatabaseArticleManager.php b/php/model/DatabaseArticleManager.php index 739b622..04eddf7 100644 --- a/php/model/DatabaseArticleManager.php +++ b/php/model/DatabaseArticleManager.php @@ -18,11 +18,11 @@ class DatabaseArticleManager implements ArticleManagerDAO { */ public function __construct() { - if (!file_exists("/db/articles.db")) { + if (!file_exists(__DIR__ . '/../../db/articles.db')) { try { $user = 'root'; $pw = null; - $dsn = 'sqlite:/db/articles.db'; + $dsn = 'sqlite:' . __DIR__ . '/../../db/articles.db'; $db = new PDO($dsn, $user, $pw); $db->exec(" From 11da418f608cbdfcc98220f653a92d4989480d81 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 11:22:38 +0200 Subject: [PATCH 12/18] Update DatabaseArticleManager.php --- php/model/DatabaseArticleManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/model/DatabaseArticleManager.php b/php/model/DatabaseArticleManager.php index 04eddf7..72de769 100644 --- a/php/model/DatabaseArticleManager.php +++ b/php/model/DatabaseArticleManager.php @@ -51,7 +51,7 @@ class DatabaseArticleManager implements ArticleManagerDAO { try { $user = 'root'; $pw = null; - $dsn = 'sqlite:../../db/articles.db'; + $dsn = 'sqlite:' . __DIR__ . '/../../db/articles.db'; return new PDO($dsn, $user, $pw); } catch (PDOException $e) { throw new InternalServerErrorException($e->getMessage()); From d42dff116543fbee274101d6b0eb80aba1ca0362 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 11:27:43 +0200 Subject: [PATCH 13/18] =?UTF-8?q?deleteArticle=20->=20Autorisierungspr?= =?UTF-8?q?=C3=BCfung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php/model/ArticleManagerDAO.php | 6 +++--- php/model/DatabaseArticleManager.php | 13 +++++++++++-- php/model/LocalArticleManager.php | 13 +++++++++++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/php/model/ArticleManagerDAO.php b/php/model/ArticleManagerDAO.php index 01826e1..fe7af03 100644 --- a/php/model/ArticleManagerDAO.php +++ b/php/model/ArticleManagerDAO.php @@ -40,15 +40,15 @@ interface ArticleManagerDAO public function updateArticle($id, $article, $author); /** - * Löscht einen Beitrag aus übergebener ID. - * TODO: sollte auch die Autorisierung prüfen... + * Löscht einen Beitrag aus übergebener ID und dem Nutzer, der die Löschung ausführt. * @param $id + * @param $author * @return void * @throws InternalServerErrorException * @throws NotFoundException * @throws UnauthorizedAccessException */ - public function deleteArticle($id); + public function deleteArticle($id, $author); /** * Beitrag aufrufen. diff --git a/php/model/DatabaseArticleManager.php b/php/model/DatabaseArticleManager.php index 72de769..20c7484 100644 --- a/php/model/DatabaseArticleManager.php +++ b/php/model/DatabaseArticleManager.php @@ -147,9 +147,18 @@ class DatabaseArticleManager implements ArticleManagerDAO { } } - public function deleteArticle($id) + public function deleteArticle($id, $author) { - // TODO: Sollte auch die Autorisierung prüfen... + $article = getArticle($id); + if (empty($article)) { + throw new NotFoundException("not_found_article"); + } + + // Berechtigungsprüfung: + if ($article->getAuthor() !== $author) { + throw new UnauthorizedAccessException("unauthorized_access"); + } + try { $db = $this->getConnection(); $sql = "DELETE FROM articles WHERE id = :id;"; diff --git a/php/model/LocalArticleManager.php b/php/model/LocalArticleManager.php index 62879e9..aff23c1 100644 --- a/php/model/LocalArticleManager.php +++ b/php/model/LocalArticleManager.php @@ -102,9 +102,18 @@ class LocalArticleManager implements ArticleManagerDAO { } } - public function deleteArticle($id) + public function deleteArticle($id, $author) { - // TODO: Sollte auch die Autorisierung prüfen... + $article = getArticle($id); + if (empty($article)) { + throw new NotFoundException("not_found_article"); + } + + // Berechtigungsprüfung: + if ($article->getAuthor() !== $author) { + throw new UnauthorizedAccessException("unauthorized_access"); + } + $articles = $this->getAllArticles(); $articleFound = false; From 46dcc16c593143483798896bd0e5eb2730dc89ac Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 11:34:29 +0200 Subject: [PATCH 14/18] Update ArticleManager.php --- php/model/ArticleManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/model/ArticleManager.php b/php/model/ArticleManager.php index be9029f..5ce70da 100644 --- a/php/model/ArticleManager.php +++ b/php/model/ArticleManager.php @@ -5,14 +5,14 @@ require_once 'Article.php'; /** * Die Klasse beinhaltet alle Methoden für die Operation mit den Artikel-Daten. - * Test + * * @author Niklas Ortmann */ class ArticleManager { public static function getInstance() { - $articleManager = DatabaseArticleManager::getInstance(); // TODO: später durch DataBaseArticleManager ersetzen. + $articleManager = DatabaseArticleManager::getInstance(); // Hier kann zwischen dem lokalen und datenbankbasiertem ArticleManager gewechselt werden. // Erstellen von Dummy-Beiträgen: if($articleManager->getArticle(1) == null ){ From 11b55008eab80564f31c442d6340495bf5b7fddd Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 5 Jun 2026 11:35:49 +0200 Subject: [PATCH 15/18] Delete articles --- db/articles | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 db/articles diff --git a/db/articles b/db/articles deleted file mode 100644 index e69de29..0000000 From 5660f8d59db5386f60cc9685dba6d82483427d39 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 8 Jun 2026 11:15:42 +0200 Subject: [PATCH 16/18] .idea --- .idea/dataSources.local.xml | 18 ++++++++++++++++++ .idea/dataSources.xml | 12 ++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 .idea/dataSources.local.xml create mode 100644 .idea/dataSources.xml diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml new file mode 100644 index 0000000..cdc31de --- /dev/null +++ b/.idea/dataSources.local.xml @@ -0,0 +1,18 @@ + + + + + + " + + + master_key + no-auth + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..3f17fd0 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + sqlite.xerial + true + org.sqlite.JDBC + jdbc:sqlite:$PROJECT_DIR$/db/articles + $ProjectFileDir$ + + + \ No newline at end of file From 15f17b7af4b596c029d61d5f78684aae45f596a5 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Tue, 9 Jun 2026 15:29:53 +0200 Subject: [PATCH 17/18] .idea --- .../a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml | 1833 ----------------- .../storage_v2/_src_/schema/main.uQUzAA.meta | 2 - 2 files changed, 1835 deletions(-) delete mode 100644 .idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml delete mode 100644 .idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba/storage_v2/_src_/schema/main.uQUzAA.meta diff --git a/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml b/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml deleted file mode 100644 index 9fc8217..0000000 --- a/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba.xml +++ /dev/null @@ -1,1833 +0,0 @@ - - - - - 3.51.1 - - - - - - - - - - - - - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - - window - - - 1 - - - 1 - - - 1 - - - - 1 - 1 - - - - - 1 - 1 - - - 1 - 1 - - - 1 - 1 - - - 1 - - - 1 - - - - - window - - - window - - - window - - - - - - 1 - 1 - - - 1 - 1 - - - 1 - - - window - - - - 1 - - - window - - - 1 - - - 1 - 1 - - - - - - 1 - - - - - 1 - - - 1 - - - window - - - window - - - 1 - - - 1 - - - 1 - 1 - - - 1 - - - 1 - 1 - - - 1 - - - 1 - - - 1 - 1 - - - 1 - - - 1 - - - 1 - - - 1 - 1 - - - 1 - window - - - 1 - window - - - 1 - 1 - - - 1 - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - 1 - - - 1 - 1 - - - 1 - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - 1 - - - 1 - 1 - - - 1 - window - - - 1 - window - - - 1 - 1 - - - 1 - 1 - - - 1 - - - 1 - 1 - - - 1 - 1 - - - 1 - 1 - - - 1 - 1 - - - window - - - window - - - window - - - - window - - - window - - - window - - - window - - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - aggregate - - - 1 - - - 1 - - - - - - 1 - 1 - - - window - - - aggregate - - - 1 - 1 - - - window - - - 1 - - - aggregate - - - window - - - window - - - 1 - - - 1 - - - - - - - - window - - - 1 - - - 1 - - - 1 - - - 1 - 1 - - - - 1 - - - 1 - - - - - window - - - 1 - - - 1 - - - - - - 1 - - - 1 - - - window - - - 1 - - - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - - - 1 - - - - aggregate - - - - 1 - 1 - - - window - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - window - - - 1 - - - 1 - - - 1 - 1 - - - 1 - - - window - - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - 1 - - - 1 - - - 1 - - - aggregate - - - aggregate - - - 1 - - - 1 - 2026-06-05.07:12:20 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - 1 - - - R - - - R - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - 3 - - - R - - - R - - - R - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - R - - - R - - - R - - - R - - - R - - - R - - - 1 - - - R - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - R - - - R - - - 1 - - - 2 - - - R - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - R - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - R - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - R - - - R - - - 1 - - - 2 - - - R - - - R - - - R - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - 3 - - - R - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - 3 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - 3 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - R - - - 1 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - R - - - R - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - R - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - R - - - R - - - 1 - - - 2 - - - 3 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - R - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - 3 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - 2 - - - 3 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - 2 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - R - - - 1 - - - 1 -
- - 1 - TEXT|0s - - - 2 - TEXT|0s - - - 3 - TEXT|0s - - - 4 - INT|0s - - - 5 - TEXT|0s - -
-
\ No newline at end of file diff --git a/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba/storage_v2/_src_/schema/main.uQUzAA.meta b/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba/storage_v2/_src_/schema/main.uQUzAA.meta deleted file mode 100644 index 8dab49c..0000000 --- a/.idea/dataSources/a0abcd0a-1d6f-40e4-88be-f442bcb431ba/storage_v2/_src_/schema/main.uQUzAA.meta +++ /dev/null @@ -1,2 +0,0 @@ -#n:main -! [0, 0, null, null, -2147483648, -2147483648] From 70f7e05fe1eeeb83eb1db8e8a70538aa3fba98ca Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Tue, 9 Jun 2026 15:30:05 +0200 Subject: [PATCH 18/18] Update DatabaseArticleManager.php --- php/model/DatabaseArticleManager.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/php/model/DatabaseArticleManager.php b/php/model/DatabaseArticleManager.php index 20c7484..1697071 100644 --- a/php/model/DatabaseArticleManager.php +++ b/php/model/DatabaseArticleManager.php @@ -20,10 +20,8 @@ class DatabaseArticleManager implements ArticleManagerDAO { { if (!file_exists(__DIR__ . '/../../db/articles.db')) { try { - $user = 'root'; - $pw = null; - $dsn = 'sqlite:' . __DIR__ . '/../../db/articles.db'; - $db = new PDO($dsn, $user, $pw); + + $db = $this->getConnection(); $db->exec(" CREATE TABLE articles (