Make WordPress Core

Changeset 54551 for branches/4.0


Ignore:
Timestamp:
10/17/2022 05:49:25 PM (20 months ago)
Author:
SergeyBiryukov
Message:

Grouped backports to the 4.0 branch.

  • 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,
  • Comments: Apply kses when editing comments,
  • Mail: Reset PHPMailer properties between use,
  • Widgets: Escape RSS error messages for display.

Merges [54521], [54522], [54523], [54525], [54527], [54529], [54541] to the 4.0 branch.
Props voldemortensen, johnbillion, paulkevan, peterwilsoncc, xknown, dd32, audrasjb, martinkrcho, davidbaumwald, tykoted, matveb, talldanwp.

Location:
branches/4.0
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/src/wp-includes/comment.php

    r29469 r54551  
    19171917        return 0;
    19181918    }
     1919
     1920    $filter_comment = false;
     1921    if ( ! has_filter( 'pre_comment_content', 'wp_filter_kses' ) ) {
     1922        $filter_comment = ! user_can( isset( $comment['user_id'] ) ? $comment['user_id'] : 0, 'unfiltered_html' );
     1923    }
     1924
     1925    if ( $filter_comment ) {
     1926        add_filter( 'pre_comment_content', 'wp_filter_kses' );
     1927    }
     1928
    19191929    // Escape data pulled from DB.
    19201930    $comment = wp_slash($comment);
     
    19261936
    19271937    $commentarr = wp_filter_comment( $commentarr );
     1938
     1939    if ( $filter_comment ) {
     1940        remove_filter( 'pre_comment_content', 'wp_filter_kses' );
     1941    }
    19281942
    19291943    // Now extract the merged array.
  • branches/4.0/src/wp-includes/default-widgets.php

    r33531 r54551  
    10191019    if ( is_wp_error($rss) ) {
    10201020        if ( is_admin() || current_user_can('manage_options') )
    1021             echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
     1021            echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), esc_html( $rss->get_error_message() ) ) . '</p>';
    10221022        return;
    10231023    }
     
    11291129
    11301130    if ( ! empty( $args['error'] ) ) {
    1131         echo '<p class="widget-error"><strong>' . sprintf( __( 'RSS Error: %s' ), $args['error'] ) . '</strong></p>';
     1131        echo '<p class="widget-error"><strong>' . sprintf( __( 'RSS Error: %s' ), esc_html( $args['error'] ) ) . '</strong></p>';
    11321132    }
    11331133
  • branches/4.0/src/wp-includes/functions.php

    r46502 r54551  
    24372437    } else {
    24382438        $html = __( 'Are you sure you want to do this?' );
    2439         if ( wp_get_referer() )
    2440             $html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
     2439        if ( wp_get_referer() ) {
     2440            $wp_http_referer = remove_query_arg( 'updated', wp_get_referer() );
     2441            $wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) );
     2442            $html           .= '</p><p>';
     2443            $html           .= sprintf(
     2444                '<a href="%s">%s</a>',
     2445                esc_url( $wp_http_referer ),
     2446                __( 'Please try again.' )
     2447            );
     2448        }
    24412449    }
    24422450
  • branches/4.0/src/wp-includes/pluggable.php

    r47968 r54551  
    351351    $phpmailer->ClearCustomHeaders();
    352352    $phpmailer->ClearReplyTos();
     353    $phpmailer->Body    = '';
     354    $phpmailer->AltBody = '';
    353355
    354356    // From email and name
  • branches/4.0/src/wp-mail.php

    r39780 r54551  
    6060    wp_die( __('There doesn&#8217;t seem to be any new mail.') );
    6161}
     62
     63// Always run as an unauthenticated user.
     64wp_set_current_user( 0 );
    6265
    6366for ( $i = 1; $i <= $count; $i++ ) {
     
    126129                $author = sanitize_email($author);
    127130                if ( is_email($author) ) {
    128                     echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
    129131                    $userdata = get_user_by('email', $author);
    130132                    if ( ! empty( $userdata ) ) {
  • branches/4.0/src/wp-trackback.php

    r25616 r54551  
    1313    wp( array( 'tb' => '1' ) );
    1414}
     15
     16// Always run as an unauthenticated user.
     17wp_set_current_user( 0 );
    1518
    1619/**
Note: See TracChangeset for help on using the changeset viewer.