Make WordPress Core

Changeset 1150


Ignore:
Timestamp:
04/24/2004 09:52:24 PM (21 years ago)
Author:
saxmatt
Message:

Timezone fixes, I hope.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r1108 r1150  
    2525$what_to_show = get_settings('what_to_show');
    2626$archive_mode = get_settings('archive_mode');
    27 $time_difference = get_settings('time_difference');
    2827$date_format = stripslashes(get_settings('date_format'));
    2928$time_format = stripslashes(get_settings('time_format'));
  • trunk/wp-admin/options-general.php

    r1131 r1150  
    9999        <th scope="row"><?php _e('Default date format:') ?></th>
    100100        <td><input name="date_format" type="text" id="date_format" size="30" value="<?php echo get_settings('date_format'); ?>" /><br />
    101 <?php _e('Output:') ?> <strong><?php echo date(get_settings('date_format'), current_time('timestamp', true)); ?></strong></td>
     101<?php _e('Output:') ?> <strong><?php echo gmdate(get_settings('date_format'), current_time('timestamp')); ?></strong></td>
    102102        </tr>
    103103      <tr>
    104104        <th scope="row"><?php _e('Default time format:') ?></th>
    105105        <td><input name="time_format" type="text" id="time_format" size="30" value="<?php echo get_settings('time_format'); ?>" /><br />
    106 <?php _e('Output:') ?> <strong><?php echo date(get_settings('time_format'), current_time('timestamp', true)); ?></strong></td>
     106<?php _e('Output:') ?> <strong><?php echo gmdate(get_settings('time_format'), current_time('timestamp')); ?></strong></td>
    107107        </tr>
    108108</table>
  • trunk/wp-admin/sidebar.php

    r1108 r1150  
    99if ($user_level == 0)
    1010    die ("Cheatin' uh ?");
    11 
    12 $time_difference = get_settings('time_difference');
    1311
    1412if ('b' == $_GET['a']) {
  • trunk/wp-blog-header.php

    r1108 r1150  
    111111$what_to_show = get_settings('what_to_show');
    112112$archive_mode = get_settings('archive_mode');
    113 $time_difference = get_settings('time_difference');
    114113$use_gzipcompression = get_settings('gzipcompression');
    115114
     
    130129}
    131130
    132 $add_hours = intval($time_difference);
    133 $add_minutes = intval(60 * ($time_difference - $add_hours));
     131$add_hours = intval(get_settings('gmt_offset'));
     132$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
    134133$wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
    135134
  • trunk/wp-commentsrss2.php

    r1108 r1150  
    3232            LEFT JOIN $tableposts ON comment_post_id = id WHERE comment_post_ID = '$id'
    3333            AND $tablecomments.comment_approved = '1' AND $tableposts.post_status = 'publish'
    34             AND post_date < '".date("Y-m-d H:i:s")."'
     34            AND post_date < '".date("Y-m-d H:i:59")."'
    3535            ORDER BY comment_date LIMIT " . get_settings('posts_per_rss') );
    3636        } else { // if no post id passed in, we'll just ue the last 10 comments.
  • trunk/wp-includes/functions-formatting.php

    r1121 r1150  
    350350function get_gmt_from_date($string) {
    351351  // note: this only substracts $time_difference from the given date
    352   $time_difference = get_settings('time_difference');
    353352  preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
    354353  $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
    355   $string_gmt = gmdate('Y-m-d H:i:s', $string_time - $time_difference*3600);
     354  $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_settings('gmt_offset') * 3600);
    356355  return $string_gmt;
    357356}
     
    360359function get_date_from_gmt($string) {
    361360  // note: this only adds $time_difference to the given date
    362   $time_difference = get_settings('time_difference');
    363361  preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
    364362  $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
    365   $string_localtime = gmdate('Y-m-d H:i:s', $string_time + $time_difference*3600);
     363  $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_settings('gmt_offset')*3600);
    366364  return $string_localtime;
    367365}
  • trunk/wp-includes/functions.php

    r1148 r1150  
    5454    switch ($type) {
    5555        case 'mysql':
    56             return ($gmt) ? gmdate('Y-m-d H:i:s')
    57                 : gmdate('Y-m-d H:i:s', (time() + ($time_difference * 3600)));;
     56            if ($gmt) $d = gmdate('Y-m-d H:i:s');
     57            else $d = gmdate('Y-m-d H:i:s', (time() + (get_settings('gmt_offset') * 3600)));
     58            return $d;
    5859            break;
    5960        case 'timestamp':
    60             return ($gmt) ? time()
    61                 : time() + ($time_difference * 3600);
     61            if ($gmt) $d = time();
     62            else $d = time() + (get_settings('gmt_offset') * 3600);
     63            return $d;
    6264            break;
    6365    }
     
    436438
    437439function touch_time($edit = 1) {
    438     global $month, $postdata, $time_difference;
     440    global $month, $postdata;
    439441    // echo $postdata['Date'];
    440442    if ('draft' == $postdata['post_status']) {
     
    447449    echo '<p><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" '.$checked.'/> <label for="timestamp">' . __('Edit timestamp') . '</label> <a href="http://wordpress.org/docs/reference/post/#edit_timestamp" title="' . __('Help on changing the timestamp') . '">?</a><br />';
    448450   
    449     $time_adj = time() + ($time_difference * 3600);
     451    $time_adj = time() + (get_settings('gmt_offset') * 3600);
    450452    $post_date = $postdata['Date'];
    451453    $jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
  • trunk/wp-includes/links.php

    r1053 r1150  
    187187        if ($show_updated) {
    188188           if (substr($row->link_updated_f,0,2) != '00') {
    189                 $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $row->link_updated_f + (get_settings('time_difference') * 3600)) .')';
     189                $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $row->link_updated_f + (get_settings('gmt_offset') * 3600)) .')';
    190190            }
    191191        }
  • trunk/wp-includes/template-functions-general.php

    r1142 r1150  
    220220
    221221function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
    222     global $tableposts, $time_difference;
     222    global $tableposts;
    223223    global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb;
    224224
     
    255255    }
    256256
    257     $add_hours = intval($time_difference);
    258     $add_minutes = intval(60 * ($time_difference - $add_hours));
     257    $add_hours = intval(get_settings('gmt_offset'));
     258    $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
    259259    $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
    260260
     
    337337        $w = ''.intval($_GET['w']);
    338338    }
    339     $time_difference = get_settings('time_difference');
    340     $add_hours = intval($time_difference);
    341     $add_minutes = intval(60 * ($time_difference - $add_hours));
     339
     340    $add_hours = intval(get_settings('gmt_offset'));
     341    $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
    342342    $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
    343343
     
    360360        }
    361361    } else {
    362         $thisyear = gmdate('Y', current_time('timestamp') + $time_difference * 3600);
    363         $thismonth = gmdate('m', current_time('timestamp') + $time_difference * 3600);
     362        $thisyear = gmdate('Y', current_time('timestamp') + get_settings('gmt_offset') * 3600);
     363        $thismonth = gmdate('m', current_time('timestamp') + get_settings('gmt_offset') * 3600);
    364364    }
    365365
     
    477477        $newrow = false;
    478478
    479         if ($day == date('j', (time() + ($time_difference * 3600))) && $thismonth == date('m', time()+($time_difference * 3600)))
     479        if ($day == date('j', (time() + (get_settings('gmt_offset') * 3600))) && $thismonth == date('m', time()+(get_settings('gmt_offset') * 3600)))
    480480            echo '<td id="today">';
    481481        else
  • trunk/wp-includes/template-functions-links.php

    r1112 r1150  
    8888function get_month_link($year, $month) {
    8989    global $querystring_start, $querystring_equal;
    90     if (!$year) $year = gmdate('Y', time()+($time_difference * 3600));
    91     if (!$month) $month = gmdate('m', time()+($time_difference * 3600));
     90    if (!$year) $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600));
     91    if (!$month) $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600));
    9292    if ('' != get_settings('permalink_structure')) {
    9393        $off = strpos(get_settings('permalink_structure'), '%monthnum%');
     
    106106function get_day_link($year, $month, $day) {
    107107    global $querystring_start, $querystring_equal;
    108     if (!$year) $year = gmdate('Y', time()+($time_difference * 3600));
    109     if (!$month) $month = gmdate('m', time()+($time_difference * 3600));
    110     if (!$day) $day = gmdate('j', time()+($time_difference * 3600));
     108    if (!$year) $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600));
     109    if (!$month) $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600));
     110    if (!$day) $day = gmdate('j', time()+(get_settings('gmt_offset') * 3600));
    111111    if ('' != get_settings('permalink_structure')) {
    112112        $off = strpos(get_settings('permalink_structure'), '%day%');
  • trunk/wp-includes/template-functions-post.php

    r1142 r1150  
    316316function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
    317317    global $tableposts, $p, $posts, $id, $post, $wpdb;
    318     global $time_difference, $single;
     318    global $single;
    319319    global $querystring_start, $querystring_equal, $querystring_separator;
    320320    if(($p) || ($posts==1) || 1 == $single) {
  • trunk/wp-mail.php

    r1108 r1150  
    88
    99$output_debugging_info = 0; # =1 if you want to output debugging info
    10 $time_difference = get_settings('time_difference');
    1110
    1211if (get_settings('use_phoneemail')) {
  • trunk/wp-trackback.php

    r1108 r1150  
    5252    $user_ip = $_SERVER['REMOTE_ADDR'];
    5353    $user_domain = gethostbyaddr($user_ip);
    54     $time_difference = get_settings('time_difference');
    5554    $now = current_time('mysql');
    5655    $now_gmt = current_time('mysql', 1);
Note: See TracChangeset for help on using the changeset viewer.