mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Ensure that drafts viewed over XMLRPC have a correct gmt date set. Fixes #10244 for trunk props josephscott.
git-svn-id: https://develop.svn.wordpress.org/trunk@11846 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
29
xmlrpc.php
29
xmlrpc.php
@@ -534,6 +534,11 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$page_date = mysql2date("Ymd\TH:i:s", $page->post_date, false);
|
||||
$page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt, false);
|
||||
|
||||
// For drafts use the GMT version of the date
|
||||
if ( $page->post_status == 'draft' ) {
|
||||
$page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date ), 'Ymd\TH:i:s' );
|
||||
}
|
||||
|
||||
// Pull the categories info together.
|
||||
$categories = array();
|
||||
foreach(wp_get_post_categories($page->ID) as $cat_id) {
|
||||
@@ -798,7 +803,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
post_title page_title,
|
||||
post_parent page_parent_id,
|
||||
post_date_gmt,
|
||||
post_date
|
||||
post_date,
|
||||
post_status
|
||||
FROM {$wpdb->posts}
|
||||
WHERE post_type = 'page'
|
||||
ORDER BY ID
|
||||
@@ -813,8 +819,15 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$page_list[$i]->dateCreated = new IXR_Date($post_date);
|
||||
$page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt);
|
||||
|
||||
// For drafts use the GMT version of the date
|
||||
if ( $page_list[$i]->post_status == 'draft' ) {
|
||||
$page_list[$i]->date_created_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page_list[$i]->post_date ), 'Ymd\TH:i:s' );
|
||||
$page_list[$i]->date_created_gmt = new IXR_Date( $page_list[$i]->date_created_gmt );
|
||||
}
|
||||
|
||||
unset($page_list[$i]->post_date_gmt);
|
||||
unset($page_list[$i]->post_date);
|
||||
unset($page_list[$i]->post_status);
|
||||
}
|
||||
|
||||
return($page_list);
|
||||
@@ -2581,9 +2594,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
// For drafts use the GMT version of the post date
|
||||
if ( $postdata['post_status'] == 'draft' ) {
|
||||
$post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ) );
|
||||
$post_date_gmt = preg_replace( '|\-|', '', $post_date_gmt );
|
||||
$post_date_gmt = preg_replace( '| |', 'T', $post_date_gmt );
|
||||
$post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ), 'Ymd\TH:i:s' );
|
||||
}
|
||||
|
||||
$categories = array();
|
||||
@@ -2702,6 +2713,11 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
|
||||
$post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
|
||||
|
||||
// For drafts use the GMT version of the date
|
||||
if ( $entry['post_status'] == 'draft' ) {
|
||||
$post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
|
||||
}
|
||||
|
||||
$categories = array();
|
||||
$catids = wp_get_post_categories($entry['ID']);
|
||||
foreach($catids as $catid) {
|
||||
@@ -2937,6 +2953,11 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
|
||||
$post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
|
||||
|
||||
// For drafts use the GMT version of the date
|
||||
if ( $entry['post_status'] == 'draft' ) {
|
||||
$post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
|
||||
}
|
||||
|
||||
$struct[] = array(
|
||||
'dateCreated' => new IXR_Date($post_date),
|
||||
'userid' => $entry['post_author'],
|
||||
|
||||
Reference in New Issue
Block a user