Skip to content

Commit 7ead79a

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/branches/3.8@54547 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 3fb1031 commit 7ead79a

6 files changed

Lines changed: 33 additions & 5 deletions

File tree

src/wp-includes/comment.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,15 @@ function wp_update_comment($commentarr) {
18321832
if ( empty( $comment ) )
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);
18371846

@@ -1842,6 +1851,10 @@ function wp_update_comment($commentarr) {
18421851

18431852
$commentarr = wp_filter_comment( $commentarr );
18441853

1854+
if ( $filter_comment ) {
1855+
remove_filter( 'pre_comment_content', 'wp_filter_kses' );
1856+
}
1857+
18451858
// Now extract the merged array.
18461859
extract(wp_unslash($commentarr), EXTR_SKIP);
18471860

src/wp-includes/default-widgets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ function wp_widget_rss_output( $rss, $args = array() ) {
834834

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
}
840840

@@ -942,7 +942,7 @@ function wp_widget_rss_form( $args, $inputs = null ) {
942942
$show_date = (int) $show_date;
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'] ) :
948948
?>

src/wp-includes/functions.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,8 +2217,16 @@ function wp_nonce_ays( $action ) {
22172217
$html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url() );
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

22242232
wp_die( $html, $title, array('response' => 403) );

src/wp-includes/pluggable.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
310310
$phpmailer->ClearAttachments();
311311
$phpmailer->ClearCustomHeaders();
312312
$phpmailer->ClearReplyTos();
313+
$phpmailer->Body = '';
314+
$phpmailer->AltBody = '';
313315

314316
// From email and name
315317
// If we don't have a name from the input headers

src/wp-mail.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
wp_die( __('There doesn&#8217;t seem to be any new mail.') );
6161
}
6262

63+
// Always run as an unauthenticated user.
64+
wp_set_current_user( 0 );
65+
6366
for ( $i = 1; $i <= $count; $i++ ) {
6467

6568
$message = $pop3->get($i);
@@ -123,7 +126,6 @@
123126
$author = trim($line);
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 ) ) {
129131
$post_author = $userdata->ID;

src/wp-trackback.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
wp( array( 'tb' => '1' ) );
1414
}
1515

16+
// Always run as an unauthenticated user.
17+
wp_set_current_user( 0 );
18+
1619
/**
1720
* Response to a trackback.
1821
*

0 commit comments

Comments
 (0)