Skip to content

Commit

Permalink
Initial merge with WP 6.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickebates committed Oct 18, 2022
1 parent c82feb1 commit 7d25ead
Show file tree
Hide file tree
Showing 28 changed files with 4,509 additions and 4,389 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Project Nami
===============

### Version: `3.0.2` ###
### Version: `3.0.3` ###

### Description: ###
[![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://deploy.azure.com/?repository=https://github.com/ProjectNami/projectnami/tree/latest)
Expand Down
26 changes: 26 additions & 0 deletions wp-admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@
<div class="about__section changelog">
<div class="column">
<h2><?php _e( 'Maintenance and Security Releases' ); ?></h2>
<p>
<?php
printf(
/* translators: %s: WordPress version number. */
__( '<strong>Version %s</strong> addressed some security issues.' ),
'6.0.3'
);
?>
<?php
printf(
/* translators: %s: HelpHub URL. */
__( 'For more information, see <a href="%s">the release notes</a>.' ),
sprintf(
/* translators: %s: WordPress version. */
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
sanitize_title( '6.0.3' )
)
);
?>
</p>
<p>
<?php
printf(
Expand Down Expand Up @@ -431,3 +451,9 @@

/* translators: %s: Documentation URL. */
__( 'For more information, see <a href="%s">the release notes</a>.' );

/* translators: 1: WordPress version number, 2: Link to update WordPress */
__( 'Important! Your version of WordPress (%1$s) is no longer supported, you will not receive any security updates for your website. To keep your site secure, please <a href="%2$s">update to the latest version of WordPress</a>.' );

/* translators: 1: WordPress version number, 2: Link to update WordPress */
__( 'Important! Your version of WordPress (%1$s) will stop receiving security updates in the near future. To keep your site secure, please <a href="%2$s">update to the latest version of WordPress</a>.' );
2 changes: 1 addition & 1 deletion wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2994,7 +2994,7 @@ function wp_ajax_query_attachments() {

// Filter query clauses to include filenames.
if ( isset( $query['s'] ) ) {
add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ function wp_edit_attachments_query_vars( $q = false ) {

// Filter query clauses to include filenames.
if ( isset( $q['s'] ) ) {
add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
}

return $q;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/legacy-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function render_block_core_legacy_widget( $attributes ) {

if ( isset( $attributes['instance']['encoded'], $attributes['instance']['hash'] ) ) {
$serialized_instance = base64_decode( $attributes['instance']['encoded'] );
if ( wp_hash( $serialized_instance ) !== $attributes['instance']['hash'] ) {
if ( ! hash_equals( wp_hash( $serialized_instance ), (string) $attributes['instance']['hash'] ) ) {
return '';
}
$instance = unserialize( $serialized_instance );
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
__( 'Close menu' ), // Close button label.
esc_attr( implode( ' ', $responsive_container_classes ) ),
esc_attr( implode( ' ', $open_button_classes ) ),
safecss_filter_attr( $colors['overlay_inline_styles'] ),
esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ),
__( 'Menu' ),
$toggle_button_content
);
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/post-featured-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
if ( ! empty( $attributes['scale'] ) ) {
$image_styles .= "object-fit:{$attributes['scale']};";
}
$featured_image = str_replace( 'src=', 'style="' . esc_attr( $image_styles ) . '" src=', $featured_image );
$featured_image = str_replace( '<img ', '<img style="' . esc_attr( safecss_filter_attr( $image_styles ) ) . '" ', $featured_image );
}

return "<figure $wrapper_attributes>$featured_image</figure>";
Expand Down
6 changes: 3 additions & 3 deletions wp-includes/blocks/rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function render_block_core_rss( $attributes ) {
$rss = fetch_feed( $attributes['feedURL'] );

if ( is_wp_error( $rss ) ) {
return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . $rss->get_error_message() . '</div></div>';
return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
}

if ( ! $rss->get_item_quantity() ) {
Expand Down Expand Up @@ -48,8 +48,8 @@ function render_block_core_rss( $attributes ) {
if ( $date ) {
$date = sprintf(
'<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ',
date_i18n( get_option( 'c' ), $date ),
date_i18n( get_option( 'date_format' ), $date )
esc_attr( date_i18n( get_option( 'c' ), $date ) ),
esc_attr( date_i18n( get_option( 'date_format' ), $date ) )
);
}
}
Expand Down
10 changes: 5 additions & 5 deletions wp-includes/blocks/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ function styles_for_block_core_search( $attributes ) {
// Add color styles.
$has_text_color = ! empty( $attributes['style']['color']['text'] );
if ( $has_text_color ) {
$button_styles[] = sprintf( 'color: %s;', esc_attr( $attributes['style']['color']['text'] ) );
$button_styles[] = sprintf( 'color: %s;', $attributes['style']['color']['text'] );
}

$has_background_color = ! empty( $attributes['style']['color']['background'] );
if ( $has_background_color ) {
$button_styles[] = sprintf( 'background-color: %s;', esc_attr( $attributes['style']['color']['background'] ) );
$button_styles[] = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] );
}

$has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] );
Expand All @@ -301,9 +301,9 @@ function styles_for_block_core_search( $attributes ) {
}

return array(
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $input_styles ) ) ) : '',
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $button_styles ) ) ) : '',
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) : '',
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $input_styles ) ) ) ) : '',
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $button_styles ) ) ) ) : '',
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) ) : '',
);
}

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/widget-group.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function render_block_core_widget_group( $attributes, $content, $block ) {
$html = '';

if ( ! empty( $attributes['title'] ) ) {
$html .= $before_title . $attributes['title'] . $after_title;
$html .= $before_title . esc_html( $attributes['title'] ) . $after_title;
}

$html .= '<div class="wp-widget-group__inner-blocks">';
Expand Down
23 changes: 21 additions & 2 deletions wp-includes/class-wp-date-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public function __construct( $date_query, $default_column = 'post_date' ) {
return;
}

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';
}
Expand Down Expand Up @@ -219,6 +219,9 @@ public function sanitize_query( $queries, $parent_query = null ) {
$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.
Expand Down Expand Up @@ -1040,4 +1043,20 @@ public function build_time_query( $column, $compare, $hour = null, $minute = nul

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';
}
}
}
33 changes: 30 additions & 3 deletions wp-includes/class-wp-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,14 @@ class WP_Query {
*/
public $thumbnails_cached = false;

/**
* Controls whether an attachment query should include filenames or not.
*
* @since 6.0.3
* @var bool
*/
protected $allow_query_attachment_by_filename = false;

/**
* Cached list of search stopwords.
*
Expand Down Expand Up @@ -1414,8 +1422,13 @@ protected function parse_search( &$q ) {
$q['search_orderby_title'][] = $wpdb->prepare( "{$wpdb->posts}.post_title LIKE %s", $like );
}

$like = $n . $wpdb->esc_like( $term ) . $n;
$search .= $wpdb->prepare( "{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))", $like, $like, $like );
$like = $n . $wpdb->esc_like( $term ) . $n;

if ( ! empty( $this->allow_query_attachment_by_filename ) ) {
$search .= $wpdb->prepare( "{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s) $andor_op (sq1.meta_value $like_op %s))", $like, $like, $like, $like );
} else {
$search .= $wpdb->prepare( "{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))", $like, $like, $like );
}
$searchand = ' AND ';
}

Expand Down Expand Up @@ -1791,6 +1804,16 @@ public function get_posts() {
// Fill again in case 'pre_get_posts' unset some vars.
$q = $this->fill_query_vars( $q );

/**
* Filters whether an attachment query should include filenames or not.
*
* @since 6.0.3
*
* @param bool $allow_query_attachment_by_filename Whether or not to include filenames.
*/
$this->allow_query_attachment_by_filename = apply_filters( 'wp_allow_query_attachment_by_filename', false );
remove_all_filters( 'wp_allow_query_attachment_by_filename' );

// Parse meta query.
$this->meta_query = new WP_Meta_Query();
$this->meta_query->parse_query_vars( $q );
Expand Down Expand Up @@ -2213,7 +2236,7 @@ public function get_posts() {
}
}

if ( !empty( $this->tax_query->queries ) || !empty( $this->meta_query->queries ) ) {
if ( ! empty( $this->tax_query->queries ) || ! empty( $this->meta_query->queries ) || ! empty( $this->allow_query_attachment_by_filename ) ) {
//$groupby = "{$wpdb->posts}.ID";
$distinct = "DISTINCT";
}
Expand Down Expand Up @@ -2291,6 +2314,10 @@ public function get_posts() {
}
$where .= $search . $whichauthor . $whichmimetype;

if ( ! empty( $this->allow_query_attachment_by_filename ) ) {
$join .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
}

if ( ! empty( $this->meta_query->queries ) ) {
$clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this );
$join .= $clauses['join'];
Expand Down
13 changes: 13 additions & 0 deletions wp-includes/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2465,6 +2465,15 @@ function wp_update_comment( $commentarr, $wp_error = false ) {
}
}

$filter_comment = false;
if ( ! has_filter( 'pre_comment_content', 'wp_filter_kses' ) ) {
$filter_comment = ! user_can( isset( $comment['user_id'] ) ? $comment['user_id'] : 0, 'unfiltered_html' );
}

if ( $filter_comment ) {
add_filter( 'pre_comment_content', 'wp_filter_kses' );
}

// Escape data pulled from DB.
$comment = wp_slash( $comment );

Expand All @@ -2475,6 +2484,10 @@ function wp_update_comment( $commentarr, $wp_error = false ) {

$commentarr = wp_filter_comment( $commentarr );

if ( $filter_comment ) {
remove_filter( 'pre_comment_content', 'wp_filter_kses' );
}

// Now extract the merged array.
$data = wp_unslash( $commentarr );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ public function print_header_image_template() {
<# } else { #>

<button type="button" class="choice thumbnail"
data-customize-image-value="{{{data.header.url}}}"
data-customize-image-value="{{data.header.url}}"
data-customize-header-image-data="{{JSON.stringify(data.header)}}">
<span class="screen-reader-text"><?php _e( 'Set image' ); ?></span>
<img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" />
<img src="{{data.header.thumbnail_url}}" alt="{{data.header.alt_text || data.header.description}}" />
</button>

<# if ( data.type === 'uploaded' ) { #>
Expand All @@ -158,7 +158,7 @@ public function print_header_image_template() {

<# } else { #>

<img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" />
<img src="{{data.header.thumbnail_url}}" alt="{{data.header.alt_text || data.header.description}}" />

<# } #>
<# } else { #>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function content_template() {
<div class="favicon">
<img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>" />
</div>
<span class="browser-title" aria-hidden="true"><# print( '<?php bloginfo( 'name' ); ?>' ) #></span>
<span class="browser-title" aria-hidden="true"><# print( '<?php echo esc_js( get_bloginfo( 'name' ) ); ?>' ) #></span>
</div>
<img class="app-icon-preview" src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>" />
</div>
Expand Down
Loading

0 comments on commit 7d25ead

Please sign in to comment.