mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
Fixed +/- functionality.
This commit is contained in:
@@ -56,18 +56,18 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
extract($params);
|
extract($params);
|
||||||
|
|
||||||
// make syntax "+N" or "-N" work with start_year and end_year
|
// make syntax "+N" or "-N" work with start_year and end_year
|
||||||
if(preg_match('!(\+|\-)\s*(\d+)!',$end_year,$match)) {
|
if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
|
||||||
if($match[1] == '+') {
|
if ($match[1] == '+') {
|
||||||
$end_year = $match[2] + strftime("%Y");
|
$end_year = strftime('%Y') + $match[2];
|
||||||
} else {
|
} else {
|
||||||
$end_year = $match[2] - strftime("%Y");
|
$end_year = strftime('%Y') - $match[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(preg_match('!(\+|\-)\s*(\d+)!',$start_year,$match)) {
|
if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
|
||||||
if($match[1] == '+') {
|
if ($match[1] == '+') {
|
||||||
$start_year = $match[2] + strftime("%Y");
|
$start_year = strftime('%Y') + $match[2];
|
||||||
} else {
|
} else {
|
||||||
$start_year = $match[2] - strftime("%Y");
|
$start_year = strftime('%Y') - $match[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -56,18 +56,18 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
extract($params);
|
extract($params);
|
||||||
|
|
||||||
// make syntax "+N" or "-N" work with start_year and end_year
|
// make syntax "+N" or "-N" work with start_year and end_year
|
||||||
if(preg_match('!(\+|\-)\s*(\d+)!',$end_year,$match)) {
|
if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
|
||||||
if($match[1] == '+') {
|
if ($match[1] == '+') {
|
||||||
$end_year = $match[2] + strftime("%Y");
|
$end_year = strftime('%Y') + $match[2];
|
||||||
} else {
|
} else {
|
||||||
$end_year = $match[2] - strftime("%Y");
|
$end_year = strftime('%Y') - $match[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(preg_match('!(\+|\-)\s*(\d+)!',$start_year,$match)) {
|
if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
|
||||||
if($match[1] == '+') {
|
if ($match[1] == '+') {
|
||||||
$start_year = $match[2] + strftime("%Y");
|
$start_year = strftime('%Y') + $match[2];
|
||||||
} else {
|
} else {
|
||||||
$start_year = $match[2] - strftime("%Y");
|
$start_year = strftime('%Y') - $match[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user