Send dateCreated as local blog time, add date_created_gmt with GMT value. Props josephscott. fixes #4624. refs #4158, #4314

git-svn-id: http://svn.automattic.com/wordpress/trunk@5888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-08-17 03:18:58 +00:00
parent e9c8915627
commit d55ac9708c
1 changed files with 33 additions and 19 deletions

View File

@ -208,7 +208,8 @@ class wp_xmlrpc_server extends IXR_Server {
$allow_pings = ("open" == $page->ping_status) ? 1 : 0; $allow_pings = ("open" == $page->ping_status) ? 1 : 0;
// Format page date. // Format page date.
$page_date = mysql2date("Ymd\TH:i:s\Z", $page->post_date_gmt); $page_date = mysql2date("Ymd\TH:i:s", $page->post_date);
$page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt);
// Pull the categories info together. // Pull the categories info together.
$categories = array(); $categories = array();
@ -240,7 +241,8 @@ class wp_xmlrpc_server extends IXR_Server {
"wp_page_parent_title" => $parent_title, "wp_page_parent_title" => $parent_title,
"wp_page_order" => $page->menu_order, "wp_page_order" => $page->menu_order,
"wp_author_id" => $author->ID, "wp_author_id" => $author->ID,
"wp_author_display_name" => $author->display_name "wp_author_display_name" => $author->display_name,
"date_created_gmt" => new IXR_Date($page_date_gmt)
); );
return($page_struct); return($page_struct);
@ -429,7 +431,8 @@ class wp_xmlrpc_server extends IXR_Server {
SELECT ID page_id, SELECT ID page_id,
post_title page_title, post_title page_title,
post_parent page_parent_id, post_parent page_parent_id,
post_date_gmt post_date_gmt,
post_date
FROM {$wpdb->posts} FROM {$wpdb->posts}
WHERE post_type = 'page' WHERE post_type = 'page'
ORDER BY ID ORDER BY ID
@ -438,10 +441,14 @@ class wp_xmlrpc_server extends IXR_Server {
// The date needs to be formated properly. // The date needs to be formated properly.
$num_pages = count($page_list); $num_pages = count($page_list);
for($i = 0; $i < $num_pages; $i++) { for($i = 0; $i < $num_pages; $i++) {
$post_date = mysql2date("Ymd\TH:i:s\Z", $page_list[$i]->post_date_gmt); $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date);
$post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt);
$page_list[$i]->dateCreated = new IXR_Date($post_date); $page_list[$i]->dateCreated = new IXR_Date($post_date);
$page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt);
unset($page_list[$i]->post_date_gmt); unset($page_list[$i]->post_date_gmt);
unset($page_list[$i]->post_date);
} }
return($page_list); return($page_list);
@ -1054,16 +1061,16 @@ class wp_xmlrpc_server extends IXR_Server {
if ( is_array($to_ping) ) if ( is_array($to_ping) )
$to_ping = implode(' ', $to_ping); $to_ping = implode(' ', $to_ping);
// Do some timestamp voodoo // Do some timestamp voodoo
$dateCreatedd = $content_struct['dateCreated']; $dateCreatedd = $content_struct['dateCreated'];
if (!empty($dateCreatedd)) { if (!empty($dateCreatedd)) {
$dateCreated = $dateCreatedd->getIso(); $dateCreated = $dateCreatedd->getIso();
$post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
$post_date_gmt = iso8601_to_datetime($dateCreated. "Z", GMT); $post_date_gmt = iso8601_to_datetime($dateCreated, GMT);
} else { } else {
$post_date = current_time('mysql'); $post_date = current_time('mysql');
$post_date_gmt = current_time('mysql', 1); $post_date_gmt = current_time('mysql', 1);
} }
$catnames = $content_struct['categories']; $catnames = $content_struct['categories'];
logIO('O', 'Post cats: ' . printr($catnames,true)); logIO('O', 'Post cats: ' . printr($catnames,true));
@ -1341,7 +1348,8 @@ class wp_xmlrpc_server extends IXR_Server {
if ($postdata['post_date'] != '') { if ($postdata['post_date'] != '') {
$post_date = mysql2date('Ymd\TH:i:s\Z', $postdata['post_date_gmt']); $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date']);
$post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt']);
$categories = array(); $categories = array();
$catids = wp_get_post_categories($post_ID); $catids = wp_get_post_categories($post_ID);
@ -1376,7 +1384,8 @@ class wp_xmlrpc_server extends IXR_Server {
'wp_slug' => $postdata['post_name'], 'wp_slug' => $postdata['post_name'],
'wp_password' => $postdata['post_password'], 'wp_password' => $postdata['post_password'],
'wp_author_id' => $author->ID, 'wp_author_id' => $author->ID,
'wp_author_display_name' => $author->display_name 'wp_author_display_name' => $author->display_name,
'date_created_gmt' => new IXR_Date($post_date_gmt)
); );
return $resp; return $resp;
@ -1409,7 +1418,9 @@ class wp_xmlrpc_server extends IXR_Server {
foreach ($posts_list as $entry) { foreach ($posts_list as $entry) {
$post_date = mysql2date('Ymd\TH:i:s\Z', $entry['post_date_gmt']); $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt']);
$categories = array(); $categories = array();
$catids = wp_get_post_categories($entry['ID']); $catids = wp_get_post_categories($entry['ID']);
foreach($catids as $catid) { foreach($catids as $catid) {
@ -1443,7 +1454,8 @@ class wp_xmlrpc_server extends IXR_Server {
'wp_slug' => $entry['post_name'], 'wp_slug' => $entry['post_name'],
'wp_password' => $entry['post_password'], 'wp_password' => $entry['post_password'],
'wp_author_id' => $author->ID, 'wp_author_id' => $author->ID,
'wp_author_display_name' => $author->display_name 'wp_author_display_name' => $author->display_name,
'date_created_gmt' => new IXR_Date($post_date_gmt)
); );
} }
@ -1593,13 +1605,15 @@ class wp_xmlrpc_server extends IXR_Server {
foreach ($posts_list as $entry) { foreach ($posts_list as $entry) {
$post_date = mysql2date('Ymd\TH:i:s\Z', $entry['post_date_gmt']); $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
$post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt']);
$struct[] = array( $struct[] = array(
'dateCreated' => new IXR_Date($post_date), 'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'], 'userid' => $entry['post_author'],
'postid' => $entry['ID'], 'postid' => $entry['ID'],
'title' => $entry['post_title'], 'title' => $entry['post_title'],
'date_created_gmt' => new IXR_Date($post_date_gmt)
); );
} }