Make WordPress Core

Changeset 54547


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

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

Location:
branches/3.8
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/3.8

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

    r26492 r54547  
    18331833        return 0;
    18341834
     1835    $filter_comment = false;
     1836    if ( ! has_filter( 'pre_comment_content', 'wp_filter_kses' ) ) {
     1837        $filter_comment = ! user_can( isset( $comment['user_id'] ) ? $comment['user_id'] : 0, 'unfiltered_html' );
     1838    }
     1839
     1840    if ( $filter_comment ) {
     1841        add_filter( 'pre_comment_content', 'wp_filter_kses' );
     1842    }
     1843
    18351844    // Escape data pulled from DB.
    18361845    $comment = wp_slash($comment);
     
    18421851
    18431852    $commentarr = wp_filter_comment( $commentarr );
     1853
     1854    if ( $filter_comment ) {
     1855        remove_filter( 'pre_comment_content', 'wp_filter_kses' );
     1856    }
    18441857
    18451858    // Now extract the merged array.
  • branches/3.8/src/wp-includes/default-widgets.php

    r33533 r54547  
    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.8/src/wp-includes/functions.php

    r46504 r54547  
    22182218    } else {
    22192219        $html = __( 'Are you sure you want to do this?' );
    2220         if ( wp_get_referer() )
    2221             $html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
     2220        if ( wp_get_referer() ) {
     2221            $wp_http_referer = remove_query_arg( 'updated', wp_get_referer() );
     2222            $wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) );
     2223            $html           .= '</p><p>';
     2224            $html           .= sprintf(
     2225                '<a href="%s">%s</a>',
     2226                esc_url( $wp_http_referer ),
     2227                __( 'Please try again.' )
     2228            );
     2229        }
    22222230    }
    22232231
  • branches/3.8/src/wp-includes/pluggable.php

    r47965 r54547  
    311311    $phpmailer->ClearCustomHeaders();
    312312    $phpmailer->ClearReplyTos();
     313    $phpmailer->Body    = '';
     314    $phpmailer->AltBody = '';
    313315
    314316    // From email and name
  • branches/3.8/src/wp-mail.php

    r39782 r54547  
    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++ ) {
     
    124127                $author = sanitize_email($author);
    125128                if ( is_email($author) ) {
    126                     echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
    127129                    $userdata = get_user_by('email', $author);
    128130                    if ( ! empty( $userdata ) ) {
  • branches/3.8/src/wp-trackback.php

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