Asked for: normal members must not see anything of the alliances - not the alliance member list, not their
calendar entries - and the alliance things out of the patch notes.
- consilium_can_view() is now consilium.view only (before: every legion member). Normal members get no menu entry,
no Consilium page, no member-list tab, no Consilium raids (raids page, dashboard, calendar) and no share button
or Consilium hints on the map (tactics_api.php: consilium flag and consilium_share need consilium.view).
- Calendar: Consilium entries only with consilium.view - calendar_can_view(), the iCal subscription, the "Für wen?"
option and the moderation queue and its counter.
- member.php: profiles of allied members only for those who see the Consilium.
- Allies no longer counted in legion lists: Lumipunkte rank on the dashboard, premade invite candidates, class
counts on the professions page.
- Map: normal members in a shared session see guests like other participants, without 🤝 and legion.
- Patch note about the Consilium removed; permission description updated (schema 70); admin setup hint and README.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
403 lines
25 KiB
PHP
403 lines
25 KiB
PHP
<?php
|
||
/**
|
||
* Moderation: Freigabe-Liste (wartende Bilder und Kommentare, gemeldete Inhalte), alle Kommentare
|
||
* mit Markierungen fuer Auffaelliges und der Schimpfwortfilter.
|
||
*/
|
||
require_once __DIR__ . '/includes/bootstrap.php';
|
||
require_once __DIR__ . '/includes/member_profile.php';
|
||
require_permission('comments.moderate');
|
||
|
||
$pdo = db();
|
||
$name = "COALESCE(NULLIF(u.display_name, ''), u.username)";
|
||
|
||
$pendingPictures = $pdo->query(
|
||
"SELECT g.id, g.filename, g.caption, g.moderation_note, g.created_at, g.user_id, g.is_background, g.premade_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();
|
||
|
||
// Kalender-Termine der Mitglieder (Tabelle kommt mit Schema 21) - interne Termine der Leitung nur
|
||
// fuer Moderatoren, die selbst zur Leitung gehoeren (calendar.leadership), Consilium-Termine nur fuer die, die das
|
||
// Consilium sehen (consilium.view)
|
||
$calendarSql = "SELECT e.id, e.title, e.description, e.starts_at, e.moderation_note, e.created_at, e.user_id, $name AS author
|
||
FROM calendar_entries e JOIN users u ON u.id = e.user_id WHERE "
|
||
. (user_has_permission('calendar.leadership') ? '' : "e.audience <> 'internal' AND ")
|
||
. (consilium_can_view() ? '' : "e.audience <> 'consilium' AND ");
|
||
try {
|
||
$pendingCalendar = $pdo->query($calendarSql . "e.status = 'pending' ORDER BY e.created_at")->fetchAll();
|
||
$reportedCalendar = $pdo->query($calendarSql . "e.status = 'visible' AND EXISTS (SELECT 1 FROM content_reports r WHERE r.content_type = 'calendar' AND r.content_id = e.id)")->fetchAll();
|
||
} catch (PDOException $e) {
|
||
$pendingCalendar = $reportedCalendar = [];
|
||
}
|
||
|
||
// 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) + count($pendingCalendar);
|
||
$reportedTotal = count($reportedPictures) + count($reportedComments) + count($reportedCalendar);
|
||
|
||
/** 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 = '<div class="moderation-actions">';
|
||
foreach ($which as $action) {
|
||
[$label, $class] = $labels[$action];
|
||
$confirm = $action === 'delete' ? ' data-confirm="Endgültig löschen?" data-confirm-title="Löschen" data-confirm-danger data-confirm-ok="Löschen"' : '';
|
||
$html .= '<form class="inline-form" method="post" action="/moderation_action.php"' . $confirm . '>' . csrf_field()
|
||
. '<input type="hidden" name="action" value="' . $action . '"><input type="hidden" name="type" value="' . $type . '">'
|
||
. '<input type="hidden" name="id" value="' . $id . '">'
|
||
. ($back !== '' ? '<input type="hidden" name="back" value="' . e($back) . '">' : '')
|
||
. '<button type="submit" class="button-small ' . $class . '">' . $label . '</button></form>';
|
||
}
|
||
return $html . '</div>';
|
||
};
|
||
|
||
/** 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 = '<ul class="moderation-reports">';
|
||
foreach ($list as $report) {
|
||
$html .= '<li>' . icon('flag') . ' <strong>' . e((string) $report['reporter']) . '</strong>'
|
||
. ($report['reason'] ? ': ' . e((string) $report['reason']) : ' <span class="text-muted">(ohne Grund)</span>')
|
||
. ' <span class="text-muted">· ' . e(date('d.m.Y H:i', strtotime((string) $report['created_at']))) . '</span></li>';
|
||
}
|
||
return $html . '</ul>';
|
||
};
|
||
|
||
/** Karte fuer einen Kalender-Termin in der Freigabe-Liste. */
|
||
$calendarCard = static function (array $entry, array $which) use ($actions, $reportList): string {
|
||
$when = date('d.m.Y H:i', strtotime((string) $entry['starts_at'])) . ' Uhr';
|
||
$link = '/calendar.php?month=' . date('Y-m', strtotime((string) $entry['starts_at'])) . '#termin-' . (int) $entry['id'];
|
||
return '<div class="moderation-card moderation-comment"><div class="moderation-calendar-icon">' . icon('calendar') . '</div>'
|
||
. '<div class="moderation-body"><div class="moderation-meta"><span class="badge">Termin</span>'
|
||
. '<a href="/member.php?id=' . (int) $entry['user_id'] . '"><strong>' . e((string) $entry['author']) . '</strong></a>'
|
||
. '<a href="' . e($link) . '" class="text-muted">' . e($when) . '</a></div>'
|
||
. '<p class="moderation-text"><strong>' . e((string) $entry['title']) . '</strong>'
|
||
. (!empty($entry['description']) ? '<br>' . nl2br(e((string) $entry['description']), false) : '') . '</p>'
|
||
. (!empty($entry['moderation_note']) ? '<p class="moderation-reason">Grund: ' . e((string) $entry['moderation_note']) . '</p>' : '')
|
||
. $reportList('calendar', (int) $entry['id'])
|
||
. $actions('calendar', (int) $entry['id'], $which) . '</div></div>';
|
||
};
|
||
|
||
// 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';
|
||
?>
|
||
<div class="panel">
|
||
<h1>Moderation</h1>
|
||
<p class="text-muted">
|
||
Bilder, Kommentare und Kalender-Termine 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.
|
||
</p>
|
||
<form class="settings-toggle" method="post" action="/admin/settings_action.php">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="setting" value="moderation_all">
|
||
<label>
|
||
<input type="checkbox" name="value" value="1" <?= moderation_all_manual() ? 'checked' : '' ?> onchange="this.form.submit()">
|
||
<span><strong>Alles manuell freigeben</strong> - jedes neue Bild und jeder Kommentar wartet auf Freigabe (z.B. bei einer Spam-Welle)</span>
|
||
</label>
|
||
<noscript><button type="submit" class="button-secondary button-small">Speichern</button></noscript>
|
||
</form>
|
||
<nav class="members-segment moderation-tabs" aria-label="Bereiche">
|
||
<a href="/moderation.php" class="<?= $tab === 'queue' ? 'active' : '' ?>">Freigabe<?= $pendingTotal + $reportedTotal > 0 ? ' <span class="chip-count">' . ($pendingTotal + $reportedTotal) . '</span>' : '' ?></a>
|
||
<a href="/moderation.php?tab=comments" class="<?= $tab === 'comments' ? 'active' : '' ?>">Alle Kommentare</a>
|
||
<a href="/moderation.php?tab=filter" class="<?= $tab === 'filter' ? 'active' : '' ?>">Schimpfwortfilter</a>
|
||
</nav>
|
||
</div>
|
||
|
||
<?php if ($tab === 'queue'): ?>
|
||
|
||
<div class="panel">
|
||
<h2>Wartet auf Freigabe <span class="chip-count"><?= $pendingTotal ?></span></h2>
|
||
<?php if ($pendingTotal === 0): ?>
|
||
<p class="text-muted">Alles erledigt - nichts wartet auf Freigabe. 🎉</p>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($pendingPictures): ?>
|
||
<div class="moderation-grid">
|
||
<?php foreach ($pendingPictures as $picture): ?>
|
||
<div class="moderation-card">
|
||
<?php // Hintergrundbilder haben keine eigene Bildseite - Link direkt aufs Bild ?>
|
||
<a href="<?= e(!empty($picture['is_background']) ? profile_image_url($picture['filename']) : '/member_picture.php?id=' . (int) $picture['id']) ?>" class="moderation-thumb"<?= !empty($picture['is_background']) ? ' target="_blank" rel="noopener"' : '' ?>>
|
||
<img src="<?= e(profile_image_url($picture['filename'])) ?>" alt="" loading="lazy">
|
||
</a>
|
||
<div class="moderation-body">
|
||
<div class="moderation-meta">
|
||
<span class="badge"><?= !empty($picture['premade_id']) ? 'Premade-Banner' : (!empty($picture['is_background']) ? 'Profil-Hintergrund' : 'Bild') ?></span>
|
||
<a href="/member.php?id=<?= (int) $picture['user_id'] ?>"><strong><?= e((string) $picture['author']) ?></strong></a>
|
||
<span class="text-muted"><?= e(date('d.m.Y H:i', strtotime((string) $picture['created_at']))) ?></span>
|
||
</div>
|
||
<?php if (!empty($picture['caption'])): ?><p><?= e((string) $picture['caption']) ?></p><?php endif; ?>
|
||
<?php if (!empty($picture['moderation_note'])): ?><p class="moderation-reason">Grund: <?= e((string) $picture['moderation_note']) ?></p><?php endif; ?>
|
||
<?= $reportList('picture', (int) $picture['id']) ?>
|
||
<?= $actions('picture', (int) $picture['id'], ['approve', 'delete']) ?>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php foreach ($pendingCalendar as $calendarEntry): ?>
|
||
<?= $calendarCard($calendarEntry, ['approve', 'delete']) ?>
|
||
<?php endforeach; ?>
|
||
|
||
<?php foreach ($pendingComments as $comment): ?>
|
||
<div class="moderation-card moderation-comment">
|
||
<a href="/member_picture.php?id=<?= (int) $comment['gallery_id'] ?>#kommentar-<?= (int) $comment['id'] ?>" class="moderation-thumb moderation-thumb-small" title="Zum Bild">
|
||
<img src="<?= e(profile_image_url($comment['filename'])) ?>" alt="" loading="lazy">
|
||
</a>
|
||
<div class="moderation-body">
|
||
<div class="moderation-meta">
|
||
<span class="badge">Kommentar</span>
|
||
<a href="/member.php?id=<?= (int) $comment['author_id'] ?>"><strong><?= e((string) $comment['author']) ?></strong></a>
|
||
<span class="text-muted"><?= e(date('d.m.Y H:i', strtotime((string) $comment['created_at']))) ?></span>
|
||
</div>
|
||
<p class="moderation-text"><?= nl2br(e((string) $comment['body']), false) ?></p>
|
||
<?php if (!empty($comment['moderation_note'])): ?><p class="moderation-reason">Grund: <?= e((string) $comment['moderation_note']) ?></p><?php endif; ?>
|
||
<?= $reportList('comment', (int) $comment['id']) ?>
|
||
<?= $actions('comment', (int) $comment['id'], ['approve', 'delete']) ?>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
|
||
<?php if ($reportedTotal > 0): ?>
|
||
<div class="panel">
|
||
<h2>Gemeldet, aber noch sichtbar <span class="chip-count"><?= $reportedTotal ?></span></h2>
|
||
<p class="text-muted">Weniger als <?= MODERATION_REPORT_THRESHOLD ?> Meldungen - noch nicht automatisch ausgeblendet.</p>
|
||
<?php foreach ($reportedCalendar as $calendarEntry): ?>
|
||
<?= $calendarCard($calendarEntry, ['hide', 'dismiss', 'delete']) ?>
|
||
<?php endforeach; ?>
|
||
<?php foreach ($reportedPictures as $picture): ?>
|
||
<div class="moderation-card moderation-comment">
|
||
<a href="/member_picture.php?id=<?= (int) $picture['id'] ?>" class="moderation-thumb moderation-thumb-small">
|
||
<img src="<?= e(profile_image_url($picture['filename'])) ?>" alt="" loading="lazy">
|
||
</a>
|
||
<div class="moderation-body">
|
||
<div class="moderation-meta">
|
||
<span class="badge">Bild</span>
|
||
<a href="/member.php?id=<?= (int) $picture['user_id'] ?>"><strong><?= e((string) $picture['author']) ?></strong></a>
|
||
<?php if (!empty($picture['caption'])): ?><span><?= e((string) $picture['caption']) ?></span><?php endif; ?>
|
||
</div>
|
||
<?= $reportList('picture', (int) $picture['id']) ?>
|
||
<?= $actions('picture', (int) $picture['id'], ['hide', 'dismiss', 'delete']) ?>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
<?php foreach ($reportedComments as $comment): ?>
|
||
<div class="moderation-card moderation-comment">
|
||
<a href="/member_picture.php?id=<?= (int) $comment['gallery_id'] ?>#kommentar-<?= (int) $comment['id'] ?>" class="moderation-thumb moderation-thumb-small" title="Zum Bild">
|
||
<img src="<?= e(profile_image_url($comment['filename'])) ?>" alt="" loading="lazy">
|
||
</a>
|
||
<div class="moderation-body">
|
||
<div class="moderation-meta">
|
||
<span class="badge">Kommentar</span>
|
||
<a href="/member.php?id=<?= (int) $comment['author_id'] ?>"><strong><?= e((string) $comment['author']) ?></strong></a>
|
||
</div>
|
||
<p class="moderation-text"><?= nl2br(e((string) $comment['body']), false) ?></p>
|
||
<?= $reportList('comment', (int) $comment['id']) ?>
|
||
<?= $actions('comment', (int) $comment['id'], ['hide', 'dismiss', 'delete']) ?>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php endif; /* Reiter Freigabe */ ?>
|
||
|
||
<?php if ($tab === 'comments'): ?>
|
||
<div class="panel">
|
||
<h2>Alle Kommentare</h2>
|
||
<form class="list-toolbar" method="get" action="/moderation.php">
|
||
<input type="hidden" name="tab" value="comments">
|
||
<input type="hidden" name="show" value="<?= e($commentFilter) ?>">
|
||
<label class="search-field">
|
||
<?= icon('search') ?>
|
||
<input type="search" name="q" value="<?= e($commentQuery) ?>" placeholder="Text, Verfasser oder Bild-Besitzer suchen …" aria-label="Kommentare durchsuchen">
|
||
</label>
|
||
<div class="list-toolbar-row">
|
||
<div class="members-chips" role="group" aria-label="Filtern">
|
||
<?php foreach (['' => 'Alle', 'flagged' => 'Markiert', 'pending' => 'Wartet auf Freigabe', 'reported' => 'Gemeldet'] as $value => $label): ?>
|
||
<button type="submit" name="show" value="<?= e($value) ?>" class="members-chip<?= $commentFilter === $value ? ' active' : '' ?>">
|
||
<?= e($label) ?> <span class="chip-count"><?= $flagCounts[$value] ?></span>
|
||
</button>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<span class="list-search-count text-muted"><?= count($allComments) ?> <?= count($allComments) === 1 ? 'Kommentar' : 'Kommentare' ?></span>
|
||
</div>
|
||
</form>
|
||
|
||
<?php if (!$commentsShown): ?>
|
||
<p class="text-muted"><?= $commentFilter !== '' || $commentQuery !== '' ? 'Kein Kommentar passt zu Suche und Filter.' : 'Noch keine Kommentare.' ?></p>
|
||
<?php endif; ?>
|
||
<?php foreach ($commentsShown as $comment): ?>
|
||
<div class="moderation-card moderation-comment<?= $comment['critical'] ? ' is-critical' : ($comment['flags'] ? ' is-flagged' : '') ?>">
|
||
<a href="/member_picture.php?id=<?= (int) $comment['gallery_id'] ?>#kommentar-<?= (int) $comment['id'] ?>" class="moderation-thumb moderation-thumb-small" title="Zum Bild">
|
||
<img src="<?= e(profile_image_url($comment['filename'])) ?>" alt="" loading="lazy">
|
||
</a>
|
||
<div class="moderation-body">
|
||
<div class="moderation-meta">
|
||
<a href="/member.php?id=<?= (int) $comment['author_id'] ?>"><strong><?= e((string) $comment['author']) ?></strong></a>
|
||
<span class="text-muted">unter einem Bild von <?= e((string) $comment['owner']) ?> · <?= e(date('d.m.Y H:i', strtotime((string) $comment['created_at']))) ?></span>
|
||
</div>
|
||
<?php if ($comment['flags']): ?>
|
||
<div class="moderation-flags">
|
||
<?php foreach ($comment['flags'] as [$flagText, $level]): ?>
|
||
<span class="mod-flag mod-flag-<?= e($level) ?>"><?= $level === 'critical' ? '⚠' : '•' ?> <?= e($flagText) ?></span>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<p class="moderation-text"><?= nl2br(e((string) $comment['body']), false) ?></p>
|
||
<?= $reportList('comment', (int) $comment['id']) ?>
|
||
<?php
|
||
$commentActions = $comment['status'] === 'pending' ? ['approve', 'delete'] : ['hide', 'delete'];
|
||
if ((int) $comment['report_count'] > 0 && $comment['status'] !== 'pending') {
|
||
array_splice($commentActions, 1, 0, ['dismiss']);
|
||
}
|
||
?>
|
||
<?= $actions('comment', (int) $comment['id'], $commentActions, 'comments') ?>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
<?php if ($commentPageCount > 1): ?>
|
||
<div class="warehouse-pages">
|
||
<span class="text-muted">Seite <?= $commentPage ?> von <?= $commentPageCount ?></span>
|
||
<?php render_pagination($commentUrl(), $commentPage, $commentPageCount); ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($tab === 'filter'): ?>
|
||
<div class="panel">
|
||
<h2>Schimpfwortfilter <span class="chip-count"><?= count($filterWords) ?></span></h2>
|
||
<p class="text-muted">
|
||
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 <code>*</code> auch als Wortteil (<code>fick*</code> findet auch „ficken“, <code>*loch</code> auch „Arschloch“).
|
||
Die Moderation selbst ist vom Filter ausgenommen.
|
||
</p>
|
||
<form class="filter-word-form" method="post" action="/moderation_action.php">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="word_add">
|
||
<input type="text" name="word" maxlength="60" required placeholder="Wort oder Wortteil mit *" aria-label="Wort">
|
||
<select name="word_action" aria-label="Was passiert">
|
||
<?php foreach (MODERATION_WORD_ACTIONS as $value => $label): ?>
|
||
<option value="<?= e($value) ?>" <?= $value === 'hold' ? 'selected' : '' ?>><?= e($label) ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<button type="submit">Hinzufügen</button>
|
||
</form>
|
||
<div class="filter-word-legend">
|
||
<span class="filter-word filter-word-flag">Nur markieren</span> erscheint markiert in „Alle Kommentare“
|
||
<span class="filter-word filter-word-hold">Zurückhalten</span> erst nach Freigabe sichtbar
|
||
<span class="filter-word filter-word-block">Blockieren</span> wird gar nicht gespeichert
|
||
</div>
|
||
<?php foreach (MODERATION_WORD_ACTIONS as $wordAction => $wordLabel): ?>
|
||
<?php $group = array_keys(array_filter($filterWords, static fn ($a) => $a === $wordAction)); ?>
|
||
<?php if (!$group) continue; ?>
|
||
<h3 class="filter-word-heading"><?= e($wordLabel) ?> <span class="chip-count"><?= count($group) ?></span></h3>
|
||
<div class="filter-word-list">
|
||
<?php foreach ($group as $word): ?>
|
||
<form class="filter-word filter-word-<?= e($wordAction) ?>" method="post" action="/moderation_action.php">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="word" value="<?= e((string) $word) ?>">
|
||
<span><?= e((string) $word) ?></span>
|
||
<select name="word_action" onchange="this.form.action.value = 'word_add'; this.form.submit()" aria-label="Aktion für <?= e((string) $word) ?>" title="Aktion ändern">
|
||
<?php foreach (['flag' => 'markieren ▾', 'hold' => 'zurückhalten ▾', 'block' => 'blockieren ▾'] as $value => $label): ?>
|
||
<option value="<?= e($value) ?>" <?= $value === $wordAction ? 'selected' : '' ?>><?= e($label) ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<input type="hidden" name="action" value="word_delete">
|
||
<button type="submit" class="filter-word-remove" title="Entfernen" aria-label="<?= e((string) $word) ?> entfernen" onclick="this.form.action.value = 'word_delete'">×</button>
|
||
</form>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php include __DIR__ . '/includes/footer.php'; ?>
|