From 8340533f84a2373464d4dcdd5319187ebc4edf33 Mon Sep 17 00:00:00 2001 From: BoboTiG Date: Mon, 11 Jul 2016 11:06:21 +0200 Subject: [PATCH 1/2] Fix month selection --- addons/calendrier.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/calendrier.php b/addons/calendrier.php index 7e016df..a8dfe00 100644 --- a/addons/calendrier.php +++ b/addons/calendrier.php @@ -10,7 +10,7 @@ # *** LICENSE *** # This plugin replaces the {calendrier} tag in the public template with -# a navigable HTML calendar. +# a navigable HTML calendar. // include this addon $GLOBALS['addons'][] = array('tag' => '{calendrier}', 'callback_function' => 'addon_calendrier'); @@ -21,7 +21,7 @@ function addon_calendrier() { if ( isset($_GET['d']) and preg_match('#^\d{4}(/\d{2}){5}#', $_GET['d'])) { $id = substr(str_replace('/', '', $_GET['d']), 0, 14); $date = substr(get_entry($GLOBALS['db_handle'], 'articles', 'bt_date', $id, 'return'), 0, 8); - $date = (preg_match('#^\d{4}(/\d{2}){5}#', $date) and $date <= date('Y/m/d/H/i/s')) ? $date : date('Ym'); + $date = ($date <= date('YmdHis')) ? $date : date('Ym'); } elseif ( isset($_GET['d']) and preg_match('#^\d{4}/\d{2}(/\d{2})?#', $_GET['d']) ) { $date = str_replace('/', '', $_GET['d']); $date = (preg_match('#^\d{6}\d{2}#', $date)) ? substr($date, 0, 8) : substr($date, 0, 6); // avec jour ? @@ -125,6 +125,3 @@ function addon_calendrier() { return $html; } - - - From 3e62f8928a78252e45c75ede711736cf1377d6bc Mon Sep 17 00:00:00 2001 From: BoboTiG Date: Mon, 11 Jul 2016 11:19:21 +0200 Subject: [PATCH 2/2] Remove useless 'His' from date() format --- addons/calendrier.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/calendrier.php b/addons/calendrier.php index a8dfe00..79b9bd5 100644 --- a/addons/calendrier.php +++ b/addons/calendrier.php @@ -21,7 +21,7 @@ function addon_calendrier() { if ( isset($_GET['d']) and preg_match('#^\d{4}(/\d{2}){5}#', $_GET['d'])) { $id = substr(str_replace('/', '', $_GET['d']), 0, 14); $date = substr(get_entry($GLOBALS['db_handle'], 'articles', 'bt_date', $id, 'return'), 0, 8); - $date = ($date <= date('YmdHis')) ? $date : date('Ym'); + $date = ($date <= date('Ymd')) ? $date : date('Ym'); } elseif ( isset($_GET['d']) and preg_match('#^\d{4}/\d{2}(/\d{2})?#', $_GET['d']) ) { $date = str_replace('/', '', $_GET['d']); $date = (preg_match('#^\d{6}\d{2}#', $date)) ? substr($date, 0, 8) : substr($date, 0, 6); // avec jour ?