Ticket #16985: 16985-with-pages.diff

File 16985-with-pages.diff, 4.3 KB (added by daniloercoli, 2 years ago)
  • wp-includes/class-wp-xmlrpc-server.php

     
    496496                        $page_date_gmt = mysql2date('Ymd\TH:i:s', $page->post_date_gmt, false); 
    497497 
    498498                        // For drafts use the GMT version of the date 
    499                         if ( $page->post_status == 'draft' ) 
     499                        if ($page->post_status == 'draft' && strcmp($page_date_gmt, '19700101T00:00:00') !=0)                            
    500500                                $page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date ), 'Ymd\TH:i:s' ); 
    501501 
     502                                 
    502503                        // Pull the categories info together. 
    503504                        $categories = array(); 
    504505                        foreach ( wp_get_post_categories($page->ID) as $cat_id ) { 
     
    682683                $username       = $this->escape($args[2]); 
    683684                $password       = $this->escape($args[3]); 
    684685                $content        = $args[4]; 
    685                 $publish        = $args[5]; 
     686                if ( isset($args[5]) ) 
     687                        $publish = $args[5]; 
     688                else 
     689                        $publish = false; 
    686690 
    687691                if ( !$user = $this->login($username, $password) ) 
    688692                        return $this->error; 
     
    762766                        $page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt); 
    763767 
    764768                        // For drafts use the GMT version of the date 
    765                         if ( $page_list[$i]->post_status == 'draft' ) { 
     769                        if ( $page_list[$i]->post_status == 'draft' && strcmp($post_date_gmt, '19700101T00:00:00') !=0) { 
    766770                                $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' ); 
    767771                                $page_list[$i]->date_created_gmt = new IXR_Date( $page_list[$i]->date_created_gmt ); 
    768772                        } 
     
    23822386                if ( !empty( $dateCreated ) ) { 
    23832387                        $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); 
    23842388                        $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT'); 
    2385                 } else { 
     2389                } /*else { 
    23862390                        $post_date = current_time('mysql'); 
    23872391                        $post_date_gmt = current_time('mysql', 1); 
    2388                 } 
     2392                }*/ 
    23892393 
    23902394                $post_category = array(); 
    23912395                if ( isset( $content_struct['categories'] ) ) { 
     
    24932497                $username  = $args[1]; 
    24942498                $password   = $args[2]; 
    24952499                $content_struct = $args[3]; 
    2496                 $publish     = $args[4]; 
    2497  
     2500                if ( isset($args[4]) ) 
     2501                        $publish = $args[4]; 
     2502                else 
     2503                        $publish = false; 
     2504                         
    24982505                if ( !$user = $this->login($username, $password) ) 
    24992506                        return $this->error; 
    25002507 
     
    27102717                if ( !empty( $dateCreated ) ) { 
    27112718                        $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); 
    27122719                        $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT'); 
    2713                 } else { 
     2720                }/* else { 
    27142721                        $post_date     = $postdata['post_date']; 
    27152722                        $post_date_gmt = $postdata['post_date_gmt']; 
    2716                 } 
     2723                }*/ 
    27172724 
    27182725                // We've got all the data -- post it: 
    27192726                $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template'); 
     
    27822789                        $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false); 
    27832790                        $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false); 
    27842791 
    2785                         // For drafts use the GMT version of the post date 
    2786                         if ( $postdata['post_status'] == 'draft' ) 
     2792                        // For drafts use the GMT version 
     2793                        if (  $entry['post_status'] == 'draft' && strcmp($post_date_gmt, '19700101T00:00:00') !=0 ) 
    27872794                                $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ), 'Ymd\TH:i:s' ); 
    2788  
     2795                                 
    27892796                        $categories = array(); 
    27902797                        $catids = wp_get_post_categories($post_ID); 
    27912798                        foreach($catids as $catid) 
     
    29092916                        $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false); 
    29102917 
    29112918                        // For drafts use the GMT version of the date 
    2912                         if ( $entry['post_status'] == 'draft' ) 
     2919                        if (  $entry['post_status'] == 'draft' && strcmp($post_date_gmt, '19700101T00:00:00') !=0 ) 
    29132920                                $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' ); 
    29142921 
    29152922                        $categories = array(); 
     
    31523159                        $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false); 
    31533160 
    31543161                        // For drafts use the GMT version of the date 
    3155                         if ( $entry['post_status'] == 'draft' ) 
     3162                        if ($entry['post_status'] == 'draft' && strcmp($post_date_gmt, '19700101T00:00:00') !=0) 
    31563163                                $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' ); 
    31573164 
    31583165                        $struct[] = array(