From ae4ac11305be68b0d91bf9ae6c0392025124955f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drix?= Date: Sat, 16 May 2026 09:40:43 +0200 Subject: [PATCH] =?UTF-8?q?feat=20:=20recherche=20titre,=20toggle=20=C3=A0?= =?UTF-8?q?=20la=20une,=20date=20modif,=20retour=20sources=20(v1.6.15)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - admin/articles : champ filter_search (titre, insensible casse) cumulable avec auteur/catégorie/statut (#85) - admin/articles : colonne ★ avec toggle rapide featured + filtre filter_featured (#84) - post/ : date de modification sous la date de publication si modifié après mise en ligne (#81) - sources/ : bouton ← Retour à l'article vers post/ au lieu de /edit/ (#83) Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 12 ++++++++++++ public/index.php | 25 +++++++++++++++++++++++++ public/version.txt | 2 +- templates/admin.php | 31 ++++++++++++++++++++++++++++++- templates/post_view.php | 11 +++++++++++ templates/sources.php | 2 +- 6 files changed, 80 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5e2cb1..5b98386 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ Format : [Keep a Changelog](https://keepachangelog.com/fr/1.0.0/) — versionnag --- +## [1.6.15] - 2026-05-16 + +### Ajouté +- `admin/articles` : champ de recherche par titre (`filter_search`), cumulable avec les autres filtres (#85) +- `admin/articles` : colonne « ★ À la une » avec toggle rapide par ligne et filtre `filter_featured` (#84) +- `post/` : date de modification affichée sous la date de publication si l'article a été modifié après sa mise en ligne (#81) + +### Modifié +- `sources/` : bouton « ← Modifier » remplacé par « ← Retour à l'article » pointant vers `post/` (#83) + +--- + ## [1.6.14] - 2026-05-15 ### Modifié diff --git a/public/index.php b/public/index.php index a8c2e5f..37a305d 100644 --- a/public/index.php +++ b/public/index.php @@ -2355,9 +2355,13 @@ switch ($action) { $filterAuthor = trim($_GET['filter_author'] ?? ''); $filterCategory = trim($_GET['filter_category'] ?? ''); $filterStatus = trim($_GET['filter_status'] ?? ''); + $filterSearch = trim($_GET['filter_search'] ?? ''); + $filterFeatured = trim($_GET['filter_featured'] ?? ''); $adminData['filter_author'] = $filterAuthor; $adminData['filter_category'] = $filterCategory; $adminData['filter_status'] = $filterStatus; + $adminData['filter_search'] = $filterSearch; + $adminData['filter_featured'] = $filterFeatured; $nowTs = time(); if ($filterAuthor !== '') { @@ -2373,6 +2377,12 @@ switch ($action) { } elseif ($filterStatus === 'preview') { $allArticles = array_values(array_filter($allArticles, fn ($a) => $a['published'] && strtotime((string)($a['published_at'] ?? '')) > $nowTs)); } + if ($filterSearch !== '') { + $allArticles = array_values(array_filter($allArticles, fn ($a) => mb_stripos($a['title'] ?? '', $filterSearch) !== false)); + } + if ($filterFeatured === 'yes') { + $allArticles = array_values(array_filter($allArticles, fn ($a) => !empty($a['featured']))); + } $sortBy = in_array($_GET['sort'] ?? '', ['title', 'published', 'updated']) ? $_GET['sort'] : 'updated'; $sortDir = ($_GET['dir'] ?? '') === 'asc' ? 'asc' : 'desc'; @@ -2741,6 +2751,21 @@ switch ($action) { header('Location: /admin/smtp'); exit; + case 'admin_toggle_featured': + requireAuth(); + if (!isAdmin() || $_SERVER['REQUEST_METHOD'] !== 'POST') { + http_response_code(403); + exit; + } + $uid = trim((string)($_POST['uuid'] ?? '')); + $art = $uid !== '' ? $articles->getByUuid($uid) : null; + if ($art) { + $articles->setFeatured($uid, !((bool)($art['featured'] ?? false))); + } + $back = $_POST['_back'] ?? '/admin/articles'; + header('Location: ' . $back); + exit; + case 'admin_bulk_delete': requireAuth(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { diff --git a/public/version.txt b/public/version.txt index 5577648..7e84a78 100644 --- a/public/version.txt +++ b/public/version.txt @@ -1 +1 @@ -1.6.14 +1.6.15 diff --git a/templates/admin.php b/templates/admin.php index bc6268f..d0dedaf 100644 --- a/templates/admin.php +++ b/templates/admin.php @@ -214,6 +214,8 @@ function adminStatusBadge(array $a, int $now): string 'filter_author' => $adminData['filter_author'] ?? '', 'filter_category' => $adminData['filter_category'] ?? '', 'filter_status' => $adminData['filter_status'] ?? '', + 'filter_search' => $adminData['filter_search'] ?? '', + 'filter_featured' => $adminData['filter_featured'] ?? '', ], fn ($v) => $v !== ''); $p['sort'] = $col; $p['dir'] = $dir; @@ -263,9 +265,19 @@ function adminStatusBadge(array $a, int $now): string +
+ +
+
+ +
- + Réinitialiser @@ -304,6 +316,7 @@ function adminStatusBadge(array $a, int $now): string Auteur Catégorie Statut + ★ @@ -330,6 +343,22 @@ function adminStatusBadge(array $a, int $now): string + + + + $adminData['filter_author'] ?? '', 'filter_category' => $adminData['filter_category'] ?? '', 'filter_status' => $adminData['filter_status'] ?? '', 'filter_search' => $adminData['filter_search'] ?? '', 'filter_featured' => $adminData['filter_featured'] ?? '', 'sort' => $_sortBy, 'dir' => $_sortDir], fn ($v) => $v !== '')); ?> +
+ + + +
+ + + + diff --git a/templates/post_view.php b/templates/post_view.php index 2246962..dcd8317 100644 --- a/templates/post_view.php +++ b/templates/post_view.php @@ -96,6 +96,14 @@ $authorName = ($authorEmail !== '' && function_exists('authorDisplayName') $authorProfileUrl = ($authorEmail !== '' && function_exists('authorProfileUrl')) ? authorProfileUrl($authorEmail) : ''; $authorSlugVal = ($authorEmail !== '' && function_exists('authorSlug')) ? authorSlug($authorEmail) : ''; $pubDate = htmlspecialchars(date('d/m/Y', strtotime((string)($article['published_at'] ?? $article['created_at'] ?? '')))); +$modDate = ''; +$_updatedTs = strtotime((string)($article['updated_at'] ?? '')); +$_publishedTs = strtotime((string)($article['published_at'] ?? $article['created_at'] ?? '')); +if ($_updatedTs > 0 && $_publishedTs > 0 && $_updatedTs > $_publishedTs) { + $_frMonths = ['janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre']; + $modDate = 'Modifié le ' . (int)date('j', $_updatedTs) . ' ' . $_frMonths[(int)date('n', $_updatedTs) - 1] + . ' ' . date('Y', $_updatedTs) . ' à ' . date('H', $_updatedTs) . 'h' . date('i', $_updatedTs); +} $hasCover = $coverFile !== ''; $heroExtraClass = $hasCover ? '' : ' article-cover--gradient'; $heroStyle = $hasCover ? '' : ' style="background:' . htmlspecialchars($gradient) . '"'; @@ -137,6 +145,9 @@ $hasSources = (!empty($externalLinks) || !empty($files)) · + +
+

diff --git a/templates/sources.php b/templates/sources.php index c51dda4..edf6875 100644 --- a/templates/sources.php +++ b/templates/sources.php @@ -38,7 +38,7 @@ function renderMetaCell(string $key, mixed $val, array $row = []): string ?>