- bugfix start_year and end_year of {html_select_date} did not use current year as offset base (Issue #53)

This commit is contained in:
rodneyrehm
2011-10-06 15:12:35 +00:00
parent 904731fd1f
commit 7169e594c4
2 changed files with 6 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
===== trunk =====
06.10.2011
- bugfix switch lexer internals depending on mbstring.func_overload
- bugfix start_year and end_year of {html_select_date} did not use current year as offset base (Issue #53)
05.10.2011
- bugfix of problem introduced with r4342 by replacing strlen() with isset()

View File

@@ -55,7 +55,9 @@ function smarty_function_html_select_date($params, $template)
{
// generate timestamps used for month names only
static $_month_timestamps = null;
static $_current_year = null;
if ($_month_timestamps === null) {
$_current_year = date('Y');
$_month_timestamps = array();
for ($i = 1; $i <= 12; $i++) {
$_month_timestamps[$i] = mktime(0, 0, 0, $i, 1, 2000);
@@ -211,11 +213,11 @@ function smarty_function_html_select_date($params, $template)
$key .= '_year';
$t = $$key;
if ($t === null) {
$$key = (int)$_year;
$$key = (int)$_current_year;
} else if ($t[0] == '+') {
$$key = (int)($_year + trim(substr($t, 1)));
$$key = (int)($_current_year + trim(substr($t, 1)));
} else if ($t[0] == '-') {
$$key = (int)($_year - trim(substr($t, 1)));
$$key = (int)($_current_year - trim(substr($t, 1)));
} else {
$$key = (int)$$key;
}