WordPress.org

Make WordPress Core

Changeset 20322


Ignore:
Timestamp:
03/29/2012 11:59:51 AM (6 years ago)
Author:
westi
Message:

XMLRPC: Fix bugs in mw_editPost hilighted by tests in [UT593]

  • Feature image code did not actually set the feature image - See #18429
  • This api call could trash post data - Fixes #20321.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r20321 r20322  
    39763976        }
    39773977
    3978         $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null;
    3979         $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null;
     3978        if ( isset( $content_struct['title'] ) )
     3979            $post_title =  $content_struct['title'];
     3980
     3981        if ( isset( $content_struct['description'] ) )
     3982            $post_content = $content_struct['description'];
    39803983
    39813984        $post_category = array();
     
    39893992        }
    39903993
    3991         $post_excerpt = isset( $content_struct['mt_excerpt'] ) ? $content_struct['mt_excerpt'] : null;
    3992         $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null;
     3994        if ( isset( $content_struct['mt_excerpt'] ) )
     3995            $post_excerpt =  $content_struct['mt_excerpt'];
     3996
     3997        if ( isset( $content_struct['mt_text_more'] ) )
     3998            $post_more =  $content_struct['mt_text_more'];
    39933999
    39944000        $post_status = $publish ? 'publish' : 'draft';
     
    40614067            $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
    40624068
    4063         if ( isset ( $post_data['wp_featured_image'] ) ) {
     4069        if ( isset ( $content_struct['wp_featured_image'] ) ) {
    40644070            // empty value deletes, non-empty value adds/updates
    4065             if ( empty( $post_data['wp_featured_image'] ) ) {
     4071            if ( empty( $content_struct['wp_featured_image'] ) ) {
    40664072                delete_post_thumbnail( $post_ID );
    4067             }
    4068             else {
    4069                 if ( set_post_thumbnail( $post_ID, $post_data['wp_featured_image'] ) === false )
     4073            } else {
     4074                if ( set_post_thumbnail( $post_ID, $content_struct['wp_featured_image'] ) === false )
    40704075                    return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
    40714076            }
Note: See TracChangeset for help on using the changeset viewer.