From ff4716172198acdc7eb0f727ff211a5ede709096 Mon Sep 17 00:00:00 2001 From: Cedric Abonnel Date: Wed, 13 May 2026 00:14:50 +0200 Subject: [PATCH] =?UTF-8?q?accueil:=20supprimer=20la=20persistence=20de=20?= =?UTF-8?q?cat=C3=A9gorie=20par=20cookie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/public/index.php b/public/index.php index 9120399..1f05a4c 100644 --- a/public/index.php +++ b/public/index.php @@ -2138,28 +2138,7 @@ switch ($action) { $privateCats = $articles->getPrivateCategories(); $allCats = $articles->getCategories(); - if (array_key_exists('cat', $_GET)) { - $filterCat = trim($_GET['cat']); - if ($filterCat === '') { - // Réinitialisation explicite → effacer le cookie et rediriger - setcookie('varlog_cat', '', time() - 3600, '/', '', $isHttps, true); - header('Location: /', true, 302); - exit; - } - // Sauvegarder la catégorie choisie (1 an) - setcookie('varlog_cat', $filterCat, time() + 365 * 24 * 3600, '/', '', $isHttps, true); - } else { - // Pas de paramètre → appliquer le cookie si la catégorie existe toujours - $savedCat = trim($_COOKIE['varlog_cat'] ?? ''); - if ($savedCat !== '' && isset($allCats[$savedCat])) { - header('Location: /categorie/' . rawurlencode($savedCat), true, 302); - exit; - } - if ($savedCat !== '' && !isset($allCats[$savedCat])) { - setcookie('varlog_cat', '', time() - 3600, '/', '', $isHttps, true); - } - $filterCat = ''; - } + $filterCat = array_key_exists('cat', $_GET) ? trim($_GET['cat']) : ''; $allPosts = array_values(array_filter($articles->getAll(), static function (array $a) use ($privateCats, $filterCat): bool { if (!$a['published']) { return canDoOnArticle('view_drafts', $a);