Skip to content
Browse files

big leap to GMT dates

git-svn-id: http://svn.automattic.com/wordpress/trunk@914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent d92647e commit 84435bfa5f548f9ec0cedac8766acc17466f2e55 michelvaldrighi committed
Showing with 16 additions and 32 deletions.
  1. +5 −12 wp-admin/post.php
  2. +1 −8 wp-admin/upgrade-functions.php
  3. +2 −1 wp-comments-post.php
  4. +4 −7 wp-includes/functions.php
  5. +2 −2 wp-mail.php
  6. +1 −1 wp-register.php
  7. +1 −1 wp-trackback.php
View
17 wp-admin/post.php
@@ -83,11 +83,9 @@ function add_magic_quotes($array) {
$hh = ($hh > 23) ? $hh - 24 : $hh;
$mn = ($mn > 59) ? $mn - 60 : $mn;
$ss = ($ss > 59) ? $ss - 60 : $ss;
- $now = "$aa-$mm-$jj $hh:$mn:$ss";
- // for GMT dates: compute GMT time from user's timezone time with time_difference
+ $now = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss")
} else {
- $now = current_time('mysql');
- // for GMT dates: $now = gmdate('Y-m-d H:i:s');
+ $now = gmdate('Y-m-d H:i:s');
}
if (!empty($HTTP_POST_VARS['mode'])) {
@@ -310,17 +308,12 @@ function add_magic_quotes($array) {
$hh = ($hh > 23) ? $hh - 24 : $hh;
$mn = ($mn > 59) ? $mn - 60 : $mn;
$ss = ($ss > 59) ? $ss - 60 : $ss;
- $datemodif = ", post_date=\"$aa-$mm-$jj $hh:$mn:$ss\"";
- /* for GMT dates:
- $add_hours = intval($time_difference);
- $add_minutes = intval(60 * ($time_difference - $add_hours));
- $datemodif = ", post_date = DATE_ADD('$aa-$mm-$jj $hh:$mn:$ss', INTERVAL '-$add_hours:$add_minutes' HOUR_MINUTE)";
- */
+ $datemodif = ", post_date = '".get_gmt_from_date('$aa-$mm-$jj $hh:$mn:$ss')."'";
} else {
$datemodif = '';
}
- $now = current_time('mysql');
- // for GMT dates: $now = gmdate('Y-m-d H:i:s');
+
+ $now = gmdate('Y-m-d H:i:s');
$result = $wpdb->query("
UPDATE $tableposts SET
View
9 wp-admin/upgrade-functions.php
@@ -712,7 +712,7 @@ function upgrade_110() {
$wpdb->query("INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level) VALUES (93, 'blog_charset', 3, 'utf-8', 'Your blog&#8217;s charset (here&#8217;s a <a href=\"http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html\">list of possible charsets</a>)', 8)");
}
- /* for GMT dates: this is commented until all of WP can deal with GMT
+ // Convert all datetime fields' values to GMT, and update $time_difference
$time_difference = get_settings('time_difference');
$server_time = gmmktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y'));
@@ -731,12 +731,6 @@ function upgrade_110() {
$add_hours = intval($diff_gmt_weblogger);
$add_minutes = intval(60 * ($diff_gmt_weblogger - $add_hours));
- #field names to update:
- #wp_posts.post_date
- #wp_posts.post_modified
- #wp_comments.comment_date
- #wp_users.dateYMDhour
-
#the queries are simple
$wpdb->query("UPDATE $tableposts SET post_date = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
$wpdb->query("UPDATE $tableposts SET post_modified = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'");
@@ -753,7 +747,6 @@ function upgrade_110() {
$wpdb->query("UPDATE $tableoptions SET option_value = '0' WHERE option_name = 'time_difference'");
}
- */
}
View
3 wp-comments-post.php
@@ -47,7 +47,8 @@ function add_magic_quotes($array) {
}
-$now = current_time('mysql');
+$now = gmdate('Y-m-d H:i:s');
+
$comment = balanceTags($comment, 1);
$comment = format_to_post($comment);
View
11 wp-includes/functions.php
@@ -96,10 +96,9 @@ function get_weekstartend($mysqlstring, $start_of_week) {
}
function get_lastpostdate() {
- global $tableposts, $cache_lastpostdate, $use_cache, $time_difference, $pagenow, $wpdb;
+ global $tableposts, $cache_lastpostdate, $use_cache, $pagenow, $wpdb;
if ((!isset($cache_lastpostdate)) OR (!$use_cache)) {
- $now = date("Y-m-d H:i:s",(time() + ($time_difference * 3600)));
-
+ $now = gmdate('Y-m-d H:i:s');
$lastpostdate = $wpdb->get_var("SELECT post_date FROM $tableposts WHERE post_date <= '$now' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
$cache_lastpostdate = $lastpostdate;
} else {
@@ -111,9 +110,7 @@ function get_lastpostdate() {
function get_lastpostmodified() {
global $tableposts, $cache_lastpostmodified, $use_cache, $pagenow, $wpdb;
if ((!isset($cache_lastpostmodified)) OR (!$use_cache)) {
- $time_difference = get_settings('time_difference'); // for some weird reason the global wasn't set anymore?
- $now = date("Y-m-d H:i:s",(time() + ($time_difference * 3600)));
-
+ $now = gmdate('Y-m-d H:i:s');
$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1");
$cache_lastpostmodified = $lastpostmodified;
} else {
@@ -1485,7 +1482,7 @@ function get_posts($args) {
if (!isset($r['orderby'])) $r['orderby'] = '';
if (!isset($r['order'])) $r['order'] = '';
- $now = current_time('mysql');
+ $now = gmdate('Y-m-d H:i:s');
$posts = $wpdb->get_results("SELECT DISTINCT * FROM $tableposts WHERE post_date <= '$now' AND (post_status = 'publish') GROUP BY $tableposts.ID ORDER BY post_date DESC LIMIT " . $r['offset'] . ',' . $r['numberposts']);
View
4 wp-mail.php
@@ -106,8 +106,8 @@
}
}
$ddate_U = mktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y);
- $ddate_U = $ddate_U + ($time_difference * 3600);
- $post_date = date('Y-m-d H:i:s', $ddate_U);
+
+ $post_date = gmdate('Y-m-d H:i:s', $ddate_U);
}
}
}
View
2 wp-register.php
@@ -87,7 +87,7 @@ function filter($value) {
$user_login = addslashes($user_login);
$pass1 = addslashes($pass1);
$user_nickname = addslashes($user_nickname);
- $now = current_time('mysql');
+ $now = gmdate('Y-m-d H:i:s');
$result = $wpdb->query("INSERT INTO $tableusers
(user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_idmode)
View
2 wp-trackback.php
@@ -52,7 +52,7 @@
$user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$user_domain = gethostbyaddr($user_ip);
$time_difference = get_settings('time_difference');
- $now = current_time('mysql');
+ $now = gmdate('Y-m-d H:i:s');
$comment = convert_chars($comment);
$comment = format_to_post($comment);

0 comments on commit 84435bf

Please sign in to comment.
Something went wrong with that request. Please try again.