From ada97ec5381715750965788e47ef888aaeaf9de5 Mon Sep 17 00:00:00 2001 From: Caroline Schulte Date: Sat, 18 Jul 2026 15:26:13 +0200 Subject: [PATCH] Kommentare ohne js verfassen --- .idea/dataSources.local.xml | 2 +- content/showArticle.php | 104 +++++++++++++++++--- js/comments.js | 37 ++++--- php/ajax/add-comment.php | 186 ++++++++++++++++++++++++++++++------ 4 files changed, 272 insertions(+), 57 deletions(-) diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml index b341a8a..707e2b3 100644 --- a/.idea/dataSources.local.xml +++ b/.idea/dataSources.local.xml @@ -1,6 +1,6 @@ - + " diff --git a/content/showArticle.php b/content/showArticle.php index aea506c..10c09f0 100644 --- a/content/showArticle.php +++ b/content/showArticle.php @@ -5,6 +5,34 @@ $repliesByParent = []; $articleObj = null; include_once 'php/controller/showArticle-controller.php'; +/* + * Ermittelt, ob ohne JavaScript auf einen Kommentar + * geantwortet werden soll. + */ +$replyTo = filter_input( + INPUT_GET, + "reply_to", + FILTER_VALIDATE_INT +); + +$replyAuthor = null; + +if ($replyTo !== false && $replyTo !== null) { + foreach ($mainComments as $mainComment) { + if ($mainComment->getId() === $replyTo) { + $replyAuthor = $mainComment->getAuthor(); + break; + } + } +} + +/* + * Eine Antwort darf nur auf einen existierenden + * Hauptkommentar geschrieben werden. + */ +if ($replyAuthor === null) { + $replyTo = null; +} ?>
-
-
@@ -106,9 +132,24 @@ include_once 'php/controller/showArticle-controller.php';
-
+

Kommentare

+ +
"> + +
+ + + +
@@ -121,12 +162,22 @@ include_once 'php/controller/showArticle-controller.php';

getContent())); ?>

- +
@@ -153,17 +204,46 @@ include_once 'php/controller/showArticle-controller.php';
-
+ + "> + value=""> + value=""> - +

+ style="display: none;" + > + + + Antwort auf + + &id=#comment-form"> + Abbrechen + + +

+ +