query( "SELECT g.id, g.filename, g.caption, g.moderation_note, g.created_at, g.user_id, $name AS author FROM member_gallery g JOIN users u ON u.id = g.user_id WHERE g.status = 'pending' ORDER BY g.created_at" )->fetchAll(); $pendingComments = $pdo->query( "SELECT c.id, c.body, c.moderation_note, c.created_at, c.author_id, c.gallery_id, g.filename, $name AS author FROM gallery_comments c JOIN users u ON u.id = c.author_id JOIN member_gallery g ON g.id = c.gallery_id WHERE c.status = 'pending' ORDER BY c.created_at" )->fetchAll(); // Gemeldet, aber (noch) sichtbar - unter der Schwelle fuers automatische Ausblenden $reportedPictures = $pdo->query( "SELECT g.id, g.filename, g.caption, g.created_at, g.user_id, $name AS author FROM member_gallery g JOIN users u ON u.id = g.user_id WHERE g.status = 'visible' AND EXISTS (SELECT 1 FROM content_reports r WHERE r.content_type = 'picture' AND r.content_id = g.id)" )->fetchAll(); $reportedComments = $pdo->query( "SELECT c.id, c.body, c.created_at, c.author_id, c.gallery_id, g.filename, $name AS author FROM gallery_comments c JOIN users u ON u.id = c.author_id JOIN member_gallery g ON g.id = c.gallery_id WHERE c.status = 'visible' AND EXISTS (SELECT 1 FROM content_reports r WHERE r.content_type = 'comment' AND r.content_id = c.id)" )->fetchAll(); // Alle Meldungen mit Grund und Melder, gruppiert nach Inhalt $reports = []; foreach ($pdo->query( "SELECT r.content_type, r.content_id, r.reason, r.created_at, $name AS reporter FROM content_reports r JOIN users u ON u.id = r.reporter_id ORDER BY r.created_at" )->fetchAll() as $row) { $reports[$row['content_type'] . ':' . $row['content_id']][] = $row; } $pendingTotal = count($pendingPictures) + count($pendingComments); $reportedTotal = count($reportedPictures) + count($reportedComments); /** Knoepfe fuer einen Inhalt. */ $actions = static function (string $type, int $id, array $which): string { $labels = [ 'approve' => ['Freigeben', 'button-success'], 'hide' => ['Ausblenden', 'button-secondary'], 'dismiss' => ['Meldungen verwerfen', 'button-secondary'], 'delete' => ['Löschen', 'button-danger'], ]; $html = '
Bilder und Kommentare neuer Mitglieder (erste = MODERATION_TRUST_DAYS ?> Tage), Beiträge mit Links und alles, was = MODERATION_REPORT_THRESHOLD ?>-mal gemeldet wurde, warten hier auf eine Entscheidung. Bis dahin sieht sie nur der Verfasser. Alle Entscheidungen landen im Audit-Log.
Alles erledigt - nichts wartet auf Freigabe. 🎉
= nl2br(e((string) $comment['body']), false) ?>
Grund: = e((string) $comment['moderation_note']) ?>
= $reportList('comment', (int) $comment['id']) ?> = $actions('comment', (int) $comment['id'], ['approve', 'delete']) ?>