diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 4e0aff467a..8f51f2ee7a 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -24,7 +24,6 @@ get_currentuserinfo(); $posts_per_page = get_settings('posts_per_page'); $what_to_show = get_settings('what_to_show'); $archive_mode = get_settings('archive_mode'); -$time_difference = get_settings('time_difference'); $date_format = stripslashes(get_settings('date_format')); $time_format = stripslashes(get_settings('time_format')); diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index a7c7a3e7e0..59340b69ae 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -98,12 +98,12 @@ include('options-head.php');
- +
- + diff --git a/wp-admin/sidebar.php b/wp-admin/sidebar.php index d7928eee81..eab0277265 100644 --- a/wp-admin/sidebar.php +++ b/wp-admin/sidebar.php @@ -9,8 +9,6 @@ get_currentuserinfo(); if ($user_level == 0) die ("Cheatin' uh ?"); -$time_difference = get_settings('time_difference'); - if ('b' == $_GET['a']) { ?> diff --git a/wp-blog-header.php b/wp-blog-header.php index 13667db4ee..b968a6fb2e 100644 --- a/wp-blog-header.php +++ b/wp-blog-header.php @@ -110,7 +110,6 @@ if (!isset($posts_per_page) || $posts_per_page == 0) $posts_per_page = get_settings('posts_per_page'); $what_to_show = get_settings('what_to_show'); $archive_mode = get_settings('archive_mode'); -$time_difference = get_settings('time_difference'); $use_gzipcompression = get_settings('gzipcompression'); /* First let's clear some variables */ @@ -129,8 +128,8 @@ if (isset($showposts) && $showposts) { $posts_per_page = $showposts; } -$add_hours = intval($time_difference); -$add_minutes = intval(60 * ($time_difference - $add_hours)); +$add_hours = intval(get_settings('gmt_offset')); +$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; // if a month is specified in the querystring, load that month diff --git a/wp-commentsrss2.php b/wp-commentsrss2.php index fddb7468da..24da460849 100644 --- a/wp-commentsrss2.php +++ b/wp-commentsrss2.php @@ -31,7 +31,7 @@ foreach ($posts as $post) { start_wp(); $tableposts.ID, $tableposts.post_password FROM $tablecomments LEFT JOIN $tableposts ON comment_post_id = id WHERE comment_post_ID = '$id' AND $tablecomments.comment_approved = '1' AND $tableposts.post_status = 'publish' - AND post_date < '".date("Y-m-d H:i:s")."' + AND post_date < '".date("Y-m-d H:i:59")."' ORDER BY comment_date LIMIT " . get_settings('posts_per_rss') ); } else { // if no post id passed in, we'll just ue the last 10 comments. $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 922e11eb39..9f2b5ff79f 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -349,20 +349,18 @@ function wp_iso_descrambler($string) { // give it a date, it will give you the same date as GMT function get_gmt_from_date($string) { // note: this only substracts $time_difference from the given date - $time_difference = get_settings('time_difference'); 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); $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); - $string_gmt = gmdate('Y-m-d H:i:s', $string_time - $time_difference*3600); + $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_settings('gmt_offset') * 3600); return $string_gmt; } // give it a GMT date, it will give you the same date with $time_difference added function get_date_from_gmt($string) { // note: this only adds $time_difference to the given date - $time_difference = get_settings('time_difference'); 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); $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); - $string_localtime = gmdate('Y-m-d H:i:s', $string_time + $time_difference*3600); + $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_settings('gmt_offset')*3600); return $string_localtime; } diff --git a/wp-includes/functions.php b/wp-includes/functions.php index c8c29382db..d9be6696eb 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -53,12 +53,14 @@ function current_time($type, $gmt = 0) { $time_difference = get_settings('time_difference'); switch ($type) { case 'mysql': - return ($gmt) ? gmdate('Y-m-d H:i:s') - : gmdate('Y-m-d H:i:s', (time() + ($time_difference * 3600)));; + if ($gmt) $d = gmdate('Y-m-d H:i:s'); + else $d = gmdate('Y-m-d H:i:s', (time() + (get_settings('gmt_offset') * 3600))); + return $d; break; case 'timestamp': - return ($gmt) ? time() - : time() + ($time_difference * 3600); + if ($gmt) $d = time(); + else $d = time() + (get_settings('gmt_offset') * 3600); + return $d; break; } } @@ -435,7 +437,7 @@ function get_catname($cat_ID) { } function touch_time($edit = 1) { - global $month, $postdata, $time_difference; + global $month, $postdata; // echo $postdata['Date']; if ('draft' == $postdata['post_status']) { $checked = 'checked="checked" '; @@ -446,7 +448,7 @@ function touch_time($edit = 1) { echo '

?
'; - $time_adj = time() + ($time_difference * 3600); + $time_adj = time() + (get_settings('gmt_offset') * 3600); $post_date = $postdata['Date']; $jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj); $mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj); diff --git a/wp-includes/links.php b/wp-includes/links.php index f6ce5170b5..ad14ddb367 100644 --- a/wp-includes/links.php +++ b/wp-includes/links.php @@ -186,7 +186,7 @@ function get_links($category = -1, $before = '', $after = '
', if ($show_updated) { if (substr($row->link_updated_f,0,2) != '00') { - $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $row->link_updated_f + (get_settings('time_difference') * 3600)) .')'; + $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $row->link_updated_f + (get_settings('gmt_offset') * 3600)) .')'; } } diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index 7a2854210a..c458be622d 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -219,7 +219,7 @@ function wp_get_archives($args = '') { } function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { - global $tableposts, $time_difference; + global $tableposts; global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb; if ('' == $type) { @@ -254,8 +254,8 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after $archive_week_end_date_format = get_settings('date_format'); } - $add_hours = intval($time_difference); - $add_minutes = intval(60 * ($time_difference - $add_hours)); + $add_hours = intval(get_settings('gmt_offset')); + $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; $now = current_time('mysql'); @@ -336,9 +336,9 @@ function get_calendar($daylength = 1) { if (isset($_GET['w'])) { $w = ''.intval($_GET['w']); } - $time_difference = get_settings('time_difference'); - $add_hours = intval($time_difference); - $add_minutes = intval(60 * ($time_difference - $add_hours)); + + $add_hours = intval(get_settings('gmt_offset')); + $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; // Let's figure out when we are @@ -359,8 +359,8 @@ function get_calendar($daylength = 1) { $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2); } } else { - $thisyear = gmdate('Y', current_time('timestamp') + $time_difference * 3600); - $thismonth = gmdate('m', current_time('timestamp') + $time_difference * 3600); + $thisyear = gmdate('Y', current_time('timestamp') + get_settings('gmt_offset') * 3600); + $thismonth = gmdate('m', current_time('timestamp') + get_settings('gmt_offset') * 3600); } $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear); @@ -476,7 +476,7 @@ function get_calendar($daylength = 1) { echo "\n\t\n\t\n\t\t"; $newrow = false; - if ($day == date('j', (time() + ($time_difference * 3600))) && $thismonth == date('m', time()+($time_difference * 3600))) + if ($day == date('j', (time() + (get_settings('gmt_offset') * 3600))) && $thismonth == date('m', time()+(get_settings('gmt_offset') * 3600))) echo ''; else echo ''; diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index 52e9018259..2a8e416b79 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -87,8 +87,8 @@ function get_permalink($id=false) { function get_month_link($year, $month) { global $querystring_start, $querystring_equal; - if (!$year) $year = gmdate('Y', time()+($time_difference * 3600)); - if (!$month) $month = gmdate('m', time()+($time_difference * 3600)); + if (!$year) $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600)); + if (!$month) $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600)); if ('' != get_settings('permalink_structure')) { $off = strpos(get_settings('permalink_structure'), '%monthnum%'); $offset = $off + 11; @@ -105,9 +105,9 @@ function get_month_link($year, $month) { function get_day_link($year, $month, $day) { global $querystring_start, $querystring_equal; - if (!$year) $year = gmdate('Y', time()+($time_difference * 3600)); - if (!$month) $month = gmdate('m', time()+($time_difference * 3600)); - if (!$day) $day = gmdate('j', time()+($time_difference * 3600)); + if (!$year) $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600)); + if (!$month) $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600)); + if (!$day) $day = gmdate('j', time()+(get_settings('gmt_offset') * 3600)); if ('' != get_settings('permalink_structure')) { $off = strpos(get_settings('permalink_structure'), '%day%'); $offset = $off + 6; diff --git a/wp-includes/template-functions-post.php b/wp-includes/template-functions-post.php index 777090b843..758ab4216f 100644 --- a/wp-includes/template-functions-post.php +++ b/wp-includes/template-functions-post.php @@ -315,7 +315,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { global $tableposts, $p, $posts, $id, $post, $wpdb; - global $time_difference, $single; + global $single; global $querystring_start, $querystring_equal, $querystring_separator; if(($p) || ($posts==1) || 1 == $single) { diff --git a/wp-mail.php b/wp-mail.php index 94dc67e8f2..b2ac2accfc 100644 --- a/wp-mail.php +++ b/wp-mail.php @@ -7,7 +7,6 @@ require_once(ABSPATH.WPINC.'/class-pop3.php'); timer_start(); $output_debugging_info = 0; # =1 if you want to output debugging info -$time_difference = get_settings('time_difference'); if (get_settings('use_phoneemail')) { // if you're using phone email, the email will already be in your timezone diff --git a/wp-trackback.php b/wp-trackback.php index dcff256688..488153a744 100644 --- a/wp-trackback.php +++ b/wp-trackback.php @@ -51,7 +51,6 @@ if ((strlen(''.$tb_id)) && (empty($_GET['__mode'])) && (strlen(''.$tb_url))) { $user_ip = $_SERVER['REMOTE_ADDR']; $user_domain = gethostbyaddr($user_ip); - $time_difference = get_settings('time_difference'); $now = current_time('mysql'); $now_gmt = current_time('mysql', 1);