LuminaWebsite/admin/settings_action.php
Maaxxs e4f23fcde4 Audit log, abuse protection, gallery comments with moderation, safe image uploads, 404 page
- 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>
2026-09-21 21:57:34 +02:00

34 lines
1.1 KiB
PHP

<?php
require_once __DIR__ . '/../includes/bootstrap.php';
require_login();
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
redirect('/dashboard.php');
}
verify_csrf();
$key = (string) ($_POST['setting'] ?? '');
if (!array_key_exists($key, SETTINGS_DEFAULTS) || !isset(SETTINGS_ACCESS[$key])) {
set_flash('error', 'Unbekannte Einstellung.');
redirect('/dashboard.php');
}
// Jede Einstellung gehoert zu einem Bereich und braucht dessen Recht.
[$permission, $returnTo] = SETTINGS_ACCESS[$key];
require_permission($permission);
// Bisher gibt es nur Ja/Nein-Einstellungen: angehakt = "1", sonst "0".
setting_set($key, isset($_POST['value']) ? '1' : '0');
$settingLabels = [
'discord_unlink_allowed' => 'Mitglieder dürfen ihre Discord-Verknüpfung lösen',
'contributions_history_public' => 'Lumipunkte-Verlauf für alle sichtbar',
'moderation_all' => 'Alle neuen Bilder und Kommentare manuell freigeben',
];
admin_log('⚙️ Einstellung geändert', [
'Einstellung' => $settingLabels[$key] ?? $key,
'Neuer Wert' => isset($_POST['value']) ? 'an' : 'aus',
]);
set_flash('success', 'Einstellung gespeichert.');
redirect($returnTo);