[geeklog-cvs] geeklog: When calling COM_getYearFormOptions with a $startoffset...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Dec 14 07:34:08 EST 2008
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/453d8ee3823d
changeset: 6564:453d8ee3823d
user: Dirk Haun <dirk at haun-online.de>
date: Sun Dec 14 13:31:34 2008 +0100
description:
When calling COM_getYearFormOptions with a $startoffset parameter, the list of years was off by one (bug #0000783)
diffstat:
2 files changed, 9 insertions(+), 18 deletions(-)
public_html/docs/history | 2 ++
public_html/lib-common.php | 25 +++++++------------------
diffs (57 lines):
diff -r aada550ce91e -r 453d8ee3823d public_html/docs/history
--- a/public_html/docs/history Tue Dec 09 11:51:29 2008 +0100
+++ b/public_html/docs/history Sun Dec 14 13:31:34 2008 +0100
@@ -3,6 +3,8 @@
??? ??, 2008 (1.5.2)
------------
+- When calling COM_getYearFormOptions with a $startoffset parameter, the list
+ of years was off by one (bug #0000783; patch provided by hiroron)
- Fixed updating feeds after changing topic permissions (bug #0000779) [Dirk]
- The security token was missing from the trackback editor template file
(reported and patch provided by hiroron, bug #0000778)
diff -r aada550ce91e -r 453d8ee3823d public_html/lib-common.php
--- a/public_html/lib-common.php Tue Dec 09 11:51:29 2008 +0100
+++ b/public_html/lib-common.php Sun Dec 14 13:31:34 2008 +0100
@@ -4895,34 +4895,23 @@
* @return string HTML years as option values
*/
-function COM_getYearFormOptions( $selected = '', $startoffset=0, $endoffset=5 )
+function COM_getYearFormOptions($selected = '', $startoffset = -1, $endoffset = 5)
{
$year_options = '';
- if ($startoffset != 0)
- {
- $start_year = date ( 'Y' ) + $startoffset;
- }
- else
- {
- $start_year = date( 'Y', time() );
- }
- $cur_year = date( 'Y', time() );
+ $start_year = date('Y') + $startoffset;
+ $cur_year = date('Y', time());
$finish_year = $cur_year + $endoffset;
- if( !empty( $selected ))
- {
- if( $selected < $cur_year )
- {
+ if (!empty($selected)) {
+ if ($selected < $cur_year) {
$start_year = $selected;
}
}
- for( $i = $start_year - 1; $i <= $finish_year; $i++ )
- {
+ for ($i = $start_year; $i <= $finish_year; $i++) {
$year_options .= '<option value="' . $i . '"';
- if( $i == $selected )
- {
+ if ($i == $selected) {
$year_options .= ' selected="selected"';
}
More information about the geeklog-cvs
mailing list