Make WordPress Core


Ignore:
Timestamp:
05/16/2017 08:23:11 AM (8 years ago)
Author:
swissspidy
Message:

Whitelist post arguments in XML-RPC

Merges [40677] to the 4.2 branch.

Location:
branches/4.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2

  • branches/4.2/src/wp-includes/class-wp-xmlrpc-server.php

    r34152 r40683  
    12111211     */
    12121212    protected function _insert_post( $user, $content_struct ) {
    1213         $defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
    1214             'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' );
    1215 
    1216         $post_data = wp_parse_args( $content_struct, $defaults );
     1213        $defaults = array(
     1214            'post_status'    => 'draft',
     1215            'post_type'      => 'post',
     1216            'post_author'    => null,
     1217            'post_password'  => null,
     1218            'post_excerpt'   => null,
     1219            'post_content'   => null,
     1220            'post_title'     => null,
     1221            'post_date'      => null,
     1222            'post_date_gmt'  => null,
     1223            'post_format'    => null,
     1224            'post_name'      => null,
     1225            'post_thumbnail' => null,
     1226            'post_parent'    => null,
     1227            'ping_status'    => null,
     1228            'comment_status' => null,
     1229            'custom_fields'  => null,
     1230            'terms_names'    => null,
     1231            'terms'          => null,
     1232            'sticky'         => null,
     1233            'enclosure'      => null,
     1234            'ID'             => null,
     1235        );
     1236
     1237        $post_data = wp_parse_args( array_intersect_key( $content_struct, $defaults ), $defaults );
    12171238
    12181239        $post_type = get_post_type_object( $post_data['post_type'] );
     
    13951416            $post_data['tax_input'] = $terms;
    13961417            unset( $post_data['terms'], $post_data['terms_names'] );
    1397         } else {
    1398             // do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'
    1399             unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
    14001418        }
    14011419
Note: See TracChangeset for help on using the changeset viewer.