From 0f7a4033c604129def965a9e0caa0872cf69e8ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sat, 2 Apr 2005 22:17:05 +0000 Subject: [PATCH] =?utf8?q?*=20Documented=20*=20Changed=20the=20validateTim?= =?utf8?q?eZone=20max=20from=20=EF=BF=BD=EF=BF=BD15:59=20to=2014:59=20and?= =?utf8?q?=20-12:59=20*=20Removed=20a=20stray=20';'?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- includes/SpecialPreferences.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index a6cd0fc16f..07eef4ea94 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -145,7 +145,13 @@ class PreferencesForm { } /** + * Used to validate the user inputed timezone before saving it as + * 'timeciorrection', will return '00:00' if fed bogus data. + * Note: It's not a 100% correct implementation timezone-wise, it will + * accept stuff like '14:30', * @access private + * @param string $s the user input + * @return string */ function validateTimeZone( $s ) { if ( $s !== '' ) { @@ -159,8 +165,10 @@ class PreferencesForm { $hour = intval( $minute / 60 ); $minute = abs( $minute ) % 60; } - $hour = min( $hour, 15 ); - $hour = max( $hour, -15 ); + # Max is +14:00 and min is -12:00, see: + # http://en.wikipedia.org/wiki/Timezone + $hour = min( $hour, 14 ); + $hour = max( $hour, -12 ); $minute = min( $minute, 59 ); $minute = max( $minute, 0 ); $s = sprintf( "%02d:%02d", $hour, $minute ); @@ -175,7 +183,6 @@ class PreferencesForm { global $wgUser, $wgLang, $wgOut; global $wgEnableUserEmail, $wgEnableEmail; global $wgEmailAuthentication, $wgMinimalPasswordLength; -; if ( '' != $this->mNewpass ) { if ( $this->mNewpass != $this->mRetypePass ) { @@ -605,7 +612,6 @@ class PreferencesForm { # Date format # - if ($dateopts) { $wgOut->addHTML( "
\n$dateFormat\n" ); foreach($dateopts as $key => $option) { -- 2.20.1