diff --git a/README.md b/README.md index e4d56e3..c69740c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/assets/css/style.css b/assets/css/style.css index e11d88a..c514e45 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -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; } diff --git a/assets/images/Landscapes/web/thumbs/landscape1-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape1-thumb.jpg new file mode 100644 index 0000000..0b14f74 Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape1-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape10-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape10-thumb.jpg new file mode 100644 index 0000000..b7ac074 Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape10-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape11-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape11-thumb.jpg new file mode 100644 index 0000000..67b401e Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape11-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape2-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape2-thumb.jpg new file mode 100644 index 0000000..ae25552 Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape2-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape3-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape3-thumb.jpg new file mode 100644 index 0000000..87246f8 Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape3-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape4-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape4-thumb.jpg new file mode 100644 index 0000000..dccde80 Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape4-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape5-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape5-thumb.jpg new file mode 100644 index 0000000..b1cb394 Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape5-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape6-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape6-thumb.jpg new file mode 100644 index 0000000..ee002dc Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape6-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape7-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape7-thumb.jpg new file mode 100644 index 0000000..2acc7d8 Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape7-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape8-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape8-thumb.jpg new file mode 100644 index 0000000..df485b7 Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape8-thumb.jpg differ diff --git a/assets/images/Landscapes/web/thumbs/landscape9-thumb.jpg b/assets/images/Landscapes/web/thumbs/landscape9-thumb.jpg new file mode 100644 index 0000000..3870610 Binary files /dev/null and b/assets/images/Landscapes/web/thumbs/landscape9-thumb.jpg differ diff --git a/includes/header.php b/includes/header.php index 467946f..b3ad488 100644 --- a/includes/header.php +++ b/includes/header.php @@ -298,7 +298,10 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($ -
+ +
>
diff --git a/includes/member_profile.php b/includes/member_profile.php index 1a873f6..8d0d4dd 100644 --- a/includes/member_profile.php +++ b/includes/member_profile.php @@ -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/-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; +} diff --git a/includes/schema.php b/includes/schema.php index 653ea91..5c57c54 100644 --- a/includes/schema.php +++ b/includes/schema.php @@ -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:" + '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", ], diff --git a/member.php b/member.php index e23ea5a..2078b26 100644 --- a/member.php +++ b/member.php @@ -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'; ?>
diff --git a/member_action.php b/member_action.php index 92c2a23..854340f 100644 --- a/member_action.php +++ b/member_action.php @@ -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]); diff --git a/member_edit.php b/member_edit.php index 5eb7a3e..df16755 100644 --- a/member_edit.php +++ b/member_edit.php @@ -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';
+ ($p['status'] ?? 'visible') === 'visible')); +?> +
+

Hintergrund der Profilseite

+

Gib deiner Profilseite deine persönliche Note: eine der Landschaften oder ein Bild aus deiner Galerie.

+
+ + + +
+ + $preset): ?> + + + + + + + +
+ +

Tipp: Lade oben ein Bild in deine Galerie hoch - dann kannst du es auch als Hintergrund nehmen.

+ +
+
+
+ diff --git a/member_picture.php b/member_picture.php index f5018e8..0415336 100644 --- a/member_picture.php +++ b/member_picture.php @@ -95,15 +95,19 @@ include __DIR__ . '/includes/header.php';
- - ‹ - - - <?= e($picture['caption'] ?: 'Bild von ' . $ownerName) ?> - - - › - + ''; ?> + +
+ + <?= e($picture['caption'] ?: 'Bild von ' . $ownerName) ?> + + + + + + + +
diff --git a/sql/schema.sql b/sql/schema.sql index f7faf47..9f701df 100644 --- a/sql/schema.sql +++ b/sql/schema.sql @@ -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:" + 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.