LuminaWebsite/profile.php
Maaxxs 706cf97d64 Add a "Mein Profil" page and align raids with the real bot logic
- New profile.php (display name, password, Discord link/unlink),
  reachable from the sidebar; removed the duplicate Discord section
  from the dashboard.
- Corrected class names/icon mapping to match the actual bot config
  (Beschwörer, Kantor) instead of the guessed German terms used
  earlier.
- raids.php now understands the bot's full group model: group 0 is
  the bench ("Ersatzbank"), -1 is a decline ("Abgemeldet"), and class
  "Ausstehend" marks a pending premade invite (now shown with an
  hourglass instead of being silently dropped or mis-rendered). The
  "X / max" counter matches the bot's own active-count logic (pending
  invites don't count). Signup form also lets a member choose the
  bench explicitly.
- A few more inline icons (profile, list) for general visual polish.

Verified grouping/active-count/icon logic with synthetic bench/
declined/pending signups, and the real raids.php flow (profile
update, sidebar nav) against a local DB plus the live raids API.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 13:49:41 +02:00

68 lines
2.4 KiB
PHP

<?php
require_once __DIR__ . '/includes/bootstrap.php';
require_login();
$user = current_user();
$error = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
verify_csrf();
$displayName = trim((string) ($_POST['display_name'] ?? ''));
if ($displayName === '') {
$error = 'Anzeigename darf nicht leer 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;
}
$pageTitle = 'Mein Profil';
include __DIR__ . '/includes/header.php';
?>
<div class="panel">
<h1>Mein Profil</h1>
<p class="text-muted">Benutzername: <strong><?= e($user['username']) ?></strong></p>
</div>
<div class="panel">
<h2>Anzeigename</h2>
<?php if ($error): ?>
<div class="flash flash-error"><?= e($error) ?></div>
<?php endif; ?>
<form method="post" action="/profile.php">
<?= csrf_field() ?>
<div>
<label for="display_name">Anzeigename</label>
<input type="text" id="display_name" name="display_name" value="<?= e($user['display_name']) ?>" required>
</div>
<button type="submit">Speichern</button>
</form>
</div>
<div class="panel">
<h2>Passwort</h2>
<p class="text-muted">Du kannst dein Passwort jederzeit ändern.</p>
<a class="button button-secondary" href="/change_password.php">Passwort ändern</a>
</div>
<div class="panel stat-card">
<div class="icon-badge"><?= icon('link') ?></div>
<div>
<h3>Discord-Verknüpfung</h3>
<?php if (!empty($user['discord_id'])): ?>
<p>Verknüpft als <strong><?= e((string) $user['discord_username']) ?></strong></p>
<form method="post" action="/discord_unlink.php" class="inline-form" onsubmit="return confirm('Discord-Verknüpfung wirklich entfernen?');">
<?= csrf_field() ?>
<button type="submit" class="button-secondary">Verknüpfung entfernen</button>
</form>
<?php else: ?>
<p class="text-muted">Verknüpfe deinen Discord-Account, um dich über die Website zu Raids anmelden zu können.</p>
<a class="button" href="/discord_login.php">Mit Discord verknüpfen</a>
<?php endif; ?>
</div>
</div>
<?php include __DIR__ . '/includes/footer.php'; ?>