LuminaWebsite/admin/legal_action.php
Maaxxs 62d6634829 Impressum and privacy policy, third-party videos and images load only after a click
- impressum.php (§ 18 MStV) and datenschutz.php, which describes what the website and the Discord bot
  actually process: Discord login scopes, member area, bot data (raids, premades, player reports with the
  automatic 48 h timeout, activity checks), cookies and browser storage keys, retention periods and rights.
  Both stay reachable in maintenance mode and are noindex. Operator data defaults to the c/o address of the
  Impressum service Online-Impressum.de (LEGAL_OPERATOR_DEFAULT), the hoster to Living-Bots; both can be
  changed under Admin -> Impressum & Datenschutz (new permission site.legal, schema v43). The audit/Discord
  log only records which fields changed, not the name or address.
- Links in the footer of all public pages, the start page footer, the sidebar and the maintenance page,
  plus a short data notice on the login page.
- Wiki and profile texts: YouTube, Twitch and Vimeo players and images or video files from other servers
  render as placeholders and load only after a click (embed_consent_html(), assets/js/embed-consent.js).
  "immer direkt laden" is remembered per provider in localStorage and can be reset in the privacy policy.
  Image URLs are now protected from inline formatting (e.g. _underscores_ in the address).
- map_frame.php only serves logged-in, active members.
- Deleting a user also removes the avatar file; audit_log entries older than 12 months are deleted
  automatically (AUDIT_LOG_KEEP_MONTHS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 16:26:54 +02:00

59 lines
2.8 KiB
PHP

<?php
/** Speichert die Angaben fuer Impressum und Datenschutzerklaerung (admin/legal.php). */
require_once __DIR__ . '/../includes/bootstrap.php';
require_permission('site.legal');
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
redirect('/admin/legal.php');
}
verify_csrf();
$clean = static fn (string $key): string => trim(str_replace("\r\n", "\n", (string) ($_POST[$key] ?? '')));
$name = $clean('name');
$address = (string) preg_replace("/\n{2,}/", "\n", $clean('address'));
$email = $clean('email');
$hoster = (string) preg_replace("/\n{2,}/", "\n", $clean('hoster'));
$error = null;
if (!mb_check_encoding($name . $address . $email . $hoster, 'UTF-8')) {
$error = 'Die Angaben enthalten ungültige Zeichen.';
} elseif (mb_strlen($name) > LEGAL_NAME_MAX) {
$error = 'Der Name darf höchstens ' . LEGAL_NAME_MAX . ' Zeichen lang sein.';
} elseif (mb_strlen($address) > LEGAL_ADDRESS_MAX) {
$error = 'Die Anschrift darf höchstens ' . LEGAL_ADDRESS_MAX . ' Zeichen lang sein.';
} elseif (mb_strlen($email) > LEGAL_EMAIL_MAX || ($email !== '' && filter_var($email, FILTER_VALIDATE_EMAIL) === false)) {
$error = 'Die E-Mail-Adresse ist ungültig.';
} elseif (mb_strlen($hoster) > LEGAL_HOSTER_MAX) {
$error = 'Die Angabe zum Hoster darf höchstens ' . LEGAL_HOSTER_MAX . ' Zeichen lang sein.';
} elseif (($name === '') !== ($address === '')) {
$error = $name === '' ? 'Bitte auch den Namen eintragen - ohne ihn ist das Impressum unvollständig.'
: 'Bitte auch die Anschrift eintragen - ohne sie ist das Impressum unvollständig.';
}
if ($error !== null) {
set_flash('error', $error);
redirect('/admin/legal.php');
}
// Leere Felder = Standard aus dem Code (LEGAL_OPERATOR_DEFAULT, LEGAL_HOSTER_DEFAULT)
$defaults = LEGAL_OPERATOR_DEFAULT + ['hoster' => LEGAL_HOSTER_DEFAULT];
$before = legal_operator() + ['hoster' => legal_hoster()];
$after = [];
foreach (['name' => $name, 'address' => $address, 'email' => $email, 'hoster' => $hoster] as $field => $value) {
$after[$field] = $value !== '' ? $value : $defaults[$field];
// Wie der Standard gespeichert wird nichts - so greift ein neuer Standard aus dem Code
setting_set('legal_' . $field, $after[$field] === $defaults[$field] ? '' : $after[$field]);
}
// Nur WAS sich geaendert hat - Name und Anschrift sollen nicht zusaetzlich im Log-Kanal auf Discord landen
$changed = array_keys(array_filter([
'Name' => $before['name'] !== $after['name'],
'Anschrift' => $before['address'] !== $after['address'],
'E-Mail' => $before['email'] !== $after['email'],
'Hoster' => $before['hoster'] !== $after['hoster'],
]));
if ($changed) {
admin_log('⚖️ Angaben für Impressum & Datenschutz geändert', ['Geändert' => implode(', ', $changed)], 'info', 'site');
}
set_flash('success', 'Gespeichert - Impressum und Datenschutzerklärung zeigen jetzt diese Angaben.');
redirect('/admin/legal.php');