prepare( "SELECT g.*, g.status AS picture_status, u.username, u.display_name, u.avatar_filename, u.status, u.gallery_comments_enabled FROM member_gallery g JOIN users u ON u.id = g.user_id WHERE g.id = ?" ); $stmt->execute([$pictureId]); $picture = $stmt->fetch(); $me = current_user(); $isModerator = moderation_can(); $isOwner = $picture && (int) $me['id'] === (int) $picture['user_id']; // Noch nicht freigegebene Bilder sehen nur der Besitzer und die Moderation. if (!$picture || $picture['status'] !== 'active' || !empty($picture['is_background']) || ($picture['picture_status'] === 'pending' && !$isOwner && !$isModerator)) { show_not_found(); } $ownerId = (int) $picture['user_id']; $ownerName = $picture['display_name'] !== '' ? $picture['display_name'] : $picture['username']; $commentsEnabled = !empty($picture['gallery_comments_enabled']); // Vorheriges / naechstes Bild derselben Galerie (Reihenfolge wie auf der Profilseite) $ids = db()->prepare('SELECT id FROM member_gallery WHERE user_id = ? AND is_background = 0' . ($isOwner || $isModerator ? '' : " AND status = 'visible'") . ' ORDER BY sort_order, id'); $ids->execute([$ownerId]); $galleryIds = array_map('intval', $ids->fetchAll(PDO::FETCH_COLUMN)); $position = array_search($pictureId, $galleryIds, true); $prevId = $position > 0 ? $galleryIds[$position - 1] : null; $nextId = $position !== false && $position < count($galleryIds) - 1 ? $galleryIds[$position + 1] : null; $comments = []; if ($commentsEnabled) { $commentStmt = db()->prepare( "SELECT c.id, c.author_id, c.body, c.created_at, c.status AS comment_status, c.moderation_note, u.username, u.display_name, u.avatar_filename, u.status FROM gallery_comments c JOIN users u ON u.id = c.author_id WHERE c.gallery_id = ? AND (c.status = 'visible' OR c.author_id = ? OR ?) ORDER BY c.created_at, c.id" ); $commentStmt->execute([$pictureId, (int) $me['id'], $isModerator ? 1 : 0]); $comments = $commentStmt->fetchAll(); } // Reaktionen (Emojis) am Bild und an den Kommentaren - gehen mit den Kommentaren an und aus $pictureReactions = reactions_for('picture', [$pictureId])[$pictureId] ?? []; $commentReactions = reactions_for('comment', array_map('intval', array_column($comments, 'id'))); // Schon gemeldet? (Knopf dann ausgegraut) $reportedPicture = !empty(moderation_my_reports('picture', [$pictureId])); $reportedComments = moderation_my_reports('comment', array_map('intval', array_column($comments, 'id'))); /** Melden-Knopf (fragt nach einem Grund) bzw. Freigeben-Knopf fuer die Moderation. */ $reportButton = static function (string $type, int $id, bool $already): string { if ($already) { return '' . icon('flag') . ' Gemeldet'; } return '
' . csrf_field() . '' . '' . '
'; }; $approveButton = static function (string $type, int $id): string { return '
' . csrf_field() . '' . '' . '
'; }; $url = profile_image_url($picture['filename']); $pageTitle = ($picture['caption'] ?: 'Bild') . ' - ' . $ownerName; include __DIR__ . '/includes/header.php'; ?>
$ownerId, 'username' => $picture['username'], 'display_name' => $picture['display_name'], 'avatar_filename' => $picture['avatar_filename']], 36) ?> Galerie von
Wartet auf Freigabe - nur dieses Bild. ()
''; ?>

Kommentare' . count($comments) . '' : '' ?>

Noch keine Kommentare - schreib den ersten.

  1. $comment['author_id'], 'username' => $comment['username'], 'display_name' => $comment['display_name'], 'avatar_filename' => $comment['avatar_filename']], 36) ?>
    Galerie-Besitzer Wartet auf Freigabe

Nur Text, Links werden klickbar. Bitte freundlich bleiben.