From 2a5ff14cb52cd6c053748562dbbfbd55cf099eb3 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:09:45 +0200 Subject: [PATCH 001/102] =?UTF-8?q?profile.php=20mit=20Nutzerbeitr=C3=A4ge?= =?UTF-8?q?n=20+=20css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/profile.php | 86 +++++++++++++++++++++++----------- css/main.css | 10 ++++ css/profile.css | 111 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+), 27 deletions(-) create mode 100644 css/profile.css diff --git a/content/profile.php b/content/profile.php index 769b4fb..ed13d04 100644 --- a/content/profile.php +++ b/content/profile.php @@ -4,43 +4,75 @@ -->
+
-
-
+ +
+ + + - + + - + + - - + + - - + - - + + +
-
+ +
+

Meine Beiträge

+
- + +
+ +

Die Zukunft von CSS Grid

+ + Bearbeiten +
-

+ +
+ +

Produktiv im Homeoffice

+ + Bearbeiten +
- - - +
+
\ No newline at end of file diff --git a/css/main.css b/css/main.css index b0634b1..b448a22 100644 --- a/css/main.css +++ b/css/main.css @@ -212,3 +212,13 @@ a, button, input, select, textarea, label, main{ border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.1); } + +.form-container { + flex: 1 1 450px; + padding: 30px; + background-color: white; + border: 1px solid #dbe3ec; + border-radius: 10px; + box-shadow: 0 6px 20px rgba(0,0,0,0.1); + box-sizing: border-box; +} \ No newline at end of file diff --git a/css/profile.css b/css/profile.css new file mode 100644 index 0000000..9edc24a --- /dev/null +++ b/css/profile.css @@ -0,0 +1,111 @@ +/* Roter Button fuer Account loeschen */ +.form-container #articlesFromUser { + flex: 1 1 450px; + padding: 30px; + background-color: white; + border: 1px solid #dbe3ec; + border-radius: 10px; + box-shadow: 0 6px 20px rgba(0,0,0,0.1); + box-sizing: border-box; +} + +.profile-layout-container { + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 30px; + width: 100%; + align-items: flex-start; +} + +.delete-account-button { + background-color: #dc2626; + margin-bottom: 0; +} + +.delete-account-button:hover { + background-color: #b91c1c; +} + +/* Beitragsliste Styling */ +.section-title { + margin-top: 0; + margin-bottom: 25px; + font-size: 1.5rem; + color: #1f2937; + border-bottom: 2px solid #eef2f7; + padding-bottom: 10px; +} + +.articles-list { + display: flex; + flex-direction: column; + gap: 20px; +} + +.article-item { + padding: 15px; + border: 1px solid #e5e7eb; + border-radius: 8px; + background-color: #f9fafb; + position: relative; +} + +.article-meta { + display: flex; + justify-content: space-between; + font-size: 0.85rem; + color: #6b7280; + margin-bottom: 8px; +} + +.article-category { + font-weight: bold; + color: #2563eb; +} + +.article-title { + margin: 0 0 10px 0; + font-size: 1.2rem; + color: #1f2937; +} + +.article-tags { + display: flex; + flex-wrap: wrap; + gap: 6px; + margin-bottom: 15px; +} + +.tag { + font-size: 0.75rem; + background-color: #e5e7eb; + color: #374151; + padding: 3px 8px; + border-radius: 4px; +} + +/* Bearbeiten-Button als Link deklariert */ +.edit-link-button { + display: inline-block; + text-decoration: none; + font-size: 0.9rem; + font-weight: bold; + color: #2563eb; + border: 1px solid #2563eb; + padding: 6px 12px; + border-radius: 6px; + transition: background-color 0.2s, color 0.2s; +} + +.edit-link-button:hover { + background-color: #2563eb; + color: white; +} + +/* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ +@media (max-width: 760px) { + .profile-layout-container { + flex-direction: column; + } +} \ No newline at end of file From d4fa588c8fd5557cc6403f5b24a7d0bb3b24b219 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:11:40 +0200 Subject: [PATCH 002/102] refactoring --- content/profile.php | 2 +- css/profile.css | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/content/profile.php b/content/profile.php index ed13d04..aebcf00 100644 --- a/content/profile.php +++ b/content/profile.php @@ -39,7 +39,7 @@ -
+

Meine Beiträge

diff --git a/css/profile.css b/css/profile.css index 9edc24a..03d4fd4 100644 --- a/css/profile.css +++ b/css/profile.css @@ -1,4 +1,6 @@ -/* Roter Button fuer Account loeschen */ +/* +CSS für die Profilseite + */ .form-container #articlesFromUser { flex: 1 1 450px; padding: 30px; @@ -18,6 +20,7 @@ align-items: flex-start; } +/* Roter Button für Account löschen */ .delete-account-button { background-color: #dc2626; margin-bottom: 0; From d5fbfc950fa36dff67bdac80d3659b651fbe3918 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:12:47 +0200 Subject: [PATCH 003/102] Update profile.css --- css/profile.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/profile.css b/css/profile.css index 03d4fd4..2112875 100644 --- a/css/profile.css +++ b/css/profile.css @@ -1,7 +1,7 @@ /* CSS für die Profilseite */ -.form-container #articlesFromUser { +#articlesFromUser { flex: 1 1 450px; padding: 30px; background-color: white; From dd1194a1c736480635d84f65d3d51db0b2f7fdc5 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:13:29 +0200 Subject: [PATCH 004/102] Update index.php --- index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/index.php b/index.php index a333e59..6d24a57 100644 --- a/index.php +++ b/index.php @@ -25,6 +25,7 @@ require_once $abs_path . "/php/controller/index-controller.php"; + EduForge From 72023a66346707525a5a7af046b1a26173d8c7a9 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:14:28 +0200 Subject: [PATCH 005/102] testing --- content/profile.php | 2 +- css/profile.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/profile.php b/content/profile.php index aebcf00..8bdc2d3 100644 --- a/content/profile.php +++ b/content/profile.php @@ -39,7 +39,7 @@
-
+

Meine Beiträge

diff --git a/css/profile.css b/css/profile.css index 2112875..8a0bc2b 100644 --- a/css/profile.css +++ b/css/profile.css @@ -1,7 +1,7 @@ /* CSS für die Profilseite */ -#articlesFromUser { +.form-container { flex: 1 1 450px; padding: 30px; background-color: white; From 60302e02b6fba72a34471ed4baf879d1bcbb4a2a Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:15:15 +0200 Subject: [PATCH 006/102] Update profile.css --- css/profile.css | 1 + 1 file changed, 1 insertion(+) diff --git a/css/profile.css b/css/profile.css index 8a0bc2b..e4c0ec3 100644 --- a/css/profile.css +++ b/css/profile.css @@ -110,5 +110,6 @@ CSS für die Profilseite @media (max-width: 760px) { .profile-layout-container { flex-direction: column; + margin: 0 auto; /* Zentriert den gesamten Container horizontal */ } } \ No newline at end of file From 26889a8b599fe6a8905ed7f77814afd6516d91ef Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:17:14 +0200 Subject: [PATCH 007/102] Update profile.css --- css/profile.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/css/profile.css b/css/profile.css index e4c0ec3..aaf2c7d 100644 --- a/css/profile.css +++ b/css/profile.css @@ -110,6 +110,10 @@ CSS für die Profilseite @media (max-width: 760px) { .profile-layout-container { flex-direction: column; - margin: 0 auto; /* Zentriert den gesamten Container horizontal */ + align-items: center; + } + .form-container { + width: 100%; + max-width: 480px; } } \ No newline at end of file From 7b4abe32a7f9bc66797f7078095e8dd4f5e651d1 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:18:13 +0200 Subject: [PATCH 008/102] Update profile.css --- css/profile.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/css/profile.css b/css/profile.css index aaf2c7d..de66ace 100644 --- a/css/profile.css +++ b/css/profile.css @@ -110,10 +110,9 @@ CSS für die Profilseite @media (max-width: 760px) { .profile-layout-container { flex-direction: column; - align-items: center; } .form-container { + margin: 0 auto; /* Zentriert den gesamten Container horizontal */ width: 100%; - max-width: 480px; } } \ No newline at end of file From 838b13e39f274ef909951e351225faebfb53621c Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:19:51 +0200 Subject: [PATCH 009/102] css --- css/main.css | 7 +++++++ css/profile.css | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/css/main.css b/css/main.css index b448a22..884d24d 100644 --- a/css/main.css +++ b/css/main.css @@ -221,4 +221,11 @@ a, button, input, select, textarea, label, main{ border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.1); box-sizing: border-box; +} + +/* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ +@media (max-width: 760px) { + .form-page { + margin: 0 auto; /* Zentriert den gesamten Container horizontal */ + } } \ No newline at end of file diff --git a/css/profile.css b/css/profile.css index de66ace..8a0bc2b 100644 --- a/css/profile.css +++ b/css/profile.css @@ -111,8 +111,4 @@ CSS für die Profilseite .profile-layout-container { flex-direction: column; } - .form-container { - margin: 0 auto; /* Zentriert den gesamten Container horizontal */ - width: 100%; - } } \ No newline at end of file From f63a2be01a2f0b66d24f2ffb05ef3041f5e81339 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:21:54 +0200 Subject: [PATCH 010/102] Update main.css --- css/main.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/css/main.css b/css/main.css index 884d24d..c2762b1 100644 --- a/css/main.css +++ b/css/main.css @@ -226,6 +226,7 @@ a, button, input, select, textarea, label, main{ /* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ @media (max-width: 760px) { .form-page { - margin: 0 auto; /* Zentriert den gesamten Container horizontal */ + justify-content: center; + padding: 20px 10px; } } \ No newline at end of file From 483dd4182e1caec969742d5eb135c2539c8df0a0 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:23:09 +0200 Subject: [PATCH 011/102] css --- css/main.css | 4 ++++ css/profile.css | 3 +++ 2 files changed, 7 insertions(+) diff --git a/css/main.css b/css/main.css index c2762b1..5ad297c 100644 --- a/css/main.css +++ b/css/main.css @@ -229,4 +229,8 @@ a, button, input, select, textarea, label, main{ justify-content: center; padding: 20px 10px; } + .form-container { + width: 100%; + max-width: 500px; + } } \ No newline at end of file diff --git a/css/profile.css b/css/profile.css index 8a0bc2b..8bea840 100644 --- a/css/profile.css +++ b/css/profile.css @@ -110,5 +110,8 @@ CSS für die Profilseite @media (max-width: 760px) { .profile-layout-container { flex-direction: column; + align-items: center; + width: 100%; } + } \ No newline at end of file From d7c7ef1041db9edaa07650e2571b37e75d53bd5f Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:24:34 +0200 Subject: [PATCH 012/102] Update main.css --- css/main.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/css/main.css b/css/main.css index 5ad297c..a17d6fb 100644 --- a/css/main.css +++ b/css/main.css @@ -230,7 +230,8 @@ a, button, input, select, textarea, label, main{ padding: 20px 10px; } .form-container { + flex: 0 1 auto; width: 100%; - max-width: 500px; + max-width: 450px; } } \ No newline at end of file From 9db31d4b8cd8f891b5fcc73e4bc43ca263f7f0c4 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:25:51 +0200 Subject: [PATCH 013/102] testing --- css/main.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/css/main.css b/css/main.css index a17d6fb..571d0e1 100644 --- a/css/main.css +++ b/css/main.css @@ -226,12 +226,12 @@ a, button, input, select, textarea, label, main{ /* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ @media (max-width: 760px) { .form-page { - justify-content: center; - padding: 20px 10px; + justify-content: center !important; + padding: 20px 10px !important; } .form-container { - flex: 0 1 auto; - width: 100%; - max-width: 450px; + flex: 0 1 auto !important; + width: 100% !important; + max-width: 450px !important; } } \ No newline at end of file From 79efee0979031b45c8b3cc8e98d1b428b7873f58 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:29:38 +0200 Subject: [PATCH 014/102] css --- css/main.css | 10 +++++----- css/profile.css | 8 ++++++++ css/search-results.css | 6 +++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/css/main.css b/css/main.css index 571d0e1..a17d6fb 100644 --- a/css/main.css +++ b/css/main.css @@ -226,12 +226,12 @@ a, button, input, select, textarea, label, main{ /* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ @media (max-width: 760px) { .form-page { - justify-content: center !important; - padding: 20px 10px !important; + justify-content: center; + padding: 20px 10px; } .form-container { - flex: 0 1 auto !important; - width: 100% !important; - max-width: 450px !important; + flex: 0 1 auto; + width: 100%; + max-width: 450px; } } \ No newline at end of file diff --git a/css/profile.css b/css/profile.css index 8bea840..649c530 100644 --- a/css/profile.css +++ b/css/profile.css @@ -114,4 +114,12 @@ CSS für die Profilseite width: 100%; } + /* Überschreibt das flex-grow der main.css und erzwingt zentrieren: */ + .form-container { + flex: 0 1 auto !important; + width: 100% !important; + max-width: 450px !important; + margin: 0 auto 20px auto; /* zentrieren der Boxen */ + } + } \ No newline at end of file diff --git a/css/search-results.css b/css/search-results.css index f2fc36f..43649b7 100644 --- a/css/search-results.css +++ b/css/search-results.css @@ -69,12 +69,12 @@ CSS für die Suchergebnis-Seite .s-res-filter-option input[type="radio"] { margin: 0; - accent-color: #3182ce; /* Moderne Färbung des Radio-Buttons */ + accent-color: #3182ce; } /* --- HAUPTINHALT (ERGEBNISSE) --- */ .s-res-main-content { - min-width: 0; /* Verhindert das Ausbrechen von Flex-Elementen */ + min-width: 0; } .s-res-header { @@ -164,7 +164,7 @@ CSS für die Suchergebnis-Seite transform: translateX(3px); } -/* --- ERGEBNISSE PRO SEITE & PAGINIERUNG --- */ +/* ERGEBNISSE PRO SEITE & PAGINIERUNG */ .s-res-pagination-footer { display: flex; justify-content: space-between; From 2ded6300ab97a55ebfcc498e2e1efff7addc5c27 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:31:47 +0200 Subject: [PATCH 015/102] Update profile.css --- css/profile.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/profile.css b/css/profile.css index 649c530..92bc505 100644 --- a/css/profile.css +++ b/css/profile.css @@ -119,7 +119,7 @@ CSS für die Profilseite flex: 0 1 auto !important; width: 100% !important; max-width: 450px !important; - margin: 0 auto 20px auto; /* zentrieren der Boxen */ + margin: 0 auto !important; /* Zentriert den gesamten Container horizontal */ } } \ No newline at end of file From 98683197e0fe64a062db125720873e7961266bb9 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:33:00 +0200 Subject: [PATCH 016/102] Update profile.css --- css/profile.css | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/css/profile.css b/css/profile.css index 92bc505..042df70 100644 --- a/css/profile.css +++ b/css/profile.css @@ -109,17 +109,21 @@ CSS für die Profilseite /* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ @media (max-width: 760px) { .profile-layout-container { - flex-direction: column; - align-items: center; - width: 100%; + flex-direction: column !important; + align-items: center !important; + justify-content: center !important; + width: 100% !important; + margin: 0 auto !important; } - /* Überschreibt das flex-grow der main.css und erzwingt zentrieren: */ + /* Erzwingt das Zentrieren der Boxen */ .form-container { flex: 0 1 auto !important; width: 100% !important; max-width: 450px !important; - margin: 0 auto !important; /* Zentriert den gesamten Container horizontal */ + margin-left: auto !important; /* Box von links in die Mitte */ + margin-right: auto !important; /* Box von rechts in die Mitte */ + margin-bottom: 20px !important;/* Abstand zwischen beiden Boxen */ } } \ No newline at end of file From bd3d81e80c9476195215399885c91ae2a2d0c2f4 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:35:01 +0200 Subject: [PATCH 017/102] css --- css/profile.css | 10 +++++++++- css/search-results.css | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/css/profile.css b/css/profile.css index 042df70..abaa648 100644 --- a/css/profile.css +++ b/css/profile.css @@ -106,8 +106,16 @@ CSS für die Profilseite color: white; } -/* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ +/* Responsive Anpassungen unter 760px (für z.B. Smartphones) */ @media (max-width: 760px) { + .form-page { + display: flex !important; + flex-direction: column !important; + align-items: center !important;/* Block in die Mitte */ + justify-content: center !important; + padding: 20px 10px !important; + } + .profile-layout-container { flex-direction: column !important; align-items: center !important; diff --git a/css/search-results.css b/css/search-results.css index 43649b7..4fc5d97 100644 --- a/css/search-results.css +++ b/css/search-results.css @@ -247,7 +247,7 @@ CSS für die Suchergebnis-Seite cursor: not-allowed; } -/* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ +/* Responsive Anpassungen unter 760px (für z.B. Smartphones) */ @media (max-width: 768px) { .s-res-layout-grid { grid-template-columns: 1fr; /* Stapelt Seitenleiste und Inhalt untereinander */ From 4d886051921c8b543a8b593054ce8b5b8689e35c Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:35:50 +0200 Subject: [PATCH 018/102] Update profile.css --- css/profile.css | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/css/profile.css b/css/profile.css index abaa648..f23a2f2 100644 --- a/css/profile.css +++ b/css/profile.css @@ -117,11 +117,10 @@ CSS für die Profilseite } .profile-layout-container { + display: flex !important; flex-direction: column !important; - align-items: center !important; - justify-content: center !important; + align-items: center !important; /* Zentriert weiße Boxen untereinander */ width: 100% !important; - margin: 0 auto !important; } /* Erzwingt das Zentrieren der Boxen */ @@ -129,9 +128,8 @@ CSS für die Profilseite flex: 0 1 auto !important; width: 100% !important; max-width: 450px !important; - margin-left: auto !important; /* Box von links in die Mitte */ - margin-right: auto !important; /* Box von rechts in die Mitte */ - margin-bottom: 20px !important;/* Abstand zwischen beiden Boxen */ + margin: 0 auto 20px auto !important; /* Zentriert die Boxen */ + box-sizing: border-box !important; } } \ No newline at end of file From 339e3025b8cc44f8f14502658b4893c8bd683308 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:36:38 +0200 Subject: [PATCH 019/102] debugging --- content/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/profile.php b/content/profile.php index 8bdc2d3..0812135 100644 --- a/content/profile.php +++ b/content/profile.php @@ -4,7 +4,7 @@ -->
-
+
From 4a67932002e656a31c8ad9abfad085cb05ae0d40 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:37:01 +0200 Subject: [PATCH 020/102] debugging --- content/profile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/profile.php b/content/profile.php index 0812135..9dd4ed0 100644 --- a/content/profile.php +++ b/content/profile.php @@ -3,8 +3,8 @@ Inhalt: Das eigene Profil, wenn man angemeldet ist. Dort hat man die Möglichkeit seine Angaben zu ändern. --> -
-
+
+
From 2c0d52a3d502ea12ed73df982fd97a598782f4c8 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:38:57 +0200 Subject: [PATCH 021/102] Update main.css --- css/main.css | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/css/main.css b/css/main.css index a17d6fb..6bc2df1 100644 --- a/css/main.css +++ b/css/main.css @@ -226,12 +226,6 @@ a, button, input, select, textarea, label, main{ /* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ @media (max-width: 760px) { .form-page { - justify-content: center; - padding: 20px 10px; - } - .form-container { - flex: 0 1 auto; - width: 100%; - max-width: 450px; + place-content: center; } } \ No newline at end of file From 00f9f9cd91c74f4eb64f0d305f2f553f22db9321 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:39:32 +0200 Subject: [PATCH 022/102] Update main.css --- css/main.css | 7 ------- 1 file changed, 7 deletions(-) diff --git a/css/main.css b/css/main.css index 6bc2df1..b448a22 100644 --- a/css/main.css +++ b/css/main.css @@ -221,11 +221,4 @@ a, button, input, select, textarea, label, main{ border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.1); box-sizing: border-box; -} - -/* --- RESPONSIVE DESIGN (MOBILGERÄTE) --- */ -@media (max-width: 760px) { - .form-page { - place-content: center; - } } \ No newline at end of file From b93692c1603b623b2e9c692c429c7f31750fe6c8 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:42:55 +0200 Subject: [PATCH 023/102] css --- content/profile.php | 4 ++-- css/profile.css | 23 ----------------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/content/profile.php b/content/profile.php index 9dd4ed0..2c8b151 100644 --- a/content/profile.php +++ b/content/profile.php @@ -4,10 +4,10 @@ -->
-
+
-
+
Date: Fri, 29 May 2026 15:43:31 +0200 Subject: [PATCH 024/102] Update profile.php --- content/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/profile.php b/content/profile.php index 2c8b151..4fe72b2 100644 --- a/content/profile.php +++ b/content/profile.php @@ -39,7 +39,7 @@
-
+

Meine Beiträge

From 46eb99b534b411bb828b4a5f1f9c59f361990405 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:44:14 +0200 Subject: [PATCH 025/102] Update profile.php --- content/profile.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/profile.php b/content/profile.php index 4fe72b2..24925f3 100644 --- a/content/profile.php +++ b/content/profile.php @@ -3,9 +3,8 @@ Inhalt: Das eigene Profil, wenn man angemeldet ist. Dort hat man die Möglichkeit seine Angaben zu ändern. --> -
+
-
From 52a34cd9b4470b8f8dc99e995ddd3fe3dba8be2a Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 15:45:13 +0200 Subject: [PATCH 026/102] Update profile.css --- css/profile.css | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/css/profile.css b/css/profile.css index 07db827..dca1cef 100644 --- a/css/profile.css +++ b/css/profile.css @@ -1,24 +1,6 @@ /* CSS für die Profilseite */ -.form-container { - flex: 1 1 450px; - padding: 30px; - background-color: white; - border: 1px solid #dbe3ec; - border-radius: 10px; - box-shadow: 0 6px 20px rgba(0,0,0,0.1); - box-sizing: border-box; -} - -.profile-layout-container { - display: flex; - flex-direction: row; - flex-wrap: wrap; - gap: 30px; - width: 100%; - align-items: flex-start; -} /* Roter Button für Account löschen */ .delete-account-button { @@ -104,9 +86,4 @@ CSS für die Profilseite .edit-link-button:hover { background-color: #2563eb; color: white; -} - -/* Responsive Anpassungen unter 760px (für z.B. Smartphones) */ -@media (max-width: 760px) { - } \ No newline at end of file From 88c369de321c17ba0ce3126d904979bc54e7764e Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Fri, 29 May 2026 16:00:31 +0200 Subject: [PATCH 027/102] =?UTF-8?q?profile.php=20dynamisch=20Beitr=C3=A4ge?= =?UTF-8?q?=20anzeigen=20(unvollst=C3=A4ndig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/profile.php | 37 ++++++++++++++----- content/showArticle.php | 5 +-- php/controller/profileArticles-controller.php | 34 +++++++++++++++++ 3 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 php/controller/profileArticles-controller.php diff --git a/content/profile.php b/content/profile.php index 24925f3..a035aa5 100644 --- a/content/profile.php +++ b/content/profile.php @@ -2,7 +2,9 @@ Content: Profil Inhalt: Das eigene Profil, wenn man angemeldet ist. Dort hat man die Möglichkeit seine Angaben zu ändern. --> - +
@@ -42,18 +44,33 @@

Meine Beiträge

- +
-

Die Zukunft von CSS Grid

- - Bearbeiten +

+ +
+
Tags:
+
+ + + +
+
+ + class="edit-link-button">Bearbeiten
diff --git a/content/showArticle.php b/content/showArticle.php index b069b88..968c0b2 100644 --- a/content/showArticle.php +++ b/content/showArticle.php @@ -15,7 +15,6 @@ include_once 'php/controller/showArticle-controller.php'; -

@@ -28,7 +27,7 @@ include_once 'php/controller/showArticle-controller.php';
- +
@@ -36,7 +35,7 @@ include_once 'php/controller/showArticle-controller.php';
- +
Tags:
diff --git a/php/controller/profileArticles-controller.php b/php/controller/profileArticles-controller.php new file mode 100644 index 0000000..dd53dac --- /dev/null +++ b/php/controller/profileArticles-controller.php @@ -0,0 +1,34 @@ +getArticle($_GET["id"]); + if($article != null){ + $title = $article->getTitle(); + $content = $article->getContent(); + $category = $article->getCategory(); + $author = $article->getAuthor(); + $tags = $article->getTags(); + $creationDate = $article->getCreationDate(); + }else{ + $_SESSION["message"] = "article_not_found"; + echo "article_not_found"; + } + } catch (Exception $e){ + $_SESSION["message"] = "internal_error"; + echo "Fehler aufgetreten: " . $e->getMessage(); + } +}else{ + $_SESSION["message"] = "article_not_found"; + echo "article_not_found"; +} + +?> \ No newline at end of file From ff23e6c9a2dab43b98ebe1bcc9cc39aae765d19d Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:00:32 +0200 Subject: [PATCH 028/102] profileArticle-controller.php Implementierung --- content/profile.php | 6 +++- php/controller/profileArticles-controller.php | 29 +++++-------------- php/controller/showArticle-controller.php | 1 - php/model/ArticleManagerDAO.php | 6 ++++ 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/content/profile.php b/content/profile.php index a035aa5..9c4b06e 100644 --- a/content/profile.php +++ b/content/profile.php @@ -43,7 +43,11 @@ include_once 'php/controller/profileArticles-controller.php';

Meine Beiträge

- + +

+ Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut. +

+ 0): ?>
From 43bd452a3063d37e952d909c97db9ab4489fe9b7 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:26:46 +0200 Subject: [PATCH 032/102] Update profile.php --- content/profile.php | 69 ++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/content/profile.php b/content/profile.php index b9fe4e5..5c3eb60 100644 --- a/content/profile.php +++ b/content/profile.php @@ -47,39 +47,44 @@ include_once 'php/controller/profileArticles-controller.php';

Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut.

- 0): ?> - -
- -

getTitle()); ?>

- getTags(); - if (isset($tags) && !empty($tags)): ?> -
-
Tags:
-
- - - -
-
- - Bearbeiten -
+ 0): ?> + + +
+ +

getTitle()); ?>

+ + getTags(); + if (isset($tags) && !empty($tags)): ?> +
+
Tags:
+
+ + + +
+
+ + Bearbeiten +
+ + + +

Noch keine Beiträge vorhanden.

+
From 2998a7bf22bca98189c18cf117e89209f4b14692 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:28:38 +0200 Subject: [PATCH 033/102] testing --- php/controller/profileArticles-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/profileArticles-controller.php b/php/controller/profileArticles-controller.php index 11e49d3..02b46fd 100644 --- a/php/controller/profileArticles-controller.php +++ b/php/controller/profileArticles-controller.php @@ -8,7 +8,7 @@ require_once 'php/model/Article.php'; require_once 'php/model/ArticleManager.php'; try { - $author = "max.mustermann"; // TODO: später Nutzer aus der Session beziehen. + $author = "max.mustermann1"; // TODO: später Nutzer aus der Session beziehen. $articleManager = ArticleManager::getInstance(); $userArticles = $articleManager->getArticlesByAuthor($author); if(!isset($userArticles)) { From d3c190096ac9763c12bce25723327141f245b966 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:30:09 +0200 Subject: [PATCH 034/102] Update profile.php --- content/profile.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/profile.php b/content/profile.php index 5c3eb60..5740249 100644 --- a/content/profile.php +++ b/content/profile.php @@ -83,7 +83,8 @@ include_once 'php/controller/profileArticles-controller.php'; -

Noch keine Beiträge vorhanden.

+

Du hast noch keine Beiträge erstellt.

+ Beitrag erstellen
From 2d03b1f05111f47ac3f2c9dc5b4b0f555b2c53a8 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:31:00 +0200 Subject: [PATCH 035/102] Update profile.php --- content/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/profile.php b/content/profile.php index 5740249..ab174e4 100644 --- a/content/profile.php +++ b/content/profile.php @@ -84,7 +84,7 @@ include_once 'php/controller/profileArticles-controller.php';

Du hast noch keine Beiträge erstellt.

- Beitrag erstellen +
From 53b593b3804a00c4862b062119f67bb9abfd7f6d Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:32:51 +0200 Subject: [PATCH 036/102] Update profile.php --- content/profile.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/profile.php b/content/profile.php index ab174e4..a925748 100644 --- a/content/profile.php +++ b/content/profile.php @@ -84,7 +84,9 @@ include_once 'php/controller/profileArticles-controller.php';

Du hast noch keine Beiträge erstellt.

- +
+ Beitrag erstellen +
From 497ce5bdb4e661cda1180cd474bb02e4f0d9187a Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:33:45 +0200 Subject: [PATCH 037/102] Update profile.php --- content/profile.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/profile.php b/content/profile.php index a925748..86df055 100644 --- a/content/profile.php +++ b/content/profile.php @@ -84,9 +84,7 @@ include_once 'php/controller/profileArticles-controller.php';

Du hast noch keine Beiträge erstellt.

-
- Beitrag erstellen -
+ Beitrag erstellen
From fec3cbb550d375707b8cfd04b199c298888452a4 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:36:46 +0200 Subject: [PATCH 038/102] Update profile.php --- content/profile.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/profile.php b/content/profile.php index 86df055..3d75472 100644 --- a/content/profile.php +++ b/content/profile.php @@ -84,7 +84,9 @@ include_once 'php/controller/profileArticles-controller.php';

Du hast noch keine Beiträge erstellt.

- Beitrag erstellen +
From 4a7bfa95677acb02b8925f064b045ca25c8bcdd8 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:37:48 +0200 Subject: [PATCH 039/102] Update profileArticles-controller.php --- php/controller/profileArticles-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/profileArticles-controller.php b/php/controller/profileArticles-controller.php index 02b46fd..11e49d3 100644 --- a/php/controller/profileArticles-controller.php +++ b/php/controller/profileArticles-controller.php @@ -8,7 +8,7 @@ require_once 'php/model/Article.php'; require_once 'php/model/ArticleManager.php'; try { - $author = "max.mustermann1"; // TODO: später Nutzer aus der Session beziehen. + $author = "max.mustermann"; // TODO: später Nutzer aus der Session beziehen. $articleManager = ArticleManager::getInstance(); $userArticles = $articleManager->getArticlesByAuthor($author); if(!isset($userArticles)) { From 317f4c0ce95b8291609639899aa998fb4b6953d4 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 18:13:06 +0200 Subject: [PATCH 040/102] ArticleManager fehlende Implementationen --- content/updateArticle.php | 86 +++++++++++++++++++++ php/controller/updateArticle-controller.php | 56 ++++++++++++++ php/model/ArticleManagerDAO.php | 29 ++++--- php/model/LocalArticleManager.php | 53 ++++++++++++- 4 files changed, 205 insertions(+), 19 deletions(-) create mode 100644 content/updateArticle.php create mode 100644 php/controller/updateArticle-controller.php diff --git a/content/updateArticle.php b/content/updateArticle.php new file mode 100644 index 0000000..600f2a5 --- /dev/null +++ b/content/updateArticle.php @@ -0,0 +1,86 @@ + + + + +
+ +

+ Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut. +

+ + +

+ Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen. +

+ + + +
+ + + + + diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php new file mode 100644 index 0000000..60c1180 --- /dev/null +++ b/php/controller/updateArticle-controller.php @@ -0,0 +1,56 @@ +getArticle($_GET["id"]); + if($article != null){ + $title = $article->getTitle(); + $content = $article->getContent(); + $category = $article->getCategory(); + $author = $article->getAuthor(); + $tags = $article->getTags(); + }else{ + $_SESSION["message"] = "article_not_found"; + echo "article_not_found"; + } + } catch (Exception $e){ + $_SESSION["message"] = "internal_error"; + echo "Fehler aufgetreten: " . $e->getMessage(); + } +}else{ + $_SESSION["message"] = "article_not_found"; +} + +// Wenn "speichern" gedrückt wurde: +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"); + } 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->updateArticle($title, $content, $author, $category, $tags); + } catch (Exception $e){ + $_SESSION["message"] = "internal_error"; + } + $_SESSION["message"] = "new_article"; + // Weiterleitung zur Homepage + header("location: ../../index.php"); + exit(); + + } +} + +?> \ No newline at end of file diff --git a/php/model/ArticleManagerDAO.php b/php/model/ArticleManagerDAO.php index 99b93f8..ac5dc42 100644 --- a/php/model/ArticleManagerDAO.php +++ b/php/model/ArticleManagerDAO.php @@ -21,26 +21,23 @@ interface ArticleManagerDAO public function addArticle($title, $content, $author, $category, $tags); /** - * Ein angemeldeter Nutzer bearbeitet einen Beitrag. - * $id ID des Beitrags - * $title Titel des Beitrags - * $content Der Inhalt des Beitrags - * $author dem Author des des Beitrags (NID oder email) + * Ändert den gespeicherten Beitrag eines übergebenen Beitrags und eines Autors. + * Es wird geprüft, ob der zu änderne Beitrag existiert und ob der übergebene Autor der Autor des originalen + * Beitrages ist. + * @param $article + * @param $author + * @return void * - * Mögliche Exceptions: - * TODO Fehlerbeschreibung hinzufügen + * TODO: Fehlerbeschreibung hinzufügen */ - public function updateArticle($id, $title, $content, $author); + public function updateArticle($article, $author); - /* - * Ein angemeldeter Nutzer löscht einen seiner Beiträge. - * $id ID des Beitrags - * $title Titel des Beitrags - * $content Der Inhalt des Beitrags - * $author dem Author des des Beitrags (NID oder email) + /** + * Löscht einen Beitrag aus übergebener ID. + * @param $id + * @return void * - * Mögliche Exceptions: - * TODO Fehlerbeschreibung hinzufügen + * TODO: Fehlerbeschreibung hinzufügen */ public function deleteArticle($id); diff --git a/php/model/LocalArticleManager.php b/php/model/LocalArticleManager.php index f686127..4e72b0a 100644 --- a/php/model/LocalArticleManager.php +++ b/php/model/LocalArticleManager.php @@ -62,14 +62,61 @@ class LocalArticleManager implements ArticleManagerDAO { $this->saveArticle($articles); } - public function updateArticle($id, $title, $content, $author) + public function updateArticle($article, $author) { - // TODO: Implement updateArticle() method. + if (empty($article)) { + return; + } + + // Berechtigungsprüfung: + if ($article->getAuthor() !== $author) { + // TODO: Implement Exception (z.B. throw new Exception("Nicht autorisiert")); + return; + } + + $articles = $this->getAllArticles(); + $updated = false; + + // Beitrag aktualisieren: + foreach ($articles as $index => $storedArticle) { + if (isset($storedArticle['id']) && $storedArticle['id'] == $article->getId()) { + $articles[$index] = [ + "id" => $article->getId(), + "title" => $article->getTitle(), + "content" => $article->getContent(), + "author" => $article->getAuthor(), + "category" => $article->getCategory(), + "tags" => $article->getTags(), + "creationDate" => $article->getCreationDate() // Behält das originale Erstelldatum bei + ]; + $updated = true; + break; + } + } + + // Nur speichern, wenn Beitrag geändert wurde: + if ($updated) { + $this->saveArticle($articles); + } } public function deleteArticle($id) { - // TODO: Implement deleteArticle() method. + $articles = $this->getAllArticles(); + $articleFound = false; + + foreach ($articles as $index => $article) { + if (isset($article['id']) && $article['id'] == $id) { + unset($articles[$index]); + $articleFound = true; + break; // Schleife abbrechen, da die ID eindeutig ist + } + } + + if ($articleFound) { + // array_values stellt sicher, dass die Array-Keys wieder fortlaufend bei 0 beginnen + $this->saveArticle(array_values($articles)); + } } public function getArticle($id) From 75d2f17a3f573f501b59ae19d1a9174a923fde1f Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 18:18:26 +0200 Subject: [PATCH 041/102] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 60c1180..93e303b 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -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"; } From f1986bc3f7d3d1b8f830d3b1cd41f8375557b613 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 18:18:31 +0200 Subject: [PATCH 042/102] Update LocalArticleManager.php --- php/model/LocalArticleManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/model/LocalArticleManager.php b/php/model/LocalArticleManager.php index 4e72b0a..5f18c32 100644 --- a/php/model/LocalArticleManager.php +++ b/php/model/LocalArticleManager.php @@ -93,7 +93,7 @@ class LocalArticleManager implements ArticleManagerDAO { break; } } - + // Nur speichern, wenn Beitrag geändert wurde: if ($updated) { $this->saveArticle($articles); From 7a3043f6444bb06ea8dd22521a01a748f0c88117 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 18:20:27 +0200 Subject: [PATCH 043/102] Update profile.php --- content/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/profile.php b/content/profile.php index 3d75472..ec059fd 100644 --- a/content/profile.php +++ b/content/profile.php @@ -78,7 +78,7 @@ include_once 'php/controller/profileArticles-controller.php';
- Bearbeiten + Bearbeiten
From 222759a1bc7920bfec10fbad307db4c286d75780 Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 18:21:46 +0200 Subject: [PATCH 044/102] Update updateArticle.php --- content/updateArticle.php | 1 + 1 file changed, 1 insertion(+) diff --git a/content/updateArticle.php b/content/updateArticle.php index 600f2a5..750437e 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -1,5 +1,6 @@ -
+
From 2cd68873de0736094b769f7bd78014369c48c43d Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:50:11 +0100 Subject: [PATCH 054/102] Update updateArticle.php --- content/updateArticle.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/content/updateArticle.php b/content/updateArticle.php index 8be7919..f6b048e 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -5,14 +5,20 @@ include_once 'php/controller/showArticle-controller.php'; Seite: Beitrag erstellen Inhalt: Formular für die Erstellung eines neuen Beitrags --> - +
- +

Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut.

+ +

+ Es ist ein Fehler aufgetreten. Die ID konnte nicht ausgelesen werden. Bitte versuche es erneut. +

+ +

Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen. From 2a3e73d409ba7258bedb27af311a9af0e0a2d3c3 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:11:11 +0200 Subject: [PATCH 055/102] updateArticle --- php/controller/updateArticle-controller.php | 7 ++++- php/model/Article.php | 32 ++++++++++++++------- php/model/LocalArticleManager.php | 12 +++++--- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 2ffb8b0..d2bcff3 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -23,7 +23,12 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { try { $articleManager = ArticleManager::getInstance(); // TODO: Später aus Session den Nutzer auslesen und Autorenrechte prüfen! - $articleManager->updateArticle(new Article($newTitle, $newContent, $newCategory, $author, $newTags), $author); + $article = $articleManager->getArticle($id); + $article->setTitle($newTitle); + $article->setContent($newContent); + $article->setCategory($newCategory); + $article->setTags($newTags); + $articleManager->updateArticle($id ,$article, $author); } catch (Exception $e){ $_SESSION["message"] = "internal_error"; } diff --git a/php/model/Article.php b/php/model/Article.php index ebb370e..9ffd701 100644 --- a/php/model/Article.php +++ b/php/model/Article.php @@ -1,7 +1,7 @@ category = $category; + } + + /** + * Gibt die Schlagworte eines Beitrags zurück. * @return string */ public function getTags(): string @@ -123,7 +133,7 @@ class Article } /** - * Setzt die Schlagworte eines Artikels. + * Setzt die Schlagworte eines Beitrags. * @param string $tags */ public function setTags(string $tags) diff --git a/php/model/LocalArticleManager.php b/php/model/LocalArticleManager.php index ed37994..7e795f0 100644 --- a/php/model/LocalArticleManager.php +++ b/php/model/LocalArticleManager.php @@ -65,32 +65,36 @@ class LocalArticleManager implements ArticleManagerDAO { public function updateArticle($id, $article, $author) { if (empty($article)) { + // TODO: Implement Exception. return; } // Berechtigungsprüfung: if ($article->getAuthor() !== $author) { - // TODO: Implement Exception (z.B. throw new Exception("Nicht autorisiert")); + // TODO: Implement Exception. return; } + // Beitrag aktualisieren: $articles = $this->getAllArticles(); $updated = false; - // Beitrag aktualisieren: foreach ($articles as $index => $storedArticle) { if (isset($storedArticle['id']) && $storedArticle['id'] == $id) { $articles[$index] = [ "id" => $id, "title" => $article->getTitle(), "content" => $article->getContent(), - "author" => $article->getAuthor(), + "author" => $author, "category" => $article->getCategory(), "tags" => $article->getTags(), - "creationDate" => $article->getCreationDate() // Behält das originale Erstelldatum bei + "creationDate" => $article->getCreationDate() ]; $updated = true; break; + }else{ + // TODO: Implement Exception. + return; } } From 6634bee77b2bb006d664092292962080fe34e61c Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:16:58 +0200 Subject: [PATCH 056/102] Update home.php --- content/home.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/home.php b/content/home.php index 58e0993..ace9e78 100644 --- a/content/home.php +++ b/content/home.php @@ -17,6 +17,11 @@ include_once 'php/controller/home-controller.php'; Dein Beitrag wurde erfolgreich veröffentlicht!

+ +

+ Dein Beitrag wurde erfolgreich bearbeitet! +

+ From 5b718f24eda77cb916205b7f3bfc960b4e022302 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:17:00 +0200 Subject: [PATCH 057/102] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index d2bcff3..f1b7a45 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -32,7 +32,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { } catch (Exception $e){ $_SESSION["message"] = "internal_error"; } - $_SESSION["message"] = "new_article"; + $_SESSION["message"] = "article_updated"; // Weiterleitung zur Homepage header("location: ../../index.php"); exit(); From d8c350c20f5435f5c7bc4fb9c73086d82094cec5 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:19:28 +0200 Subject: [PATCH 058/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 1 - 1 file changed, 1 deletion(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 5eaf999..79b5e9e 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -16,7 +16,6 @@ if (isset($_GET["id"])){ $tags = $article->getTags(); }else{ $_SESSION["message"] = "article_not_found"; - echo "article_not_found"; } } catch (Exception $e){ $_SESSION["message"] = "internal_error"; From 560f53cfb6f19a1ff0b370eac9efb1595c852d01 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:24:51 +0200 Subject: [PATCH 059/102] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index f1b7a45..19d2c2a 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -5,14 +5,17 @@ require_once '../model/ArticleManager.php'; require_once '../model/Article.php'; if ($_SERVER["REQUEST_METHOD"] === "POST") { - if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){ + try { + $id = $_GET["id"]; + } catch (Exception $e){ + $_SESSION["message"] = "missing_id"; + } + if (!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){ $_SESSION["message"] = "missing_parameters"; header("location: ../../index.php?pfad=updateArticle"); - exit(); } elseif(!isset($id)) { $_SESSION["message"] = "missing_id"; header("location: ../../index.php?pfad=updateArticle"); - exit(); }else{ $newTitle = $_POST["title"]; @@ -35,9 +38,9 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { $_SESSION["message"] = "article_updated"; // Weiterleitung zur Homepage header("location: ../../index.php"); - exit(); } + exit(); } ?> \ No newline at end of file From e575e3dfa87d3a32c83d57bf8f68ac49f919b481 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:25:22 +0200 Subject: [PATCH 060/102] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 19d2c2a..2f23258 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -15,7 +15,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { header("location: ../../index.php?pfad=updateArticle"); } elseif(!isset($id)) { $_SESSION["message"] = "missing_id"; - header("location: ../../index.php?pfad=updateArticle"); + //header("location: ../../index.php?pfad=updateArticle"); }else{ $newTitle = $_POST["title"]; From c1ddbfdf48b783345a76e25386c35d7810d68e1b Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:28:29 +0200 Subject: [PATCH 061/102] Update updateArticle.php --- content/updateArticle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/updateArticle.php b/content/updateArticle.php index f6b048e..a82436a 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -5,7 +5,7 @@ include_once 'php/controller/showArticle-controller.php'; Seite: Beitrag erstellen Inhalt: Formular für die Erstellung eines neuen Beitrags --> - +" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container">
From 365f70af98a3cc43fc2eda8a404e46b403f1da68 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:29:06 +0200 Subject: [PATCH 062/102] Update updateArticle.php --- content/updateArticle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/updateArticle.php b/content/updateArticle.php index a82436a..fb99314 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -5,7 +5,7 @@ include_once 'php/controller/showArticle-controller.php'; Seite: Beitrag erstellen Inhalt: Formular für die Erstellung eines neuen Beitrags --> -" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container"> +" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container">
From f96415bfe69186bc5abf38910f0ab32c4662d5e7 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:36:23 +0200 Subject: [PATCH 063/102] Update showArticle.php --- content/showArticle.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/content/showArticle.php b/content/showArticle.php index 968c0b2..796d207 100644 --- a/content/showArticle.php +++ b/content/showArticle.php @@ -9,6 +9,23 @@ include_once 'php/controller/showArticle-controller.php';
+ +

+ Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut. +

+ + +

+ Es ist ein Fehler aufgetreten. Die ID konnte nicht ausgelesen werden. Bitte versuche es erneut. +

+ + + +

+ Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen. +

+ +
From 3cb63f791adbd50d8d07603d2226cafa37b3fdb1 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:36:28 +0200 Subject: [PATCH 064/102] Update updateArticle.php --- content/updateArticle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/updateArticle.php b/content/updateArticle.php index fb99314..464a3e3 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -5,7 +5,7 @@ include_once 'php/controller/showArticle-controller.php'; Seite: Beitrag erstellen Inhalt: Formular für die Erstellung eines neuen Beitrags --> -" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container"> +" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container">
From e86fef17661ab074deeb6a269dde43d0667d39ec Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:36:31 +0200 Subject: [PATCH 065/102] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 2f23258..fa5e232 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -37,7 +37,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { } $_SESSION["message"] = "article_updated"; // Weiterleitung zur Homepage - header("location: ../../index.php"); + header("location: ../../index.php?pfad=showArticle&id=$id"); } exit(); From 71a8dd5f1796d21a46290b2371821f52baf709de Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 09:41:34 +0200 Subject: [PATCH 066/102] updateArticle funktioniert --- content/createArticle.php | 5 ++++- content/home.php | 5 ----- content/profile.php | 8 ++++---- content/showArticle.php | 10 +++++++++- content/updateArticle.php | 6 ++++-- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/content/createArticle.php b/content/createArticle.php index 8fa550d..381c85a 100644 --- a/content/createArticle.php +++ b/content/createArticle.php @@ -10,7 +10,7 @@ session_start();

- Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut. + Es ist ein interner Fehler beim Speichern aufgetreten. Bitte versuche es erneut.

@@ -18,6 +18,9 @@ session_start(); Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.

+
diff --git a/content/home.php b/content/home.php index ace9e78..58e0993 100644 --- a/content/home.php +++ b/content/home.php @@ -17,11 +17,6 @@ include_once 'php/controller/home-controller.php'; Dein Beitrag wurde erfolgreich veröffentlicht!

- -

- Dein Beitrag wurde erfolgreich bearbeitet! -

- diff --git a/content/profile.php b/content/profile.php index ec059fd..d7f5aa1 100644 --- a/content/profile.php +++ b/content/profile.php @@ -45,10 +45,9 @@ include_once 'php/controller/profileArticles-controller.php';

- Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut. + Es ist ein interner Fehler aufgetreten. Bitte versuche es erneut.

0): ?> -
@@ -57,7 +56,6 @@ include_once 'php/controller/profileArticles-controller.php';

getTitle()); ?>

- getTags(); if (isset($tags) && !empty($tags)): ?> @@ -81,13 +79,15 @@ include_once 'php/controller/profileArticles-controller.php'; Bearbeiten
-

Du hast noch keine Beiträge erstellt.

+
diff --git a/content/showArticle.php b/content/showArticle.php index 796d207..77125dd 100644 --- a/content/showArticle.php +++ b/content/showArticle.php @@ -11,7 +11,7 @@ include_once 'php/controller/showArticle-controller.php';

- Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut. + Es ist ein interner Fehler aufgetreten. Bitte versuche es erneut.

@@ -25,6 +25,14 @@ include_once 'php/controller/showArticle-controller.php'; Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.

+ +

+ Dein Beitrag wurde erfolgreich bearbeitet! +

+ +
diff --git a/content/updateArticle.php b/content/updateArticle.php index 464a3e3..06d345e 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -10,7 +10,7 @@ include_once 'php/controller/showArticle-controller.php';

- Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut. + Es ist ein interner Fehler beim Speichern aufgetreten. Bitte versuche es erneut.

@@ -18,12 +18,14 @@ include_once 'php/controller/showArticle-controller.php'; Es ist ein Fehler aufgetreten. Die ID konnte nicht ausgelesen werden. Bitte versuche es erneut.

-

Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.

+ + +
@@ -104,7 +108,9 @@ session_start(); diff --git a/php/controller/createArticle-controller.php b/php/controller/createArticle-controller.php index d0a5b6a..ad90d86 100644 --- a/php/controller/createArticle-controller.php +++ b/php/controller/createArticle-controller.php @@ -4,6 +4,10 @@ require_once '../model/LocalArticleManager.php'; require_once '../model/ArticleManager.php'; if ($_SERVER["REQUEST_METHOD"] === "POST") { + $_SESSION["old_title"] = $_POST["title"] ?? ''; + $_SESSION["old_content"] = $_POST["content"] ?? ''; + $_SESSION["old_category"] = $_POST["category"] ?? ''; + $_SESSION["old_tags"] = $_POST["tags"] ?? ''; if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){ $_SESSION["message"] = "missing_parameters"; header("location: ../../index.php?pfad=createArticle"); From 09795c30dd5e392b3fc77413c0d729f3d7dbc5cc Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 11:19:01 +0200 Subject: [PATCH 070/102] debugging --- php/controller/createArticle-controller.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/php/controller/createArticle-controller.php b/php/controller/createArticle-controller.php index ad90d86..9533580 100644 --- a/php/controller/createArticle-controller.php +++ b/php/controller/createArticle-controller.php @@ -16,6 +16,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { // ------------------------ Validierung des Authors: ---------------------------- $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. $validatedAuthor = $author; + echo "Autorvalidierung erfolgreich"; // --------------------- Eingabevalidierung des Titels: ------------------------- $title = $_POST["title"]; @@ -31,6 +32,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { if (!preg_match('/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u', $title)) { $errors['title'] = "Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht."; } + echo "Titelvalidierung erfolgreich"; // --------------------- Eingabeüberprüfung des Contents: ----------------------- $content = $_POST["content"]; @@ -42,6 +44,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { header("location: ../../index.php?pfad=createArticle"); exit(); } + echo "Contentvalidierung erfolgreich"; // --------------------- -Eingabevalidierung der Kategorie: -------------------- $category = $_POST["category"]; @@ -57,6 +60,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { header("location: ../../index.php?pfad=createArticle"); exit(); } + echo "Kategorievalidierung erfolgreich"; // -------------------------- Eingabevalidierung der tags: ---------------------- if (isset($_POST['tags'])) { @@ -89,6 +93,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { // Duplikate entfernen: $validatedTags = array_unique($validatedTags); $validatedTags = implode(',', $validatedTags); + echo "Tagvalidierung erfolgreich"; // ----------------- Übertragung der validierten Daten in ArticleManager: --------------------------- if (!isset($validatedTitle) || !isset($validatedContent) || !isset($validatedCategory) || !isset($validatedTags)) { @@ -97,6 +102,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { try { $articleManager = ArticleManager::getInstance(); $articleManager->addArticle($validatedTitle, $validatedContent, $validatedAuthor, $validatedCategory, $validatedTags); + echo "Speichern erfolgreich"; } catch (Exception $e){ $_SESSION["message"] = "internal_error"; header("location: ../../index.php?pfad=createArticle"); From 6aa1cd9a6304b6f0aea1c33ebedc1904744c008b Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 11:30:07 +0200 Subject: [PATCH 071/102] Update createArticle-controller.php --- php/controller/createArticle-controller.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/php/controller/createArticle-controller.php b/php/controller/createArticle-controller.php index 9533580..a4c0fa2 100644 --- a/php/controller/createArticle-controller.php +++ b/php/controller/createArticle-controller.php @@ -60,11 +60,12 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { header("location: ../../index.php?pfad=createArticle"); exit(); } + $validatedCategory = $category; echo "Kategorievalidierung erfolgreich"; // -------------------------- Eingabevalidierung der tags: ---------------------- if (isset($_POST['tags'])) { - $tags = trim($_POST['tags']); + $tags = $_POST['tags']; } else { $tags = ''; } @@ -96,8 +97,10 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { echo "Tagvalidierung erfolgreich"; // ----------------- Übertragung der validierten Daten in ArticleManager: --------------------------- - if (!isset($validatedTitle) || !isset($validatedContent) || !isset($validatedCategory) || !isset($validatedTags)) { + if (!isset($validatedTitle) || !isset($validatedContent) || !isset($validatedAuthor) || !isset($validatedCategory) || !isset($validatedTags)) { $_SESSION["message"] = "validation_missing"; + header("location: ../../index.php?pfad=createArticle"); + exit(); } else { try { $articleManager = ArticleManager::getInstance(); From d6249169c65ced736aaff6be9a45fc3e91d2f768 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 11:31:25 +0200 Subject: [PATCH 072/102] Update createArticle.php --- content/createArticle.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/createArticle.php b/content/createArticle.php index 7697780..9d2dadf 100644 --- a/content/createArticle.php +++ b/content/createArticle.php @@ -47,10 +47,10 @@ session_start(); unset($_SESSION["message"]); ?>
@@ -109,7 +109,7 @@ session_start(); From f12babf2b13bf9e0dba9291db615161ab7fd053b Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 11:35:25 +0200 Subject: [PATCH 073/102] Update createArticle.php --- content/createArticle.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/createArticle.php b/content/createArticle.php index 9d2dadf..c52fb80 100644 --- a/content/createArticle.php +++ b/content/createArticle.php @@ -47,10 +47,10 @@ session_start(); unset($_SESSION["message"]); ?>
@@ -109,7 +109,7 @@ session_start(); From 829a0e49d820ffc85823fc98aa145242668299e4 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 11:42:51 +0200 Subject: [PATCH 074/102] Content: zwischen 10 und 7000 Zeichen --- content/createArticle.php | 2 +- php/controller/createArticle-controller.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/createArticle.php b/content/createArticle.php index c52fb80..970186c 100644 --- a/content/createArticle.php +++ b/content/createArticle.php @@ -25,7 +25,7 @@ session_start();

- Der Text ist zu lang. Maximal 7.000 Zeichen erlaubt (ca. 1.000 Wörter). + Der Text erlaubt eine Länge von 10 bis maximal 7.000 Zeichen (ca. 1.000 Wörter).

diff --git a/php/controller/createArticle-controller.php b/php/controller/createArticle-controller.php index a4c0fa2..10916fb 100644 --- a/php/controller/createArticle-controller.php +++ b/php/controller/createArticle-controller.php @@ -13,7 +13,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { header("location: ../../index.php?pfad=createArticle"); exit(); } else { - // ------------------------ Validierung des Authors: ---------------------------- + // ------------------------ Validierung des Autors: ---------------------------- $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. $validatedAuthor = $author; echo "Autorvalidierung erfolgreich"; @@ -37,7 +37,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { // --------------------- Eingabeüberprüfung des Contents: ----------------------- $content = $_POST["content"]; $zeichenAnzahl = mb_strlen($content); - if ($zeichenAnzahl <= 7000) { + if ($zeichenAnzahl <= 7000 && $zeichenAnzahl > 10) { $validatedContent = $content; }else{ $_SESSION["message"] = "invalid_content"; From 754777d69e0dcf96c87f39b1b2d046029dd2b571 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 11:49:36 +0200 Subject: [PATCH 075/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 79b5e9e..38d69ee 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -15,12 +15,16 @@ if (isset($_GET["id"])){ $author = $article->getAuthor(); $tags = $article->getTags(); }else{ - $_SESSION["message"] = "article_not_found"; + header("location: ../../index.php?pfad=404"); + exit(); } } catch (Exception $e){ $_SESSION["message"] = "internal_error"; + header("location: ../../index.php?pfad=showArticle"); + exit(); } }else{ - $_SESSION["message"] = "article_not_found"; + header("location: ../../index.php?pfad=404"); + exit(); } ?> \ No newline at end of file From 603c208ae4fe40dedd7a910fb670316648e5c13a Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 11:50:59 +0200 Subject: [PATCH 076/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 38d69ee..f0ef716 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -24,7 +24,6 @@ if (isset($_GET["id"])){ exit(); } }else{ - header("location: ../../index.php?pfad=404"); - exit(); + $_SESSION["message"] = "missing_id"; } ?> \ No newline at end of file From 9f4ca058bdeb35e1820695fca3cfb0b18519ee02 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 11:52:16 +0200 Subject: [PATCH 077/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index f0ef716..c78bdbd 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -3,7 +3,7 @@ session_start(); require_once 'php/model/Article.php'; require_once 'php/model/ArticleManager.php'; -if (isset($_GET["id"])){ +if (isset($_GET["id"]) && !empty($_GET["id"])){ try { $id = $_GET["id"]; $articleManager = ArticleManager::getInstance(); From c5bfd02f09ed400dc860675e5417f34a56f46821 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:02:21 +0200 Subject: [PATCH 078/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index c78bdbd..b5ae40d 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -15,7 +15,7 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $author = $article->getAuthor(); $tags = $article->getTags(); }else{ - header("location: ../../index.php?pfad=404"); + header("location: ../index.php?pfad=404"); exit(); } } catch (Exception $e){ From 76beb8d62e9892c323237ca3fa1291e871d36428 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:02:40 +0200 Subject: [PATCH 079/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index b5ae40d..46936b8 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -15,7 +15,7 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $author = $article->getAuthor(); $tags = $article->getTags(); }else{ - header("location: ../index.php?pfad=404"); + header("location: index.php?pfad=404"); exit(); } } catch (Exception $e){ From ca337c4fac572fe8dc051eae1843aae9538b9ec4 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:03:22 +0200 Subject: [PATCH 080/102] debugging --- php/controller/showArticle-controller.php | 1 + 1 file changed, 1 insertion(+) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 46936b8..2e0e4ca 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -15,6 +15,7 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $author = $article->getAuthor(); $tags = $article->getTags(); }else{ + echo "Test"; header("location: index.php?pfad=404"); exit(); } From 21793dffd7496d61883f6565804c6e8cfa9b4658 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:03:40 +0200 Subject: [PATCH 081/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 2e0e4ca..154da0b 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -16,7 +16,7 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $tags = $article->getTags(); }else{ echo "Test"; - header("location: index.php?pfad=404"); + header("Location: index.php?pfad=404"); exit(); } } catch (Exception $e){ From 7dc3c3b9882dcb3c226ecd3772308134917fa5f1 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:06:32 +0200 Subject: [PATCH 082/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 154da0b..3f88d42 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -16,7 +16,7 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $tags = $article->getTags(); }else{ echo "Test"; - header("Location: index.php?pfad=404"); + header("location: ../../../index.php?pfad=404"); exit(); } } catch (Exception $e){ From 80732354663181a1c25d18194e2119f32c584c0d Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:07:26 +0200 Subject: [PATCH 083/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 3f88d42..2e0e4ca 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -16,7 +16,7 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $tags = $article->getTags(); }else{ echo "Test"; - header("location: ../../../index.php?pfad=404"); + header("location: index.php?pfad=404"); exit(); } } catch (Exception $e){ From fdece531afbf5f30a207bd54789904a3b87dd8fc Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:09:44 +0200 Subject: [PATCH 084/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 2e0e4ca..53e7226 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -16,7 +16,7 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $tags = $article->getTags(); }else{ echo "Test"; - header("location: index.php?pfad=404"); + header("location: /index.php?pfad=404"); exit(); } } catch (Exception $e){ From a6210c9d6ece421efff6fcf27f55c4a3b1a8f44b Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:13:03 +0200 Subject: [PATCH 085/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 53e7226..154da0b 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -16,7 +16,7 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $tags = $article->getTags(); }else{ echo "Test"; - header("location: /index.php?pfad=404"); + header("Location: index.php?pfad=404"); exit(); } } catch (Exception $e){ From 62190fa8217388beec497c4de06618b7770db33a Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:17:10 +0200 Subject: [PATCH 086/102] Update showArticle.php --- content/showArticle.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/content/showArticle.php b/content/showArticle.php index 77125dd..4457dcc 100644 --- a/content/showArticle.php +++ b/content/showArticle.php @@ -1,12 +1,11 @@ + - -
From d18f33a87a21dd2e2aded2428046646159d890ed Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:17:11 +0200 Subject: [PATCH 087/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 154da0b..95d649d 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -16,12 +16,12 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $tags = $article->getTags(); }else{ echo "Test"; - header("Location: index.php?pfad=404"); + header("location: index.php?pfad=404"); exit(); } } catch (Exception $e){ $_SESSION["message"] = "internal_error"; - header("location: ../../index.php?pfad=showArticle"); + header("location: index.php?pfad=showArticle"); exit(); } }else{ From 10b058afa03f6d98ef5c1d481fca01464f8319fe Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:22:14 +0200 Subject: [PATCH 088/102] Update path.php --- path.php | 1 + 1 file changed, 1 insertion(+) diff --git a/path.php b/path.php index 61ea409..d1d0a18 100644 --- a/path.php +++ b/path.php @@ -1,3 +1,4 @@ From e105ab61b7c8bbaf9c1eee6b2eda6957d094929b Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:24:59 +0200 Subject: [PATCH 089/102] Update showArticle-controller.php --- php/controller/showArticle-controller.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php index 95d649d..38bb3f2 100644 --- a/php/controller/showArticle-controller.php +++ b/php/controller/showArticle-controller.php @@ -15,13 +15,12 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){ $author = $article->getAuthor(); $tags = $article->getTags(); }else{ - echo "Test"; - header("location: index.php?pfad=404"); + //header("location: index.php?pfad=404"); + include_once "content/404.php"; exit(); } } catch (Exception $e){ $_SESSION["message"] = "internal_error"; - header("location: index.php?pfad=showArticle"); exit(); } }else{ From c440c25e4175a3d52138d44b81d4692a828d316e Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:30:50 +0200 Subject: [PATCH 090/102] Update updateArticle.php --- content/updateArticle.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/content/updateArticle.php b/content/updateArticle.php index 06d345e..01d5108 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -23,6 +23,31 @@ include_once 'php/controller/showArticle-controller.php'; Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.

+ +

+ Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht. +

+ + +

+ Der Text erlaubt eine Länge von 10 bis maximal 7.000 Zeichen (ca. 1.000 Wörter). +

+ + +

+ Die ausgewählte Kategorie ist ungültig. +

+ + +

+ Ungültige Schlagworte gefunden. Erlaubt sind nur Buchstaben, Zahlen, Leerzeichen und Bindestriche (2-20 Zeichen). +

+ + +

+ Bei der Validierung deiner Daten ist ein Fehler aufgetreten. Bitte versuche es erneut. +

+ From cd38af22dbcfbf6c9efde2773aac53e0dc4d0607 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:33:13 +0200 Subject: [PATCH 091/102] Update updateArticle.php --- content/updateArticle.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/content/updateArticle.php b/content/updateArticle.php index 01d5108..67be89e 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -51,9 +51,20 @@ include_once 'php/controller/showArticle-controller.php'; - +
@@ -111,7 +122,13 @@ include_once 'php/controller/showArticle-controller.php'; From c96d93c2ceebaa1a18f21593e4f59415b304544a Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:42:00 +0200 Subject: [PATCH 092/102] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 120 +++++++++++++++++--- 1 file changed, 104 insertions(+), 16 deletions(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index fa5e232..6d1b875 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -5,6 +5,10 @@ require_once '../model/ArticleManager.php'; require_once '../model/Article.php'; if ($_SERVER["REQUEST_METHOD"] === "POST") { + $_SESSION["old_title"] = $_POST["title"] ?? ''; + $_SESSION["old_content"] = $_POST["content"] ?? ''; + $_SESSION["old_category"] = $_POST["category"] ?? ''; + $_SESSION["old_tags"] = $_POST["tags"] ?? ''; try { $id = $_GET["id"]; } catch (Exception $e){ @@ -12,28 +16,112 @@ 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"); } elseif(!isset($id)) { $_SESSION["message"] = "missing_id"; - //header("location: ../../index.php?pfad=updateArticle"); }else{ - $newTitle = $_POST["title"]; - $newContent = $_POST["content"]; - $newCategory = $_POST["category"]; + // ------------------------ Validierung des Autors: ---------------------------- $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. - $newTags = $_POST["tags"]; + $validatedAuthor = $author; + echo "Autorvalidierung erfolgreich"; - try { - $articleManager = ArticleManager::getInstance(); // TODO: Später aus Session den Nutzer auslesen und Autorenrechte prüfen! - $article = $articleManager->getArticle($id); - $article->setTitle($newTitle); - $article->setContent($newContent); - $article->setCategory($newCategory); - $article->setTags($newTags); - $articleManager->updateArticle($id ,$article, $author); - } catch (Exception $e){ - $_SESSION["message"] = "internal_error"; + // --------------------- Eingabevalidierung des Titels: ------------------------- + $title = $_POST["title"]; + // Mit Regex prüfen: + $titlePattern = '/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u'; //Erlaubt: Buchstaben, Zahlen, Standardsatzzeichen; 5-120 Zeichen + if (preg_match($titlePattern, $title)) { + $validatedTitle = $title; + } else { + $_SESSION["message"] = "invalid_title"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } + if (!preg_match('/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u', $title)) { + $errors['title'] = "Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht."; + } + echo "Titelvalidierung erfolgreich"; + + // --------------------- Eingabeüberprüfung des Contents: ----------------------- + $content = $_POST["content"]; + $zeichenAnzahl = mb_strlen($content); + if ($zeichenAnzahl <= 7000 && $zeichenAnzahl > 10) { + $validatedContent = $content; + }else{ + $_SESSION["message"] = "invalid_content"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } + echo "Contentvalidierung erfolgreich"; + + // --------------------- -Eingabevalidierung der Kategorie: -------------------- + $category = $_POST["category"]; + $allowedCategories = [ + 'deutsch', 'englisch', 'franzoesisch', 'latein', 'literatur', + 'mathe', 'biologie', 'chemie', 'physik', 'informatik', 'astronomie', + 'geschichte', 'erdkunde', 'sozialkunde', 'wirtschaft', 'religion', + 'ethik', 'philosophie', 'psychologie', 'kunst', 'musik', 'theater', + 'technik', 'werken', 'hauswirtschaft', 'sport' + ]; + if (!in_array($category, $allowedCategories, true)) { + $_SESSION["message"] = "invalid_category"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } + $validatedCategory = $category; + echo "Kategorievalidierung erfolgreich"; + + // -------------------------- Eingabevalidierung der tags: ---------------------- + if (isset($_POST['tags'])) { + $tags = $_POST['tags']; + } else { + $tags = ''; + } + $validatedTags = []; + $rawTags = explode(',', $tags); // String mit Kommas in array... + + foreach ($rawTags as $rawTag) { + // Leerzeichen am Anfang/Ende des einzelnen Tags entfernen: + $tag = trim($rawTag); + + // leere Elemente überspringen: + if ($tag === '') { + continue; + } + + // Tag mit Regex prüfen: + $tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,20}$/u'; //Erlaubt: Buchstaben, Zahlen, Bindestriche, Leerzeichen; 2-20 Zeichen + if (preg_match($tagPattern, $tag)) { + $validatedTags[] = $tag; + } else { + $_SESSION["message"] = "invalid_tags"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } + } + // Duplikate entfernen: + $validatedTags = array_unique($validatedTags); + $validatedTags = implode(',', $validatedTags); + echo "Tagvalidierung erfolgreich"; + + // ----------------- Übertragung der validierten Daten in ArticleManager: --------------------------- + if (!isset($validatedTitle) || !isset($validatedContent) || !isset($validatedAuthor) || !isset($validatedCategory) || !isset($validatedTags)) { + $_SESSION["message"] = "validation_missing"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } else { + try { + $articleManager = ArticleManager::getInstance(); + $article = $articleManager->getArticle($id); + $article->setTitle($validatedTitle); + $article->setContent($validatedContent); + $article->setCategory($validatedCategory); + $article->setTags($validatedTags); + $articleManager->updateArticle($id ,$article, $validatedAuthor); + } catch (Exception $e){ + $_SESSION["message"] = "internal_error"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } } $_SESSION["message"] = "article_updated"; // Weiterleitung zur Homepage From 1ca27bc072ebf671d8ba22548fb2845ff76cda42 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:43:11 +0200 Subject: [PATCH 093/102] Update updateArticle.php --- content/updateArticle.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/updateArticle.php b/content/updateArticle.php index 67be89e..49c0254 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -126,8 +126,7 @@ include_once 'php/controller/showArticle-controller.php'; value=" - ?>" + echo htmlspecialchars($_SESSION['old_tags'] ?? ''); unset($_SESSION['old_tags']); ?>" placeholder="z.B. Technik, IT (mit Komma trennen)">
From a24914126f33044e21cf57c4f89272cf71d3d6d1 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:46:51 +0200 Subject: [PATCH 094/102] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 6d1b875..999ae76 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -23,7 +23,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { // ------------------------ Validierung des Autors: ---------------------------- $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. $validatedAuthor = $author; - echo "Autorvalidierung erfolgreich"; // --------------------- Eingabevalidierung des Titels: ------------------------- $title = $_POST["title"]; @@ -39,7 +38,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { if (!preg_match('/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u', $title)) { $errors['title'] = "Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht."; } - echo "Titelvalidierung erfolgreich"; // --------------------- Eingabeüberprüfung des Contents: ----------------------- $content = $_POST["content"]; @@ -51,7 +49,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { header("location: ../../index.php?pfad=createArticle"); exit(); } - echo "Contentvalidierung erfolgreich"; // --------------------- -Eingabevalidierung der Kategorie: -------------------- $category = $_POST["category"]; @@ -68,7 +65,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { exit(); } $validatedCategory = $category; - echo "Kategorievalidierung erfolgreich"; // -------------------------- Eingabevalidierung der tags: ---------------------- if (isset($_POST['tags'])) { @@ -101,7 +97,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { // Duplikate entfernen: $validatedTags = array_unique($validatedTags); $validatedTags = implode(',', $validatedTags); - echo "Tagvalidierung erfolgreich"; // ----------------- Übertragung der validierten Daten in ArticleManager: --------------------------- if (!isset($validatedTitle) || !isset($validatedContent) || !isset($validatedAuthor) || !isset($validatedCategory) || !isset($validatedTags)) { From 268fe6a6b96a499822a1640d7011bd80ba20cbbe Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:49:45 +0200 Subject: [PATCH 095/102] Update updateArticle.php --- content/updateArticle.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/content/updateArticle.php b/content/updateArticle.php index 49c0254..ac86814 100644 --- a/content/updateArticle.php +++ b/content/updateArticle.php @@ -53,17 +53,21 @@ include_once 'php/controller/showArticle-controller.php'; ?>
@@ -124,9 +128,12 @@ include_once 'php/controller/showArticle-controller.php'; " placeholder="z.B. Technik, IT (mit Komma trennen)">
From 308e5af6ff507a6698bdb56945f71bb35f561a78 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 12:51:17 +0200 Subject: [PATCH 096/102] tags-> bis 50 Zeichen --- content/createArticle.php | 2 +- php/controller/createArticle-controller.php | 2 +- php/controller/updateArticle-controller.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/createArticle.php b/content/createArticle.php index 970186c..41f1ca8 100644 --- a/content/createArticle.php +++ b/content/createArticle.php @@ -35,7 +35,7 @@ session_start();

- Ungültige Schlagworte gefunden. Erlaubt sind nur Buchstaben, Zahlen, Leerzeichen und Bindestriche (2-20 Zeichen). + Ungültige Schlagworte gefunden. Erlaubt sind nur Buchstaben, Zahlen, Leerzeichen und Bindestriche (2-50 Zeichen).

diff --git a/php/controller/createArticle-controller.php b/php/controller/createArticle-controller.php index 10916fb..77e71ea 100644 --- a/php/controller/createArticle-controller.php +++ b/php/controller/createArticle-controller.php @@ -82,7 +82,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { } // Tag mit Regex prüfen: - $tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,20}$/u'; //Erlaubt: Buchstaben, Zahlen, Bindestriche, Leerzeichen; 2-20 Zeichen + $tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,50}$/u'; //Erlaubt: Buchstaben, Zahlen, Bindestriche, Leerzeichen; 2-50 Zeichen if (preg_match($tagPattern, $tag)) { $validatedTags[] = $tag; } else { diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 999ae76..807a45d 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -85,7 +85,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { } // Tag mit Regex prüfen: - $tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,20}$/u'; //Erlaubt: Buchstaben, Zahlen, Bindestriche, Leerzeichen; 2-20 Zeichen + $tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,50}$/u'; //Erlaubt: Buchstaben, Zahlen, Bindestriche, Leerzeichen; 2-50 Zeichen if (preg_match($tagPattern, $tag)) { $validatedTags[] = $tag; } else { From d5f30176c4ed71bbc863b60de8c78e5a10691822 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 13:41:22 +0200 Subject: [PATCH 097/102] article-validator.php --- php/controller/updateArticle-controller.php | 135 ++++++++------------ php/validator/article-validator.php | 104 +++++++++++++++ 2 files changed, 154 insertions(+), 85 deletions(-) create mode 100644 php/validator/article-validator.php diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 807a45d..086de7e 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -3,6 +3,7 @@ session_start(); require_once '../model/LocalArticleManager.php'; require_once '../model/ArticleManager.php'; require_once '../model/Article.php'; +require_once '../validator/article-validator.php'; if ($_SERVER["REQUEST_METHOD"] === "POST") { $_SESSION["old_title"] = $_POST["title"] ?? ''; @@ -19,111 +20,75 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { } elseif(!isset($id)) { $_SESSION["message"] = "missing_id"; }else{ - - // ------------------------ Validierung des Autors: ---------------------------- - $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. - $validatedAuthor = $author; - - // --------------------- Eingabevalidierung des Titels: ------------------------- $title = $_POST["title"]; - // Mit Regex prüfen: - $titlePattern = '/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u'; //Erlaubt: Buchstaben, Zahlen, Standardsatzzeichen; 5-120 Zeichen - if (preg_match($titlePattern, $title)) { - $validatedTitle = $title; - } else { - $_SESSION["message"] = "invalid_title"; - header("location: ../../index.php?pfad=createArticle"); - exit(); - } - if (!preg_match('/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u', $title)) { - $errors['title'] = "Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht."; - } - - // --------------------- Eingabeüberprüfung des Contents: ----------------------- $content = $_POST["content"]; - $zeichenAnzahl = mb_strlen($content); - if ($zeichenAnzahl <= 7000 && $zeichenAnzahl > 10) { - $validatedContent = $content; - }else{ - $_SESSION["message"] = "invalid_content"; - header("location: ../../index.php?pfad=createArticle"); - exit(); - } - - // --------------------- -Eingabevalidierung der Kategorie: -------------------- + $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. $category = $_POST["category"]; - $allowedCategories = [ - 'deutsch', 'englisch', 'franzoesisch', 'latein', 'literatur', - 'mathe', 'biologie', 'chemie', 'physik', 'informatik', 'astronomie', - 'geschichte', 'erdkunde', 'sozialkunde', 'wirtschaft', 'religion', - 'ethik', 'philosophie', 'psychologie', 'kunst', 'musik', 'theater', - 'technik', 'werken', 'hauswirtschaft', 'sport' - ]; - if (!in_array($category, $allowedCategories, true)) { - $_SESSION["message"] = "invalid_category"; - header("location: ../../index.php?pfad=createArticle"); - exit(); - } - $validatedCategory = $category; - - // -------------------------- Eingabevalidierung der tags: ---------------------- if (isset($_POST['tags'])) { $tags = $_POST['tags']; } else { $tags = ''; } - $validatedTags = []; - $rawTags = explode(',', $tags); // String mit Kommas in array... - foreach ($rawTags as $rawTag) { - // Leerzeichen am Anfang/Ende des einzelnen Tags entfernen: - $tag = trim($rawTag); - - // leere Elemente überspringen: - if ($tag === '') { - continue; - } - - // Tag mit Regex prüfen: - $tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,50}$/u'; //Erlaubt: Buchstaben, Zahlen, Bindestriche, Leerzeichen; 2-50 Zeichen - if (preg_match($tagPattern, $tag)) { - $validatedTags[] = $tag; - } else { - $_SESSION["message"] = "invalid_tags"; - header("location: ../../index.php?pfad=createArticle"); - exit(); - } + // -------------------------------- Validierung der Daten: ------------------------- + if (!articleAuthorValidator($author)) { + $_SESSION["message"] = "author_not_valid"; + header("location: ../../index.php?pfad=createArticle"); + exit(); } - // Duplikate entfernen: - $validatedTags = array_unique($validatedTags); - $validatedTags = implode(',', $validatedTags); - // ----------------- Übertragung der validierten Daten in ArticleManager: --------------------------- - if (!isset($validatedTitle) || !isset($validatedContent) || !isset($validatedAuthor) || !isset($validatedCategory) || !isset($validatedTags)) { - $_SESSION["message"] = "validation_missing"; + if (!articleTitleValidator($title)) { + $_SESSION["message"] = "invalid_title"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } + + if (!articleContentValidator($content)) { + $_SESSION["message"] = "invalid_content"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } + + if (!articleCategoryValidator($category)) { + $_SESSION["message"] = "invalid_category"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } + + if (!articleTagValidator($_POST["tags"])) { + $_SESSION["message"] = "invalid_tags"; header("location: ../../index.php?pfad=createArticle"); exit(); } else { - try { - $articleManager = ArticleManager::getInstance(); - $article = $articleManager->getArticle($id); - $article->setTitle($validatedTitle); - $article->setContent($validatedContent); - $article->setCategory($validatedCategory); - $article->setTags($validatedTags); - $articleManager->updateArticle($id ,$article, $validatedAuthor); - } catch (Exception $e){ - $_SESSION["message"] = "internal_error"; - header("location: ../../index.php?pfad=createArticle"); - exit(); + $cleanedTags = []; + $rawTags = explode(',', $tags); + foreach ($rawTags as $rawTag) { + // Leerzeichen am Anfang/Ende des einzelnen Tags entfernen: + $tag = trim($rawTag); + // Duplikate entfernen: + $cleanedTags = array_unique($cleanedTags); + $cleanedTags = implode(',', $cleanedTags); } } + + // ----------------- Übertragung der validierten Daten in ArticleManager: --------------------------- + try { + $articleManager = ArticleManager::getInstance(); + $article = $articleManager->getArticle($id); + $article->setTitle($title); + $article->setContent($content); + $article->setCategory($category); + $article->setTags($cleanedTags); + $articleManager->updateArticle($id ,$article, $author); + } catch (Exception $e){ + $_SESSION["message"] = "internal_error"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } $_SESSION["message"] = "article_updated"; // Weiterleitung zur Homepage header("location: ../../index.php?pfad=showArticle&id=$id"); - } - exit(); } ?> \ No newline at end of file diff --git a/php/validator/article-validator.php b/php/validator/article-validator.php new file mode 100644 index 0000000..2eb1dbc --- /dev/null +++ b/php/validator/article-validator.php @@ -0,0 +1,104 @@ + 10) { + return true; + }else{ + return false; + } +} + +/** + * Prüft, ob die Kategorie eine erlaubt Kategorie ist. + * @param $category + * @return bool + */ +function articleCategoryValidator($category) +{ + $allowedCategories = [ + 'deutsch', 'englisch', 'franzoesisch', 'latein', 'literatur', + 'mathe', 'biologie', 'chemie', 'physik', 'informatik', 'astronomie', + 'geschichte', 'erdkunde', 'sozialkunde', 'wirtschaft', 'religion', + 'ethik', 'philosophie', 'psychologie', 'kunst', 'musik', 'theater', + 'technik', 'werken', 'hauswirtschaft', 'sport' + ]; + if (in_array($category, $allowedCategories, true)) { + return true; + } else { + return false; + } +} + +/** + * Prüft, ob die Tags die folgenden Bedingungen erfüllen: + * Buchstaben von a-z; A-Z + * Zahlen von 0-9 + * Umlaute äöüÄÖÜß + * Satzeichen - + * 2-50 Zeichen + * @param $tags + * @return bool + */ +function articleTagValidator($tags) +{ + if (!isset($tags)) { + $tags = ''; + } + + $rawTags = explode(',', $tags); + + foreach ($rawTags as $rawTag) { + // Leerzeichen am Anfang/Ende des einzelnen Tags entfernen: + $tag = trim($rawTag); + + // leere Elemente überspringen: + if ($tag === '') { + continue; + } + + // Tag mit Regex prüfen: + $tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,50}$/u'; + if (!preg_match($tagPattern, $tag)) { + return false; + } + } + return true; +} + +?> \ No newline at end of file From 3df526d5b5a5fb381950f45e5be4b6c253388a07 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 13:54:02 +0200 Subject: [PATCH 098/102] Update article-validator.php --- php/validator/article-validator.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/php/validator/article-validator.php b/php/validator/article-validator.php index 2eb1dbc..02c4f94 100644 --- a/php/validator/article-validator.php +++ b/php/validator/article-validator.php @@ -3,6 +3,7 @@ * Prüft, ob der Autor auch der Eigentümer des Beitrags ist. * @param $author * @return true + * TODO: Implement this. */ function articleAuthorValidator($author) { @@ -21,6 +22,7 @@ function articleAuthorValidator($author) */ function articleTitleValidator($title) { + $title = trim($title); $titlePattern = '/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u'; if (preg_match($titlePattern, $title)) { return true; @@ -36,8 +38,9 @@ function articleTitleValidator($title) */ function articleContentValidator($content) { + $content = trim($content); $zeichenAnzahl = mb_strlen($content); - if ($zeichenAnzahl <= 7000 && $zeichenAnzahl > 10) { + if ($zeichenAnzahl <= 7000 && $zeichenAnzahl >= 10) { return true; }else{ return false; From 17345345b5625228ec6361ec315105c2da9b72db Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 13:54:04 +0200 Subject: [PATCH 099/102] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 33 ++++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 086de7e..3a40f5c 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -10,15 +10,19 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { $_SESSION["old_content"] = $_POST["content"] ?? ''; $_SESSION["old_category"] = $_POST["category"] ?? ''; $_SESSION["old_tags"] = $_POST["tags"] ?? ''; - try { + + if (isset($_GET["id"]) && !empty($_GET["id"])) { $id = $_GET["id"]; - } catch (Exception $e){ + } else { $_SESSION["message"] = "missing_id"; + header("location: ../../index.php?pfad=updateArticle"); + exit(); } + if (!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){ $_SESSION["message"] = "missing_parameters"; - } elseif(!isset($id)) { - $_SESSION["message"] = "missing_id"; + header("location: ../../index.php?pfad=updateArticle"); + exit(); }else{ $title = $_POST["title"]; $content = $_POST["content"]; @@ -33,31 +37,31 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { // -------------------------------- Validierung der Daten: ------------------------- if (!articleAuthorValidator($author)) { $_SESSION["message"] = "author_not_valid"; - header("location: ../../index.php?pfad=createArticle"); + header("location: ../../index.php?pfad=updateArticle"); exit(); } if (!articleTitleValidator($title)) { $_SESSION["message"] = "invalid_title"; - header("location: ../../index.php?pfad=createArticle"); + header("location: ../../index.php?pfad=updateArticle"); exit(); } if (!articleContentValidator($content)) { $_SESSION["message"] = "invalid_content"; - header("location: ../../index.php?pfad=createArticle"); + header("location: ../../index.php?pfad=updateArticle"); exit(); } if (!articleCategoryValidator($category)) { $_SESSION["message"] = "invalid_category"; - header("location: ../../index.php?pfad=createArticle"); + header("location: ../../index.php?pfad=updateArticle"); exit(); } - if (!articleTagValidator($_POST["tags"])) { + if (!articleTagValidator($tags)) { $_SESSION["message"] = "invalid_tags"; - header("location: ../../index.php?pfad=createArticle"); + header("location: ../../index.php?pfad=updateArticle"); exit(); } else { $cleanedTags = []; @@ -65,10 +69,11 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { foreach ($rawTags as $rawTag) { // Leerzeichen am Anfang/Ende des einzelnen Tags entfernen: $tag = trim($rawTag); - // Duplikate entfernen: - $cleanedTags = array_unique($cleanedTags); - $cleanedTags = implode(',', $cleanedTags); + $cleanedTags[] = $tag; } + // Duplikate entfernen: + $cleanedTags = array_unique($cleanedTags); + $cleanedTags = implode(',', $cleanedTags); } // ----------------- Übertragung der validierten Daten in ArticleManager: --------------------------- @@ -82,7 +87,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { $articleManager->updateArticle($id ,$article, $author); } catch (Exception $e){ $_SESSION["message"] = "internal_error"; - header("location: ../../index.php?pfad=createArticle"); + header("location: ../../index.php?pfad=updateArticle"); exit(); } $_SESSION["message"] = "article_updated"; From e779162ec256fe9248f00671b113406e8a6944f5 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 13:57:53 +0200 Subject: [PATCH 100/102] Update createArticle-controller.php --- php/controller/createArticle-controller.php | 124 +++++++------------- 1 file changed, 43 insertions(+), 81 deletions(-) diff --git a/php/controller/createArticle-controller.php b/php/controller/createArticle-controller.php index 77e71ea..0270a00 100644 --- a/php/controller/createArticle-controller.php +++ b/php/controller/createArticle-controller.php @@ -13,109 +13,71 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { header("location: ../../index.php?pfad=createArticle"); exit(); } else { - // ------------------------ Validierung des Autors: ---------------------------- - $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. - $validatedAuthor = $author; - echo "Autorvalidierung erfolgreich"; - - // --------------------- Eingabevalidierung des Titels: ------------------------- $title = $_POST["title"]; - // Mit Regex prüfen: - $titlePattern = '/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u'; //Erlaubt: Buchstaben, Zahlen, Standardsatzzeichen; 5-120 Zeichen - if (preg_match($titlePattern, $title)) { - $validatedTitle = $title; - } else { + $content = $_POST["content"]; + $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. + $category = $_POST["category"]; + $tags = $_POST['tags'] ?? ''; + + // -------------------------------- Validierung der Daten: ------------------------- + if (!articleAuthorValidator($author)) { + $_SESSION["message"] = "author_not_valid"; + header("location: ../../index.php?pfad=createArticle"); + exit(); + } + + if (!articleTitleValidator($title)) { $_SESSION["message"] = "invalid_title"; header("location: ../../index.php?pfad=createArticle"); exit(); } - if (!preg_match('/^[a-zA-Z0-9äöüÄÖÜß\s.,!?:;()\'"„“«»_+-]{5,120}$/u', $title)) { - $errors['title'] = "Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht."; - } - echo "Titelvalidierung erfolgreich"; - // --------------------- Eingabeüberprüfung des Contents: ----------------------- - $content = $_POST["content"]; - $zeichenAnzahl = mb_strlen($content); - if ($zeichenAnzahl <= 7000 && $zeichenAnzahl > 10) { - $validatedContent = $content; - }else{ + if (!articleContentValidator($content)) { $_SESSION["message"] = "invalid_content"; header("location: ../../index.php?pfad=createArticle"); exit(); } - echo "Contentvalidierung erfolgreich"; - // --------------------- -Eingabevalidierung der Kategorie: -------------------- - $category = $_POST["category"]; - $allowedCategories = [ - 'deutsch', 'englisch', 'franzoesisch', 'latein', 'literatur', - 'mathe', 'biologie', 'chemie', 'physik', 'informatik', 'astronomie', - 'geschichte', 'erdkunde', 'sozialkunde', 'wirtschaft', 'religion', - 'ethik', 'philosophie', 'psychologie', 'kunst', 'musik', 'theater', - 'technik', 'werken', 'hauswirtschaft', 'sport' - ]; - if (!in_array($category, $allowedCategories, true)) { + if (!articleCategoryValidator($category)) { $_SESSION["message"] = "invalid_category"; header("location: ../../index.php?pfad=createArticle"); exit(); } - $validatedCategory = $category; - echo "Kategorievalidierung erfolgreich"; - // -------------------------- Eingabevalidierung der tags: ---------------------- - if (isset($_POST['tags'])) { - $tags = $_POST['tags']; - } else { - $tags = ''; - } - $validatedTags = []; - $rawTags = explode(',', $tags); // String mit Kommas in array... - - foreach ($rawTags as $rawTag) { - // Leerzeichen am Anfang/Ende des einzelnen Tags entfernen: - $tag = trim($rawTag); - - // leere Elemente überspringen: - if ($tag === '') { - continue; - } - - // Tag mit Regex prüfen: - $tagPattern = '/^[a-zA-Z0-9äöüÄÖÜß\s-]{2,50}$/u'; //Erlaubt: Buchstaben, Zahlen, Bindestriche, Leerzeichen; 2-50 Zeichen - if (preg_match($tagPattern, $tag)) { - $validatedTags[] = $tag; - } else { - $_SESSION["message"] = "invalid_tags"; - header("location: ../../index.php?pfad=createArticle"); - exit(); - } - } - // Duplikate entfernen: - $validatedTags = array_unique($validatedTags); - $validatedTags = implode(',', $validatedTags); - echo "Tagvalidierung erfolgreich"; - - // ----------------- Übertragung der validierten Daten in ArticleManager: --------------------------- - if (!isset($validatedTitle) || !isset($validatedContent) || !isset($validatedAuthor) || !isset($validatedCategory) || !isset($validatedTags)) { - $_SESSION["message"] = "validation_missing"; + if (!articleTagValidator($tags)) { + $_SESSION["message"] = "invalid_tags"; header("location: ../../index.php?pfad=createArticle"); exit(); } else { - try { - $articleManager = ArticleManager::getInstance(); - $articleManager->addArticle($validatedTitle, $validatedContent, $validatedAuthor, $validatedCategory, $validatedTags); - echo "Speichern erfolgreich"; - } catch (Exception $e){ - $_SESSION["message"] = "internal_error"; - header("location: ../../index.php?pfad=createArticle"); - exit(); + $cleanedTags = []; + $rawTags = explode(',', $tags); + foreach ($rawTags as $rawTag) { + // Leerzeichen am Anfang/Ende des einzelnen Tags entfernen: + $tag = trim($rawTag); + $cleanedTags[] = $tag; } - $_SESSION["message"] = "new_article"; - // Weiterleitung zur Homepage - header("location: ../../index.php"); + // Duplikate entfernen: + $cleanedTags = array_unique($cleanedTags); + $cleanedTags = implode(',', $cleanedTags); + } + // ----------------- Übertragung der validierten Daten in ArticleManager: --------------------------- + try { + $articleManager = ArticleManager::getInstance(); + $articleManager->addArticle($title, $content, $author, $category, $cleanedTags); + + // Formulardaten nach erfolgreichem Erstellen aus der Session löschen + unset($_SESSION["old_title"], $_SESSION["old_content"], $_SESSION["old_category"], $_SESSION["old_tags"]); + + } catch (Exception $e){ + $_SESSION["message"] = "internal_error"; + header("location: ../../index.php?pfad=createArticle"); exit(); } + + $_SESSION["message"] = "new_article"; + // Weiterleitung zur Homepage + header("location: ../../index.php"); + exit(); } } From f99b7bc8ab8db1b6e18925f54d852681f661cc03 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 14:02:11 +0200 Subject: [PATCH 101/102] Update updateArticle-controller.php --- php/controller/updateArticle-controller.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/php/controller/updateArticle-controller.php b/php/controller/updateArticle-controller.php index 3a40f5c..6ff32ec 100644 --- a/php/controller/updateArticle-controller.php +++ b/php/controller/updateArticle-controller.php @@ -28,11 +28,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { $content = $_POST["content"]; $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen. $category = $_POST["category"]; - if (isset($_POST['tags'])) { - $tags = $_POST['tags']; - } else { - $tags = ''; - } + $tags = $_POST['tags'] ?? ''; // -------------------------------- Validierung der Daten: ------------------------- if (!articleAuthorValidator($author)) { From 625dd35b9eb7287ff03c022c7a875942916d9121 Mon Sep 17 00:00:00 2001 From: NOrtmann1 Date: Mon, 1 Jun 2026 14:02:31 +0200 Subject: [PATCH 102/102] Update createArticle-controller.php --- php/controller/createArticle-controller.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php/controller/createArticle-controller.php b/php/controller/createArticle-controller.php index 0270a00..d4c1cec 100644 --- a/php/controller/createArticle-controller.php +++ b/php/controller/createArticle-controller.php @@ -2,12 +2,14 @@ session_start(); require_once '../model/LocalArticleManager.php'; require_once '../model/ArticleManager.php'; +require_once '../validator/article-validator.php'; if ($_SERVER["REQUEST_METHOD"] === "POST") { $_SESSION["old_title"] = $_POST["title"] ?? ''; $_SESSION["old_content"] = $_POST["content"] ?? ''; $_SESSION["old_category"] = $_POST["category"] ?? ''; $_SESSION["old_tags"] = $_POST["tags"] ?? ''; + if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){ $_SESSION["message"] = "missing_parameters"; header("location: ../../index.php?pfad=createArticle");