mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-15 07:05:37 +01:00
Whitelist post arguments in XML-RPC
Merges [40677] to the 4.2 branch. Built from https://develop.svn.wordpress.org/branches/4.2@40683 git-svn-id: http://core.svn.wordpress.org/branches/4.2@40546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5565b98dde
commit
7fc612abfb
@ -1210,10 +1210,31 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
* @param array|IXR_Error $content_struct Post data to insert.
|
||||
*/
|
||||
protected function _insert_post( $user, $content_struct ) {
|
||||
$defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
|
||||
'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' );
|
||||
$defaults = array(
|
||||
'post_status' => 'draft',
|
||||
'post_type' => 'post',
|
||||
'post_author' => null,
|
||||
'post_password' => null,
|
||||
'post_excerpt' => null,
|
||||
'post_content' => null,
|
||||
'post_title' => null,
|
||||
'post_date' => null,
|
||||
'post_date_gmt' => null,
|
||||
'post_format' => null,
|
||||
'post_name' => null,
|
||||
'post_thumbnail' => null,
|
||||
'post_parent' => null,
|
||||
'ping_status' => null,
|
||||
'comment_status' => null,
|
||||
'custom_fields' => null,
|
||||
'terms_names' => null,
|
||||
'terms' => null,
|
||||
'sticky' => null,
|
||||
'enclosure' => null,
|
||||
'ID' => null,
|
||||
);
|
||||
|
||||
$post_data = wp_parse_args( $content_struct, $defaults );
|
||||
$post_data = wp_parse_args( array_intersect_key( $content_struct, $defaults ), $defaults );
|
||||
|
||||
$post_type = get_post_type_object( $post_data['post_type'] );
|
||||
if ( ! $post_type )
|
||||
@ -1394,9 +1415,6 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$post_data['tax_input'] = $terms;
|
||||
unset( $post_data['terms'], $post_data['terms_names'] );
|
||||
} else {
|
||||
// do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'
|
||||
unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
|
||||
}
|
||||
|
||||
if ( isset( $post_data['post_format'] ) ) {
|
||||
|
Loading…
Reference in New Issue
Block a user