Update showArticle.php

This commit is contained in:
2026-07-19 15:33:13 +02:00
parent 75f9fdbeb8
commit ca74690952
+32 -17
View File
@@ -45,26 +45,31 @@ if ($replyAuthor === null) {
<!-- Metadaten & Titel --> <!-- Metadaten & Titel -->
<div class="article-view-top-section"> <div class="article-view-top-section">
<div class="category-and-likes-row"> <div class="category-and-likes-row">
<?php if (isset($category) && !empty($category)): ?> <?php if (isset($category) && !empty($category)): ?>
<span class="article-view-category"><?php echo htmlspecialchars($category); ?></span> <span class="article-view-category"><?php echo htmlspecialchars($category); ?></span>
<?php endif; ?> <?php endif; ?>
<!-- Like-Anzeige und dynamischer Like-Button --> <!-- Like-Anzeige und dynamischer Like-Button -->
<?php if (isset($articleObj) && $articleObj !== null): ?> <?php if (isset($articleObj) && $articleObj !== null): ?>
<div class="article-view-likes"> <div class="article-view-likes">
<span>❤️ <span class="like-count"><?php echo $articleObj->getLikeCount(); ?></span></span> <span>❤️ <span class="like-count"><?php echo $articleObj->getLikeCount(); ?></span></span>
<?php if (isset($_SESSION["user_email"])): ?> <?php if (isset($_SESSION["user_email"])): ?>
<a href="php/controller/like-controller.php?id=<?php echo $articleObj->getId(); ?>" class="like-toggle-btn"> <form method="post"
action="php/controller/like-controller.php?id=<?php echo $articleObj->getId(); ?>"
class="like-toggle-form">
<?php csrf_field(); ?>
<button type="submit" class="like-toggle-btn">
<?php echo $articleObj->hasLiked($_SESSION["user_email"]) ? '👎 Gefällt mir nicht mehr' : '👍 Gefällt mir'; ?> <?php echo $articleObj->hasLiked($_SESSION["user_email"]) ? '👎 Gefällt mir nicht mehr' : '👍 Gefällt mir'; ?>
</a> </button>
<?php else: ?> </form>
<span class="login-hint">(Anmelden zum Liken)</span> <?php else: ?>
<?php endif; ?> <span class="login-hint">(Anmelden zum Liken)</span>
</div> <?php endif; ?>
<?php endif; ?> </div>
</div> <?php endif; ?>
</div>
<h1 class="article-view-title"> <h1 class="article-view-title">
<?php if (isset($title)) { echo htmlspecialchars($title); } ?> <?php if (isset($title)) { echo htmlspecialchars($title); } ?>
@@ -202,6 +207,8 @@ if ($replyAuthor === null) {
action="index.php?pfad=updateComment" action="index.php?pfad=updateComment"
class="edit-comment-form"> class="edit-comment-form">
<?php csrf_field(); ?>
<input type="hidden" <input type="hidden"
name="comment_id" name="comment_id"
value="<?php echo htmlspecialchars( value="<?php echo htmlspecialchars(
@@ -239,6 +246,8 @@ if ($replyAuthor === null) {
action="index.php?pfad=deleteComment" action="index.php?pfad=deleteComment"
class="delete-comment-form"> class="delete-comment-form">
<?php csrf_field(); ?>
<input type="hidden" <input type="hidden"
name="comment_id" name="comment_id"
value="<?php echo htmlspecialchars( value="<?php echo htmlspecialchars(
@@ -334,6 +343,8 @@ if ($replyAuthor === null) {
action="index.php?pfad=updateComment" action="index.php?pfad=updateComment"
class="edit-comment-form"> class="edit-comment-form">
<?php csrf_field(); ?>
<input type="hidden" <input type="hidden"
name="comment_id" name="comment_id"
value="<?php echo htmlspecialchars( value="<?php echo htmlspecialchars(
@@ -371,6 +382,8 @@ if ($replyAuthor === null) {
action="index.php?pfad=deleteComment" action="index.php?pfad=deleteComment"
class="delete-comment-form"> class="delete-comment-form">
<?php csrf_field(); ?>
<input type="hidden" <input type="hidden"
name="comment_id" name="comment_id"
value="<?php echo htmlspecialchars( value="<?php echo htmlspecialchars(
@@ -412,6 +425,8 @@ if ($replyAuthor === null) {
method="post" method="post"
action="php/ajax/add-comment.php"> action="php/ajax/add-comment.php">
<?php csrf_field(); ?>
<input type="hidden" <input type="hidden"
name="article_id" name="article_id"
value="<?php echo htmlspecialchars( value="<?php echo htmlspecialchars(