Make WordPress Core


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

Whitelist post arguments in XML-RPC

Merges [40677] to the 4.3 branch.

Location:
branches/4.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.3

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

    r34151 r40682  
    12441244         */
    12451245        protected function _insert_post( $user, $content_struct ) {
    1246                 $defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
    1247                         'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' );
    1248 
    1249                 $post_data = wp_parse_args( $content_struct, $defaults );
     1246                $defaults = array(
     1247                        'post_status'    => 'draft',
     1248                        'post_type'      => 'post',
     1249                        'post_author'    => null,
     1250                        'post_password'  => null,
     1251                        'post_excerpt'   => null,
     1252                        'post_content'   => null,
     1253                        'post_title'     => null,
     1254                        'post_date'      => null,
     1255                        'post_date_gmt'  => null,
     1256                        'post_format'    => null,
     1257                        'post_name'      => null,
     1258                        'post_thumbnail' => null,
     1259                        'post_parent'    => null,
     1260                        'ping_status'    => null,
     1261                        'comment_status' => null,
     1262                        'custom_fields'  => null,
     1263                        'terms_names'    => null,
     1264                        'terms'          => null,
     1265                        'sticky'         => null,
     1266                        'enclosure'      => null,
     1267                        'ID'             => null,
     1268                );
     1269
     1270                $post_data = wp_parse_args( array_intersect_key( $content_struct, $defaults ), $defaults );
    12501271
    12511272                $post_type = get_post_type_object( $post_data['post_type'] );
     
    14311452                        $post_data['tax_input'] = $terms;
    14321453                        unset( $post_data['terms'], $post_data['terms_names'] );
    1433                 } else {
    1434                         // Do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'.
    1435                         unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
    14361454                }
    14371455
Note: See TracChangeset for help on using the changeset viewer.