From: Greg Sabino Mullane Date: Thu, 1 Mar 2007 16:30:15 +0000 (+0000) Subject: Allow for timestamps in offset clause in non-integer-datetime databases. X-Git-Tag: 1.31.0-rc.0~53932 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=d3c19c6540dd145f3abffc15e65105fa3e9bedbf;p=lhc%2Fweb%2Fwiklou.git Allow for timestamps in offset clause in non-integer-datetime databases. Fixes bug 9131. --- diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index c3e31e96df..c6cd3224a6 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -213,9 +213,18 @@ function wfSpecialContributions( $par = null ) { list( $options['limit'], $options['offset']) = wfCheckLimits(); $options['offset'] = $wgRequest->getVal( 'offset' ); - /* Offset must be an integral. */ - if ( !strlen( $options['offset'] ) || !preg_match( '/^[0-9]+$/', $options['offset'] ) ) - $options['offset'] = ''; + + /* Offset must either be numeric, or a "standard" timestamp */ + $dbr = wfGetDB( DB_SLAVE ); + if ( !strlen( $options['offset'] ) + || ($dbr->realTimestamps() + && !preg_match ( '/^\d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d(?:[+-]\d\d)?$/', $options['offset'] ) + ) + || (!$dbr->realTimestamps() + && !preg_match( '/^[0-9]+$/', $options['offset'] ) + ) + ) + $options['offset'] = ''; $title = SpecialPage::getTitleFor( 'Contributions' ); $options['target'] = $target;