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 $back = ''): string { $labels = [ 'approve' => ['Freigeben', 'button-success'], 'hide' => ['Ausblenden', 'button-secondary'], 'dismiss' => ['Meldungen verwerfen', 'button-secondary'], 'delete' => ['Löschen', 'button-danger'], ]; $html = '
'; foreach ($which as $action) { [$label, $class] = $labels[$action]; $confirm = $action === 'delete' ? ' onsubmit="return confirm("Endgültig löschen?");"' : ''; $html .= '
' . csrf_field() . '' . '' . ($back !== '' ? '' : '') . '
'; } return $html . '
'; }; /** Meldungen zu einem Inhalt als kleine Liste. */ $reportList = static function (string $type, int $id) use ($reports): string { $list = $reports[$type . ':' . $id] ?? []; if (!$list) { return ''; } $html = ''; }; // Reiter: Freigabe (Standard), alle Kommentare, Schimpfwortfilter $tab = in_array($_GET['tab'] ?? '', ['comments', 'filter'], true) ? (string) $_GET['tab'] : 'queue'; // ---- Alle Kommentare mit Markierungen ---- $commentFilter = in_array($_GET['show'] ?? '', ['flagged', 'pending', 'reported'], true) ? (string) $_GET['show'] : ''; $commentQuery = mb_substr(trim((string) ($_GET['q'] ?? '')), 0, 100); $allComments = []; $flagCounts = ['' => 0, 'flagged' => 0, 'pending' => 0, 'reported' => 0]; if ($tab === 'comments') { // Die letzten 1000 reichen - bei einer Legion ist das weit mehr als genug $rows = $pdo->query( "SELECT c.id, c.body, c.status, c.moderation_note, c.created_at, c.author_id, c.gallery_id, g.filename, g.user_id AS owner_id, $name AS author, COALESCE(u.discord_joined_at, u.created_at) AS author_since, COALESCE(NULLIF(o.display_name, ''), o.username) AS owner, (SELECT COUNT(*) FROM content_reports r WHERE r.content_type = 'comment' AND r.content_id = c.id) AS report_count FROM gallery_comments c JOIN users u ON u.id = c.author_id JOIN member_gallery g ON g.id = c.gallery_id JOIN users o ON o.id = g.user_id ORDER BY c.created_at DESC, c.id DESC LIMIT 1000" )->fetchAll(); $needle = mb_strtolower($commentQuery); foreach ($rows as $row) { $row['flags'] = moderation_comment_flags($row); $row['critical'] = in_array('critical', array_column($row['flags'], 1), true); $flagCounts['']++; $flagCounts['flagged'] += $row['flags'] ? 1 : 0; $flagCounts['pending'] += $row['status'] === 'pending' ? 1 : 0; $flagCounts['reported'] += (int) $row['report_count'] > 0 ? 1 : 0; $matchesFilter = match ($commentFilter) { 'flagged' => (bool) $row['flags'], 'pending' => $row['status'] === 'pending', 'reported' => (int) $row['report_count'] > 0, default => true, }; $matchesQuery = $needle === '' || mb_strpos(mb_strtolower($row['body'] . ' ' . $row['author'] . ' ' . $row['owner']), $needle) !== false; if ($matchesFilter && $matchesQuery) { $allComments[] = $row; } } } $commentsPerPage = 40; $commentPageCount = max(1, (int) ceil(count($allComments) / $commentsPerPage)); $commentPage = min($commentPageCount, max(1, (int) ($_GET['page'] ?? 1))); $commentsShown = array_slice($allComments, ($commentPage - 1) * $commentsPerPage, $commentsPerPage); $commentUrl = static function (array $overrides = []) use ($commentFilter, $commentQuery): string { $params = array_filter(array_merge(['tab' => 'comments', 'show' => $commentFilter, 'q' => $commentQuery], $overrides), static fn ($v) => $v !== '' && $v !== null); return '/moderation.php?' . http_build_query($params) . '&'; }; // ---- Schimpfwortfilter ---- $filterWords = $tab === 'filter' ? moderation_words() : []; $pageTitle = 'Moderation'; $containerWide = true; include __DIR__ . '/includes/header.php'; ?>

Moderation

Bilder und Kommentare neuer Mitglieder (erste Tage), Beiträge mit Links und alles, was -mal gemeldet wurde, warten hier auf eine Entscheidung. Bis dahin sieht sie nur der Verfasser. Alle Entscheidungen landen im Audit-Log.

Wartet auf Freigabe

Alles erledigt - nichts wartet auf Freigabe. 🎉

Bild

Grund:

Kommentar

Grund:

0): ?>

Gemeldet, aber noch sichtbar

Weniger als Meldungen - noch nicht automatisch ausgeblendet.

Bild
Kommentar

Alle Kommentare

'Alle', 'flagged' => 'Markiert', 'pending' => 'Wartet auf Freigabe', 'reported' => 'Gemeldet'] as $value => $label): ?>

unter einem Bild von ·

0 && $comment['status'] !== 'pending') { array_splice($commentActions, 1, 0, ['dismiss']); } ?>
1): ?>
Seite von

Schimpfwortfilter

Gilt für Kommentare und Bildunterschriften. Groß-/Kleinschreibung egal, auch Schreibweisen wie „f1ck“ oder „fiiick“ werden erkannt. Normalerweise zählt nur das ganze Wort - mit * auch als Wortteil (fick* findet auch „ficken“, *loch auch „Arschloch“). Die Moderation selbst ist vom Filter ausgenommen.

Nur markieren erscheint markiert in „Alle Kommentare“ Zurückhalten erst nach Freigabe sichtbar Blockieren wird gar nicht gespeichert
$wordLabel): ?> $a === $wordAction)); ?>