- Audit log: every admin_log entry is also stored permanently in the database (admin/audit.php, audit.view) - Rate limits per account, login throttling per IP (not per account), emergency lock after mass deletions, force logout / lock in user management - Comments under gallery pictures (picture page, report button, owner can disable them) - Moderation: new members, links, reported content and a "moderate everything" switch go to the approval list (moderation.php) - Every uploaded image is re-encoded (strips appended code and EXIF data) - Custom 404 page, also shown for pages without permission Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
73 lines
3.5 KiB
PHP
73 lines
3.5 KiB
PHP
<?php
|
||
require_once __DIR__ . '/includes/bootstrap.php';
|
||
require_once __DIR__ . '/includes/wiki.php';
|
||
require_permission('wiki.view');
|
||
|
||
$page = wiki_page_by_id((int) ($_GET['id'] ?? 0));
|
||
if (!$page) {
|
||
show_not_found();
|
||
}
|
||
$canManage = wiki_can_manage();
|
||
|
||
$stmt = db()->prepare(
|
||
"SELECT r.id, r.title, r.summary, r.created_at, r.is_wip, CHAR_LENGTH(r.content) AS length,
|
||
COALESCE(NULLIF(u.display_name, ''), u.username) AS editor
|
||
FROM wiki_revisions r LEFT JOIN users u ON u.id = r.edited_by
|
||
WHERE r.page_id = ? ORDER BY r.created_at DESC, r.id DESC"
|
||
);
|
||
$stmt->execute([(int) $page['id']]);
|
||
$revisions = $stmt->fetchAll();
|
||
|
||
// Eine alte Version ansehen
|
||
$shown = null;
|
||
$revisionId = (int) ($_GET['rev'] ?? 0);
|
||
if ($revisionId > 0) {
|
||
$s = db()->prepare('SELECT * FROM wiki_revisions WHERE id = ? AND page_id = ?');
|
||
$s->execute([$revisionId, (int) $page['id']]);
|
||
$shown = $s->fetch() ?: null;
|
||
}
|
||
|
||
$pageTitle = 'Verlauf: ' . $page['title'] . ' - Wiki';
|
||
include __DIR__ . '/includes/header.php';
|
||
?>
|
||
<div class="panel">
|
||
<nav class="wiki-breadcrumb"><a href="/wiki.php">Wiki</a> <span>›</span> <a href="/wiki.php?page=<?= e(rawurlencode($page['slug'])) ?>"><?= e($page['title']) ?></a></nav>
|
||
<h1>Verlauf</h1>
|
||
<p class="text-muted">Jede gespeicherte Änderung dieser Seite. <?= $canManage ? 'Eine ältere Version lässt sich ansehen und wiederherstellen.' : 'Ältere Versionen kannst du dir ansehen.' ?></p>
|
||
|
||
<div class="table-scroll">
|
||
<table>
|
||
<thead><tr><th>Zeitpunkt</th><th>Von</th><th>Änderung</th><th>Länge</th><th></th></tr></thead>
|
||
<tbody>
|
||
<?php foreach ($revisions as $i => $revision): ?>
|
||
<tr<?= $shown && (int) $shown['id'] === (int) $revision['id'] ? ' class="row-pending"' : '' ?>>
|
||
<td><?= e(date('d.m.Y H:i', strtotime($revision['created_at']))) ?><?= $i === 0 ? ' <span class="badge badge-active">aktuell</span>' : '' ?></td>
|
||
<td><?= e($revision['editor'] ?? 'Unbekannt') ?></td>
|
||
<td><?= e($revision['summary'] ?? '') ?><?= $revision['title'] !== $page['title'] ? ' <span class="text-muted">(Titel: ' . e($revision['title']) . ')</span>' : '' ?></td>
|
||
<td class="text-muted"><?= number_format((int) $revision['length'], 0, ',', '.') ?> Zeichen</td>
|
||
<td><?php if ($i > 0): ?><a href="/wiki_history.php?id=<?= (int) $page['id'] ?>&rev=<?= (int) $revision['id'] ?>">ansehen</a><?php endif; ?></td>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if ($shown): ?>
|
||
<div class="panel wiki-article">
|
||
<div class="raid-header">
|
||
<h2>Version vom <?= e(date('d.m.Y H:i', strtotime($shown['created_at']))) ?> Uhr</h2>
|
||
<?php if ($canManage): ?>
|
||
<form method="post" action="/wiki_action.php" class="inline-form" onsubmit="return confirm('Diese Version wiederherstellen? Die aktuelle bleibt im Verlauf erhalten.');">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="restore">
|
||
<input type="hidden" name="revision_id" value="<?= (int) $shown['id'] ?>">
|
||
<button type="submit" class="button-small">Diese Version wiederherstellen</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
<h1><?= e($shown['title']) ?></h1>
|
||
<div class="wiki-content"><?= wiki_render($shown['content']) ?></div>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php include __DIR__ . '/includes/footer.php'; ?>
|