Own profile background image, hover borders on buttons, members below profile in the menu
- Profile background: upload an image only for the background (not part of the gallery), same moderation as gallery pictures, one per member, replace or delete it - Hover border on buttons: black on gold buttons, gold on dark ones (dashboard points buttons keep their own effect) - Sidebar: "Mitglieder" directly below "Mein Profil", tour follows the new order Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
9c955af902
commit
2a0e5c6fbc
14 changed files with 164 additions and 28 deletions
|
|
@ -593,10 +593,14 @@ input[type="datetime-local"]::-webkit-calendar-picker-indicator {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
transition: background 0.15s ease;
|
transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button:hover, button:hover { background: var(--gold-hover); color: #1a1a1a; text-decoration: none; }
|
.button:hover, button:hover { background: var(--gold-hover); color: #1a1a1a; text-decoration: none; }
|
||||||
|
/* Rand beim Drueberfahren (als Innenschatten, damit nichts verrutscht): goldene Buttons mit
|
||||||
|
schwarzer Schrift bekommen einen schwarzen Rand, dunkle (.button-secondary) einen goldenen.
|
||||||
|
Die Buttons unter den Lumipunkten im Dashboard (.dashboard-cta) haben ihren eigenen Effekt. */
|
||||||
|
.button:hover, button:hover { box-shadow: inset 0 0 0 2px #111; }
|
||||||
|
|
||||||
/* [hidden] soll auch bei Buttons wirken (display von .button wuerde es sonst ueberstimmen) */
|
/* [hidden] soll auch bei Buttons wirken (display von .button wuerde es sonst ueberstimmen) */
|
||||||
.button[hidden] { display: none !important; }
|
.button[hidden] { display: none !important; }
|
||||||
|
|
@ -604,10 +608,17 @@ input[type="datetime-local"]::-webkit-calendar-picker-indicator {
|
||||||
.button-danger:hover { background: #c9302c; color: #fff; }
|
.button-danger:hover { background: #c9302c; color: #fff; }
|
||||||
|
|
||||||
.button-secondary { background: var(--bg-panel-alt); color: var(--text); border: 1px solid var(--border); }
|
.button-secondary { background: var(--bg-panel-alt); color: var(--text); border: 1px solid var(--border); }
|
||||||
.button-secondary:hover { background: #383838; border-color: rgba(201, 162, 39, 0.55); color: var(--text); }
|
.button-secondary:hover { background: #383838; border-color: var(--gold); color: var(--text); box-shadow: inset 0 0 0 1px var(--gold); }
|
||||||
|
|
||||||
.button-success { background: var(--success); color: #fff; }
|
.button-success { background: var(--success); color: #fff; }
|
||||||
.button-success:hover { background: #3d8b40; color: #fff; }
|
.button-success:hover { background: #3d8b40; color: #fff; }
|
||||||
|
.button-danger:hover, .button-success:hover, .discord-connect-button:hover,
|
||||||
|
.button:disabled:hover, button:disabled:hover,
|
||||||
|
/* Knoepfe, die gar nicht gold sind (Symbole, Filter, Seitenzahlen, Menue ...) */
|
||||||
|
.icon-button:hover, .modal-close:hover, .text-button:hover, .members-chip:hover, .members-segment button:hover,
|
||||||
|
.page-link:hover, .shop-category:hover, .class-picker-option:hover, .user-filter-trigger:hover, .user-filter-option:hover,
|
||||||
|
.file-drop-clear:hover, .group-picker-option:hover, .sidebar-toggle:hover, .wiki-preview-toggle:hover,
|
||||||
|
.lightbox button:hover, .item-picker button:hover { box-shadow: none; }
|
||||||
|
|
||||||
.button:disabled, button:disabled {
|
.button:disabled, button:disabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
|
@ -5974,6 +5985,26 @@ a.calendar-agenda-entry:hover { text-decoration: none; filter: brightness(1.2);
|
||||||
}
|
}
|
||||||
.background-option input:focus-visible + .background-thumb { outline: 2px solid var(--gold); outline-offset: 2px; }
|
.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-name { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.background-thumb { position: relative; }
|
||||||
|
.background-pending {
|
||||||
|
position: absolute;
|
||||||
|
left: 0.35rem;
|
||||||
|
bottom: 0.35rem;
|
||||||
|
padding: 0.1rem 0.45rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(0, 0, 0, 0.75);
|
||||||
|
border: 1px solid var(--gold);
|
||||||
|
color: var(--gold);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.background-own .background-name { color: var(--gold); }
|
||||||
|
/* Eigenes Bild nur fuer den Hintergrund hochladen */
|
||||||
|
.background-upload { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
|
||||||
|
.background-upload h3 { margin: 0 0 0.6rem; font-size: 1rem; }
|
||||||
|
.background-upload-form { display: flex; flex-direction: column; gap: 0.6rem; }
|
||||||
|
.background-upload-form button { align-self: flex-start; }
|
||||||
|
.background-upload .inline-form { margin-top: 0.75rem; }
|
||||||
.background-option.is-selected .background-name { color: var(--gold); font-weight: 600; }
|
.background-option.is-selected .background-name { color: var(--gold); font-weight: 600; }
|
||||||
.background-default .background-thumb img { filter: grayscale(0.6) brightness(0.8); }
|
.background-default .background-thumb img { filter: grayscale(0.6) brightness(0.8); }
|
||||||
/* Kommentarfeld: Avatar neben dem Feld (Formulare sind sonst global untereinander) */
|
/* Kommentarfeld: Avatar neben dem Feld (Formulare sind sonst global untereinander) */
|
||||||
|
|
|
||||||
|
|
@ -421,15 +421,15 @@ if (empty($user['tour_completed_at'])):
|
||||||
['target' => '[data-tour="overview"]', 'title' => 'Dein Überblick', 'text' => 'Ganz oben siehst du deine Rollen in der Legion und ob dein Discord-Account verbunden ist. Die Rollen kommen automatisch von unserem Discord-Server.'],
|
['target' => '[data-tour="overview"]', 'title' => 'Dein Überblick', 'text' => 'Ganz oben siehst du deine Rollen in der Legion und ob dein Discord-Account verbunden ist. Die Rollen kommen automatisch von unserem Discord-Server.'],
|
||||||
['target' => $link('/profile.php'), 'title' => 'Mein Profil', 'text' => 'Im Profil änderst du Anzeigename und Profilbild und verwaltest deine Discord-Verknüpfung. Dort kannst du diese Einführung auch jederzeit neu starten.'],
|
['target' => $link('/profile.php'), 'title' => 'Mein Profil', 'text' => 'Im Profil änderst du Anzeigename und Profilbild und verwaltest deine Discord-Verknüpfung. Dort kannst du diese Einführung auch jederzeit neu starten.'],
|
||||||
];
|
];
|
||||||
|
if (user_has_permission('members.view')) {
|
||||||
|
$tourSteps[] = ['target' => $link('/members.php'), 'title' => 'Mitglieder', 'text' => 'Hier findest du alle Mitglieder der Legion, sortiert nach ihren Rängen.'];
|
||||||
|
}
|
||||||
if ($myPoints !== null) {
|
if ($myPoints !== null) {
|
||||||
$tourSteps[] = ['target' => '[data-tour="points"]', 'title' => 'Lumipunkte', 'text' => 'Für deinen Einsatz in der Legion, z.B. bei Raids, bekommst du Lumipunkte. Hier siehst du deinen Stand und deinen Platz in der Rangliste.'];
|
$tourSteps[] = ['target' => '[data-tour="points"]', 'title' => 'Lumipunkte', 'text' => 'Für deinen Einsatz in der Legion, z.B. bei Raids, bekommst du Lumipunkte. Hier siehst du deinen Stand und deinen Platz in der Rangliste.'];
|
||||||
}
|
}
|
||||||
if ($canViewShop) {
|
if ($canViewShop) {
|
||||||
$tourSteps[] = ['target' => $link('/shop.php'), 'title' => 'Lumishop', 'text' => 'Im Lumishop tauschst du deine Lumipunkte gegen Gegenstände ein. Die Leitung bewilligt deinen Antrag und übergibt dir den Gegenstand im Spiel.'];
|
$tourSteps[] = ['target' => $link('/shop.php'), 'title' => 'Lumishop', 'text' => 'Im Lumishop tauschst du deine Lumipunkte gegen Gegenstände ein. Die Leitung bewilligt deinen Antrag und übergibt dir den Gegenstand im Spiel.'];
|
||||||
}
|
}
|
||||||
if (user_has_permission('members.view')) {
|
|
||||||
$tourSteps[] = ['target' => $link('/members.php'), 'title' => 'Mitglieder', 'text' => 'Hier findest du alle Mitglieder der Legion, sortiert nach ihren Rängen.'];
|
|
||||||
}
|
|
||||||
if ($canViewRaids) {
|
if ($canViewRaids) {
|
||||||
$tourSteps[] = ['target' => '[data-tour="raids"]', 'title' => 'Nächste Raids', 'text' => 'Die nächsten Raids mit Termin, freien Plätzen und deinem Anmeldestatus. Unter „Raids“ im Menü meldest du dich mit deiner Klasse an.'];
|
$tourSteps[] = ['target' => '[data-tour="raids"]', 'title' => 'Nächste Raids', 'text' => 'Die nächsten Raids mit Termin, freien Plätzen und deinem Anmeldestatus. Unter „Raids“ im Menü meldest du dich mit deiner Klasse an.'];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ if ($action === 'add') {
|
||||||
$pictureId = (int) ($_POST['picture_id'] ?? 0);
|
$pictureId = (int) ($_POST['picture_id'] ?? 0);
|
||||||
$back = '/member_picture.php?id=' . $pictureId . '#kommentare';
|
$back = '/member_picture.php?id=' . $pictureId . '#kommentare';
|
||||||
$stmt = $pdo->prepare(
|
$stmt = $pdo->prepare(
|
||||||
'SELECT g.id, g.user_id, g.status AS picture_status, u.status, u.gallery_comments_enabled FROM member_gallery g JOIN users u ON u.id = g.user_id WHERE g.id = ?'
|
'SELECT g.id, g.user_id, g.status AS picture_status, u.status, u.gallery_comments_enabled FROM member_gallery g JOIN users u ON u.id = g.user_id WHERE g.id = ? AND g.is_background = 0'
|
||||||
);
|
);
|
||||||
$stmt->execute([$pictureId]);
|
$stmt->execute([$pictureId]);
|
||||||
$picture = $stmt->fetch();
|
$picture = $stmt->fetch();
|
||||||
|
|
|
||||||
|
|
@ -97,10 +97,14 @@ const DATA_RESET_AREAS = [
|
||||||
],
|
],
|
||||||
'profiles' => [
|
'profiles' => [
|
||||||
'label' => 'Profiltexte & Hintergründe',
|
'label' => 'Profiltexte & Hintergründe',
|
||||||
'description' => 'Beschreibungstexte und gewählte Hintergründe aller Profilseiten. Konten und Profilbilder bleiben.',
|
'description' => 'Beschreibungstexte, gewählte Hintergründe und eigene Hintergrundbilder aller Profilseiten. Konten, Profilbilder und Galerien bleiben.',
|
||||||
'count' => "SELECT COUNT(*) FROM users WHERE (profile_bio IS NOT NULL AND profile_bio <> '') OR profile_background IS NOT NULL",
|
'count' => "SELECT COUNT(*) FROM users WHERE (profile_bio IS NOT NULL AND profile_bio <> '') OR profile_background IS NOT NULL",
|
||||||
'unit' => ['Profil', 'Profile'],
|
'unit' => ['Profil', 'Profile'],
|
||||||
'delete' => ['UPDATE users SET profile_bio = NULL, profile_background = NULL'],
|
'delete' => [
|
||||||
|
"DELETE FROM content_reports WHERE content_type = 'picture' AND content_id IN (SELECT id FROM member_gallery WHERE is_background = 1)",
|
||||||
|
'DELETE FROM member_gallery WHERE is_background = 1',
|
||||||
|
'UPDATE users SET profile_bio = NULL, profile_background = NULL',
|
||||||
|
],
|
||||||
'reset_ids' => [],
|
'reset_ids' => [],
|
||||||
],
|
],
|
||||||
'gear_sets' => [
|
'gear_sets' => [
|
||||||
|
|
@ -187,6 +191,9 @@ function data_reset_run(array $keys): array
|
||||||
if (in_array('gallery', $keys, true)) {
|
if (in_array('gallery', $keys, true)) {
|
||||||
$files = array_merge($files, $pdo->query('SELECT filename FROM member_gallery')->fetchAll(PDO::FETCH_COLUMN));
|
$files = array_merge($files, $pdo->query('SELECT filename FROM member_gallery')->fetchAll(PDO::FETCH_COLUMN));
|
||||||
}
|
}
|
||||||
|
if (in_array('profiles', $keys, true) && !in_array('gallery', $keys, true)) {
|
||||||
|
$files = array_merge($files, $pdo->query('SELECT filename FROM member_gallery WHERE is_background = 1')->fetchAll(PDO::FETCH_COLUMN));
|
||||||
|
}
|
||||||
if (in_array('characters', $keys, true)) {
|
if (in_array('characters', $keys, true)) {
|
||||||
foreach ($pdo->query('SELECT portrait_filename, image_filename FROM member_characters')->fetchAll() as $row) {
|
foreach ($pdo->query('SELECT portrait_filename, image_filename FROM member_characters')->fetchAll() as $row) {
|
||||||
$files[] = $row['portrait_filename'];
|
$files[] = $row['portrait_filename'];
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,11 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
|
||||||
<a href="/profile.php" class="sidebar-link<?= $isProfileActive ? ' active' : '' ?>" title="Mein Profil">
|
<a href="/profile.php" class="sidebar-link<?= $isProfileActive ? ' active' : '' ?>" title="Mein Profil">
|
||||||
<?= icon('profile') ?><span class="label">Mein Profil</span>
|
<?= icon('profile') ?><span class="label">Mein Profil</span>
|
||||||
</a>
|
</a>
|
||||||
|
<?php if ($canViewMembers): ?>
|
||||||
|
<a href="/members.php" class="sidebar-link<?= $isMembersActive ? ' active' : '' ?>" title="Mitglieder">
|
||||||
|
<?= icon('users') ?><span class="label">Mitglieder</span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
<?php if ($canViewContributions): ?>
|
<?php if ($canViewContributions): ?>
|
||||||
<a href="/contributions.php" class="sidebar-link<?= $isContributionsActive ? ' active' : '' ?>" title="Lumipunkte">
|
<a href="/contributions.php" class="sidebar-link<?= $isContributionsActive ? ' active' : '' ?>" title="Lumipunkte">
|
||||||
<?= icon('heart') ?><span class="label">Lumipunkte</span>
|
<?= icon('heart') ?><span class="label">Lumipunkte</span>
|
||||||
|
|
@ -202,11 +207,6 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($canViewMembers): ?>
|
|
||||||
<a href="/members.php" class="sidebar-link<?= $isMembersActive ? ' active' : '' ?>" title="Mitglieder">
|
|
||||||
<?= icon('users') ?><span class="label">Mitglieder</span>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($canViewWiki): ?>
|
<?php if ($canViewWiki): ?>
|
||||||
<a href="/wiki.php" class="sidebar-link<?= $isWikiActive ? ' active' : '' ?>" title="Wiki">
|
<a href="/wiki.php" class="sidebar-link<?= $isWikiActive ? ' active' : '' ?>" title="Wiki">
|
||||||
<?= icon('book') ?><span class="label">Wiki</span>
|
<?= icon('book') ?><span class="label">Wiki</span>
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,32 @@ const PROFILE_BACKGROUND_PRESETS = [
|
||||||
* Bild-URL fuer den gewaehlten Hintergrund, null = Standard. Galeriebilder nur, solange sie dem
|
* Bild-URL fuer den gewaehlten Hintergrund, null = Standard. Galeriebilder nur, solange sie dem
|
||||||
* Mitglied gehoeren und freigegeben sind - sonst wieder der Standard.
|
* Mitglied gehoeren und freigegeben sind - sonst wieder der Standard.
|
||||||
*/
|
*/
|
||||||
|
/** Eigenes Hintergrundbild eines Mitglieds (nur fuer den Hintergrund hochgeladen), falls vorhanden. */
|
||||||
|
function profile_background_image(int $userId): ?array
|
||||||
|
{
|
||||||
|
$stmt = db()->prepare('SELECT * FROM member_gallery WHERE user_id = ? AND is_background = 1 ORDER BY id DESC LIMIT 1');
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
return $stmt->fetch() ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eigenes Hintergrundbild loeschen (Zeile, Datei, Meldungen). War es gewaehlt, gilt wieder der
|
||||||
|
* Standard-Hintergrund.
|
||||||
|
*/
|
||||||
|
function profile_background_image_delete(int $userId): void
|
||||||
|
{
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare('SELECT id, filename FROM member_gallery WHERE user_id = ? AND is_background = 1');
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
foreach ($stmt->fetchAll() as $row) {
|
||||||
|
$pdo->prepare('DELETE FROM member_gallery WHERE id = ?')->execute([$row['id']]);
|
||||||
|
$pdo->prepare('UPDATE users SET profile_background = NULL WHERE id = ? AND profile_background = ?')
|
||||||
|
->execute([$userId, 'gallery:' . (int) $row['id']]);
|
||||||
|
moderation_clear_reports('picture', (int) $row['id']);
|
||||||
|
profile_delete_file((string) $row['filename']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function profile_background_url(?string $value, int $userId): ?string
|
function profile_background_url(?string $value, int $userId): ?string
|
||||||
{
|
{
|
||||||
$value = (string) $value;
|
$value = (string) $value;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
|
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
|
||||||
const SCHEMA_VERSION = 26;
|
const SCHEMA_VERSION = 27;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
|
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
|
||||||
|
|
@ -564,6 +564,8 @@ function schema_column_upgrades(): array
|
||||||
'member_gallery' => [
|
'member_gallery' => [
|
||||||
'status' => "ALTER TABLE member_gallery ADD COLUMN status VARCHAR(10) NOT NULL DEFAULT 'visible' AFTER caption",
|
'status' => "ALTER TABLE member_gallery ADD COLUMN status VARCHAR(10) NOT NULL DEFAULT 'visible' AFTER caption",
|
||||||
'moderation_note' => "ALTER TABLE member_gallery ADD COLUMN moderation_note VARCHAR(255) NULL AFTER status",
|
'moderation_note' => "ALTER TABLE member_gallery ADD COLUMN moderation_note VARCHAR(255) NULL AFTER status",
|
||||||
|
// 1 = nur als Hintergrund der Profilseite hochgeladen, nicht Teil der Galerie
|
||||||
|
'is_background' => "ALTER TABLE member_gallery ADD COLUMN is_background TINYINT(1) NOT NULL DEFAULT 0 AFTER moderation_note",
|
||||||
],
|
],
|
||||||
// Treffpunkt auf der Karte (Link /map.php?karte=...&x=...&y=...)
|
// Treffpunkt auf der Karte (Link /map.php?karte=...&x=...&y=...)
|
||||||
'calendar_entries' => [
|
'calendar_entries' => [
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ $gearSets = user_has_permission('gear.view') ? gear_profile_sets($id) : [];
|
||||||
// Noch nicht freigegebene Bilder sehen nur der Besitzer und die Moderation.
|
// Noch nicht freigegebene Bilder sehen nur der Besitzer und die Moderation.
|
||||||
$seesPending = (int) current_user()['id'] === $id || moderation_can();
|
$seesPending = (int) current_user()['id'] === $id || moderation_can();
|
||||||
$galleryStmt = db()->prepare(
|
$galleryStmt = db()->prepare(
|
||||||
'SELECT * FROM member_gallery WHERE user_id = ?' . ($seesPending ? '' : " AND status = 'visible'") . ' ORDER BY sort_order, id'
|
'SELECT * FROM member_gallery WHERE user_id = ? AND is_background = 0' . ($seesPending ? '' : " AND status = 'visible'") . ' ORDER BY sort_order, id'
|
||||||
);
|
);
|
||||||
$galleryStmt->execute([$id]);
|
$galleryStmt->execute([$id]);
|
||||||
$gallery = $galleryStmt->fetchAll();
|
$gallery = $galleryStmt->fetchAll();
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ switch ($action) {
|
||||||
redirect($back);
|
redirect($back);
|
||||||
|
|
||||||
case 'gallery_upload':
|
case 'gallery_upload':
|
||||||
$count = $pdo->prepare('SELECT COUNT(*), COALESCE(MAX(sort_order), 0) FROM member_gallery WHERE user_id = ?');
|
$count = $pdo->prepare('SELECT COUNT(*), COALESCE(MAX(sort_order), 0) FROM member_gallery WHERE user_id = ? AND is_background = 0');
|
||||||
$count->execute([$userId]);
|
$count->execute([$userId]);
|
||||||
[$existingCount, $order] = array_map('intval', $count->fetch(PDO::FETCH_NUM));
|
[$existingCount, $order] = array_map('intval', $count->fetch(PDO::FETCH_NUM));
|
||||||
$caption = mb_substr(trim((string) ($_POST['caption'] ?? '')), 0, 150);
|
$caption = mb_substr(trim((string) ($_POST['caption'] ?? '')), 0, 150);
|
||||||
|
|
@ -202,7 +202,7 @@ switch ($action) {
|
||||||
if (preg_match('/^preset:(landscape\d+)$/', $choice, $m) && in_array($m[1], PROFILE_BACKGROUND_PRESETS, true)) {
|
if (preg_match('/^preset:(landscape\d+)$/', $choice, $m) && in_array($m[1], PROFILE_BACKGROUND_PRESETS, true)) {
|
||||||
$value = $choice;
|
$value = $choice;
|
||||||
} elseif (preg_match('/^gallery:(\d+)$/', $choice, $m)) {
|
} elseif (preg_match('/^gallery:(\d+)$/', $choice, $m)) {
|
||||||
$own = $pdo->prepare("SELECT COUNT(*) FROM member_gallery WHERE id = ? AND user_id = ? AND status = 'visible'");
|
$own = $pdo->prepare("SELECT COUNT(*) FROM member_gallery WHERE id = ? AND user_id = ? AND (status = 'visible' OR is_background = 1)");
|
||||||
$own->execute([(int) $m[1], $userId]);
|
$own->execute([(int) $m[1], $userId]);
|
||||||
if ((int) $own->fetchColumn() === 0) {
|
if ((int) $own->fetchColumn() === 0) {
|
||||||
set_flash('error', 'Dieses Bild kann nicht als Hintergrund dienen (nicht in deiner Galerie oder noch nicht freigegeben).');
|
set_flash('error', 'Dieses Bild kann nicht als Hintergrund dienen (nicht in deiner Galerie oder noch nicht freigegeben).');
|
||||||
|
|
@ -215,6 +215,39 @@ switch ($action) {
|
||||||
set_flash('success', $value === null ? 'Hintergrund zurückgesetzt.' : 'Hintergrund gespeichert.');
|
set_flash('success', $value === null ? 'Hintergrund zurückgesetzt.' : 'Hintergrund gespeichert.');
|
||||||
redirect($back . '#hintergrund');
|
redirect($back . '#hintergrund');
|
||||||
|
|
||||||
|
case 'background_upload':
|
||||||
|
// Eigenes Bild nur fuer den Hintergrund: kommt nicht in die Galerie, geht aber durch dieselbe
|
||||||
|
// Moderation (neue Mitglieder / "alles manuell" -> erst nach Freigabe sichtbar).
|
||||||
|
$file = $_FILES['background_image'] ?? null;
|
||||||
|
if (!security_throttle('upload')) {
|
||||||
|
set_flash('error', 'Du hast in den letzten Minuten schon sehr viele Bilder hochgeladen. Bitte warte ein paar Minuten.');
|
||||||
|
redirect($back . '#hintergrund');
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$filename = profile_store_upload(is_array($file) ? $file : null, 'bg' . $userId, 2560);
|
||||||
|
} catch (RuntimeException $e) {
|
||||||
|
set_flash('error', $e->getMessage());
|
||||||
|
redirect($back . '#hintergrund');
|
||||||
|
}
|
||||||
|
[$status, $moderationNote] = moderation_initial_status('picture');
|
||||||
|
// Es gibt hoechstens ein eigenes Hintergrundbild - das alte faellt weg
|
||||||
|
profile_background_image_delete($userId);
|
||||||
|
$pdo->prepare('INSERT INTO member_gallery (user_id, filename, status, moderation_note, is_background) VALUES (?, ?, ?, ?, 1)')
|
||||||
|
->execute([$userId, $filename, $status, $moderationNote]);
|
||||||
|
$pdo->prepare('UPDATE users SET profile_background = ? WHERE id = ?')
|
||||||
|
->execute(['gallery:' . (int) $pdo->lastInsertId(), $userId]);
|
||||||
|
$modLog('Eigenes Hintergrundbild hochgeladen');
|
||||||
|
set_flash('success', $status === 'pending'
|
||||||
|
? 'Hintergrundbild hochgeladen. Es erscheint nach einer kurzen Freigabe durch die Moderation - bis dahin bleibt der Standard-Hintergrund.'
|
||||||
|
: 'Hintergrundbild hochgeladen und als Hintergrund gesetzt.');
|
||||||
|
redirect($back . '#hintergrund');
|
||||||
|
|
||||||
|
case 'background_delete':
|
||||||
|
profile_background_image_delete($userId);
|
||||||
|
$modLog('Eigenes Hintergrundbild entfernt');
|
||||||
|
set_flash('success', 'Eigenes Hintergrundbild entfernt.');
|
||||||
|
redirect($back . '#hintergrund');
|
||||||
|
|
||||||
case 'gallery_comments_toggle':
|
case 'gallery_comments_toggle':
|
||||||
$enabled = !empty($_POST['enabled']) ? 1 : 0;
|
$enabled = !empty($_POST['enabled']) ? 1 : 0;
|
||||||
$pdo->prepare('UPDATE users SET gallery_comments_enabled = ? WHERE id = ?')->execute([$enabled, $userId]);
|
$pdo->prepare('UPDATE users SET gallery_comments_enabled = ? WHERE id = ?')->execute([$enabled, $userId]);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ $name = $member['display_name'] !== '' ? $member['display_name'] : $member['user
|
||||||
$isOwn = (int) current_user()['id'] === $id;
|
$isOwn = (int) current_user()['id'] === $id;
|
||||||
|
|
||||||
$characters = profile_characters_by_user($id)[$id] ?? [];
|
$characters = profile_characters_by_user($id)[$id] ?? [];
|
||||||
$galleryStmt = db()->prepare('SELECT * FROM member_gallery WHERE user_id = ? ORDER BY sort_order, id');
|
$galleryStmt = db()->prepare('SELECT * FROM member_gallery WHERE user_id = ? AND is_background = 0 ORDER BY sort_order, id');
|
||||||
$galleryStmt->execute([$id]);
|
$galleryStmt->execute([$id]);
|
||||||
$gallery = $galleryStmt->fetchAll();
|
$gallery = $galleryStmt->fetchAll();
|
||||||
|
|
||||||
|
|
@ -197,10 +197,12 @@ include __DIR__ . '/includes/header.php';
|
||||||
<?php
|
<?php
|
||||||
$currentBackground = (string) ($member['profile_background'] ?? '');
|
$currentBackground = (string) ($member['profile_background'] ?? '');
|
||||||
$backgroundPictures = array_values(array_filter($gallery, static fn (array $p): bool => ($p['status'] ?? 'visible') === 'visible'));
|
$backgroundPictures = array_values(array_filter($gallery, static fn (array $p): bool => ($p['status'] ?? 'visible') === 'visible'));
|
||||||
|
// Eigenes Bild, das nur als Hintergrund hochgeladen wurde (nicht in der Galerie)
|
||||||
|
$ownBackground = profile_background_image($id);
|
||||||
?>
|
?>
|
||||||
<div class="panel" id="hintergrund">
|
<div class="panel" id="hintergrund">
|
||||||
<h2>Hintergrund der Profilseite</h2>
|
<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>
|
<p class="text-muted">Gib deiner Profilseite deine persönliche Note: eine der Landschaften, ein Bild aus deiner Galerie oder ein eigenes Bild nur für den Hintergrund.</p>
|
||||||
<form method="post" action="/member_action.php" class="background-picker">
|
<form method="post" action="/member_action.php" class="background-picker">
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
<input type="hidden" name="action" value="background_save">
|
<input type="hidden" name="action" value="background_save">
|
||||||
|
|
@ -219,6 +221,17 @@ $backgroundPictures = array_values(array_filter($gallery, static fn (array $p):
|
||||||
<span class="background-name">Landschaft <?= $index + 1 ?></span>
|
<span class="background-name">Landschaft <?= $index + 1 ?></span>
|
||||||
</label>
|
</label>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<?php if ($ownBackground): ?>
|
||||||
|
<?php $value = 'gallery:' . (int) $ownBackground['id']; $ownPending = $ownBackground['status'] === 'pending'; ?>
|
||||||
|
<label class="background-option background-own<?= $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($ownBackground['filename'])) ?>" alt="" loading="lazy">
|
||||||
|
<?php if ($ownPending): ?><span class="background-pending" title="<?= e((string) $ownBackground['moderation_note']) ?>">Wartet auf Freigabe</span><?php endif; ?>
|
||||||
|
</span>
|
||||||
|
<span class="background-name">Eigenes Hintergrundbild</span>
|
||||||
|
</label>
|
||||||
|
<?php endif; ?>
|
||||||
<?php foreach ($backgroundPictures as $picture): ?>
|
<?php foreach ($backgroundPictures as $picture): ?>
|
||||||
<?php $value = 'gallery:' . (int) $picture['id']; ?>
|
<?php $value = 'gallery:' . (int) $picture['id']; ?>
|
||||||
<label class="background-option<?= $currentBackground === $value ? ' is-selected' : '' ?>">
|
<label class="background-option<?= $currentBackground === $value ? ' is-selected' : '' ?>">
|
||||||
|
|
@ -228,11 +241,31 @@ $backgroundPictures = array_values(array_filter($gallery, static fn (array $p):
|
||||||
</label>
|
</label>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</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>
|
<div class="actions"><button type="submit">Hintergrund speichern</button></div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<div class="background-upload">
|
||||||
|
<h3><?= $ownBackground ? 'Anderes eigenes Hintergrundbild' : 'Eigenes Bild als Hintergrund' ?></h3>
|
||||||
|
<form method="post" action="/member_action.php" enctype="multipart/form-data" class="background-upload-form">
|
||||||
|
<?= csrf_field() ?>
|
||||||
|
<input type="hidden" name="action" value="background_upload">
|
||||||
|
<input type="hidden" name="user_id" value="<?= $id ?>">
|
||||||
|
<input type="file" name="background_image" accept="image/png,image/jpeg,image/gif,image/webp" required data-max-size="2560" data-paste>
|
||||||
|
<button type="submit">Hochladen & als Hintergrund setzen</button>
|
||||||
|
</form>
|
||||||
|
<div class="field-hint">
|
||||||
|
Kommt nicht in deine Galerie. Am besten ein Querformat-Bild (z.B. ein Screenshot), höchstens 8 MB.
|
||||||
|
<?= $ownBackground ? 'Ersetzt dein bisheriges eigenes Hintergrundbild.' : '' ?>
|
||||||
|
</div>
|
||||||
|
<?php if ($ownBackground): ?>
|
||||||
|
<form method="post" action="/member_action.php" class="inline-form" onsubmit="return confirm('Eigenes Hintergrundbild löschen?');">
|
||||||
|
<?= csrf_field() ?>
|
||||||
|
<input type="hidden" name="action" value="background_delete">
|
||||||
|
<input type="hidden" name="user_id" value="<?= $id ?>">
|
||||||
|
<button type="submit" class="button-secondary button-small"><?= icon('trash') ?> Eigenes Hintergrundbild löschen</button>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
// Auswahl sofort sichtbar markieren
|
// Auswahl sofort sichtbar markieren
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ $me = current_user();
|
||||||
$isModerator = moderation_can();
|
$isModerator = moderation_can();
|
||||||
$isOwner = $picture && (int) $me['id'] === (int) $picture['user_id'];
|
$isOwner = $picture && (int) $me['id'] === (int) $picture['user_id'];
|
||||||
// Noch nicht freigegebene Bilder sehen nur der Besitzer und die Moderation.
|
// Noch nicht freigegebene Bilder sehen nur der Besitzer und die Moderation.
|
||||||
if (!$picture || $picture['status'] !== 'active' || ($picture['picture_status'] === 'pending' && !$isOwner && !$isModerator)) {
|
if (!$picture || $picture['status'] !== 'active' || !empty($picture['is_background'])
|
||||||
|
|| ($picture['picture_status'] === 'pending' && !$isOwner && !$isModerator)) {
|
||||||
show_not_found();
|
show_not_found();
|
||||||
}
|
}
|
||||||
$ownerId = (int) $picture['user_id'];
|
$ownerId = (int) $picture['user_id'];
|
||||||
|
|
@ -26,7 +27,7 @@ $ownerName = $picture['display_name'] !== '' ? $picture['display_name'] : $pictu
|
||||||
$commentsEnabled = !empty($picture['gallery_comments_enabled']);
|
$commentsEnabled = !empty($picture['gallery_comments_enabled']);
|
||||||
|
|
||||||
// Vorheriges / naechstes Bild derselben Galerie (Reihenfolge wie auf der Profilseite)
|
// Vorheriges / naechstes Bild derselben Galerie (Reihenfolge wie auf der Profilseite)
|
||||||
$ids = db()->prepare('SELECT id FROM member_gallery WHERE user_id = ?' . ($isOwner || $isModerator ? '' : " AND status = 'visible'") . ' ORDER BY sort_order, id');
|
$ids = db()->prepare('SELECT id FROM member_gallery WHERE user_id = ? AND is_background = 0' . ($isOwner || $isModerator ? '' : " AND status = 'visible'") . ' ORDER BY sort_order, id');
|
||||||
$ids->execute([$ownerId]);
|
$ids->execute([$ownerId]);
|
||||||
$galleryIds = array_map('intval', $ids->fetchAll(PDO::FETCH_COLUMN));
|
$galleryIds = array_map('intval', $ids->fetchAll(PDO::FETCH_COLUMN));
|
||||||
$position = array_search($pictureId, $galleryIds, true);
|
$position = array_search($pictureId, $galleryIds, true);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ $pdo = db();
|
||||||
$name = "COALESCE(NULLIF(u.display_name, ''), u.username)";
|
$name = "COALESCE(NULLIF(u.display_name, ''), u.username)";
|
||||||
|
|
||||||
$pendingPictures = $pdo->query(
|
$pendingPictures = $pdo->query(
|
||||||
"SELECT g.id, g.filename, g.caption, g.moderation_note, g.created_at, g.user_id, $name AS author
|
"SELECT g.id, g.filename, g.caption, g.moderation_note, g.created_at, g.user_id, g.is_background, $name AS author
|
||||||
FROM member_gallery g JOIN users u ON u.id = g.user_id WHERE g.status = 'pending' ORDER BY g.created_at"
|
FROM member_gallery g JOIN users u ON u.id = g.user_id WHERE g.status = 'pending' ORDER BY g.created_at"
|
||||||
)->fetchAll();
|
)->fetchAll();
|
||||||
$pendingComments = $pdo->query(
|
$pendingComments = $pdo->query(
|
||||||
|
|
@ -198,12 +198,13 @@ include __DIR__ . '/includes/header.php';
|
||||||
<div class="moderation-grid">
|
<div class="moderation-grid">
|
||||||
<?php foreach ($pendingPictures as $picture): ?>
|
<?php foreach ($pendingPictures as $picture): ?>
|
||||||
<div class="moderation-card">
|
<div class="moderation-card">
|
||||||
<a href="/member_picture.php?id=<?= (int) $picture['id'] ?>" class="moderation-thumb">
|
<?php // Hintergrundbilder haben keine eigene Bildseite - Link direkt aufs Bild ?>
|
||||||
|
<a href="<?= e(!empty($picture['is_background']) ? profile_image_url($picture['filename']) : '/member_picture.php?id=' . (int) $picture['id']) ?>" class="moderation-thumb"<?= !empty($picture['is_background']) ? ' target="_blank" rel="noopener"' : '' ?>>
|
||||||
<img src="<?= e(profile_image_url($picture['filename'])) ?>" alt="" loading="lazy">
|
<img src="<?= e(profile_image_url($picture['filename'])) ?>" alt="" loading="lazy">
|
||||||
</a>
|
</a>
|
||||||
<div class="moderation-body">
|
<div class="moderation-body">
|
||||||
<div class="moderation-meta">
|
<div class="moderation-meta">
|
||||||
<span class="badge">Bild</span>
|
<span class="badge"><?= !empty($picture['is_background']) ? 'Profil-Hintergrund' : 'Bild' ?></span>
|
||||||
<a href="/member.php?id=<?= (int) $picture['user_id'] ?>"><strong><?= e((string) $picture['author']) ?></strong></a>
|
<a href="/member.php?id=<?= (int) $picture['user_id'] ?>"><strong><?= e((string) $picture['author']) ?></strong></a>
|
||||||
<span class="text-muted"><?= e(date('d.m.Y H:i', strtotime((string) $picture['created_at']))) ?></span>
|
<span class="text-muted"><?= e(date('d.m.Y H:i', strtotime((string) $picture['created_at']))) ?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ $me = current_user();
|
||||||
if ($type === 'picture') {
|
if ($type === 'picture') {
|
||||||
$stmt = db()->prepare(
|
$stmt = db()->prepare(
|
||||||
'SELECT g.id AS picture_id, g.user_id AS owner_id, g.status, g.user_id AS author_id, u.gallery_comments_enabled, u.status AS owner_status
|
'SELECT g.id AS picture_id, g.user_id AS owner_id, g.status, g.user_id AS author_id, u.gallery_comments_enabled, u.status AS owner_status
|
||||||
FROM member_gallery g JOIN users u ON u.id = g.user_id WHERE g.id = ?'
|
FROM member_gallery g JOIN users u ON u.id = g.user_id WHERE g.id = ? AND g.is_background = 0'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$stmt = db()->prepare(
|
$stmt = db()->prepare(
|
||||||
|
|
|
||||||
|
|
@ -438,6 +438,8 @@ CREATE TABLE IF NOT EXISTS member_gallery (
|
||||||
-- visible = fuer alle sichtbar, pending = wartet auf Freigabe (Vertrauensstufe, Link, KI-Pruefung, Meldungen)
|
-- visible = fuer alle sichtbar, pending = wartet auf Freigabe (Vertrauensstufe, Link, KI-Pruefung, Meldungen)
|
||||||
status VARCHAR(10) NOT NULL DEFAULT 'visible',
|
status VARCHAR(10) NOT NULL DEFAULT 'visible',
|
||||||
moderation_note VARCHAR(255) NULL,
|
moderation_note VARCHAR(255) NULL,
|
||||||
|
-- 1 = nur als Hintergrund der Profilseite hochgeladen, nicht Teil der Galerie (gleiche Moderation)
|
||||||
|
is_background TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
sort_order INT NOT NULL DEFAULT 0,
|
sort_order INT NOT NULL DEFAULT 0,
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue