Make WordPress Core

Changeset 54546


Ignore:
Timestamp:
10/17/2022 05:39:41 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Grouped backports to the 3.7 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 3.7 branch.
Props voldemortensen, johnbillion, paulkevan, peterwilsoncc, xknown, dd32, audrasjb, martinkrcho, davidbaumwald, tykoted, matveb, talldanwp.

Location:
branches/3.7
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7

  • branches/3.7/src

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

    r25868 r54546  
    15091509        return 0;
    15101510
     1511    $filter_comment = false;
     1512    if ( ! has_filter( 'pre_comment_content', 'wp_filter_kses' ) ) {
     1513        $filter_comment = ! user_can( isset( $comment['user_id'] ) ? $comment['user_id'] : 0, 'unfiltered_html' );
     1514    }
     1515
     1516    if ( $filter_comment ) {
     1517        add_filter( 'pre_comment_content', 'wp_filter_kses' );
     1518    }
     1519
    15111520    // Escape data pulled from DB.
    15121521    $comment = wp_slash($comment);
     
    15181527
    15191528    $commentarr = wp_filter_comment( $commentarr );
     1529
     1530    if ( $filter_comment ) {
     1531        remove_filter( 'pre_comment_content', 'wp_filter_kses' );
     1532    }
    15201533
    15211534    // Now extract the merged array.
  • branches/3.7/src/wp-includes/default-widgets.php

    r33534 r54546  
    835835    if ( is_wp_error($rss) ) {
    836836        if ( is_admin() || current_user_can('manage_options') )
    837             echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
     837            echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), esc_html( $rss->get_error_message() ) ) . '</p>';
    838838        return;
    839839    }
     
    943943
    944944    if ( !empty($error) )
    945         echo '<p class="widget-error"><strong>' . sprintf( __('RSS Error: %s'), $error) . '</strong></p>';
     945        echo '<p class="widget-error"><strong>' . sprintf( __('RSS Error: %s'), esc_html( $error ) ) . '</strong></p>';
    946946
    947947    if ( $inputs['url'] ) :
  • branches/3.7/src/wp-includes/functions.php

    r46505 r54546  
    22222222    } else {
    22232223        $html = __( 'Are you sure you want to do this?' );
    2224         if ( wp_get_referer() )
    2225             $html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
     2224        if ( wp_get_referer() ) {
     2225            $wp_http_referer = remove_query_arg( 'updated', wp_get_referer() );
     2226            $wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) );
     2227            $html .= '</p><p>';
     2228            $html .= sprintf(
     2229                '<a href="%s">%s</a>',
     2230                esc_url( $wp_http_referer ),
     2231                __( 'Please try again.' )
     2232            );
     2233        }
    22262234    }
    22272235
  • branches/3.7/src/wp-includes/pluggable.php

    r47962 r54546  
    314314    $phpmailer->ClearCustomHeaders();
    315315    $phpmailer->ClearReplyTos();
     316    $phpmailer->Body    = '';
     317    $phpmailer->AltBody = '';
    316318
    317319    // From email and name
  • branches/3.7/src/wp-mail.php

    r39784 r54546  
    5656    wp_die( __('There doesn&#8217;t seem to be any new mail.') );
    5757}
     58
     59// Always run as an unauthenticated user.
     60wp_set_current_user( 0 );
    5861
    5962for ( $i = 1; $i <= $count; $i++ ) {
     
    120123                $author = sanitize_email($author);
    121124                if ( is_email($author) ) {
    122                     echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
    123125                    $userdata = get_user_by('email', $author);
    124126                    if ( ! empty( $userdata ) ) {
  • branches/3.7/src/wp-trackback.php

    r25616 r54546  
    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.