From fcb988688d75f55b10ce011bf1963c40f5020508 Mon Sep 17 00:00:00 2001
From: Sergey Biryukov
diff --git a/wp-includes/date.php b/wp-includes/date.php
index ace3e41bdf..fc425413f3 100644
--- a/wp-includes/date.php
+++ b/wp-includes/date.php
@@ -152,8 +152,8 @@ class WP_Date_Query {
*/
public function __construct( $date_query, $default_column = 'post_date' ) {
- if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] ) ) {
- $this->relation = 'OR';
+ if ( isset( $date_query['relation'] ) ) {
+ $this->relation = $this->sanitize_relation( $date_query['relation'] );
} else {
$this->relation = 'AND';
}
@@ -233,6 +233,9 @@ class WP_Date_Query {
$this->validate_date_values( $queries );
}
+ // Sanitize the relation parameter.
+ $queries['relation'] = $this->sanitize_relation( $queries['relation'] );
+
foreach ( $queries as $key => $q ) {
if ( ! is_array( $q ) || in_array( $key, $this->time_keys, true ) ) {
// This is a first-order query. Trust the values and sanitize when building SQL.
@@ -1011,4 +1014,20 @@ class WP_Date_Query {
return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time );
}
+
+ /**
+ * Sanitizes a 'relation' operator.
+ *
+ * @since 6.0.3
+ *
+ * @param string $relation Raw relation key from the query argument.
+ * @return string Sanitized relation ('AND' or 'OR').
+ */
+ public function sanitize_relation( $relation ) {
+ if ( 'OR' === strtoupper( $relation ) ) {
+ return 'OR';
+ } else {
+ return 'AND';
+ }
+ }
}
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 7f22a35e5a..4dcfc81cf8 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -2605,8 +2605,16 @@ function wp_nonce_ays( $action ) {
$html .= sprintf( __( "Do you really want to log out?"), wp_logout_url( $redirect_to ) );
} else {
$html = __( 'Are you sure you want to do this?' );
- if ( wp_get_referer() )
- $html .= "
" . __( 'Please try again.' ) . ""; + if ( wp_get_referer() ) { + $wp_http_referer = remove_query_arg( 'updated', wp_get_referer() ); + $wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) ); + $html .= '
'; + $html .= sprintf( + '%s', + esc_url( $wp_http_referer ), + __( 'Please try again.' ) + ); + } } wp_die( $html, __( 'WordPress Failure Notice' ), 403 ); diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php index 8d7c758c50..f18688471b 100644 --- a/wp-includes/media-template.php +++ b/wp-includes/media-template.php @@ -1245,7 +1245,7 @@ function wp_print_media_templates() {
' . sprintf( __('RSS Error: %s'), $rss->get_error_message() ) . '
'; + echo '' . sprintf( __('RSS Error: %s'), esc_html( $rss->get_error_message() ) ) . '
'; return; } @@ -1342,7 +1342,7 @@ function wp_widget_rss_form( $args, $inputs = null ) { $args['show_date'] = isset( $args['show_date'] ) ? (int) $args['show_date'] : (int) $inputs['show_date']; if ( ! empty( $args['error'] ) ) { - echo ' '; + echo ' '; } $esc_number = esc_attr( $args['number'] ); diff --git a/wp-mail.php b/wp-mail.php index 60287a07bc..4a70c7cc23 100644 --- a/wp-mail.php +++ b/wp-mail.php @@ -60,6 +60,9 @@ if( 0 === $count ) { wp_die( __('There doesn’t seem to be any new mail.') ); } +// Always run as an unauthenticated user. +wp_set_current_user( 0 ); + for ( $i = 1; $i <= $count; $i++ ) { $message = $pop3->get($i); @@ -125,7 +128,6 @@ for ( $i = 1; $i <= $count; $i++ ) { $author = trim($line); $author = sanitize_email($author); if ( is_email($author) ) { - echo '' . sprintf(__('Author is %s'), $author) . '
'; $userdata = get_user_by('email', $author); if ( ! empty( $userdata ) ) { $post_author = $userdata->ID; diff --git a/wp-trackback.php b/wp-trackback.php index 3d211043eb..8fe5b087be 100644 --- a/wp-trackback.php +++ b/wp-trackback.php @@ -13,6 +13,9 @@ if (empty($wp)) { wp( array( 'tb' => '1' ) ); } +// Always run as an unauthenticated user. +wp_set_current_user( 0 ); + /** * Response to a trackback. *