<body>
<h1 id="logo">
<a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
- <br /> Version 4.2.4
+ <br /> Version 4.2.5
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
</h2>
<div class="changelog point-releases">
- <h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 4 ); ?></h3>
+ <h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 5 ); ?></h3>
+ <p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
+ '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 2 ), '4.2.5', number_format_i18n( 2 ) ); ?>
+ <?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.2.5' ); ?>
+ </p>
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 4 ), '4.2.4', number_format_i18n( 4 ) ); ?>
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.2.4' ); ?>
$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';
break;
case 'email':
- echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>";
+ echo "<td $attributes><a href='" . esc_url( "mailto:$user->user_email" ) . "'>$user->user_email</a></td>";
break;
case 'registered':
$r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
break;
case 'email':
- $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
+ $r .= "<td $attributes><a href='" . esc_url( "mailto:$email" ) . "' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
break;
case 'role':
$r .= "<td $attributes>$role_name</td>";
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 ) ) )
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.
*
$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;
}
}
// 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']) )
$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.' ) );
// 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']) )
$content = $matches[1];
$attr['caption'] = trim( $matches[2] );
}
+ } elseif ( strpos( $attr['caption'], '<' ) !== false ) {
+ $attr['caption'] = wp_kses( $attr['caption'], 'post' );
}
/**
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);
}
*
* @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.
. '|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] );
}
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] );
}
. '|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] );
}