]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/options-general.php
Wordpress 2.9.1
[autoinstalls/wordpress.git] / wp-admin / options-general.php
index cd4b8cdb3ad5731fb0900a0124f9d4f5804b3ee5..4741c851d64e1016f5ef0f97caf555a8dc522e8e 100644 (file)
@@ -9,6 +9,9 @@
 /** 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 */
@@ -136,11 +139,23 @@ foreach ( $offset_range as $offset ) {
 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>
@@ -157,7 +172,7 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
 <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.');
@@ -165,11 +180,11 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
        ?>
        <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;
                        }
                }
@@ -179,10 +194,7 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
                        $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.');
                }