From e51aa595496b17f9201fe7dde0f16bf560748092 Mon Sep 17 00:00:00 2001 From: westi Date: Sat, 19 Dec 2009 11:30:54 +0000 Subject: [PATCH] Ensure that bulk comment actions do not remove spaces from search terms. Also refactors comment bulk action redirect url building to be consistent with other operations. Fixes #11471 props nacin. git-svn-id: http://svn.automattic.com/wordpress/trunk@12461 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-comments.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index ee23b3e36b..4969d3bae3 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -32,10 +32,11 @@ if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_R $comment_ids = array_map( 'absint', explode(',', $_REQUEST['ids']) ); $doaction = $_REQUEST['action']; } else { - wp_redirect($_SERVER['HTTP_REFERER']); + wp_redirect( wp_get_referer() ); } $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; + $redirect_to = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids'), wp_get_referer() ); foreach ($comment_ids as $comment_id) { // Check the permissions on each $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) ); @@ -75,8 +76,6 @@ if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_R } } - $redirect_to = 'edit-comments.php'; - if ( $approved ) $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); if ( $unapproved ) @@ -94,17 +93,8 @@ if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_R if ( $trashed || $spammed ) $redirect_to = add_query_arg( 'ids', join(',', $comment_ids), $redirect_to ); - if ( $post_id ) - $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); - if ( isset($_REQUEST['apage']) ) - $redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to ); - if ( !empty($_REQUEST['mode']) ) - $redirect_to = add_query_arg('mode', $_REQUEST['mode'], $redirect_to); - if ( !empty($_REQUEST['comment_status']) ) - $redirect_to = add_query_arg('comment_status', $_REQUEST['comment_status'], $redirect_to); - if ( !empty($_REQUEST['s']) ) - $redirect_to = add_query_arg('s', $_REQUEST['s'], $redirect_to); wp_redirect( $redirect_to ); + exit; } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); exit;