LuminaWebsite/data_export.php
Maaxxs cd8716e791 Data export and account deletion (anonymization) with a grace period
- Data export (Art. 15/20 GDPR, includes/data_export.php): ZIP with daten.json, LIESMICH.txt and the
  member's own images (avatar, characters, gallery, bug reports). It covers every table related to the
  account plus, via the bot API, raid sign-ups, premades, created events and activity checks. Password hash,
  tokens and player reports (they name the reporters) are left out. The ZIP is written by data_export_zip(),
  so the PHP zip extension is not needed.
- Members find export and deletion under "Mein Profil" at the very bottom in a collapsed "Konto & Daten"
  section (data_export.php, account_delete.php).
- Leadership: new icon "Daten & Löschung" in the user admin (admin/user_export.php, permission users.export).
  It downloads the export or creates a download link for someone without access (datenauskunft.php?t=...,
  7 days, 5 downloads, only the SHA-256 hash stored in data_export_links). The link page shows a button first,
  so link previews don't use up downloads. It also works in maintenance mode.
- Account deletion (includes/account_deletion.php): the account is anonymized instead of removed.
  - Deleted: profile, avatar, characters, gallery, gear sets, private tactics, groups, tokens, calendar
    participations and bug report images.
  - Contributions remain as "Ehemaliges Mitglied" without name or Discord ID.
  - Requested by the member (type LÖSCHEN) or by the leadership (users.delete, also immediately).
  - Executed after 7 days by account_deletion_run_due(); logging in before that cancels it and tells the member.
- The user admin shows "Löschung am ..." and "Gelöscht (unkenntlich)". Privacy policy, README and a
  leadership patch note are updated. Schema v44 (users.deletion_scheduled_at, users.deleted_at, data_export_links).

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

30 lines
1,018 B
PHP

<?php
/**
* "Meine Daten herunterladen" (Mein Profil): Datenauskunft zum eigenen Konto als ZIP -
* siehe includes/data_export.php.
*/
require_once __DIR__ . '/includes/bootstrap.php';
require_once __DIR__ . '/includes/data_export.php';
$me = current_user();
if (!$me) {
redirect('/login.php');
}
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
redirect('/profile.php?konto#meine-daten');
}
verify_csrf();
if (!security_throttle('export')) {
set_flash('error', 'Du hast deine Daten gerade schon mehrmals heruntergeladen - versuch es in einer Stunde noch einmal.');
redirect('/profile.php?konto#meine-daten');
}
// Nur ins Audit-Log, nicht in den Discord-Log der Leitung - das ist die eigene Sache des Mitglieds
audit_store('📦 Eigene Daten heruntergeladen', [], 'info', 'users');
try {
data_export_send((int) $me['id']);
} catch (Throwable $e) {
set_flash('error', 'Deine Daten konnten nicht zusammengestellt werden: ' . $e->getMessage());
redirect('/profile.php?konto#meine-daten');
}