big leap to GMT dates

git-svn-id: http://svn.automattic.com/wordpress/trunk@914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
michelvaldrighi 2004-02-23 03:42:40 +00:00
parent d92647edb0
commit 84435bfa5f
7 changed files with 16 additions and 32 deletions

View File

@ -83,11 +83,9 @@ switch($action) {
$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 @@ switch($action) {
$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 File

@ -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 File

@ -47,7 +47,8 @@ if ($comment == 'comment' || $comment == '') {
}
$now = current_time('mysql');
$now = gmdate('Y-m-d H:i:s');
$comment = balanceTags($comment, 1);
$comment = format_to_post($comment);

View File

@ -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 File

@ -106,8 +106,8 @@ for ($iCount=1; $iCount<=$Count; $iCount++) {
}
}
$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 File

@ -87,7 +87,7 @@ case 'register':
$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 File

@ -52,7 +52,7 @@ if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$tb_u
$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);