예제 #1
0
            }
        }
    }
    $goback = add_query_arg('updated', 'true', nxt_get_referer());
    bb_safe_redirect($goback);
    exit;
}
if (!empty($_GET['updated'])) {
    bb_admin_notice(__('<strong>Settings saved.</strong>'));
}
$general_options = array('name' => array('title' => __('Site title'), 'class' => 'long'), 'description' => array('title' => __('Tagline'), 'class' => 'long', 'note' => __('In a few words, explain what this site is about.')), 'uri' => array('title' => __('bbPress address (URL)'), 'class' => array('long', 'code'), 'note' => __('The full URL of your bbPress install.')), 'from_email' => array('title' => __('E-mail address'), 'note' => __('This address is used for admin purposes, like new user notification.')));
$time_options = array('gmt_offset' => array('title' => __('Time zone'), 'type' => 'select', 'options' => array('-12' => '-12:00', '-11.5' => '-11:30', '-11' => '-11:00', '-10.5' => '-10:30', '-10' => '-10:00', '-9.5' => '-9:30', '-9' => '-9:00', '-8.5' => '-8:30', '-8' => '-8:00', '-7.5' => '-7:30', '-7' => '-7:00', '-6.5' => '-6:30', '-6' => '-6:00', '-5.5' => '-5:30', '-5' => '-5:00', '-4.5' => '-4:30', '-4' => '-4:00', '-3.5' => '-3:30', '-3' => '-3:00', '-2.5' => '-2:30', '-2' => '-2:00', '-1.5' => '-1:30', '-1' => '-1:00', '-0.5' => '-0:30', '0' => '', '0.5' => '+0:30', '1' => '+1:00', '1.5' => '+1:30', '2' => '+2:00', '2.5' => '+2:30', '3' => '+3:00', '3.5' => '+3:30', '4' => '+4:00', '4.5' => '+4:30', '5' => '+5:00', '5.5' => '+5:30', '5.75' => '+5:45', '6' => '+6:00', '6.5' => '+6:30', '7' => '+7:00', '7.5' => '+7:30', '8' => '+8:00', '8.5' => '+8:30', '8.75' => '+8:45', '9' => '+9:00', '9.5' => '+9:30', '10' => '+10:00', '10.5' => '+10:30', '11' => '+11:00', '11.5' => '+11:30', '12' => '+12:00', '12.75' => '+12:45', '13' => '+13:00', '13.75' => '+13:45', '14' => '+14:00'), 'after' => __('hours')), 'datetime_format' => array('title' => __('Date and time format'), 'class' => 'short', 'value' => bb_get_datetime_formatstring_i18n(), 'after' => bb_datetime_format_i18n(bb_current_time()), 'note' => array(__('<a href="http://codex.nxtclass.org/Formatting_Date_and_Time">Documentation on date formatting</a>.'), __('Click "Save Changes" to update sample output.'))), 'date_format' => array('title' => __('Date format'), 'class' => 'short', 'value' => bb_get_datetime_formatstring_i18n('date'), 'after' => bb_datetime_format_i18n(bb_current_time(), 'date')));
if (!($gmt_offset = bb_get_option('gmt_offset'))) {
    $gmt_offset = 0;
}
if (nxt_timezone_supported()) {
    unset($time_options['gmt_offset']);
    if (!($timezone_string = bb_get_option('timezone_string'))) {
        // set the Etc zone if no timezone string exists
        $_gmt_offset = (int) round($gmt_offset);
        if ($_gmt_offset === 0) {
            $timezone_string = 'Etc/UTC';
        } elseif ($_gmt_offset > 0) {
            // Zoneinfo has these signed backwards to common convention
            $timezone_string = 'Etc/GMT-' . abs($_gmt_offset);
        } else {
            // Zoneinfo has these signed backwards to common convention
            $timezone_string = 'Etc/GMT+' . abs($_gmt_offset);
        }
        unset($_gmt_offset);
    }
예제 #2
0
 /**
  * gmt_offset modification for smart timezone handling
  *
  * Overrides the gmt_offset option if we have a timezone_string available
  */
 function nxt_timezone_override_offset()
 {
     if (!nxt_timezone_supported()) {
         return false;
     }
     if (!($timezone_string = backpress_get_option('timezone_string'))) {
         return false;
     }
     @date_default_timezone_set($timezone_string);
     $timezone_object = timezone_open($timezone_string);
     $datetime_object = date_create();
     if (false === $timezone_object || false === $datetime_object) {
         return false;
     }
     return round(timezone_offset_get($timezone_object, $datetime_object) / 3600, 2);
 }