From c91137d98a7e74f4b594586dad8f180e7b20727b Mon Sep 17 00:00:00 2001 From: Rob Lanphier Date: Sun, 15 May 2011 14:51:01 +0000 Subject: [PATCH] Bug 28715 - Display what the server default timezone is in the timezone selection preference. --- includes/Preferences.php | 13 ++++++++++--- languages/messages/MessagesEn.php | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/Preferences.php b/includes/Preferences.php index 1331181532..617f3c1137 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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'; diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 01c9c7f191..c9942831c5 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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:', -- 2.20.1