Make WordPress Core

Ticket #11471: 11471.diff

File 11471.diff, 1.9 KB (added by nacin, 15 years ago)
  • edit-comments.php

     
    3232                $comment_ids = array_map( 'absint', explode(',', $_REQUEST['ids']) );
    3333                $doaction = $_REQUEST['action'];
    3434        } else {
    35                 wp_redirect($_SERVER['HTTP_REFERER']);
     35                wp_redirect( wp_get_referer() );
    3636        }
    3737
    3838        $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0;
     39        $redirect_to = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids'), wp_get_referer() );
    3940
    4041        foreach ($comment_ids as $comment_id) { // Check the permissions on each
    4142                $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
     
    7576                }
    7677        }
    7778
    78         $redirect_to = 'edit-comments.php';
    79 
    8079        if ( $approved )
    8180                $redirect_to = add_query_arg( 'approved', $approved, $redirect_to );
    8281        if ( $unapproved )
     
    9493        if ( $trashed || $spammed )
    9594                $redirect_to = add_query_arg( 'ids', join(',', $comment_ids), $redirect_to );
    9695
    97         if ( $post_id )
    98                 $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
    99         if ( isset($_REQUEST['apage']) )
    100                 $redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to );
    101         if ( !empty($_REQUEST['mode']) )
    102                 $redirect_to = add_query_arg('mode', $_REQUEST['mode'], $redirect_to);
    103         if ( !empty($_REQUEST['comment_status']) )
    104                 $redirect_to = add_query_arg('comment_status', $_REQUEST['comment_status'], $redirect_to);
    105         if ( !empty($_REQUEST['s']) )
    106                 $redirect_to = add_query_arg('s', $_REQUEST['s'], $redirect_to);
    10796        wp_redirect( $redirect_to );
     97        exit;
    10898} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
    10999         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
    110100         exit;