LuminaWebsite/admin/settings_action.php
Maaxxs dd7ad2a25b Beitragspunkte: switch for public history, old logo back
Above the history, people with contributions.manage can switch "Verlauf für
alle sichtbar" (default on). Turned off, everyone else sees only the ranking,
without history and without links on the cards. Settings now carry their own
permission and return page, so the same action serves this switch and the
Discord unlink switch in the user list.

The sidebar, login page and mobile top bar show the previous logo again;
the new logo files are removed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 09:31:19 +02:00

24 lines
738 B
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');
set_flash('success', 'Einstellung gespeichert.');
redirect($returnTo);