Skip to content

Commit

Permalink
Merge pull request #51 from BoboTiG/fix-addon-calendar
Browse files Browse the repository at this point in the history
Fix month selection
  • Loading branch information
timovn authored Jul 12, 2016
2 parents c174073 + 3e62f89 commit a8f4bea
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions addons/calendrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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('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 ?
Expand Down Expand Up @@ -125,6 +125,3 @@ function addon_calendrier() {
return $html;

}



0 comments on commit a8f4bea

Please sign in to comment.