From 63d71ab7e4d4ee8e304e824dbd818b01680c9126 Mon Sep 17 00:00:00 2001 From: perco Date: Tue, 12 May 2026 09:40:19 +0200 Subject: [PATCH 1/2] Settings : upload image fond page d'accueil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Section "Image d'accueil" dans settings.php (par famille) - Stockage dans /uploads/home_bg_{family_id}.{ext} - Aperçu de l'image actuelle + bouton reset vers le défaut - /home-bg.php : endpoint sécurisé pour servir l'image - index.php : override inline CSS si image personnalisée Co-Authored-By: Claude Sonnet 4.6 --- home-bg.php | 18 +++++++++++++++ index.php | 11 +++++++++- settings.php | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 home-bg.php diff --git a/home-bg.php b/home-bg.php new file mode 100644 index 0000000..6da1d0e --- /dev/null +++ b/home-bg.php @@ -0,0 +1,18 @@ +'image/jpeg','jpeg'=>'image/jpeg','png'=>'image/png','webp'=>'image/webp'][$ext] ?? 'image/jpeg'; + +header('Content-Type: ' . $mime); +header('Cache-Control: private, max-age=3600'); +readfile($file); diff --git a/index.php b/index.php index 9f848c5..b7f4ada 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,16 @@ $bodyClass = "pf-home"; // Important pour l'image de fond définie dans home.cs $pageCss = "/modules/home/home.css"; require __DIR__ . '/header.php'; -?> + +// Override background si image personnalisée uploadée +$_fid = $_SESSION['user']['family_id'] ?? null; +$_has_custom_bg = false; +if ($_fid) { + foreach (glob('/uploads/home_bg_' . $_fid . '.*') as $_f) { $_has_custom_bg = true; break; } +} +if ($_has_custom_bg): ?> + +
diff --git a/settings.php b/settings.php index 804ed92..5d49d7f 100644 --- a/settings.php +++ b/settings.php @@ -86,6 +86,32 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ->execute([$new_code, $family_id]); $success = "Nouveau code d'invitation généré."; } + + if ($action === 'upload_home_bg' && $family_id) { + $upload_dir = '/uploads/'; + if (!is_dir($upload_dir)) @mkdir($upload_dir, 0755, true); + $file = $_FILES['home_bg'] ?? null; + if ($file && $file['error'] === 0) { + $ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION)); + if (!in_array($ext, ['jpg','jpeg','png','webp'])) { + $error = "Format non supporté (jpg, png, webp)."; + } else { + $dest = $upload_dir . 'home_bg_' . $family_id . '.' . $ext; + // Supprimer anciens fichiers de ce family + foreach (glob($upload_dir . 'home_bg_' . $family_id . '.*') as $old) @unlink($old); + if (move_uploaded_file($file['tmp_name'], $dest)) { + $success = "Image d'accueil mise à jour."; + } else { + $error = "Erreur lors de l'upload."; + } + } + } + } + + if ($action === 'reset_home_bg' && $family_id) { + foreach (glob('/uploads/home_bg_' . $family_id . '.*') as $old) @unlink($old); + $success = "Image d'accueil réinitialisée."; + } } // ─── Chargement données ─────────────────────────────────────────────────────── @@ -181,6 +207,42 @@ require __DIR__ . '/header.php'; + + +
+

🖼️ Image d'accueil

+

Photo de fond affichée sur la page d'accueil (partagée avec tous les membres).

+ + +
+ Fond actuel + Image personnalisée +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ +
+ +

👤 Mon profil

From 1e43f4bdc1e58f479f720422682c1d68838b8b84 Mon Sep 17 00:00:00 2001 From: perco Date: Tue, 12 May 2026 10:36:17 +0200 Subject: [PATCH 2/2] Uniformisation body : data-page au lieu de classes par page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - uniforme sur toutes les pages -
reçoit la classe module via $mainClass (pas le body) - home.css : body.pf-home → body[data-page="home"] - family-calendar.css : .pf-family-calendar .pf-main → .pf-family-calendar.pf-main - dark-mode.css : mise à jour références body.pf-home Co-Authored-By: Claude Sonnet 4.6 --- dark-mode.css | 12 ++++----- family-calendar.php | 2 +- gift-list.php | 2 +- header.php | 4 +-- holidays.php | 2 +- index.php | 4 +-- modules/family-calendar/family-calendar.css | 2 +- modules/home/home.css | 28 ++++++++++----------- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/dark-mode.css b/dark-mode.css index 665f167..f0160eb 100644 --- a/dark-mode.css +++ b/dark-mode.css @@ -5,22 +5,22 @@ /* ─── HOME PAGE ─────────────────────────────────────────────────────────────── */ /* Le header home.css a plus de spécificité que global.css → on le force ici */ -[data-theme="dark"] body.pf-home .pf-header { +[data-theme="dark"] body[data-page="home"] .pf-header { background: rgba(13,17,23,.92) !important; border-color: rgba(48,54,61,.6) !important; backdrop-filter: blur(8px) !important; } -[data-theme="dark"] body.pf-home .pf-module-card { +[data-theme="dark"] body[data-page="home"] .pf-module-card { background: rgba(22,27,34,.92) !important; border: 1px solid var(--border-light) !important; box-shadow: 0 4px 15px rgba(0,0,0,.4) !important; } -[data-theme="dark"] body.pf-home .pf-module-card:hover { +[data-theme="dark"] body[data-page="home"] .pf-module-card:hover { border-color: var(--primary) !important; } -[data-theme="dark"] body.pf-home .pf-card-title { color: var(--text-main); } -[data-theme="dark"] body.pf-home .pf-card-desc { color: var(--text-muted); } -[data-theme="dark"] body.pf-home .pf-card-cta { color: var(--primary); } +[data-theme="dark"] body[data-page="home"] .pf-card-title { color: var(--text-main); } +[data-theme="dark"] body[data-page="home"] .pf-card-desc { color: var(--text-muted); } +[data-theme="dark"] body[data-page="home"] .pf-card-cta { color: var(--primary); } /* ─── SHARED / GLOBAL PATTERNS ──────────────────────────────────────────────── */ [data-theme="dark"] .pf-card { background: var(--bg-panel) !important; border-color: var(--border-light) !important; color: var(--text-main) !important; } diff --git a/family-calendar.php b/family-calendar.php index 39aeca3..b05f54c 100644 --- a/family-calendar.php +++ b/family-calendar.php @@ -10,7 +10,7 @@ require_once __DIR__ . '/includes/i18n.php'; $pageTitle = tr('fc_page_title'); $activePage = "family-calendar"; -$bodyClass = "pf-family-calendar"; +$mainClass = "pf-family-calendar"; $pageCss = "/modules/family-calendar/family-calendar.css"; require __DIR__ . '/header.php'; diff --git a/gift-list.php b/gift-list.php index 704c6fa..215a2ca 100644 --- a/gift-list.php +++ b/gift-list.php @@ -12,7 +12,7 @@ if (session_status() === PHP_SESSION_NONE) { session_start(); } $year = (int)date('Y'); $pageTitle = tr('gift_page_title'); $activePage = "gift-list"; -$bodyClass = "pf-gift-list"; +$mainClass = "pf-gift-list"; $pageCss = "/modules/gift-list/gift-list.css"; $children = ['Pol', 'Pep', 'Elna', 'Bru', 'Guim']; diff --git a/header.php b/header.php index 7287852..74c84e8 100644 --- a/header.php +++ b/header.php @@ -39,7 +39,7 @@ $currentLang = $_SESSION['app_lang'] ?? 'fr'; } - +
@@ -107,7 +107,7 @@ $currentLang = $_SESSION['app_lang'] ?? 'fr';
-
+