fixes #132 - thx laborix & @Fraenkiman!
This commit is contained in:
parent
e58efa9da0
commit
225e3b1b8d
39
CHANGELOG.md
39
CHANGELOG.md
@ -4,33 +4,36 @@
|
|||||||
- [README](https://github.com/flatpressblog/flatpress/blob/master/README.md): added "help and support" section
|
- [README](https://github.com/flatpressblog/flatpress/blob/master/README.md): added "help and support" section
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
- Gallery captions plugin added (see [#108](https://github.com/flatpressblog/flatpress/issues/108))
|
- Gallery captions plugin added ([#108](https://github.com/flatpressblog/flatpress/issues/108))
|
||||||
- PhotoSwipe plugin added (see [#109](https://github.com/flatpressblog/flatpress/issues/109))
|
- PhotoSwipe plugin added ([#109](https://github.com/flatpressblog/flatpress/issues/109))
|
||||||
- jQuery plugin: Updated jQuery (3.5.1 => 3.6) and jQueryUI (1.12.1 => 1.13.1)
|
- jQuery plugin: Updated jQuery (3.5.1 => 3.6) and jQueryUI (1.12.1 => 1.13.1)
|
||||||
- Media Manager plugin shows 50 items per page, not 10
|
- Media Manager plugin shows 50 items per page, not 10
|
||||||
|
- LastComments plugin will not even attempt to delete or rebuild LastComments caches if LastComments plugin is not available ([#43](https://github.com/flatpressblog/flatpress/issues/43))
|
||||||
|
|
||||||
## Themes
|
## Themes
|
||||||
- Leggero
|
- Leggero
|
||||||
- Fixed searchbox glitch in FlatMaas revisited style (see [#97](https://github.com/flatpressblog/flatpress/issues/97))
|
- Fixed searchbox glitch in FlatMaas revisited style ([#97](https://github.com/flatpressblog/flatpress/issues/97))
|
||||||
- Fixed missing bullets in preview (see [#98](https://github.com/flatpressblog/flatpress/issues/98))
|
- Fixed missing bullets in preview ([#98](https://github.com/flatpressblog/flatpress/issues/98))
|
||||||
- CSS of the Leggero style had some glitches on mobile devices
|
- CSS of the Leggero style had some glitches on mobile devices
|
||||||
- Invalid HTML output fixed (see [#106](https://github.com/flatpressblog/flatpress/issues/106))
|
- Invalid HTML output fixed ([#106](https://github.com/flatpressblog/flatpress/issues/106))
|
||||||
- Removed unneccessary external font resource (see [#112](https://github.com/flatpressblog/flatpress/issues/112))
|
- Removed unneccessary external font resource ([#112](https://github.com/flatpressblog/flatpress/issues/112))
|
||||||
- "Add comment" link has its own line (see [#135](https://github.com/flatpressblog/flatpress/issues/135))
|
- "Add comment" link has its own line ([#135](https://github.com/flatpressblog/flatpress/issues/135))
|
||||||
- Removed legacy/invalid CSS (see [#133](https://github.com/flatpressblog/flatpress/issues/133), [#134](https://github.com/flatpressblog/flatpress/issues/134))
|
- Removed legacy/invalid CSS ([#133](https://github.com/flatpressblog/flatpress/issues/133), [#134](https://github.com/flatpressblog/flatpress/issues/134))
|
||||||
- Fixed description of Leggero and Leggero v2 styles (see [#137](https://github.com/flatpressblog/flatpress/issues/137))
|
- Fixed description of Leggero and Leggero v2 styles ([#137](https://github.com/flatpressblog/flatpress/issues/137))
|
||||||
- Obsolete bullet points removed (see [#136](https://github.com/flatpressblog/flatpress/issues/136))
|
- Obsolete bullet points removed ([#136](https://github.com/flatpressblog/flatpress/issues/136))
|
||||||
- Updated preview image (see [#139](https://github.com/flatpressblog/flatpress/issues/139))
|
- Updated preview image ([#139](https://github.com/flatpressblog/flatpress/issues/139))
|
||||||
|
|
||||||
## Bugfixes
|
## Internationalization
|
||||||
- Comment Center config page threw errors (see [#90](https://github.com/flatpressblog/flatpress/issues/90))
|
|
||||||
- Fixed glitches in Spanish an Portuguese language files
|
- Fixed glitches in Spanish an Portuguese language files
|
||||||
|
- Fixed wrong pt-br country code ([#100](https://github.com/flatpressblog/flatpress/issues/100))
|
||||||
|
- Search page: Month names displayed in configured frontend language ([#132](https://github.com/flatpressblog/flatpress/issues/132))
|
||||||
|
|
||||||
|
## Other bugfixes
|
||||||
|
- Comment Center config page threw errors ([#90](https://github.com/flatpressblog/flatpress/issues/90))
|
||||||
- Plugin management page: Removed empty warning messages box
|
- Plugin management page: Removed empty warning messages box
|
||||||
- Fixed wrong pt-br country code (see [#100](https://github.com/flatpressblog/flatpress/issues/100))
|
- Fixed error at prev link on first / next link on last entry ([#95](https://github.com/flatpressblog/flatpress/issues/95))
|
||||||
- Fixed error at prev link on first / next link on last entry (see [#95](https://github.com/flatpressblog/flatpress/issues/95))
|
- Logout redirects to home page again ([#119](https://github.com/flatpressblog/flatpress/issues/119))
|
||||||
- LastComments plugin will not even attempt to delete or rebuild LastComments caches if LastComments plugin is not available (see [#43](https://github.com/flatpressblog/flatpress/issues/43))
|
- Fixed disappearing non-Latin characters in page title ([#49](https://github.com/flatpressblog/flatpress/issues/49) and [#91](https://github.com/flatpressblog/flatpress/issues/91))
|
||||||
- Logout redirects to home page again (see [#119](https://github.com/flatpressblog/flatpress/issues/119))
|
|
||||||
- Fixed disappearing non-Latin characters in page title (see [#49](https://github.com/flatpressblog/flatpress/issues/49) and [#91](https://github.com/flatpressblog/flatpress/issues/91))
|
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
- Fixed security issue reported by huntr.dev: Session cookie missed the "secure" flag
|
- Fixed security issue reported by huntr.dev: Session cookie missed the "secure" flag
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty plugin
|
* Smarty plugin
|
||||||
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage plugins
|
* @subpackage plugins
|
||||||
*/
|
*/
|
||||||
@ -8,322 +10,362 @@
|
|||||||
/**
|
/**
|
||||||
* Smarty {html_select_date} plugin
|
* Smarty {html_select_date} plugin
|
||||||
*
|
*
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: html_select_date<br>
|
* Name: html_select_date<br>
|
||||||
* Purpose: Prints the dropdowns for date selection.
|
* Purpose: Prints the dropdowns for date selection.
|
||||||
*
|
*
|
||||||
* ChangeLog:<br>
|
* ChangeLog:<br>
|
||||||
* - 1.0 initial release
|
* - 1.0 initial release
|
||||||
* - 1.1 added support for +/- N syntax for begin
|
* - 1.1 added support for +/- N syntax for begin
|
||||||
* and end year values. (Monte)
|
* and end year values. (Monte)
|
||||||
* - 1.2 added support for yyyy-mm-dd syntax for
|
* - 1.2 added support for yyyy-mm-dd syntax for
|
||||||
* time value. (Jan Rosier)
|
* time value. (Jan Rosier)
|
||||||
* - 1.3 added support for choosing format for
|
* - 1.3 added support for choosing format for
|
||||||
* month values (Gary Loescher)
|
* month values (Gary Loescher)
|
||||||
* - 1.3.1 added support for choosing format for
|
* - 1.3.1 added support for choosing format for
|
||||||
* day values (Marcus Bointon)
|
* day values (Marcus Bointon)
|
||||||
* - 1.3.2 support negative timestamps, force year
|
* - 1.3.2 support negative timestamps, force year
|
||||||
* dropdown to include given date unless explicitly set (Monte)
|
* dropdown to include given date unless explicitly set (Monte)
|
||||||
* - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
|
* - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
|
||||||
* of 0000-00-00 dates (cybot, boots)
|
* of 0000-00-00 dates (cybot, boots)
|
||||||
|
*
|
||||||
* @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date}
|
* @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @version 1.3.4
|
* @version 1.3.4
|
||||||
* @author Andrei Zmievski
|
* @author Andrei Zmievski
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @param array
|
* @param
|
||||||
* @param Smarty
|
* array
|
||||||
|
* @param
|
||||||
|
* Smarty
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_function_html_select_date($params, &$smarty)
|
function smarty_function_html_select_date($params, &$smarty) {
|
||||||
{
|
require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
|
||||||
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
|
require_once $smarty->_get_plugin_filepath('shared', 'make_timestamp');
|
||||||
require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
|
require_once $smarty->_get_plugin_filepath('function', 'html_options');
|
||||||
require_once $smarty->_get_plugin_filepath('function','html_options');
|
/* Default values. */
|
||||||
/* Default values. */
|
$prefix = "Date_";
|
||||||
$prefix = "Date_";
|
$start_year = strftime("%Y");
|
||||||
$start_year = strftime("%Y");
|
$end_year = $start_year;
|
||||||
$end_year = $start_year;
|
$display_days = true;
|
||||||
$display_days = true;
|
$display_months = true;
|
||||||
$display_months = true;
|
$display_years = true;
|
||||||
$display_years = true;
|
$month_format = "%B";
|
||||||
$month_format = "%B";
|
/* Write months as numbers by default GL */
|
||||||
/* Write months as numbers by default GL */
|
$month_value_format = "%m";
|
||||||
$month_value_format = "%m";
|
$day_format = "%02d";
|
||||||
$day_format = "%02d";
|
/* Write day values using this format MB */
|
||||||
/* Write day values using this format MB */
|
$day_value_format = "%d";
|
||||||
$day_value_format = "%d";
|
$year_as_text = false;
|
||||||
$year_as_text = false;
|
/* Display years in reverse order? Ie. 2000,1999,.... */
|
||||||
/* Display years in reverse order? Ie. 2000,1999,.... */
|
$reverse_years = false;
|
||||||
$reverse_years = false;
|
/*
|
||||||
/* Should the select boxes be part of an array when returned from PHP?
|
* Should the select boxes be part of an array when returned from PHP?
|
||||||
e.g. setting it to "birthday", would create "birthday[Day]",
|
* e.g. setting it to "birthday", would create "birthday[Day]",
|
||||||
"birthday[Month]" & "birthday[Year]". Can be combined with prefix */
|
* "birthday[Month]" & "birthday[Year]". Can be combined with prefix
|
||||||
$field_array = null;
|
*/
|
||||||
/* <select size>'s of the different <select> tags.
|
$field_array = null;
|
||||||
If not set, uses default dropdown. */
|
/*
|
||||||
$day_size = null;
|
* <select size>'s of the different <select> tags.
|
||||||
$month_size = null;
|
* If not set, uses default dropdown.
|
||||||
$year_size = null;
|
*/
|
||||||
/* Unparsed attributes common to *ALL* the <select>/<input> tags.
|
$day_size = null;
|
||||||
An example might be in the template: all_extra ='class ="foo"'. */
|
$month_size = null;
|
||||||
$all_extra = null;
|
$year_size = null;
|
||||||
/* Separate attributes for the tags. */
|
/*
|
||||||
$day_extra = null;
|
* Unparsed attributes common to *ALL* the <select>/<input> tags.
|
||||||
$month_extra = null;
|
* An example might be in the template: all_extra ='class ="foo"'.
|
||||||
$year_extra = null;
|
*/
|
||||||
/* Order in which to display the fields.
|
$all_extra = null;
|
||||||
"D" -> day, "M" -> month, "Y" -> year. */
|
/* Separate attributes for the tags. */
|
||||||
$field_order = 'MDY';
|
$day_extra = null;
|
||||||
/* String printed between the different fields. */
|
$month_extra = null;
|
||||||
$field_separator = "\n";
|
$year_extra = null;
|
||||||
$time = time();
|
/*
|
||||||
$all_empty = null;
|
* Order in which to display the fields.
|
||||||
$day_empty = null;
|
* "D" -> day, "M" -> month, "Y" -> year.
|
||||||
$month_empty = null;
|
*/
|
||||||
$year_empty = null;
|
$field_order = 'MDY';
|
||||||
$extra_attrs = '';
|
/* String printed between the different fields. */
|
||||||
|
$field_separator = "\n";
|
||||||
|
$time = time();
|
||||||
|
$all_empty = null;
|
||||||
|
$day_empty = null;
|
||||||
|
$month_empty = null;
|
||||||
|
$year_empty = null;
|
||||||
|
$extra_attrs = '';
|
||||||
|
|
||||||
foreach ($params as $_key=>$_value) {
|
foreach ($params as $_key => $_value) {
|
||||||
switch ($_key) {
|
switch ($_key) {
|
||||||
case 'prefix':
|
case 'prefix':
|
||||||
case 'time':
|
case 'time':
|
||||||
case 'start_year':
|
case 'start_year':
|
||||||
case 'end_year':
|
case 'end_year':
|
||||||
case 'month_format':
|
case 'month_format':
|
||||||
case 'day_format':
|
case 'day_format':
|
||||||
case 'day_value_format':
|
case 'day_value_format':
|
||||||
case 'field_array':
|
case 'field_array':
|
||||||
case 'day_size':
|
case 'day_size':
|
||||||
case 'month_size':
|
case 'month_size':
|
||||||
case 'year_size':
|
case 'year_size':
|
||||||
case 'all_extra':
|
case 'all_extra':
|
||||||
case 'day_extra':
|
case 'day_extra':
|
||||||
case 'month_extra':
|
case 'month_extra':
|
||||||
case 'year_extra':
|
case 'year_extra':
|
||||||
case 'field_order':
|
case 'field_order':
|
||||||
case 'field_separator':
|
case 'field_separator':
|
||||||
case 'month_value_format':
|
case 'month_value_format':
|
||||||
case 'month_empty':
|
case 'month_empty':
|
||||||
case 'day_empty':
|
case 'day_empty':
|
||||||
case 'year_empty':
|
case 'year_empty':
|
||||||
$$_key = (string)$_value;
|
$$_key = (string) $_value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'all_empty':
|
case 'all_empty':
|
||||||
$$_key = (string)$_value;
|
$$_key = (string) $_value;
|
||||||
$day_empty = $month_empty = $year_empty = $all_empty;
|
$day_empty = $month_empty = $year_empty = $all_empty;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'display_days':
|
case 'display_days':
|
||||||
case 'display_months':
|
case 'display_months':
|
||||||
case 'display_years':
|
case 'display_years':
|
||||||
case 'year_as_text':
|
case 'year_as_text':
|
||||||
case 'reverse_years':
|
case 'reverse_years':
|
||||||
$$_key = (bool)$_value;
|
$$_key = (bool) $_value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(!is_array($_value)) {
|
if (!is_array($_value)) {
|
||||||
$extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"';
|
$extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
|
||||||
} else {
|
} else {
|
||||||
$smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
|
$smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('!^-\d+$!', $time)) {
|
if (preg_match('!^-\d+$!', $time)) {
|
||||||
// negative timestamp, use date()
|
// negative timestamp, use date()
|
||||||
$time = date('Y-m-d', $time);
|
$time = date('Y-m-d', $time);
|
||||||
}
|
}
|
||||||
// If $time is not in format yyyy-mm-dd
|
// If $time is not in format yyyy-mm-dd
|
||||||
if (preg_match('/^(\d{0,4}-\d{0,2}-\d{0,2})/', $time, $found)) {
|
if (preg_match('/^(\d{0,4}-\d{0,2}-\d{0,2})/', $time, $found)) {
|
||||||
$time = $found[1];
|
$time = $found [1];
|
||||||
} else {
|
} else {
|
||||||
// use smarty_make_timestamp to get an unix timestamp and
|
// use 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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strlen($time[0]) > 0) {
|
if (strlen($time [0]) > 0) {
|
||||||
if ($start_year > $time[0] && !isset($params['start_year'])) {
|
if ($start_year > $time [0] && !isset($params ['start_year'])) {
|
||||||
// force start year to include given date if not explicitly set
|
// force start year to include given date if not explicitly set
|
||||||
$start_year = $time[0];
|
$start_year = $time [0];
|
||||||
}
|
}
|
||||||
if($end_year < $time[0] && !isset($params['end_year'])) {
|
if ($end_year < $time [0] && !isset($params ['end_year'])) {
|
||||||
// force end year to include given date if not explicitly set
|
// force end year to include given date if not explicitly set
|
||||||
$end_year = $time[0];
|
$end_year = $time [0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$field_order = strtoupper($field_order);
|
$field_order = strtoupper($field_order);
|
||||||
|
|
||||||
$html_result = $month_result = $day_result = $year_result = "";
|
$html_result = $month_result = $day_result = $year_result = "";
|
||||||
|
|
||||||
$field_separator_count = -1;
|
$field_separator_count = -1;
|
||||||
if ($display_months) {
|
if ($display_months) {
|
||||||
$field_separator_count++;
|
$field_separator_count++;
|
||||||
$month_names = array();
|
$month_names = array();
|
||||||
$month_values = array();
|
$month_values = array();
|
||||||
if(isset($month_empty)) {
|
if (isset($month_empty)) {
|
||||||
$month_names[''] = $month_empty;
|
$month_names [''] = $month_empty;
|
||||||
$month_values[''] = '';
|
$month_values [''] = '';
|
||||||
}
|
}
|
||||||
for ($i = 1; $i <= 12; $i++) {
|
// Using the month_names from the FlatPress language files
|
||||||
$month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000));
|
global $lang;
|
||||||
$month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000));
|
$replace_month_names = array();
|
||||||
}
|
$replace_month_names [0] = '-';
|
||||||
|
$replace_month_value_format = array(
|
||||||
|
"00",
|
||||||
|
"01",
|
||||||
|
"02",
|
||||||
|
"03",
|
||||||
|
"04",
|
||||||
|
"05",
|
||||||
|
"06",
|
||||||
|
"07",
|
||||||
|
"08",
|
||||||
|
"09",
|
||||||
|
"10",
|
||||||
|
"11",
|
||||||
|
"12"
|
||||||
|
);
|
||||||
|
$fp_lang_months = array();
|
||||||
|
$fp_lang_months = $lang ['date'] ['month'];
|
||||||
|
$fplm = 0;
|
||||||
|
for($lm = 1; $lm <= 12; $lm++) {
|
||||||
|
$replace_month_names [$lm] = $fp_lang_months [$fplm];
|
||||||
|
$fplm++;
|
||||||
|
}
|
||||||
|
for($i = 1; $i <= 12; $i++) {
|
||||||
|
$month_names [$i] = $replace_month_names [$i];
|
||||||
|
$month_values [$i] = $replace_month_value_format [$i];
|
||||||
|
}
|
||||||
|
// /FlatPress change
|
||||||
|
|
||||||
$month_result .= '<select name=';
|
$month_result .= '<select name=';
|
||||||
if (null !== $field_array){
|
if (null !== $field_array) {
|
||||||
$month_result .= '"' . $field_array . '[' . $prefix . 'Month]"';
|
$month_result .= '"' . $field_array . '[' . $prefix . 'Month]"';
|
||||||
} else {
|
} else {
|
||||||
$month_result .= '"' . $prefix . 'Month"';
|
$month_result .= '"' . $prefix . 'Month"';
|
||||||
}
|
}
|
||||||
if (null !== $month_size){
|
if (null !== $month_size) {
|
||||||
$month_result .= ' size="' . $month_size . '"';
|
$month_result .= ' size="' . $month_size . '"';
|
||||||
}
|
}
|
||||||
if (null !== $month_extra){
|
if (null !== $month_extra) {
|
||||||
$month_result .= ' ' . $month_extra;
|
$month_result .= ' ' . $month_extra;
|
||||||
}
|
}
|
||||||
if (null !== $all_extra){
|
if (null !== $all_extra) {
|
||||||
$month_result .= ' ' . $all_extra;
|
$month_result .= ' ' . $all_extra;
|
||||||
}
|
}
|
||||||
$month_result .= $extra_attrs . '>'."\n";
|
$month_result .= $extra_attrs . '>' . "\n";
|
||||||
|
|
||||||
$month_result .= smarty_function_html_options(array('output' => $month_names,
|
$month_result .= smarty_function_html_options(array(
|
||||||
'values' => $month_values,
|
'output' => $month_names,
|
||||||
'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
|
'values' => $month_values,
|
||||||
'print_result' => false),
|
'selected' => (int) $time [1] ? strftime($month_value_format, mktime(0, 0, 0, (int) $time [1], 1, 2000)) : '',
|
||||||
$smarty);
|
'print_result' => false
|
||||||
$month_result .= '</select>';
|
), $smarty);
|
||||||
}
|
$month_result .= '</select>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($display_days) {
|
if ($display_days) {
|
||||||
$field_separator_count++;
|
$field_separator_count++;
|
||||||
$days = array();
|
$days = array();
|
||||||
if (isset($day_empty)) {
|
if (isset($day_empty)) {
|
||||||
$days[''] = $day_empty;
|
$days [''] = $day_empty;
|
||||||
$day_values[''] = '';
|
$day_values [''] = '';
|
||||||
}
|
}
|
||||||
for ($i = 1; $i <= 31; $i++) {
|
for($i = 1; $i <= 31; $i++) {
|
||||||
$days[] = sprintf($day_format, $i);
|
$days [] = sprintf($day_format, $i);
|
||||||
$day_values[] = sprintf($day_value_format, $i);
|
$day_values [] = sprintf($day_value_format, $i);
|
||||||
}
|
}
|
||||||
|
|
||||||
$day_result .= '<select name=';
|
$day_result .= '<select name=';
|
||||||
if (null !== $field_array){
|
if (null !== $field_array) {
|
||||||
$day_result .= '"' . $field_array . '[' . $prefix . 'Day]"';
|
$day_result .= '"' . $field_array . '[' . $prefix . 'Day]"';
|
||||||
} else {
|
} else {
|
||||||
$day_result .= '"' . $prefix . 'Day"';
|
$day_result .= '"' . $prefix . 'Day"';
|
||||||
}
|
}
|
||||||
if (null !== $day_size){
|
if (null !== $day_size) {
|
||||||
$day_result .= ' size="' . $day_size . '"';
|
$day_result .= ' size="' . $day_size . '"';
|
||||||
}
|
}
|
||||||
if (null !== $all_extra){
|
if (null !== $all_extra) {
|
||||||
$day_result .= ' ' . $all_extra;
|
$day_result .= ' ' . $all_extra;
|
||||||
}
|
}
|
||||||
if (null !== $day_extra){
|
if (null !== $day_extra) {
|
||||||
$day_result .= ' ' . $day_extra;
|
$day_result .= ' ' . $day_extra;
|
||||||
}
|
}
|
||||||
$day_result .= $extra_attrs . '>'."\n";
|
$day_result .= $extra_attrs . '>' . "\n";
|
||||||
$day_result .= smarty_function_html_options(array('output' => $days,
|
$day_result .= smarty_function_html_options(array(
|
||||||
'values' => $day_values,
|
'output' => $days,
|
||||||
'selected' => $time[2],
|
'values' => $day_values,
|
||||||
'print_result' => false),
|
'selected' => $time [2],
|
||||||
$smarty);
|
'print_result' => false
|
||||||
$day_result .= '</select>';
|
), $smarty);
|
||||||
}
|
$day_result .= '</select>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($display_years) {
|
if ($display_years) {
|
||||||
$field_separator_count++;
|
$field_separator_count++;
|
||||||
if (null !== $field_array){
|
if (null !== $field_array) {
|
||||||
$year_name = $field_array . '[' . $prefix . 'Year]';
|
$year_name = $field_array . '[' . $prefix . 'Year]';
|
||||||
} else {
|
} else {
|
||||||
$year_name = $prefix . 'Year';
|
$year_name = $prefix . 'Year';
|
||||||
}
|
}
|
||||||
if ($year_as_text) {
|
if ($year_as_text) {
|
||||||
$year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"';
|
$year_result .= '<input type="text" name="' . $year_name . '" value="' . $time [0] . '" size="4" maxlength="4"';
|
||||||
if (null !== $all_extra){
|
if (null !== $all_extra) {
|
||||||
$year_result .= ' ' . $all_extra;
|
$year_result .= ' ' . $all_extra;
|
||||||
}
|
}
|
||||||
if (null !== $year_extra){
|
if (null !== $year_extra) {
|
||||||
$year_result .= ' ' . $year_extra;
|
$year_result .= ' ' . $year_extra;
|
||||||
}
|
}
|
||||||
$year_result .= ' />';
|
$year_result .= ' />';
|
||||||
} else {
|
} else {
|
||||||
$years = range((int)$start_year, (int)$end_year);
|
$years = range((int) $start_year, (int) $end_year);
|
||||||
if ($reverse_years) {
|
if ($reverse_years) {
|
||||||
rsort($years, SORT_NUMERIC);
|
rsort($years, SORT_NUMERIC);
|
||||||
} else {
|
} else {
|
||||||
sort($years, SORT_NUMERIC);
|
sort($years, SORT_NUMERIC);
|
||||||
}
|
}
|
||||||
$yearvals = $years;
|
$yearvals = $years;
|
||||||
if(isset($year_empty)) {
|
if (isset($year_empty)) {
|
||||||
array_unshift($years, $year_empty);
|
array_unshift($years, $year_empty);
|
||||||
array_unshift($yearvals, '');
|
array_unshift($yearvals, '');
|
||||||
}
|
}
|
||||||
$year_result .= '<select name="' . $year_name . '"';
|
$year_result .= '<select name="' . $year_name . '"';
|
||||||
if (null !== $year_size){
|
if (null !== $year_size) {
|
||||||
$year_result .= ' size="' . $year_size . '"';
|
$year_result .= ' size="' . $year_size . '"';
|
||||||
}
|
}
|
||||||
if (null !== $all_extra){
|
if (null !== $all_extra) {
|
||||||
$year_result .= ' ' . $all_extra;
|
$year_result .= ' ' . $all_extra;
|
||||||
}
|
}
|
||||||
if (null !== $year_extra){
|
if (null !== $year_extra) {
|
||||||
$year_result .= ' ' . $year_extra;
|
$year_result .= ' ' . $year_extra;
|
||||||
}
|
}
|
||||||
$year_result .= $extra_attrs . '>'."\n";
|
$year_result .= $extra_attrs . '>' . "\n";
|
||||||
$year_result .= smarty_function_html_options(array('output' => $years,
|
$year_result .= smarty_function_html_options(array(
|
||||||
'values' => $yearvals,
|
'output' => $years,
|
||||||
'selected' => $time[0],
|
'values' => $yearvals,
|
||||||
'print_result' => false),
|
'selected' => $time [0],
|
||||||
$smarty);
|
'print_result' => false
|
||||||
$year_result .= '</select>';
|
), $smarty);
|
||||||
}
|
$year_result .= '</select>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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 < $field_separator_count) {
|
if ($i < $field_separator_count) {
|
||||||
$html_result .= $field_separator;
|
$html_result .= $field_separator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html_result;
|
return $html_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set expandtab: */
|
/* vim: set expandtab: */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user