mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
fixed indetiation
This commit is contained in:
@@ -71,36 +71,36 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
$field_order = 'MDY';
|
$field_order = 'MDY';
|
||||||
/* String printed between the different fields. */
|
/* String printed between the different fields. */
|
||||||
$field_separator = "\n";
|
$field_separator = "\n";
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|
||||||
|
|
||||||
extract($params);
|
extract($params);
|
||||||
|
|
||||||
// If $time is not in format yyyy-mm-dd
|
// If $time is not in format yyyy-mm-dd
|
||||||
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $time)) {
|
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $time)) {
|
||||||
// then $time is empty or unix timestamp or mysql timestamp
|
// then $time is empty or unix timestamp or mysql timestamp
|
||||||
// using smarty_make_timestamp to get an unix timestamp and
|
// using smarty_make_timestamp to get an unix timestamp and
|
||||||
// strftime to make yyyy-mm-dd
|
// strftime to make yyyy-mm-dd
|
||||||
$time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
|
$time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
|
||||||
}
|
}
|
||||||
// Now split this in pieces, which later can be used to set the select
|
// Now split this in pieces, which later can be used to set the select
|
||||||
$time = explode("-", $time);
|
$time = explode("-", $time);
|
||||||
|
|
||||||
// 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 = strftime('%Y') + $match[2];
|
$end_year = strftime('%Y') + $match[2];
|
||||||
} else {
|
} else {
|
||||||
$end_year = strftime('%Y') - $match[2];
|
$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 = strftime('%Y') + $match[2];
|
$start_year = strftime('%Y') + $match[2];
|
||||||
} else {
|
} else {
|
||||||
$start_year = strftime('%Y') - $match[2];
|
$start_year = strftime('%Y') - $match[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$field_order = strtoupper($field_order);
|
$field_order = strtoupper($field_order);
|
||||||
|
|
||||||
@@ -215,24 +215,24 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
|
|
||||||
// Loop thru the field_order field
|
// Loop thru the field_order field
|
||||||
for ($i = 0; $i <= 2; $i++){
|
for ($i = 0; $i <= 2; $i++){
|
||||||
$c = substr($field_order, $i, 1);
|
$c = substr($field_order, $i, 1);
|
||||||
switch ($c){
|
switch ($c){
|
||||||
case 'D':
|
case 'D':
|
||||||
$html_result .= $day_result;
|
$html_result .= $day_result;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M':
|
case 'M':
|
||||||
$html_result .= $month_result;
|
$html_result .= $month_result;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Y':
|
case 'Y':
|
||||||
$html_result .= $year_result;
|
$html_result .= $year_result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Add the field seperator
|
// Add the field seperator
|
||||||
if($i != 2) {
|
if($i != 2) {
|
||||||
$html_result .= $field_separator;
|
$html_result .= $field_separator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html_result;
|
return $html_result;
|
||||||
|
Reference in New Issue
Block a user