Löschen Button verschönert

This commit is contained in:
2026-07-19 17:51:52 +02:00
parent d9da018ac2
commit 4f4ad9599d
2 changed files with 102 additions and 8 deletions
+38 -2
View File
@@ -5,6 +5,28 @@ $repliesByParent = [];
$articleObj = null;
include_once 'php/controller/showArticle-controller.php';
require_once 'php/model/UserManager.php';
$userManager = UserManager::getInstance();
/**
* Liefert den vollständigen Namen zu einer gespeicherten E-Mail-Adresse.
* Falls kein Benutzer gefunden wird, wird die E-Mail als Ersatz angezeigt.
*/
function getCommentAuthorName($email, $userManager)
{
$user = $userManager->findUser($email);
if ($user === null) {
return $email;
}
$fullName = trim(
($user["vorname"] ?? "") . " " . ($user["nachname"] ?? "")
);
return $fullName !== "" ? $fullName : $email;
}
/*
* Ermittelt, ob ohne JavaScript auf einen Kommentar
* geantwortet werden soll.
@@ -173,7 +195,14 @@ if ($replyAuthor === null) {
<p>
<strong>
<?php echo htmlspecialchars($comment->getAuthor()); ?>
<?php
echo htmlspecialchars(
getCommentAuthorName(
$comment->getAuthor(),
$userManager
)
);
?>
</strong>
<span>
@@ -304,7 +333,14 @@ if ($replyAuthor === null) {
<p>
<strong>
<?php echo htmlspecialchars($reply->getAuthor()); ?>
<?php
echo htmlspecialchars(
getCommentAuthorName(
$reply->getAuthor(),
$userManager
)
);
?>
</strong>
<span>