From e89de221e473db2e4829ce23fd0de55ed553756e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 9 Jul 2007 18:45:05 +0000 Subject: [PATCH] Assume last year, not this year, when jumping to a month that hasn't happened yet this year --- includes/SpecialContributions.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index bbd1bab645..6e883cdd8b 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -22,7 +22,7 @@ class ContribsPager extends IndexPager { $this->year = ($year > 0 && $year < 10000) ? $year : false; $this->month = ($month > 0 && $month < 13) ? $month : false; - $this->GetDateCond(); + $this->getDateCond(); $this->mDb = wfGetDB( DB_SLAVE, 'contributions' ); } @@ -78,6 +78,11 @@ class ContribsPager extends IndexPager { $year_start = $this->year; } else { $year_start = substr( wfTimestampNow(), 0, 4 ); + $thisMonth = gmdate( 'n' ); + if( $this->month > $thisMonth ) { + // Future contributions aren't supposed to happen. :) + $year_start--; + } } if ( $this->month ) { @@ -274,7 +279,12 @@ function wfSpecialContributions( $par = null ) { if ( ( $year = $wgRequest->getIntOrNull( 'year' ) ) !== null ) { $options['year'] = intval( $year ); } else if( $options['month'] ) { - $options['year'] = intval( substr( wfTimestampNow(), 0, 4 ) ); + $thisMonth = intval( gmdate( 'n' ) ); + $thisYear = intval( gmdate( 'Y' ) ); + if( intval( $options['month'] ) > $thisMonth ) { + $thisYear--; + } + $options['year'] = $thisYear; } else { $options['year'] = ''; } -- 2.20.1