From 7fc51f79d1191249ba4272ea789b3586c7a49053 Mon Sep 17 00:00:00 2001 From: real_nowhereman Date: Thu, 28 Feb 2008 14:56:52 +0000 Subject: [PATCH] this commit addresses some locale issues (date combobox in search template) and refactors a bit the date_formatting code; date_strformat was not used, so it's been modified to work as it should by moving around things a bit, and making it compatible - for what concerns the prototype of the function - to strftime --- fp-includes/core/core.date.php | 56 ++++++++++---- fp-includes/core/core.theme.php | 77 ++++--------------- .../plugins/function.html_select_date.php | 20 ++--- 3 files changed, 68 insertions(+), 85 deletions(-) diff --git a/fp-includes/core/core.date.php b/fp-includes/core/core.date.php index 6e1ec52..4d240e5 100755 --- a/fp-includes/core/core.date.php +++ b/fp-includes/core/core.date.php @@ -1,23 +1,51 @@ _get_plugin_filepath('function','html_options'); /* Default values. */ $prefix = "Date_"; - $start_year = strftime("%Y"); + $start_year = date_strformat("%Y"); $end_year = $start_year; $display_days = true; $display_months = true; @@ -142,8 +142,8 @@ function smarty_function_html_select_date($params, &$smarty) $time = $found[1]; } else { // use smarty_make_timestamp to get an unix timestamp and - // strftime to make yyyy-mm-dd - $time = strftime('%Y-%m-%d', smarty_make_timestamp($time)); + // date_strformat to make yyyy-mm-dd + $time = date_strformat('%Y-%m-%d', smarty_make_timestamp($time)); } // Now split this in pieces, which later can be used to set the select $time = explode("-", $time); @@ -151,16 +151,16 @@ function smarty_function_html_select_date($params, &$smarty) // 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 = strftime('%Y') + $match[2]; + $end_year = date_strformat('%Y') + $match[2]; } else { - $end_year = strftime('%Y') - $match[2]; + $end_year = date_strformat('%Y') - $match[2]; } } if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) { if ($match[1] == '+') { - $start_year = strftime('%Y') + $match[2]; + $start_year = date_strformat('%Y') + $match[2]; } else { - $start_year = strftime('%Y') - $match[2]; + $start_year = date_strformat('%Y') - $match[2]; } } if (strlen($time[0]) > 0) { @@ -188,8 +188,8 @@ function smarty_function_html_select_date($params, &$smarty) $month_values[''] = ''; } for ($i = 1; $i <= 12; $i++) { - $month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000)); - $month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000)); + $month_names[$i] = date_strformat($month_format, mktime(0, 0, 0, $i, 1, 2000)); + $month_values[$i] = date_strformat($month_value_format, mktime(0, 0, 0, $i, 1, 2000)); } $month_result .= '';