mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
- 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:
@@ -1,6 +1,7 @@
|
|||||||
===== trunk =====
|
===== trunk =====
|
||||||
06.10.2011
|
06.10.2011
|
||||||
- bugfix switch lexer internals depending on mbstring.func_overload
|
- 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
|
05.10.2011
|
||||||
- bugfix of problem introduced with r4342 by replacing strlen() with isset()
|
- bugfix of problem introduced with r4342 by replacing strlen() with isset()
|
||||||
|
@@ -55,7 +55,9 @@ function smarty_function_html_select_date($params, $template)
|
|||||||
{
|
{
|
||||||
// generate timestamps used for month names only
|
// generate timestamps used for month names only
|
||||||
static $_month_timestamps = null;
|
static $_month_timestamps = null;
|
||||||
|
static $_current_year = null;
|
||||||
if ($_month_timestamps === null) {
|
if ($_month_timestamps === null) {
|
||||||
|
$_current_year = date('Y');
|
||||||
$_month_timestamps = array();
|
$_month_timestamps = array();
|
||||||
for ($i = 1; $i <= 12; $i++) {
|
for ($i = 1; $i <= 12; $i++) {
|
||||||
$_month_timestamps[$i] = mktime(0, 0, 0, $i, 1, 2000);
|
$_month_timestamps[$i] = mktime(0, 0, 0, $i, 1, 2000);
|
||||||
@@ -211,11 +213,11 @@ function smarty_function_html_select_date($params, $template)
|
|||||||
$key .= '_year';
|
$key .= '_year';
|
||||||
$t = $$key;
|
$t = $$key;
|
||||||
if ($t === null) {
|
if ($t === null) {
|
||||||
$$key = (int)$_year;
|
$$key = (int)$_current_year;
|
||||||
} else if ($t[0] == '+') {
|
} else if ($t[0] == '+') {
|
||||||
$$key = (int)($_year + trim(substr($t, 1)));
|
$$key = (int)($_current_year + trim(substr($t, 1)));
|
||||||
} else if ($t[0] == '-') {
|
} else if ($t[0] == '-') {
|
||||||
$$key = (int)($_year - trim(substr($t, 1)));
|
$$key = (int)($_current_year - trim(substr($t, 1)));
|
||||||
} else {
|
} else {
|
||||||
$$key = (int)$$key;
|
$$key = (int)$$key;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user