Make WordPress Core


Ignore:
Timestamp:
10/17/2022 06:03:55 PM (4 years ago)
Author:
audrasjb
Message:

Grouped backports to the 5.3 branch.

  • Editor: Bump @wordpress packages for the branch,
  • Media: Refactor search by filename within the admin,
  • REST API: Lockdown post parameter of the terms endpoint,
  • Customize: Escape blogname option in underscores templates,
  • Query: Validate relation in WP_Date_Query,
  • Posts, Post types: Apply KSES to post-by-email content,
  • General: Validate host on "Are you sure?" screen,
  • Posts, Post types: Remove emails from post-by-email logs,
  • Pings/trackbacks: Apply KSES to all trackbacks,
  • Mail: Reset PHPMailer properties between use,
  • Comments: Apply kses when editing comments,
  • Widgets: Escape RSS error messages for display.

Merges [54521-54530] to the 5.3 branch.
Props audrasjb, costdev, cu121, dd32, davidbaumwald, ehtis, johnbillion, johnjamesjacoby, martinkrcho, matveb, oztaser, paulkevan, peterwilsoncc, ravipatel, SergeyBiryukov, talldanwp, timothyblynjacobs, tykoted, voldemortensen, vortfu, xknown.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-includes/class-wp-date-query.php

    r45932 r54562  
    150150                }
    151151
    152                 if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] ) ) {
    153                         $this->relation = 'OR';
     152                if ( isset( $date_query['relation'] ) ) {
     153                        $this->relation = $this->sanitize_relation( $date_query['relation'] );
    154154                } else {
    155155                        $this->relation = 'AND';
     
    221221                        $this->validate_date_values( $queries );
    222222                }
     223
     224                // Sanitize the relation parameter.
     225                $queries['relation'] = $this->sanitize_relation( $queries['relation'] );
    223226
    224227                foreach ( $queries as $key => $q ) {
     
    10401043                return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time );
    10411044        }
     1045
     1046        /**
     1047         * Sanitizes a 'relation' operator.
     1048         *
     1049         * @since 6.0.3
     1050         *
     1051         * @param string $relation Raw relation key from the query argument.
     1052         * @return string Sanitized relation ('AND' or 'OR').
     1053         */
     1054        public function sanitize_relation( $relation ) {
     1055                if ( 'OR' === strtoupper( $relation ) ) {
     1056                        return 'OR';
     1057                } else {
     1058                        return 'AND';
     1059                }
     1060        }
    10421061}
Note: See TracChangeset for help on using the changeset viewer.