Profile background selectable; picture page arrows centered, comment field side by side

- Members pick the background of their profile page: 11 landscapes or one of their own approved gallery pictures (users.profile_background, small preview images)
- Picture page: arrows as icons, centered on the image itself (not on image + caption)
- Comment field: avatar next to the input, normal font

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Maaxxs 2026-09-21 22:45:34 +02:00
parent 892c55ef1a
commit 905e954118
21 changed files with 171 additions and 19 deletions

View file

@ -654,7 +654,9 @@ Portrait und Bild sowie eine **Bildergalerie** mit Großansicht. Jedes Mitglied
seine Seite selbst (`member_edit.php`, auch über „Mein Profil“); wer `users.edit` hat, darf
bei anderen Inhalte entfernen - das landet im Discord-Log. Bilder werden schon im Browser
verkleinert (Upload-Limit des Webspaces) und liegen unter `assets/uploads/profiles/`;
höchstens 12 Charaktere und 30 Galeriebilder pro Mitglied.
höchstens 12 Charaktere und 30 Galeriebilder pro Mitglied. Den **Hintergrund** seiner Profilseite wählt jedes Mitglied im
Profil-Editor selbst: eine der 11 Landschaften der Website oder ein eigenes (freigegebenes)
Galeriebild (`users.profile_background`, Vorschaubilder in `assets/images/Landscapes/web/thumbs/`).
Unter jedem **Galeriebild** lässt sich kommentieren (nur dort - keine Pinnwand auf dem
Profil): Klick auf das Sprechblasen-Symbol am Bild oder auf „Kommentare“ in der Großansicht

View file

@ -4999,7 +4999,9 @@ input[type="file"]::file-selector-button {
.picture-owner { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); }
.picture-owner:hover { text-decoration: none; color: var(--gold); }
.picture-view-image { position: relative; margin: 0; text-align: center; }
.picture-view-image img { max-width: 100%; max-height: 75vh; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.picture-view-frame { position: relative; display: inline-block; max-width: 100%; vertical-align: top; }
.picture-view-frame > a:first-child { display: block; }
.picture-view-image img { display: block; max-width: 100%; max-height: 75vh; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.picture-view-image figcaption { margin-top: 0.6rem; color: var(--text-muted); }
.picture-nav {
position: absolute;
@ -5012,13 +5014,15 @@ input[type="file"]::file-selector-button {
border-radius: 50%;
background: rgba(0, 0, 0, 0.55);
color: #fff;
font-size: 1.8rem;
line-height: 1;
z-index: 1;
backdrop-filter: blur(4px);
transition: background 0.15s ease, transform 0.15s ease;
}
.picture-nav svg { display: block; }
.picture-nav:hover { transform: translateY(-50%) scale(1.08); }
.picture-nav:hover { background: rgba(201, 162, 39, 0.8); color: #111; text-decoration: none; }
.picture-nav-prev { left: 0.5rem; }
.picture-nav-next { right: 0.5rem; }
.picture-nav-prev { left: 0.75rem; }
.picture-nav-next { right: 0.75rem; }
.picture-comments h2 { display: flex; align-items: center; gap: 0.5rem; }
.comment-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
@ -5477,3 +5481,41 @@ a.calendar-agenda-entry:hover { text-decoration: none; filter: brightness(1.2);
.map-pick-head .text-muted { font-size: 0.85rem; }
.map-pick-head .modal-close { position: absolute; top: 0.45rem; right: 0.6rem; }
.map-pick-dialog iframe { flex: 1; width: 100%; border: 0; background: #0a0a1e; }
/* ---- Hintergrund der Profilseite (Auswahl im Profil-Editor) ---- */
.background-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; margin: 0.8rem 0; }
.background-option { position: relative; display: flex; flex-direction: column; gap: 0.3rem; margin: 0; cursor: pointer; font-weight: 400; }
.background-option input { position: absolute; opacity: 0; pointer-events: none; }
.background-thumb {
display: block;
aspect-ratio: 16 / 9;
border-radius: 10px;
overflow: hidden;
border: 2px solid var(--border);
transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.background-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.background-option:hover .background-thumb { border-color: rgba(201, 162, 39, 0.6); transform: translateY(-2px); }
.background-option.is-selected .background-thumb { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.3); }
.background-option.is-selected::after {
content: '✓';
position: absolute;
top: 0.4rem;
right: 0.4rem;
display: grid;
place-items: center;
width: 1.5rem;
height: 1.5rem;
border-radius: 50%;
background: var(--gold);
color: #1a1a1a;
font-weight: 800;
font-size: 0.85rem;
}
.background-option input:focus-visible + .background-thumb { outline: 2px solid var(--gold); outline-offset: 2px; }
.background-name { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.background-option.is-selected .background-name { color: var(--gold); font-weight: 600; }
.background-default .background-thumb img { filter: grayscale(0.6) brightness(0.8); }
/* Kommentarfeld: Avatar neben dem Feld (Formulare sind sonst global untereinander) */
.comment-form { flex-direction: row; }
.comment-form textarea { font-family: inherit; font-size: 0.95rem; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -298,7 +298,10 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
</a>
</div>
</aside>
<div class="app-content<?= $pageBackgroundClass ? ' ' . e($pageBackgroundClass) : '' ?>">
<?php // $pageBackgroundImage: eigenes Hintergrundbild einer Seite (z.B. Profilseite eines Mitglieds) ?>
<div class="app-content<?= $pageBackgroundClass ? ' ' . e($pageBackgroundClass) : '' ?>"<?= !empty($pageBackgroundImage)
? ' style="background-image: linear-gradient(rgba(26, 26, 26, 0.5), rgba(26, 26, 26, 0.74)), url(\'' . e(str_replace(["'", '"', '(', ')', ' '], '', (string) $pageBackgroundImage)) . '\')"'
: '' ?>>
<main class="container<?= !empty($containerWide) ? ' container-wide' : '' ?>">
<?php foreach ($otherFlashes as $flash): ?>
<div class="flash flash-<?= e($flash['type']) ?>"><?= e($flash['message']) ?></div>

View file

@ -144,3 +144,30 @@ function gallery_comment_html(string $body): string
);
return nl2br($html, false);
}
// ---- Hintergrund der Profilseite ----
// Landschaftsbilder der Website zur Auswahl (assets/images/Landscapes/web/<name>-bg.jpg, Vorschau in thumbs/)
const PROFILE_BACKGROUND_PRESETS = [
'landscape1', 'landscape2', 'landscape3', 'landscape4', 'landscape5', 'landscape6',
'landscape7', 'landscape8', 'landscape9', 'landscape10', 'landscape11',
];
/**
* Bild-URL fuer den gewaehlten Hintergrund, null = Standard. Galeriebilder nur, solange sie dem
* Mitglied gehoeren und freigegeben sind - sonst wieder der Standard.
*/
function profile_background_url(?string $value, int $userId): ?string
{
$value = (string) $value;
if (preg_match('/^preset:(landscape\d+)$/', $value, $m) && in_array($m[1], PROFILE_BACKGROUND_PRESETS, true)) {
return '/assets/images/Landscapes/web/' . $m[1] . '-bg.jpg';
}
if (preg_match('/^gallery:(\d+)$/', $value, $m)) {
$stmt = db()->prepare("SELECT filename FROM member_gallery WHERE id = ? AND user_id = ? AND status = 'visible'");
$stmt->execute([(int) $m[1], $userId]);
$filename = $stmt->fetchColumn();
return $filename !== false ? profile_image_url((string) $filename) : null;
}
return null;
}

View file

@ -11,7 +11,7 @@ declare(strict_types=1);
*/
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
const SCHEMA_VERSION = 22;
const SCHEMA_VERSION = 23;
/**
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
@ -456,6 +456,8 @@ function schema_column_upgrades(): array
"UPDATE users SET last_seen_at = last_login",
],
'session_epoch' => "ALTER TABLE users ADD COLUMN session_epoch INT UNSIGNED NOT NULL DEFAULT 0 AFTER is_admin",
// Hintergrund der eigenen Profilseite: "preset:landscape5" oder "gallery:<Bild-ID>"
'profile_background' => "ALTER TABLE users ADD COLUMN profile_background VARCHAR(40) NULL AFTER profile_bio",
// Kommentare unter den eigenen Galeriebildern (0 = vom Mitglied abgeschaltet)
'gallery_comments_enabled' => "ALTER TABLE users ADD COLUMN gallery_comments_enabled TINYINT(1) NOT NULL DEFAULT 1 AFTER profile_bio",
],

View file

@ -7,7 +7,7 @@ require_permission('members.view');
$id = (int) ($_GET['id'] ?? 0);
$stmt = db()->prepare(
"SELECT id, username, display_name, class_name, profile_bio, gallery_comments_enabled, discord_id, discord_username, avatar_filename, status,
"SELECT id, username, display_name, class_name, profile_bio, profile_background, gallery_comments_enabled, discord_id, discord_username, avatar_filename, status,
COALESCE(discord_joined_at, created_at) AS joined_at, discord_joined_at IS NOT NULL AS joined_discord,
COALESCE(last_seen_at, last_login) AS last_active
FROM users WHERE id = ?"
@ -42,6 +42,8 @@ $canEdit = profile_can_edit($id);
$isOwn = (int) current_user()['id'] === $id;
$pageTitle = $name;
// Selbst gewaehlter Hintergrund (Landschaft oder eigenes Galeriebild)
$pageBackgroundImage = profile_background_url($member['profile_background'] ?? null, $id);
include __DIR__ . '/includes/header.php';
?>
<div class="panel member-profile-head">

View file

@ -191,6 +191,25 @@ switch ($action) {
$modLog($added . ' Bild(er) in die Galerie hochgeladen');
redirect($back);
case 'background_save':
$choice = (string) ($_POST['background'] ?? '');
$value = null;
if (preg_match('/^preset:(landscape\d+)$/', $choice, $m) && in_array($m[1], PROFILE_BACKGROUND_PRESETS, true)) {
$value = $choice;
} elseif (preg_match('/^gallery:(\d+)$/', $choice, $m)) {
$own = $pdo->prepare("SELECT COUNT(*) FROM member_gallery WHERE id = ? AND user_id = ? AND status = 'visible'");
$own->execute([(int) $m[1], $userId]);
if ((int) $own->fetchColumn() === 0) {
set_flash('error', 'Dieses Bild kann nicht als Hintergrund dienen (nicht in deiner Galerie oder noch nicht freigegeben).');
redirect($back . '#hintergrund');
}
$value = $choice;
}
$pdo->prepare('UPDATE users SET profile_background = ? WHERE id = ?')->execute([$value, $userId]);
$modLog('Hintergrund der Profilseite geändert');
set_flash('success', $value === null ? 'Hintergrund zurückgesetzt.' : 'Hintergrund gespeichert.');
redirect($back . '#hintergrund');
case 'gallery_comments_toggle':
$enabled = !empty($_POST['enabled']) ? 1 : 0;
$pdo->prepare('UPDATE users SET gallery_comments_enabled = ? WHERE id = ?')->execute([$enabled, $userId]);

View file

@ -8,7 +8,7 @@ if (!profile_can_edit($id)) {
set_flash('error', 'Du darfst nur deine eigene Profilseite bearbeiten.');
redirect('/member.php?id=' . $id);
}
$stmt = db()->prepare("SELECT id, username, display_name, profile_bio, gallery_comments_enabled, status FROM users WHERE id = ?");
$stmt = db()->prepare("SELECT id, username, display_name, profile_bio, profile_background, gallery_comments_enabled, status FROM users WHERE id = ?");
$stmt->execute([$id]);
$member = $stmt->fetch();
if (!$member) {
@ -194,4 +194,53 @@ include __DIR__ . '/includes/header.php';
<?php endif; ?>
</div>
<script src="<?= e(asset_url('/assets/js/image-resize.js')) ?>"></script>
<?php
$currentBackground = (string) ($member['profile_background'] ?? '');
$backgroundPictures = array_values(array_filter($gallery, static fn (array $p): bool => ($p['status'] ?? 'visible') === 'visible'));
?>
<div class="panel" id="hintergrund">
<h2>Hintergrund der Profilseite</h2>
<p class="text-muted">Gib deiner Profilseite deine persönliche Note: eine der Landschaften oder ein Bild aus deiner Galerie.</p>
<form method="post" action="/member_action.php" class="background-picker">
<?= csrf_field() ?>
<input type="hidden" name="action" value="background_save">
<input type="hidden" name="user_id" value="<?= $id ?>">
<div class="background-grid">
<label class="background-option background-default<?= $currentBackground === '' ? ' is-selected' : '' ?>">
<input type="radio" name="background" value="" <?= $currentBackground === '' ? 'checked' : '' ?>>
<span class="background-thumb"><img src="/assets/images/Landscapes/web/thumbs/landscape9-thumb.jpg" alt="" loading="lazy"></span>
<span class="background-name">Standard</span>
</label>
<?php foreach (PROFILE_BACKGROUND_PRESETS as $index => $preset): ?>
<?php $value = 'preset:' . $preset; ?>
<label class="background-option<?= $currentBackground === $value ? ' is-selected' : '' ?>">
<input type="radio" name="background" value="<?= e($value) ?>" <?= $currentBackground === $value ? 'checked' : '' ?>>
<span class="background-thumb"><img src="/assets/images/Landscapes/web/thumbs/<?= e($preset) ?>-thumb.jpg" alt="" loading="lazy"></span>
<span class="background-name">Landschaft <?= $index + 1 ?></span>
</label>
<?php endforeach; ?>
<?php foreach ($backgroundPictures as $picture): ?>
<?php $value = 'gallery:' . (int) $picture['id']; ?>
<label class="background-option<?= $currentBackground === $value ? ' is-selected' : '' ?>">
<input type="radio" name="background" value="<?= e($value) ?>" <?= $currentBackground === $value ? 'checked' : '' ?>>
<span class="background-thumb"><img src="<?= e(profile_image_url($picture['filename'])) ?>" alt="" loading="lazy"></span>
<span class="background-name"><?= e($picture['caption'] ?: 'Eigenes Bild') ?></span>
</label>
<?php endforeach; ?>
</div>
<?php if (!$backgroundPictures): ?>
<p class="field-hint">Tipp: Lade oben ein Bild in deine Galerie hoch - dann kannst du es auch als Hintergrund nehmen.</p>
<?php endif; ?>
<div class="actions"><button type="submit">Hintergrund speichern</button></div>
</form>
</div>
<script>
// Auswahl sofort sichtbar markieren
document.querySelectorAll('.background-picker input[type="radio"]').forEach(function (radio) {
radio.addEventListener('change', function () {
document.querySelectorAll('.background-option').forEach(function (o) { o.classList.remove('is-selected'); });
radio.closest('.background-option').classList.add('is-selected');
});
});
</script>
<?php include __DIR__ . '/includes/footer.php'; ?>

View file

@ -95,15 +95,19 @@ include __DIR__ . '/includes/header.php';
<?php endif; ?>
<figure class="picture-view-image">
<?php if ($prevId !== null): ?>
<a class="picture-nav picture-nav-prev" href="/member_picture.php?id=<?= $prevId ?>" title="Vorheriges Bild (←)" aria-label="Vorheriges Bild">‹</a>
<?php endif; ?>
<a href="<?= e($url) ?>" target="_blank" rel="noopener" title="Originalgröße öffnen">
<img src="<?= e($url) ?>" alt="<?= e($picture['caption'] ?: 'Bild von ' . $ownerName) ?>">
</a>
<?php if ($nextId !== null): ?>
<a class="picture-nav picture-nav-next" href="/member_picture.php?id=<?= $nextId ?>" title="Nächstes Bild (→)" aria-label="Nächstes Bild">›</a>
<?php endif; ?>
<?php $chevron = static fn (string $points): string => '<svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><polyline points="' . $points . '" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></svg>'; ?>
<!-- Rahmen so gross wie das Bild: die Pfeile sitzen mittig auf dem Bild, nicht auf Bild + Unterschrift -->
<div class="picture-view-frame">
<a href="<?= e($url) ?>" target="_blank" rel="noopener" title="Originalgröße öffnen">
<img src="<?= e($url) ?>" alt="<?= e($picture['caption'] ?: 'Bild von ' . $ownerName) ?>">
</a>
<?php if ($prevId !== null): ?>
<a class="picture-nav picture-nav-prev" href="/member_picture.php?id=<?= $prevId ?>" title="Vorheriges Bild (←)" aria-label="Vorheriges Bild"><?= $chevron('15 18 9 12 15 6') ?></a>
<?php endif; ?>
<?php if ($nextId !== null): ?>
<a class="picture-nav picture-nav-next" href="/member_picture.php?id=<?= $nextId ?>" title="Nächstes Bild (→)" aria-label="Nächstes Bild"><?= $chevron('9 18 15 12 9 6') ?></a>
<?php endif; ?>
</div>
<?php if (!empty($picture['caption'])): ?><figcaption><?= e($picture['caption']) ?></figcaption><?php endif; ?>
</figure>
<?php if ($commentsEnabled): ?>

View file

@ -12,6 +12,8 @@ CREATE TABLE IF NOT EXISTS users (
class_name VARCHAR(30) NULL,
-- Profilseite: frei geschriebener Text (Wiki-Format)
profile_bio TEXT NULL,
-- Hintergrund der eigenen Profilseite: "preset:landscape5" oder "gallery:<Bild-ID>"
profile_background VARCHAR(40) NULL,
-- Kommentare unter den eigenen Galeriebildern (0 = abgeschaltet)
gallery_comments_enabled TINYINT(1) NOT NULL DEFAULT 1,
-- pending = per Discord angemeldet, aber noch nicht freigeschaltet.