false, "message" => "Du musst angemeldet sein." ]); exit(); } $articleId = $_POST["article_id"] ?? null; $content = trim($_POST["content"] ?? ""); if (empty($articleId) || empty($content)) { echo json_encode([ "success" => false, "message" => "Kommentar darf nicht leer sein." ]); exit(); } try { $commentManager = CommentManager::getInstance(); $commentManager->addComment( $articleId, $_SESSION["user_email"], $content ); echo json_encode([ "success" => true, "author" => $_SESSION["user_email"], "content" => $content, "created" => date("Y-m-d H:i:s") ]); } catch (Exception $e) { echo json_encode([ "success" => false, "message" => "Kommentar konnte nicht gespeichert werden." ]); }