From: Edward Z. Yang Date: Wed, 16 Sep 2015 22:48:53 +0000 (-0700) Subject: WordPress 4.2.5 X-Git-Tag: wordpress-4.2.5 X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/commitdiff_plain/refs/tags/wordpress-4.2.5 WordPress 4.2.5 Signed-off-by: Edward Z. Yang --- diff --git a/readme.html b/readme.html index c44623cf..cdf3e4e4 100644 --- a/readme.html +++ b/readme.html @@ -9,7 +9,7 @@

WordPress -
Version 4.2.4 +
Version 4.2.5

Semantic Personal Publishing Platform

diff --git a/wp-admin/about.php b/wp-admin/about.php index 8105de98..6e85b919 100644 --- a/wp-admin/about.php +++ b/wp-admin/about.php @@ -41,7 +41,11 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
-

+

+

Version %1$s addressed some security issues and fixed %2$s bug.', + 'Version %1$s addressed some security issues and fixed %2$s bugs.', 2 ), '4.2.5', number_format_i18n( 2 ) ); ?> + the release notes.' ), 'http://codex.wordpress.org/Version_4.2.5' ); ?> +

Version %1$s addressed some security issues and fixed %2$s bug.', 'Version %1$s addressed some security issues and fixed %2$s bugs.', 4 ), '4.2.4', number_format_i18n( 4 ) ); ?> the release notes.' ), 'http://codex.wordpress.org/Version_4.2.4' ); ?> diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 423a159f..696b4328 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1540,10 +1540,12 @@ function wp_ajax_inline_save() { $data['parent_id'] = $data['post_parent']; // Status. - if ( isset($data['keep_private']) && 'private' == $data['keep_private'] ) + if ( isset( $data['keep_private'] ) && 'private' == $data['keep_private'] ) { + $data['visibility'] = 'private'; $data['post_status'] = 'private'; - else + } else { $data['post_status'] = $data['_status']; + } if ( empty($data['comment_status']) ) $data['comment_status'] = 'closed'; diff --git a/wp-admin/includes/class-wp-ms-users-list-table.php b/wp-admin/includes/class-wp-ms-users-list-table.php index e5eaeb50..c70636f6 100644 --- a/wp-admin/includes/class-wp-ms-users-list-table.php +++ b/wp-admin/includes/class-wp-ms-users-list-table.php @@ -224,7 +224,7 @@ class WP_MS_Users_List_Table extends WP_List_Table { break; case 'email': - echo "$user->user_email"; + echo "$user->user_email"; break; case 'registered': diff --git a/wp-admin/includes/class-wp-users-list-table.php b/wp-admin/includes/class-wp-users-list-table.php index 50067363..07aab5b1 100644 --- a/wp-admin/includes/class-wp-users-list-table.php +++ b/wp-admin/includes/class-wp-users-list-table.php @@ -420,7 +420,7 @@ class WP_Users_List_Table extends WP_List_Table { $r .= "$user_object->first_name $user_object->last_name"; break; case 'email': - $r .= "$email"; + $r .= "$email"; break; case 'role': $r .= "$role_name"; diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index 8a3d3350..b73eb41b 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -1260,7 +1260,16 @@ function map_meta_cap( $cap, $user_id ) { if ( empty( $comment ) ) break; $post = get_post( $comment->comment_post_ID ); - $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); + + /* + * If the post doesn't exist, we have an orphaned comment. + * Fall back to the edit_posts capability, instead. + */ + if ( $post ) { + $caps = map_meta_cap( 'edit_post', $user_id, $post->ID ); + } else { + $caps = map_meta_cap( 'edit_posts', $user_id ); + } break; case 'unfiltered_upload': if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) ) ) diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 10c593d2..aac66314 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -1150,6 +1150,56 @@ class wp_xmlrpc_server extends IXR_Server { return $count > 1; } + private function _validate_boolean( $var ) { + if ( is_bool( $var ) ) { + return $var; + } + + if ( is_string( $var ) && 'false' === strtolower( $var ) ) { + return false; + } + + return (bool) $var; + } + + /** + * Encapsulate the logic for sticking a post + * and determining if the user has permission to do so + * + * @since 4.3.0 + * @access private + * + * @param array $post_data + * @param bool $update + * @return void|IXR_Error + */ + private function _toggle_sticky( $post_data, $update = false ) { + $post_type = get_post_type_object( $post_data['post_type'] ); + + // Private and password-protected posts cannot be stickied. + if ( 'private' === $post_data['post_status'] || ! empty( $post_data['post_password'] ) ) { + // Error if the client tried to stick the post, otherwise, silently unstick. + if ( ! empty( $post_data['sticky'] ) ) { + return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) ); + } + + if ( $update ) { + unstick_post( $post_data['ID'] ); + } + } elseif ( isset( $post_data['sticky'] ) ) { + if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) { + return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) ); + } + + $sticky = $this->_validate_boolean( $post_data['sticky'] ); + if ( $sticky ) { + stick_post( $post_data['ID'] ); + } else { + unstick_post( $post_data['ID'] ); + } + } + } + /** * Helper method for wp_newPost and wp_editPost, containing shared logic. * @@ -1242,20 +1292,9 @@ class wp_xmlrpc_server extends IXR_Server { $post_ID = $post_data['ID']; if ( $post_data['post_type'] == 'post' ) { - // Private and password-protected posts cannot be stickied. - if ( $post_data['post_status'] == 'private' || ! empty( $post_data['post_password'] ) ) { - // Error if the client tried to stick the post, otherwise, silently unstick. - if ( ! empty( $post_data['sticky'] ) ) - return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) ); - if ( $update ) - unstick_post( $post_ID ); - } elseif ( isset( $post_data['sticky'] ) ) { - if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) - return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) ); - if ( $post_data['sticky'] ) - stick_post( $post_ID ); - else - unstick_post( $post_ID ); + $error = $this->_toggle_sticky( $post_data, $update ); + if ( $error ) { + return $error; } } @@ -4580,10 +4619,12 @@ class wp_xmlrpc_server extends IXR_Server { // Only posts can be sticky if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { - if ( $content_struct['sticky'] == true ) - stick_post( $post_ID ); - elseif ( $content_struct['sticky'] == false ) - unstick_post( $post_ID ); + $data = $postdata; + $data['sticky'] = $content_struct['sticky']; + $error = $this->_toggle_sticky( $data ); + if ( $error ) { + return $error; + } } if ( isset($content_struct['custom_fields']) ) @@ -4873,8 +4914,8 @@ class wp_xmlrpc_server extends IXR_Server { $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; - if ( ('publish' == $post_status) ) { - if ( ( 'page' == $post_type ) && ! current_user_can( 'publish_pages' ) ) { + if ( 'publish' == $post_status || 'private' == $post_status ) { + if ( 'page' == $post_type && ! current_user_can( 'publish_pages' ) ) { return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this page.' ) ); } elseif ( ! current_user_can( 'publish_posts' ) ) { return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this post.' ) ); @@ -4918,10 +4959,13 @@ class wp_xmlrpc_server extends IXR_Server { // Only posts can be sticky if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) { - if ( $content_struct['sticky'] == true ) - stick_post( $post_ID ); - elseif ( $content_struct['sticky'] == false ) - unstick_post( $post_ID ); + $data = $newpost; + $data['sticky'] = $content_struct['sticky']; + $data['post_type'] = 'post'; + $error = $this->_toggle_sticky( $data, true ); + if ( $error ) { + return $error; + } } if ( isset($content_struct['custom_fields']) ) diff --git a/wp-includes/media.php b/wp-includes/media.php index b69b328d..35ecdd95 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -847,6 +847,8 @@ function img_caption_shortcode( $attr, $content = null ) { $content = $matches[1]; $attr['caption'] = trim( $matches[2] ); } + } elseif ( strpos( $attr['caption'], '<' ) !== false ) { + $attr['caption'] = wp_kses( $attr['caption'], 'post' ); } /** diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php index 531a1fa1..810db200 100644 --- a/wp-includes/shortcodes.php +++ b/wp-includes/shortcodes.php @@ -457,6 +457,15 @@ function shortcode_parse_atts($text) { elseif (isset($m[8])) $atts[] = stripcslashes($m[8]); } + + // Reject any unclosed HTML elements + foreach( $atts as &$value ) { + if ( false !== strpos( $value, '<' ) ) { + if ( 1 !== preg_match( '/^[^<]*+(?:<[^>]*+>[^<]*+)*+$/', $value ) ) { + $value = ''; + } + } + } } else { $atts = ltrim($text); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 21e9f5ad..dda093a5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2.4'; +$wp_version = '4.2.5'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 14a3438b..296a5d21 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -2835,7 +2835,7 @@ class wpdb { . '|REPLACE(?:\s+LOW_PRIORITY|\s+DELAYED)?(?:\s+INTO)?' . '|UPDATE(?:\s+LOW_PRIORITY)?(?:\s+IGNORE)?' . '|DELETE(?:\s+LOW_PRIORITY|\s+QUICK|\s+IGNORE)*(?:\s+FROM)?' - . ')\s+((?:[0-9a-zA-Z$_.`]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) { + . ')\s+((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) { return str_replace( '`', '', $maybe[1] ); } @@ -2843,7 +2843,7 @@ class wpdb { if ( preg_match( '/^\s*(?:' . 'SHOW\s+TABLE\s+STATUS.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)' . '|SHOW\s+(?:FULL\s+)?TABLES.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)' - . ')\W((?:[0-9a-zA-Z$_.`]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) { + . ')\W((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) { return str_replace( '`', '', $maybe[1] ); } @@ -2862,7 +2862,7 @@ class wpdb { . '|LOAD\s+DATA.*INFILE.*INTO\s+TABLE' . '|(?:GRANT|REVOKE).*ON\s+TABLE' . '|SHOW\s+(?:.*FROM|.*TABLE)' - . ')\s+\(*\s*((?:[0-9a-zA-Z$_.`]|[\xC2-\xDF][\x80-\xBF])+)\s*\)*/is', $query, $maybe ) ) { + . ')\s+\(*\s*((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\s*\)*/is', $query, $maybe ) ) { return str_replace( '`', '', $maybe[1] ); }