Korrektur
This commit is contained in:
@@ -195,7 +195,7 @@ if ($replyAuthor === null) {
|
|||||||
): ?>
|
): ?>
|
||||||
|
|
||||||
<form method="post"
|
<form method="post"
|
||||||
action="php/controller/deleteComment-controller.php"
|
action="index.php?pfad=deleteComment"
|
||||||
class="delete-comment-form">
|
class="delete-comment-form">
|
||||||
|
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
@@ -285,7 +285,7 @@ if ($replyAuthor === null) {
|
|||||||
): ?>
|
): ?>
|
||||||
|
|
||||||
<form method="post"
|
<form method="post"
|
||||||
action="php/controller/deleteComment-controller.php"
|
action="index.php?pfad=deleteComment"
|
||||||
class="delete-comment-form">
|
class="delete-comment-form">
|
||||||
|
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ if ($pfad === "deleteAccount") {
|
|||||||
include_once "php/controller/deleteAccount-controller.php";
|
include_once "php/controller/deleteAccount-controller.php";
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
if ($pfad === "deleteComment") {
|
||||||
|
include_once "php/controller/deleteComment-controller.php";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
+34
-7
@@ -92,12 +92,39 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
commentElement.classList.add("comment-reply");
|
commentElement.classList.add("comment-reply");
|
||||||
|
|
||||||
commentElement.innerHTML = `
|
commentElement.innerHTML = `
|
||||||
<p>
|
<p>
|
||||||
<strong>${escapeHtml(data.author)}</strong>
|
<strong>${escapeHtml(data.author)}</strong>
|
||||||
<span>${escapeHtml(data.created)}</span>
|
<span>${escapeHtml(data.created)}</span>
|
||||||
</p>
|
</p>
|
||||||
<p>${escapeHtml(data.content).replace(/\n/g, "<br>")}</p>
|
|
||||||
`;
|
<p>${escapeHtml(data.content).replace(/\n/g, "<br>")}</p>
|
||||||
|
|
||||||
|
<form
|
||||||
|
method="post"
|
||||||
|
action="index.php?pfad=deleteComment"
|
||||||
|
class="delete-comment-form"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="comment_id"
|
||||||
|
value="${escapeHtml(data.commentId)}"
|
||||||
|
>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="article_id"
|
||||||
|
value="${escapeHtml(formData.get("article_id"))}"
|
||||||
|
>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="delete-comment-button"
|
||||||
|
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');"
|
||||||
|
>
|
||||||
|
Kommentar löschen
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
`;
|
||||||
|
|
||||||
const parentReplies = commentsList.querySelector(
|
const parentReplies = commentsList.querySelector(
|
||||||
`.comment-item[data-comment-id="${parentCommentId}"] .comment-replies`
|
`.comment-item[data-comment-id="${parentCommentId}"] .comment-replies`
|
||||||
@@ -119,7 +146,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
<form
|
<form
|
||||||
method="post"
|
method="post"
|
||||||
action="php/controller/deleteComment-controller.php"
|
action="index.php?pfad=deleteComment"
|
||||||
class="delete-comment-form"
|
class="delete-comment-form"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ require_once __DIR__ . "/../model/CommentManager.php";
|
|||||||
* Kommentare dürfen nur über ein POST-Formular gelöscht werden.
|
* Kommentare dürfen nur über ein POST-Formular gelöscht werden.
|
||||||
*/
|
*/
|
||||||
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
|
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
|
||||||
header("Location: ../../index.php");
|
header("Location: index.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
$commentId = filter_input(
|
$commentId = filter_input(
|
||||||
@@ -97,7 +97,7 @@ try {
|
|||||||
* Anschließend wird wieder zum Beitrag und zu den Kommentaren geleitet.
|
* Anschließend wird wieder zum Beitrag und zu den Kommentaren geleitet.
|
||||||
*/
|
*/
|
||||||
header(
|
header(
|
||||||
"Location: ../../index.php?pfad=showArticle&id="
|
"Location: index.php?pfad=showArticle&id="
|
||||||
. urlencode((string) $articleId)
|
. urlencode((string) $articleId)
|
||||||
. "#comments"
|
. "#comments"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user