Asked for: Damaskar's proposal (iCalendar/webcal feed with a personal token URL in the profile, "Feed-URL neu generieren", token blocked when a member leaves or is banned) - "da soll man aber nur die synchronisiert werden für die man sich auch anmelden kann". - calendar_feed.php + includes/calendar_feed.php: calendar_feed.php?t=<48 hex> returns an .ics (RFC 5545, UTC, folded lines, ETag/304) without login, also in maintenance mode. Content = what you can sign up for: active raids (raids.view + linked Discord) with your own state (signed up with class and group, bench, declined, invite pending), archived ones only if you were in; member entries where "Bin dabei" is possible (audience rules of calendar_audience.php), your own and joined ones. Past entries stay 90 days if you took part. No bot event reminders and no names of other members; TRANSP busy/free by participation. - New table calendar_feeds (one per account, schema version 66): token in plain text so the profile can show it again, looked up by its SHA-256; bound to users.session_epoch like "Angemeldet bleiben" (forced logout, lock and deletion request invalidate it). Unknown address 404; invalid address, locked account or no rights 403; leaving the Discord server (checked at most hourly via discord_live_check) deletes the feed; 60 fetches per hour and feed (audit log entry); bot down 503 so the apps keep their last state. No lockout per IP - shared fetchers like Google would be hit by stale addresses. - profile.php: "Kalender-Abo" panel - set up, copy, one-click links for Google Kalender, Outlook and webcal, manual steps per app, last fetch with the app type, new address / end subscription with confirmation; calendar.php links to it. - Privacy page, data export (kalender_abo without the address), account deletion, patch note and README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
510 lines
30 KiB
PHP
510 lines
30 KiB
PHP
<?php
|
||
require_once __DIR__ . '/includes/bootstrap.php';
|
||
require_once __DIR__ . '/includes/calendar_feed.php';
|
||
require_login();
|
||
|
||
$user = current_user();
|
||
$profileError = null;
|
||
$passwordError = null;
|
||
$avatarError = null;
|
||
$avatarUploadDir = __DIR__ . '/assets/uploads/avatars/';
|
||
|
||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||
verify_csrf();
|
||
$action = (string) ($_POST['action'] ?? '');
|
||
|
||
if ($action === 'update_profile') {
|
||
$displayName = trim((string) ($_POST['display_name'] ?? ''));
|
||
// Mit Discord-Verknuepfung folgt der Anzeigename dem Namen auf dem Discord-Server.
|
||
if (!empty($user['discord_id'])) {
|
||
$displayName = (string) $user['display_name'];
|
||
}
|
||
if ($displayName === '') {
|
||
$profileError = 'Anzeigename darf nicht leer sein.';
|
||
} elseif (mb_strlen($displayName) > 100) {
|
||
$profileError = 'Der Anzeigename darf höchstens 100 Zeichen lang sein.';
|
||
} else {
|
||
db()->prepare('UPDATE users SET display_name = ? WHERE id = ?')->execute([$displayName, $user['id']]);
|
||
set_flash('success', 'Profil wurde aktualisiert.');
|
||
redirect('/profile.php');
|
||
}
|
||
$user['display_name'] = $displayName;
|
||
} elseif ($action === 'change_password' && !empty($user['password_login'])) {
|
||
$newPassword = (string) ($_POST['new_password'] ?? '');
|
||
$newPasswordConfirm = (string) ($_POST['new_password_confirm'] ?? '');
|
||
|
||
if (strlen($newPassword) < 8) {
|
||
$passwordError = 'Das neue Passwort muss mindestens 8 Zeichen lang sein.';
|
||
} elseif ($newPassword !== $newPasswordConfirm) {
|
||
$passwordError = 'Die Passwörter stimmen nicht überein.';
|
||
} else {
|
||
db()->prepare('UPDATE users SET password_hash = ?, must_change_password = 0 WHERE id = ?')
|
||
->execute([password_hash($newPassword, PASSWORD_DEFAULT), $user['id']]);
|
||
set_flash('success', 'Passwort wurde geändert.');
|
||
redirect('/profile.php');
|
||
}
|
||
} elseif ($action === 'update_avatar') {
|
||
$file = $_FILES['avatar'] ?? null;
|
||
$allowedTypes = [IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_WEBP];
|
||
|
||
if (!$file || ($file['error'] ?? UPLOAD_ERR_NO_FILE) === UPLOAD_ERR_NO_FILE) {
|
||
$avatarError = 'Bitte eine Bilddatei auswählen.';
|
||
} elseif ($file['error'] !== UPLOAD_ERR_OK) {
|
||
$avatarError = 'Upload fehlgeschlagen.';
|
||
} elseif ($file['size'] > 3 * 1024 * 1024) {
|
||
$avatarError = 'Die Datei ist zu groß (max. 3 MB).';
|
||
} else {
|
||
// Dateityp wird ausschließlich am tatsaechlichen Bildinhalt erkannt (nicht am
|
||
// Originalnamen), die Endung selbst erzeugt - so kann keine ausfuehrbare Datei
|
||
// unter falschem Namen/falscher Endung eingeschleust werden.
|
||
$imageInfo = @getimagesize($file['tmp_name']);
|
||
if ($imageInfo === false || !in_array($imageInfo[2], $allowedTypes, true)) {
|
||
$avatarError = 'Nur JPG, PNG, GIF oder WEBP sind als Profilbild erlaubt.';
|
||
} else {
|
||
$filename = 'user' . $user['id'] . '_' . bin2hex(random_bytes(8)) . '.' . image_type_to_extension($imageInfo[2], false);
|
||
|
||
// Neu rechnen (entfernt angehaengten Code/EXIF) und auf 512 px begrenzen
|
||
$storeError = store_uploaded_image($file['tmp_name'], $avatarUploadDir . $filename, $imageInfo[2], 512);
|
||
if ($storeError === null) {
|
||
$oldFilename = $user['avatar_filename'] ?? null;
|
||
// Eigenes Bild: nicht mehr vom Discord-Profilbild ueberschreiben lassen.
|
||
db()->prepare('UPDATE users SET avatar_filename = ?, avatar_sync = 0, discord_avatar = NULL WHERE id = ?')
|
||
->execute([$filename, $user['id']]);
|
||
if ($oldFilename && is_file($avatarUploadDir . $oldFilename)) {
|
||
@unlink($avatarUploadDir . $oldFilename);
|
||
}
|
||
set_flash('success', 'Profilbild wurde aktualisiert.');
|
||
redirect('/profile.php');
|
||
} else {
|
||
$avatarError = $storeError;
|
||
}
|
||
}
|
||
}
|
||
} elseif ($action === 'set_main_class') {
|
||
// Main-Klasse: nur eine der Klassen, die man auf Discord gewaehlt hat
|
||
$choice = (string) ($_POST['main_class'] ?? '');
|
||
if (!in_array($choice, classes_from_list($user['classes'] ?? null), true)) {
|
||
set_flash('error', 'Diese Klasse hast du auf unserem Discord nicht ausgewählt.');
|
||
} else {
|
||
db()->prepare('UPDATE users SET main_class = ?, class_name = ? WHERE id = ?')->execute([$choice, $choice, $user['id']]);
|
||
set_flash('success', $choice . ' ist jetzt deine Main-Klasse.');
|
||
}
|
||
redirect('/profile.php#klassen');
|
||
} elseif ($action === 'sync_discord' && !empty($user['discord_id'])) {
|
||
// Klassen (und Gruppen) gleich abgleichen, statt auf den naechsten automatischen Abgleich zu
|
||
// warten - hoechstens alle 30 Sekunden.
|
||
$stmt = db()->prepare('SELECT discord_synced_at FROM users WHERE id = ?');
|
||
$stmt->execute([$user['id']]);
|
||
$lastSync = strtotime((string) $stmt->fetchColumn()) ?: 0;
|
||
if ($lastSync > time() - 30) {
|
||
set_flash('info', 'Gerade eben erst abgeglichen - versuch es in ein paar Sekunden noch einmal.');
|
||
} elseif (!security_throttle('discord_sync')) {
|
||
set_flash('error', 'Du hast in der letzten Stunde schon oft abgeglichen. Automatisch passiert das ohnehin alle paar Minuten.');
|
||
} else {
|
||
$result = discord_live_check((int) $user['id'], true);
|
||
$messages = [
|
||
'ok' => ['success', 'Mit Discord abgeglichen - Name, Klassen und Gruppen sind aktuell.'],
|
||
'no_token' => ['info', 'Melde dich einmal über „Mit Discord einloggen“ an, dann werden deine Klassen erkannt.'],
|
||
'revoked' => ['info', 'Deine Discord-Anmeldung ist abgelaufen - melde dich einmal über „Mit Discord einloggen“ an.'],
|
||
'left' => ['error', 'Du bist nicht mehr auf unserem Discord-Server.'],
|
||
'error' => ['error', 'Discord war gerade nicht erreichbar - versuch es später noch einmal.'],
|
||
];
|
||
[$type, $message] = $messages[$result] ?? ['error', 'Abgleich fehlgeschlagen.'];
|
||
set_flash($type, $message);
|
||
}
|
||
redirect('/profile.php#klassen');
|
||
} elseif ($action === 'restart_tour') {
|
||
// Einfuehrung zuruecksetzen - sie startet beim naechsten Aufruf des Dashboards.
|
||
db()->prepare('UPDATE users SET tour_completed_at = NULL WHERE id = ?')->execute([$user['id']]);
|
||
redirect('/dashboard.php');
|
||
} elseif ($action === 'use_discord_avatar' && !empty($user['discord_id'])) {
|
||
// Wieder das Discord-Profilbild verwenden: eigenes Bild weg, Übernahme an, sofort abgleichen.
|
||
$oldFilename = $user['avatar_filename'] ?? null;
|
||
db()->prepare('UPDATE users SET avatar_filename = NULL, avatar_sync = 1, discord_avatar = NULL WHERE id = ?')
|
||
->execute([$user['id']]);
|
||
if ($oldFilename && is_file($avatarUploadDir . $oldFilename)) {
|
||
@unlink($avatarUploadDir . $oldFilename);
|
||
}
|
||
$result = discord_live_check((int) $user['id'], true);
|
||
set_flash($result === 'ok' ? 'success' : 'info', $result === 'ok'
|
||
? 'Dein Discord-Profilbild wird jetzt verwendet und bleibt automatisch aktuell.'
|
||
: 'Dein Discord-Profilbild wird ab der nächsten Discord-Anmeldung übernommen.');
|
||
redirect('/profile.php');
|
||
} elseif ($action === 'remove_avatar') {
|
||
$oldFilename = $user['avatar_filename'] ?? null;
|
||
// Bewusst kein Bild: auch nicht wieder von Discord holen.
|
||
db()->prepare('UPDATE users SET avatar_filename = NULL, avatar_sync = 0, discord_avatar = NULL WHERE id = ?')->execute([$user['id']]);
|
||
if ($oldFilename && is_file($avatarUploadDir . $oldFilename)) {
|
||
@unlink($avatarUploadDir . $oldFilename);
|
||
}
|
||
set_flash('success', 'Profilbild wurde entfernt.');
|
||
redirect('/profile.php');
|
||
} elseif ($action === 'calendar_feed_renew' && calendar_feed_allowed($user)) {
|
||
// Kalender-Abo einrichten bzw. neue Adresse erzeugen - eine vorhandene gilt danach nicht mehr (includes/calendar_feed.php)
|
||
$hadFeed = calendar_feed_get((int) $user['id']) !== null;
|
||
calendar_feed_renew((int) $user['id']);
|
||
set_flash('success', $hadFeed
|
||
? 'Neue Adresse erzeugt – die bisherige gilt nicht mehr. Trag die neue in deiner Kalender-App ein.'
|
||
: 'Dein Kalender-Abo ist eingerichtet – jetzt nur noch in deiner Kalender-App hinzufügen.');
|
||
redirect('/profile.php#kalender-abo');
|
||
} elseif ($action === 'calendar_feed_delete') {
|
||
calendar_feed_delete((int) $user['id']);
|
||
set_flash('success', 'Kalender-Abo beendet – die Adresse funktioniert nicht mehr. Den Kalender kannst du jetzt aus deiner Kalender-App entfernen.');
|
||
redirect('/profile.php#kalender-abo');
|
||
}
|
||
}
|
||
|
||
$pageTitle = 'Mein Profil';
|
||
include __DIR__ . '/includes/header.php';
|
||
?>
|
||
<div class="panel">
|
||
<div class="profile-header">
|
||
<div class="avatar-edit-wrap">
|
||
<?= avatar_html($user, 120) ?>
|
||
<label class="avatar-edit-btn" for="avatar-upload-input" title="Profilbild ändern">
|
||
<?= icon('edit') ?>
|
||
</label>
|
||
</div>
|
||
<div>
|
||
<h1>Mein Profil</h1>
|
||
<p class="text-muted">Benutzername: <strong><?= e($user['username']) ?></strong></p>
|
||
<?php if ($avatarError): ?>
|
||
<p class="flash flash-error" style="margin-top:0.5rem;"><?= e($avatarError) ?></p>
|
||
<?php endif; ?>
|
||
<?php if (!empty($user['discord_id']) && !empty($user['avatar_sync'])): ?>
|
||
<p class="avatar-sync-hint"><?= discord_logo(14) ?> Dein Profilbild wird automatisch von Discord übernommen. Lädst du ein eigenes hoch, bleibt dieses bestehen.</p>
|
||
<?php elseif (!empty($user['discord_id'])): ?>
|
||
<form method="post" action="/profile.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="use_discord_avatar">
|
||
<button type="submit" class="button-secondary button-small avatar-sync-button"><?= discord_logo(14) ?> Discord-Profilbild verwenden</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
<?php if (!empty($user['avatar_filename'])): ?>
|
||
<form method="post" action="/profile.php" class="inline-form" data-confirm="Profilbild wirklich entfernen?" data-confirm-title="Profilbild entfernen" data-confirm-danger data-confirm-ok="Entfernen">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="remove_avatar">
|
||
<button type="submit" class="text-button" style="font-size:0.85rem;margin-top:0.4rem;">Profilbild entfernen</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
<form id="avatar-upload-form" method="post" action="/profile.php" enctype="multipart/form-data" style="display:none;">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="update_avatar">
|
||
<input type="file" id="avatar-upload-input" name="avatar" accept="image/png,image/jpeg,image/gif,image/webp">
|
||
</form>
|
||
</div>
|
||
<script>
|
||
document.getElementById('avatar-upload-input').addEventListener('change', function () {
|
||
if (this.files && this.files.length) {
|
||
document.getElementById('avatar-upload-form').submit();
|
||
}
|
||
});
|
||
</script>
|
||
|
||
<div class="profile-grid">
|
||
<div class="panel profile-card">
|
||
<h2>Anzeigename</h2>
|
||
<?php if ($profileError): ?>
|
||
<div class="flash flash-error"><?= e($profileError) ?></div>
|
||
<?php endif; ?>
|
||
<form method="post" action="/profile.php" class="profile-card-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="update_profile">
|
||
<div>
|
||
<label for="display_name">Anzeigename</label>
|
||
<input type="text" id="display_name" name="display_name" value="<?= e($user['display_name']) ?>" maxlength="100" required<?= !empty($user['discord_id']) ? ' readonly' : '' ?>>
|
||
<?php if (!empty($user['discord_id'])): ?>
|
||
<div class="field-hint"><?= discord_logo(12) ?> Wird automatisch von deinem Namen auf unserem Discord-Server übernommen. Ändern kannst du ihn dort über „Server-Profil bearbeiten“.</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php if (empty($user['discord_id'])): ?>
|
||
<button type="submit" class="profile-card-button">Speichern</button>
|
||
<?php endif; ?>
|
||
</form>
|
||
</div>
|
||
|
||
<?php $myClasses = user_classes($user); ?>
|
||
<div class="panel profile-card" id="klassen">
|
||
<h2>Klassen</h2>
|
||
<?php if ($myClasses): ?>
|
||
<form method="post" action="/profile.php" class="profile-classes-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="set_main_class">
|
||
<div class="profile-classes" role="radiogroup" aria-label="Main-Klasse">
|
||
<?php foreach ($myClasses as $class): ?>
|
||
<?php $isMain = $class === ($user['class_name'] ?? ''); ?>
|
||
<label class="profile-class<?= $isMain ? ' is-main' : '' ?>">
|
||
<?php if (count($myClasses) > 1): ?>
|
||
<input type="radio" name="main_class" value="<?= e($class) ?>"<?= $isMain ? ' checked' : '' ?> onchange="this.form.submit()">
|
||
<?php endif; ?>
|
||
<?= class_badge_html($class, 30) ?>
|
||
<span class="profile-class-name"><?= e($class) ?></span>
|
||
<?php if ($isMain && count($myClasses) > 1): ?><span class="profile-class-main">Main</span><?php endif; ?>
|
||
</label>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php if (count($myClasses) > 1): ?>
|
||
<noscript><button type="submit" class="button-secondary button-small">Main-Klasse speichern</button></noscript>
|
||
<p class="field-hint">Du spielst mehrere Klassen: Wähle deine Main-Klasse - sie steht überall als erste und wird z.B. bei der Raid-Anmeldung vorausgewählt.</p>
|
||
<?php endif; ?>
|
||
</form>
|
||
<?php else: ?>
|
||
<p class="text-muted">Noch keine Klasse erkannt.</p>
|
||
<?php endif; ?>
|
||
<?php if (!empty($user['discord_id'])): ?>
|
||
<p class="field-hint"><?= discord_logo(12) ?> Deine Klassen kommen automatisch von deinen Klassenrollen auf unserem Discord-Server - ändern kannst du sie nur dort.</p>
|
||
<form method="post" action="/profile.php" class="profile-classes-sync">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="sync_discord">
|
||
<button type="submit" class="button-secondary button-small"><?= discord_logo(14) ?> Jetzt mit Discord abgleichen</button>
|
||
</form>
|
||
<?php else: ?>
|
||
<p class="field-hint">Die Klassen kommen von deinen Klassenrollen auf unserem Discord-Server. Verknüpfe unten dein Discord-Konto, dann werden sie automatisch erkannt.</p>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<?php if (!empty($user['password_login'])): ?>
|
||
<div class="panel profile-card">
|
||
<h2>Passwort ändern</h2>
|
||
<?php if ($passwordError): ?>
|
||
<div class="flash flash-error"><?= e($passwordError) ?></div>
|
||
<?php endif; ?>
|
||
<form method="post" action="/profile.php" class="profile-card-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="change_password">
|
||
<div>
|
||
<label for="new_password">Neues Passwort</label>
|
||
<input type="password" id="new_password" name="new_password" required>
|
||
<div class="field-hint">Mindestens 8 Zeichen.</div>
|
||
</div>
|
||
<div>
|
||
<label for="new_password_confirm">Neues Passwort wiederholen</label>
|
||
<input type="password" id="new_password_confirm" name="new_password_confirm" required>
|
||
</div>
|
||
<button type="submit" class="profile-card-button">Passwort speichern</button>
|
||
</form>
|
||
</div>
|
||
<?php else: ?>
|
||
<div class="panel profile-card">
|
||
<h2>Anmeldung</h2>
|
||
<p class="text-muted">Du meldest dich über Discord an. Die Anmeldung mit Benutzername und Passwort ist für dein Konto nicht freigeschaltet - das kann die Legionsleitung bei Bedarf ändern.</p>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<div class="panel discord-card">
|
||
<div class="discord-card-header">
|
||
<?= discord_logo(40) ?>
|
||
<div>
|
||
<h2>Discord</h2>
|
||
<?php if (!empty($user['discord_id'])): ?>
|
||
<span class="badge badge-active">Verbunden</span>
|
||
<?php else: ?>
|
||
<span class="badge badge-disabled">Nicht verbunden</span>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
<?php if (!empty($user['discord_id'])): ?>
|
||
<p>Verknüpft als <strong><?= e((string) $user['discord_username']) ?></strong></p>
|
||
<p class="text-muted">Deine Berechtigungsgruppen werden automatisch mit deinen Rollen auf dem Discord-Server abgeglichen.</p>
|
||
<?php if (!discord_unlink_allowed()): ?>
|
||
<p class="text-muted">Das Lösen der Verknüpfung ist von der Legionsleitung deaktiviert.</p>
|
||
<?php elseif (!empty($user['password_login'])): ?>
|
||
<form method="post" action="/discord_unlink.php" class="inline-form" data-confirm="Gruppen, die über Discord-Rollen vergeben werden, gehen dabei verloren." data-confirm-title="Discord-Verknüpfung entfernen?" data-confirm-danger data-confirm-ok="Entfernen">
|
||
<?= csrf_field() ?>
|
||
<button type="submit" class="button-secondary">Verknüpfung entfernen</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
<?php else: ?>
|
||
<p class="text-muted">Verknüpfe deinen Discord-Account, um dich über Discord anzumelden, deine Gruppen automatisch aus deinen Discord-Rollen zu bekommen und dich über die Website zu Raids anmelden zu können.</p>
|
||
<a class="button discord-connect-button" href="/discord_login.php">
|
||
<?= discord_logo(18) ?> Mit Discord verknüpfen
|
||
</a>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<?php if (calendar_feed_allowed($user)): ?>
|
||
<?php
|
||
// Kalender-Abo: eigene, geheime Adresse fuer Google Kalender, Outlook, Apple & Co. (includes/calendar_feed.php)
|
||
$feed = calendar_feed_get((int) $user['id']);
|
||
$feedActive = $feed !== null && calendar_feed_active($feed);
|
||
$feedUrl = $feedActive ? calendar_feed_url((string) $feed['token']) : '';
|
||
$feedLinks = $feedActive ? calendar_feed_app_links($feedUrl) : [];
|
||
$feedRaids = !empty($user['discord_id']) && user_has_permission('raids.view');
|
||
?>
|
||
<div class="panel calendar-feed" id="kalender-abo">
|
||
<div class="calendar-feed-head">
|
||
<span class="icon-badge"><?= icon('calendar') ?></span>
|
||
<h2>Kalender-Abo</h2>
|
||
</div>
|
||
<p class="text-muted calendar-feed-intro">
|
||
Hol dir die Raids und Termine der Legion in deinen eigenen Kalender – Google Kalender, Outlook, Apple Kalender oder
|
||
jede andere App, die Kalender abonnieren kann. Neue Termine und Änderungen kommen von selbst nach.
|
||
</p>
|
||
<ul class="calendar-feed-contents">
|
||
<?php if ($feedRaids): ?>
|
||
<li>Raids, zu denen du dich anmelden kannst – mit deinem Stand: angemeldet, Ersatzbank oder abgesagt</li>
|
||
<?php endif; ?>
|
||
<?php if (user_has_permission('members.view')): ?>
|
||
<li>Termine der Mitglieder, bei denen du „Bin dabei“ klicken kannst, und deine eigenen<?= calendar_can_lead() ? ' – auch die der Leitung' : '' ?></li>
|
||
<?php endif; ?>
|
||
<li>Wo du dabei bist, zeigt dich dein Kalender als beschäftigt. Vergangenes bleibt <?= CALENDAR_FEED_PAST_DAYS ?> Tage drin, wenn du dabei warst.</li>
|
||
</ul>
|
||
<p class="field-hint">
|
||
Nicht dabei sind die Event-Erinnerungen aus dem Discord – für die gibt es keine Anmeldung.
|
||
<?php if (!$feedRaids && user_has_permission('raids.view')): ?>Raids kommen dazu, sobald du dein Discord-Konto verknüpfst.<?php endif; ?>
|
||
</p>
|
||
|
||
<?php if ($feed === null): ?>
|
||
<form method="post" action="/profile.php" class="calendar-feed-actions">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="calendar_feed_renew">
|
||
<button type="submit"><?= icon('calendar') ?> Kalender-Abo einrichten</button>
|
||
</form>
|
||
<?php elseif (!$feedActive): ?>
|
||
<div class="flash flash-error">
|
||
Deine bisherige Abo-Adresse gilt nicht mehr, weil dein Konto überall abgemeldet wurde – zum Beispiel durch die
|
||
Legionsleitung oder einen Antrag auf Kontolöschung. Erzeuge eine neue und trag sie in deiner Kalender-App neu ein.
|
||
</div>
|
||
<div class="calendar-feed-actions">
|
||
<form method="post" action="/profile.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="calendar_feed_renew">
|
||
<button type="submit"><?= icon('restore') ?> Neue Adresse erzeugen</button>
|
||
</form>
|
||
<form method="post" action="/profile.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="calendar_feed_delete">
|
||
<button type="submit" class="button-secondary">Abo beenden</button>
|
||
</form>
|
||
</div>
|
||
<?php else: ?>
|
||
<label for="calendar-feed-url" class="calendar-feed-label">Deine Abo-Adresse</label>
|
||
<div class="data-link-copy">
|
||
<input type="text" id="calendar-feed-url" value="<?= e($feedUrl) ?>" readonly>
|
||
<button type="button" class="button-secondary" data-copy-target="calendar-feed-url">Kopieren</button>
|
||
</div>
|
||
<div class="calendar-feed-apps">
|
||
<span class="text-muted">Direkt hinzufügen:</span>
|
||
<a class="button button-secondary button-small" href="<?= e($feedLinks['google']) ?>" target="_blank" rel="noopener noreferrer">Google Kalender</a>
|
||
<a class="button button-secondary button-small" href="<?= e($feedLinks['outlook']) ?>" target="_blank" rel="noopener noreferrer">Outlook</a>
|
||
<a class="button button-secondary button-small" href="<?= e($feedLinks['webcal']) ?>">Apple Kalender & andere</a>
|
||
</div>
|
||
<details class="calendar-feed-help">
|
||
<summary>So richtest du es von Hand ein</summary>
|
||
<ul>
|
||
<li><strong>Google Kalender:</strong> am PC auf calendar.google.com links bei „Weitere Kalender“ auf <strong>+</strong> → „Per URL“ → Adresse einfügen → „Kalender hinzufügen“. In der Handy-App erscheint er danach von selbst – wenn nicht, dort in den Einstellungen „Lumina Ascendens“ antippen und „Synchronisieren“ einschalten. In der App selbst lassen sich keine Abos hinzufügen.</li>
|
||
<li><strong>Outlook:</strong> im Kalender „Kalender hinzufügen“ → „Aus dem Internet abonnieren“ → Adresse einfügen.</li>
|
||
<li><strong>iPhone und iPad:</strong> „Apple Kalender & andere“ antippen und das Abo bestätigen. Von Hand: in den Einstellungen bei Kalender → Accounts → Account hinzufügen → Andere → „Kalenderabo hinzufügen“.</li>
|
||
<li><strong>Mac:</strong> in der Kalender-App „Ablage“ → „Neues Kalenderabonnement …“ → Adresse einfügen.</li>
|
||
<li><strong>Andere Apps:</strong> jede App, die Kalender per Adresse (iCal) abonnieren kann, etwa Thunderbird – auf Android ohne Google Kalender z. B. ICSx⁵.</li>
|
||
</ul>
|
||
</details>
|
||
<p class="field-hint">
|
||
Google Kalender holt Abos nur alle paar Stunden, manchmal erst nach einem Tag, Outlook etwa alle drei bis sechs Stunden.
|
||
Ganz kurzfristige Änderungen siehst du deshalb zuerst hier auf der Website und im Discord.
|
||
</p>
|
||
<p class="calendar-feed-status text-muted">
|
||
Eingerichtet am <?= e(date('d.m.Y', (int) strtotime((string) $feed['created_at']))) ?> ·
|
||
<?php if (!empty($feed['last_used_at'])): ?>
|
||
zuletzt abgerufen am <?= e(date('d.m.Y \u\m H:i', (int) strtotime((string) $feed['last_used_at']))) ?> Uhr<?= !empty($feed['last_client']) ? ' (' . e((string) $feed['last_client']) . ')' : '' ?>
|
||
<?php else: ?>
|
||
noch nicht abgerufen
|
||
<?php endif; ?>
|
||
</p>
|
||
<p class="calendar-feed-warning">
|
||
<?= icon('lock') ?> Die Adresse ist dein persönlicher Schlüssel: Wer sie hat, sieht deine Termine. Gib sie nicht weiter –
|
||
ist sie doch rausgerutscht, erzeuge eine neue.
|
||
</p>
|
||
<div class="calendar-feed-actions">
|
||
<form method="post" action="/profile.php" class="inline-form"
|
||
data-confirm="Die bisherige Adresse funktioniert dann sofort nicht mehr – du musst das Abo in deiner Kalender-App mit der neuen Adresse neu einrichten."
|
||
data-confirm-title="Neue Adresse erzeugen?" data-confirm-ok="Neu erzeugen">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="calendar_feed_renew">
|
||
<button type="submit" class="button-secondary button-small"><?= icon('restore') ?> Neue Adresse erzeugen</button>
|
||
</form>
|
||
<form method="post" action="/profile.php" class="inline-form"
|
||
data-confirm="Die Adresse wird gelöscht, dein Kalender bekommt keine Termine mehr. Entferne den Kalender danach auch aus deiner Kalender-App."
|
||
data-confirm-title="Kalender-Abo beenden?" data-confirm-danger data-confirm-ok="Abo beenden">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="calendar_feed_delete">
|
||
<button type="submit" class="button-secondary button-small">Abo beenden</button>
|
||
</form>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<script src="<?= e(asset_url('/assets/js/copy-button.js')) ?>"></script>
|
||
<?php endif; ?>
|
||
|
||
<?php if (user_has_permission('members.view')): ?>
|
||
<div class="panel tour-restart-panel">
|
||
<div class="tour-restart">
|
||
<span class="icon-badge"><?= icon('users') ?></span>
|
||
<div>
|
||
<h2>Meine Profilseite</h2>
|
||
<p class="text-muted">Deine Seite in der Mitgliederliste: ein Text über dich, deine Charaktere mit Portrait und Bild und eine Bildergalerie.</p>
|
||
</div>
|
||
<a class="button button-secondary tour-restart-button" href="/member_edit.php">Profilseite gestalten</a>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div class="panel tour-restart-panel">
|
||
<div class="tour-restart">
|
||
<span class="icon-badge"><?= icon('route') ?></span>
|
||
<div>
|
||
<h2>Einführung</h2>
|
||
<p class="text-muted">Lass dir das Dashboard noch einmal Schritt für Schritt zeigen - wo du was findest und wofür es gut ist.</p>
|
||
</div>
|
||
<form method="post" action="/profile.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="restart_tour">
|
||
<button type="submit" class="button button-secondary tour-restart-button">Einführung neu starten</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
|
||
<?php // Datenauskunft und Kontoloeschung - bewusst unauffaellig zugeklappt ganz unten (data_export.php, account_delete.php) ?>
|
||
<details class="account-data" id="konto-und-daten"<?= isset($_GET['konto']) ? ' open' : '' ?>>
|
||
<summary>Konto & Daten</summary>
|
||
<div class="panel account-data-body">
|
||
<section id="meine-daten">
|
||
<h2>Meine Daten herunterladen</h2>
|
||
<p class="text-muted">
|
||
Alles, was die Website und der Discord-Bot zu deinem Konto gespeichert haben - als ZIP mit einer JSON-Datei,
|
||
einer Erklärung und deinen hochgeladenen Bildern (Art. 15 und 20 DSGVO).
|
||
</p>
|
||
<form method="post" action="/data_export.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<button type="submit" class="button-secondary"><?= icon('archive') ?> Meine Daten herunterladen</button>
|
||
</form>
|
||
</section>
|
||
<section id="konto-loeschen">
|
||
<h2>Konto löschen</h2>
|
||
<?php if (!empty($user['is_admin']) || is_developer($user)): ?>
|
||
<p class="text-muted">Als Administrator kannst du dein Konto nicht selbst löschen - lass dir zuerst die Administrator-Rechte entziehen.</p>
|
||
<?php else: ?>
|
||
<p class="text-muted">
|
||
Die Löschung wird <?= ACCOUNT_DELETION_DAYS ?> Tage nach dem Antrag ausgeführt; du wirst sofort abgemeldet. Meldest du
|
||
dich in dieser Zeit wieder an, ist sie abgebrochen. Gelöscht werden dein Profil, Profilbild, Charaktere, Galerie,
|
||
Gear-Sets und deine Zugänge. Was du zur Legion beigetragen hast - Kommentare, Wiki-Bearbeitungen, Lumipunkte,
|
||
Raid-Anwesenheiten und Ähnliches - bleibt ohne deinen Namen als „<?= e(ACCOUNT_DELETED_NAME) ?>“ erhalten.
|
||
Lade vorher deine Daten herunter, wenn du sie behalten möchtest.
|
||
</p>
|
||
<form method="post" action="/account_delete.php" class="inline-form"
|
||
data-confirm="Dein Konto wird in <?= ACCOUNT_DELETION_DAYS ?> Tagen gelöscht und du wirst jetzt abgemeldet. Zum Bestätigen LÖSCHEN eintippen."
|
||
data-confirm-title="Konto löschen?" data-confirm-danger data-confirm-ok="Löschung beantragen"
|
||
data-confirm-input="confirm_word" data-confirm-placeholder="LÖSCHEN">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="confirm_word" value="">
|
||
<button type="submit" class="button-danger">Konto löschen …</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
</section>
|
||
</div>
|
||
</details>
|
||
|
||
<?php include __DIR__ . '/includes/footer.php'; ?>
|