Reviewänderungen

This commit is contained in:
2026-06-16 22:09:17 +02:00
parent 47239016c5
commit 23ccbe2d02
5 changed files with 44 additions and 8 deletions
+33
View File
@@ -24,6 +24,11 @@ if (isset($_GET["id"])) {
} }
} }
?> ?>
<!--
Seite: Anzeige für Beiträge
Funktion: Stellt einen übergebenen Beitrag dar.
-->
<!-- Hauptcontainer für die Beitragsansicht (Ausschließlich der Content-Bereich) -->
<main class="article-view-container"> <main class="article-view-container">
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?> <?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
@@ -32,8 +37,30 @@ if (isset($_GET["id"])) {
</p> </p>
<?php endif; ?> <?php endif; ?>
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_id"): ?>
<p class="alert-message is-error">
Es ist ein Fehler aufgetreten. Die ID konnte nicht ausgelesen werden. Bitte versuche es erneut.
</p>
<?php endif; ?>
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
<p class="alert-message is-error">
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
</p>
<?php endif; ?>
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "article_updated"): ?>
<p class="alert-message is-success">
Dein Beitrag wurde erfolgreich bearbeitet!
</p>
<?php endif; ?>
<?php
unset($_SESSION["message"]);
?>
<?php unset($_SESSION["message"]); ?> <?php unset($_SESSION["message"]); ?>
<!-- Metadaten & Titel -->
<div class="article-view-top-section"> <div class="article-view-top-section">
<?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>
@@ -52,13 +79,18 @@ if (isset($_GET["id"])) {
</div> </div>
</div> </div>
<!-- Beitrags-Inhalt -->
<div class="article-view-content"> <div class="article-view-content">
<?php if (isset($content)): ?> <?php if (isset($content)): ?>
<!-- nl2br für Zeilenumbrüche -->
<div class="article-view-body"> <div class="article-view-body">
<?php echo nl2br(htmlspecialchars($content)); ?> <?php echo nl2br(htmlspecialchars($content)); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<!-- Beitrags-Endbereich (Tags) -->
<?php if (isset($tags) && !empty($tags)): ?> <?php if (isset($tags) && !empty($tags)): ?>
<div class="article-view-bottom-section"> <div class="article-view-bottom-section">
@@ -66,6 +98,7 @@ if (isset($_GET["id"])) {
<div class="article-view-tags-list"> <div class="article-view-tags-list">
<?php <?php
// Falls $tags ein String ist (z.B. "Web, CSS"), in ein Array umwandeln
$tagArray = is_array($tags) ? $tags : explode(',', $tags); $tagArray = is_array($tags) ? $tags : explode(',', $tags);
foreach ($tagArray as $tag): foreach ($tagArray as $tag):
+2 -2
View File
@@ -1,7 +1,7 @@
/* Container für den gesamten articleikel */ /* Container für den gesamten articleikel */
.article-view-container { .article-view-container {
box-sizing: border-box; box-sizing: border-box;
max-width: 900px; max-width: 900px; /* Angenehme Lesebreite für längere Texte */
margin: 3rem auto; margin: 3rem auto;
padding: 0 2rem; padding: 0 2rem;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
@@ -105,7 +105,7 @@
cursor: default; cursor: default;
} }
/* Responsive Anpassungen unter 760px */ /* Responsive Anpassungen unter 760px (für z.B. Smarticlephones) */
@media (max-width: 760px) { @media (max-width: 760px) {
.article-view-container { .article-view-container {
margin: 1.5rem auto; margin: 1.5rem auto;
+1
View File
@@ -52,6 +52,7 @@ if ($pfad === "deleteAccount") {
<link rel="stylesheet" href="css/showArticle.css"> <link rel="stylesheet" href="css/showArticle.css">
<link rel="stylesheet" href="css/message.css"> <link rel="stylesheet" href="css/message.css">
<script src="js/paginator.js" async></script>
<script src="js/comments.js" defer></script> <script src="js/comments.js" defer></script>
<title>EduForge</title> <title>EduForge</title>
+3 -1
View File
@@ -1,5 +1,7 @@
<?php <?php
session_start(); if (session_status() === PHP_SESSION_NONE) {
session_start();
}
header("Content-Type: application/json"); header("Content-Type: application/json");
+5 -5
View File
@@ -47,7 +47,7 @@ class DatabaseCommentManager implements CommentManagerDAO
} }
} catch (PDOException $e) { } catch (PDOException $e) {
throw new RuntimeException("Kommentardatenbank konnte nicht erstellt werden."); throw new RuntimeException("internal_error");
} }
} }
@@ -67,7 +67,7 @@ class DatabaseCommentManager implements CommentManagerDAO
return $db; return $db;
} catch (PDOException $e) { } catch (PDOException $e) {
throw new RuntimeException("Verbindung zur Kommentardatenbank fehlgeschlagen."); throw new RuntimeException("internal_error");
} }
} }
@@ -135,7 +135,7 @@ class DatabaseCommentManager implements CommentManagerDAO
return intval($db->lastInsertId()); return intval($db->lastInsertId());
} catch (PDOException $e) { } catch (PDOException $e) {
throw new RuntimeException("Kommentar konnte nicht gespeichert werden."); throw new RuntimeException("internal_error");
} }
} }
@@ -175,7 +175,7 @@ class DatabaseCommentManager implements CommentManagerDAO
return $this->mapRowsToComments($command); return $this->mapRowsToComments($command);
} catch (PDOException $e) { } catch (PDOException $e) {
throw new RuntimeException("Kommentare konnten nicht geladen werden."); throw new RuntimeException("internal_error");
} }
} }
@@ -215,7 +215,7 @@ class DatabaseCommentManager implements CommentManagerDAO
return $this->mapRowsToComments($command); return $this->mapRowsToComments($command);
} catch (PDOException $e) { } catch (PDOException $e) {
throw new RuntimeException("Kommentare konnten nicht geladen werden."); throw new RuntimeException("internal_error");
} }
} }