X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=wwwroot%2Fsmarty%2Flibs%2Fplugins%2Ffunction.html_select_date.php;h=e5eb18307bf3922d27b2b978bd81a30920e4d57f;hb=9b7c11be09e7a553b26667f673c6315209ddc210;hp=e03e670903fa057e2126d4a9a6a94895052ba094;hpb=95a6ccc277bc41d750ced09fe5a1a779bde342c7;p=mirrors%2FKyberia-bloodline.git diff --git a/wwwroot/smarty/libs/plugins/function.html_select_date.php b/wwwroot/smarty/libs/plugins/function.html_select_date.php index e03e670..e5eb183 100644 --- a/wwwroot/smarty/libs/plugins/function.html_select_date.php +++ b/wwwroot/smarty/libs/plugins/function.html_select_date.php @@ -22,12 +22,15 @@ * month values (Gary Loescher) * - 1.3.1 added support for choosing format for * day values (Marcus Bointon) - * - 1.3.2 suppport negative timestamps, force year + * - 1.3.2 support negative timestamps, force year * dropdown to include given date unless explicitly set (Monte) + * - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that + * of 0000-00-00 dates (cybot, boots) * @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date} * (Smarty online manual) - * @version 1.3.2 - * @author Andrei Zmievski + * @version 1.3.4 + * @author Andrei Zmievski + * @author Monte Ohrt * @param array * @param Smarty * @return string @@ -130,12 +133,14 @@ function smarty_function_html_select_date($params, &$smarty) } } - if(preg_match('!^-\d+$!',$time)) { + if (preg_match('!^-\d+$!', $time)) { // negative timestamp, use date() - $time = date('Y-m-d',$time); + $time = date('Y-m-d', $time); } // If $time is not in format yyyy-mm-dd - if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) { + if (preg_match('/^(\d{0,4}-\d{0,2}-\d{0,2})/', $time, $found)) { + $time = $found[1]; + } else { // use smarty_make_timestamp to get an unix timestamp and // strftime to make yyyy-mm-dd $time = strftime('%Y-%m-%d', smarty_make_timestamp($time)); @@ -173,7 +178,9 @@ function smarty_function_html_select_date($params, &$smarty) $html_result = $month_result = $day_result = $year_result = ""; + $field_separator_count = -1; if ($display_months) { + $field_separator_count++; $month_names = array(); $month_values = array(); if(isset($month_empty)) { @@ -211,6 +218,7 @@ function smarty_function_html_select_date($params, &$smarty) } if ($display_days) { + $field_separator_count++; $days = array(); if (isset($day_empty)) { $days[''] = $day_empty; @@ -246,6 +254,7 @@ function smarty_function_html_select_date($params, &$smarty) } if ($display_years) { + $field_separator_count++; if (null !== $field_array){ $year_name = $field_array . '[' . $prefix . 'Year]'; } else { @@ -309,7 +318,7 @@ function smarty_function_html_select_date($params, &$smarty) break; } // Add the field seperator - if($i != 2) { + if($i < $field_separator_count) { $html_result .= $field_separator; } }