/** WordPress Administration Bootstrap */
require_once('./admin.php');
+if ( ! current_user_can('manage_options') )
+ wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
+
$title = __('General Settings');
$parent_file = 'options-general.php';
/* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
else: // looks like we can do nice timezone selection!
$current_offset = get_option('gmt_offset');
$tzstring = get_option('timezone_string');
+
+$check_zone_info = true;
+
+// Remove old Etc mappings. Fallback to gmt_offset.
+if ( false !== strpos($tzstring,'Etc/GMT') )
+ $tzstring = '';
+
if (empty($tzstring)) { // set the Etc zone if no timezone string exists
- if ($current_offset < 0) $offnum = - ceil($current_offset);
- else $offnum = - floor($current_offset);
- $tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum;
+ $check_zone_info = false;
+ if ( 0 == $current_offset )
+ $tzstring = 'UTC+0';
+ elseif ($current_offset < 0)
+ $tzstring = 'UTC' . $current_offset;
+ else
+ $tzstring = 'UTC+' . $current_offset;
}
+
?>
<th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
<td>
<span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
<br />
<span>
-<?php if (get_option('timezone_string')) : ?>
+<?php if ($check_zone_info && $tzstring) : ?>
<?php
$now = localtime(time(),true);
if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
?>
<br />
<?php
- if (function_exists('timezone_transitions_get') && $tzstring) {
+ if (function_exists('timezone_transitions_get')) {
$dateTimeZoneSelected = new DateTimeZone($tzstring);
foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
if ($tr['ts'] > time()) {
- $found = true;
+ $found = true;
break;
}
}
$message = $tr['isdst'] ?
__('Daylight savings time begins on: <code>%s</code>.') :
__('Standard time begins on: <code>%s</code>.');
- $tz = new DateTimeZone($tzstring);
- $d = new DateTime( "@{$tr['ts']}" );
- $d->setTimezone($tz);
- printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $d->format('U') ) );
+ printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] ) );
} else {
_e('This timezone does not observe daylight savings time.');
}