diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 8b6b6a021f..a19917e240 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -58,13 +58,13 @@ wp_enqueue_script( 'svg-painter' ); $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix); ?> diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index fc320f9f41..4508b25bec 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -454,6 +454,7 @@ if ( current_theme_supports( 'custom-background', 'default-color' ) ) * @deprecated 3.5.0 */ public function wp_set_background_image() { + check_ajax_referer( 'custom-background' ); if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit; $attachment_id = absint($_POST['attachment_id']); /** This filter is documented in wp-admin/includes/media.php */ diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index a56c7602c6..6c1a2adfd4 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -318,7 +318,7 @@ class Custom_Image_Header { addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();} -var ajaxurl = '', - pagenow = 'id; ?>', - typenow = 'post_type; ?>', - adminpage = '', - thousandsSeparator = 'number_format['thousands_sep'] ); ?>', - decimalPoint = 'number_format['decimal_point'] ); ?>', +var ajaxurl = '', + pagenow = 'id ); ?>', + typenow = 'post_type ); ?>', + adminpage = '', + thousandsSeparator = 'number_format['thousands_sep'] ); ?>', + decimalPoint = 'number_format['decimal_point'] ); ?>', isRtl = ; - +
diff --git a/wp-admin/network/site-users.php b/wp-admin/network/site-users.php index 57a189b7ae..7745177b85 100644 --- a/wp-admin/network/site-users.php +++ b/wp-admin/network/site-users.php @@ -177,7 +177,7 @@ if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users require( ABSPATH . 'wp-admin/admin-header.php' ); ?> diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 86fd8dcbd4..8c5df96231 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -3292,6 +3292,21 @@ class wp_xmlrpc_server extends IXR_Server { if ( ! get_post($post_id) ) return new IXR_Error( 404, __( 'Invalid post ID.' ) ); + if ( + 'publish' === get_post_status( $post_id ) && + ! current_user_can( 'edit_post', $post_id ) && + post_password_required( $post_id ) + ) { + return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); + } + + if ( + 'private' === get_post_status( $post_id ) && + ! current_user_can( 'read_post', $post_id ) + ) { + return new IXR_Error( 403, __( 'Sorry, you are not allowed to comment on this post.' ) ); + } + $comment = array(); $comment['comment_post_ID'] = $post_id; @@ -3608,8 +3623,10 @@ class wp_xmlrpc_server extends IXR_Server { /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ do_action( 'xmlrpc_call', 'wp.getMediaItem' ); - if ( ! $attachment = get_post($attachment_id) ) + $attachment = get_post( $attachment_id ); + if ( ! $attachment || 'attachment' !== $attachment->post_type ) { return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); + } return $this->_prepare_media_item( $attachment ); } diff --git a/wp-includes/meta.php b/wp-includes/meta.php index b57e761f46..c41ceaaa49 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -1597,8 +1597,9 @@ function _get_meta_table($type) { * @param string|null $meta_type * @return bool True if the key is protected, false otherwise. */ -function is_protected_meta( $meta_key, $meta_type = null ) { - $protected = ( '_' == $meta_key[0] ); +function is_protected_meta( $meta_key, $meta_type = '' ) { + $sanitized_key = preg_replace( "/[^\x20-\x7E\p{L}]/", '', $meta_key ); + $protected = strlen( $sanitized_key ) > 0 && ( '_' === $sanitized_key[0] ); /** * Filter whether a meta key is protected.