Bug 28715 - Display what the server default timezone is in the timezone selection...
authorRob Lanphier <robla@users.mediawiki.org>
Sun, 15 May 2011 14:51:01 +0000 (14:51 +0000)
committerRob Lanphier <robla@users.mediawiki.org>
Sun, 15 May 2011 14:51:01 +0000 (14:51 +0000)
includes/Preferences.php
languages/messages/MessagesEn.php

index 1331181..617f3c1 100644 (file)
@@ -1180,9 +1180,16 @@ class Preferences {
        static function getTimezoneOptions() {
                $opt = array();
 
-               global $wgLocalTZoffset;
-
-               $opt[wfMsg( 'timezoneuseserverdefault' )] = "System|$wgLocalTZoffset";
+               global $wgLocalTZoffset, $wgLocaltimezone;
+               // Check that $wgLocalTZoffset is the same as $wgLocaltimezone
+               if ( $wgLocalTZoffset == date('Z') / 60 ) {
+                       $server_tz_msg = wfMsg( 'timezoneuseserverdefault', $wgLocaltimezone );
+               }
+               else {
+                       $tzstring = sprintf( '%+03d:%02d', floor( $wgLocalTZoffset / 60 ), abs( $wgLocalTZoffset ) % 60 );
+                       $server_tz_msg = wfMsg( 'timezoneuseserverdefault', $tzstring );
+               }
+               $opt[$server_tz_msg] = "System|$wgLocalTZoffset";
                $opt[wfMsg( 'timezoneuseoffset' )] = 'other';
                $opt[wfMsg( 'guesstimezone' )] = 'guess';
 
index 01c9c7f..c994283 100644 (file)
@@ -1791,7 +1791,7 @@ Here's a randomly-generated value you can use: $1",
 'savedprefs'                    => 'Your preferences have been saved.',
 'timezonelegend'                => 'Time zone:',
 'localtime'                     => 'Local time:',
-'timezoneuseserverdefault'      => 'Use server default',
+'timezoneuseserverdefault'      => 'Use wiki default ($1)',
 'timezoneuseoffset'             => 'Other (specify offset)',
 'timezoneoffset'                => 'Offset¹:',
 'servertime'                    => 'Server time:',