From bdbd8168f35a20f0f93ef24ef4a17b0ce92a5c52 Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 20 Mar 2002 19:33:04 +0000 Subject: [PATCH] Fixed +/- functionality. --- libs/plugins/function.html_select_date.php | 16 ++++++++-------- plugins/function.html_select_date.php | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libs/plugins/function.html_select_date.php b/libs/plugins/function.html_select_date.php index 2036027e..faeabb06 100644 --- a/libs/plugins/function.html_select_date.php +++ b/libs/plugins/function.html_select_date.php @@ -56,18 +56,18 @@ function smarty_function_html_select_date($params, &$smarty) extract($params); // make syntax "+N" or "-N" work with start_year and end_year - if(preg_match('!(\+|\-)\s*(\d+)!',$end_year,$match)) { - if($match[1] == '+') { - $end_year = $match[2] + strftime("%Y"); + if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) { + if ($match[1] == '+') { + $end_year = strftime('%Y') + $match[2]; } else { - $end_year = $match[2] - strftime("%Y"); + $end_year = strftime('%Y') - $match[2]; } } - if(preg_match('!(\+|\-)\s*(\d+)!',$start_year,$match)) { - if($match[1] == '+') { - $start_year = $match[2] + strftime("%Y"); + if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) { + if ($match[1] == '+') { + $start_year = strftime('%Y') + $match[2]; } else { - $start_year = $match[2] - strftime("%Y"); + $start_year = strftime('%Y') - $match[2]; } } diff --git a/plugins/function.html_select_date.php b/plugins/function.html_select_date.php index 2036027e..faeabb06 100644 --- a/plugins/function.html_select_date.php +++ b/plugins/function.html_select_date.php @@ -56,18 +56,18 @@ function smarty_function_html_select_date($params, &$smarty) extract($params); // make syntax "+N" or "-N" work with start_year and end_year - if(preg_match('!(\+|\-)\s*(\d+)!',$end_year,$match)) { - if($match[1] == '+') { - $end_year = $match[2] + strftime("%Y"); + if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) { + if ($match[1] == '+') { + $end_year = strftime('%Y') + $match[2]; } else { - $end_year = $match[2] - strftime("%Y"); + $end_year = strftime('%Y') - $match[2]; } } - if(preg_match('!(\+|\-)\s*(\d+)!',$start_year,$match)) { - if($match[1] == '+') { - $start_year = $match[2] + strftime("%Y"); + if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) { + if ($match[1] == '+') { + $start_year = strftime('%Y') + $match[2]; } else { - $start_year = $match[2] - strftime("%Y"); + $start_year = strftime('%Y') - $match[2]; } }