From f54c70b9fa2df87c3a10139c59fa9af11a93406a Mon Sep 17 00:00:00 2001 From: Fil <fil@rezo.net> Date: Wed, 18 Jan 2006 22:13:30 +0000 Subject: [PATCH] =?UTF-8?q?mettre=20la=20date=20dans=20le=20contexte=20d'i?= =?UTF-8?q?nclusion=20(si=20elle=20n'est=20pas=20pr=C3=A9cis=C3=A9e,=20?= =?UTF-8?q?=C3=A9videmment)=20-=20r=C3=A9soud=20#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc-public-global.php3 | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/inc-public-global.php3 b/inc-public-global.php3 index 10b865c457..df1147b97c 100644 --- a/inc-public-global.php3 +++ b/inc-public-global.php3 @@ -223,19 +223,27 @@ function inclure_page($fond, $contexte_inclus, $cache_incluant='') { $lang_select = true; // pour lang_dselect en sortie } - if (!$use_cache) - $page = obtenir_page_ancienne ($chemin_cache, $fond, false); - else { - include_local('inc-calcul'); - $page = cherche_page($chemin_cache, $contexte_inclus, $fond, false); - $page['signal']['process_ins'] = $page['process_ins']; - $lastmodified = time(); - if ($chemin_cache) creer_cache($page, $chemin_cache, $use_cache); - } + // Une fois le chemin-cache decide, on ajoute la date (et date_redac) + // dans le contexte inclus, pour que les criteres {age} etc fonctionnent + if (!isset($contexte_inclus['date'])) + $contexte_inclus['date'] = date('Y-m-d H:i:s'); + if (!isset($contexte_inclus['date_redac'])) + $contexte_inclus['date_redac'] = $contexte_inclus['date']; + + // On va ensuite chercher la page + if (!$use_cache) + $page = obtenir_page_ancienne ($chemin_cache, $fond, false); + else { + include_local('inc-calcul'); + $page = cherche_page($chemin_cache, $contexte_inclus, $fond, false); + $page['signal']['process_ins'] = $page['process_ins']; + $lastmodified = time(); + if ($chemin_cache) creer_cache($page, $chemin_cache, $use_cache); + } - $page['lang_select'] = $lang_select; + $page['lang_select'] = $lang_select; - return $page; + return $page; } -- GitLab