Ticket #16166: 16166.2.diff

File 16166.2.diff, 9.4 KB (added by nacin, 2 years ago)

Untested.

  • wp-admin/users.php

     
    4949        check_admin_referer('bulk-users'); 
    5050 
    5151        if ( empty($_REQUEST['users']) ) { 
    52                 wp_redirect($redirect); 
     52                $wp_list_table->redirect( $redirect ); 
    5353                exit(); 
    5454        } 
    5555 
     
    7878                $user->set_role($_REQUEST['new_role']); 
    7979        } 
    8080 
    81         wp_redirect(add_query_arg('update', $update, $redirect)); 
     81        $wp_list_table->redirect(add_query_arg('update', $update, $redirect)); 
    8282        exit(); 
    8383 
    8484break; 
     
    137137        check_admin_referer('bulk-users'); 
    138138 
    139139        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { 
    140                 wp_redirect($redirect); 
     140                $wp_list_table->redirect($redirect); 
    141141                exit(); 
    142142        } 
    143143 
     
    232232        check_admin_referer('bulk-users'); 
    233233 
    234234        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { 
    235                 wp_redirect($redirect); 
     235                $wp_list_table->redirect($redirect); 
    236236                exit(); 
    237237        } 
    238238 
  • wp-admin/edit-comments.php

     
    3737        $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; 
    3838 
    3939        $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); 
    40         $redirect_to = $wp_list_table->add_query_args( $redirect_to ); 
    4140 
    4241        foreach ( $comment_ids as $comment_id ) { // Check the permissions on each 
    4342                if ( !current_user_can( 'edit_comment', $comment_id ) ) 
     
    9291        if ( $trashed || $spammed ) 
    9392                $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); 
    9493 
    95         wp_redirect( $redirect_to ); 
     94        $wp_list_table->redirect( $redirect_to ); 
    9695        exit; 
    9796} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { 
    9897         wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) ); 
  • wp-admin/includes/class-wp-list-table.php

     
    631631 
    632632                return array( $current_orderby, $current_order ); 
    633633        } 
    634          
    635         function add_query_args( $location ) { 
     634 
     635        function redirect( $location ) { 
    636636                $pagenum = $this->get_pagenum(); 
    637637                list( $current_orderby, $current_order ) = $this->get_order_info(); 
    638638                $location = add_query_arg( 'paged', $pagenum, $location ); 
    639639                if ( $current_orderby ) 
    640640                        $location = add_query_arg( array( 'orderby' => $current_orderby, 'order' => $current_order ), $location ); 
    641  
    642                 return $location; 
     641                wp_redirect( $location ); 
    643642        } 
    644643 
    645644        /** 
  • wp-admin/edit-tags.php

     
    7878 
    7979        wp_delete_term( $tag_ID, $taxonomy ); 
    8080 
    81         $location = $wp_list_table->add_query_args( $location ); 
    8281        $location = add_query_arg( 'message', 2, $location ); 
    83         wp_redirect( $location ); 
     82        $wp_list_table->redirect( $location ); 
    8483        exit; 
    8584 
    8685break; 
     
    105104        } 
    106105 
    107106        $location = add_query_arg( 'message', 6, $location ); 
    108         $location = $wp_list_table->add_query_args( $location ); 
    109         wp_redirect( $location ); 
     107        $wp_list_table->redirect( $location ); 
    110108        exit; 
    111109 
    112110break; 
  • wp-admin/upload.php

     
    8484                                                $location = $referer; 
    8585                                } 
    8686 
    87                                 $location = $wp_list_table->add_query_args( $location ); 
    8887                                $location = add_query_arg( array( 'attached' => $attached ) , $location ); 
    89                                 wp_redirect( $location ); 
     88                                $wp_list_table->redirect( $location ); 
    9089                                exit; 
    9190                        } 
    9291                        break; 
     
    122121                        break; 
    123122        } 
    124123 
    125         $location = $wp_list_table->add_query_args( $location ); 
    126         wp_redirect( $location ); 
     124        $wp_list_table->redirect( $location ); 
    127125        exit; 
    128126} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { 
    129127         wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) ); 
  • wp-admin/network/edit.php

     
    223223                                } 
    224224                        } 
    225225 
    226                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) ); 
     226                        $wp_list_table->redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) ); 
    227227                } else { 
    228                         wp_redirect( network_admin_url( 'sites.php' ) ); 
     228                        $wp_list_table->redirect( network_admin_url( 'sites.php' ) ); 
    229229                } 
    230230                exit(); 
    231231        break; 
     
    425425                                } 
    426426                        } 
    427427 
    428                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) ); 
     428                        $wp_list_table->redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) ); 
    429429                } else { 
    430                         wp_redirect( network_admin_url( 'users.php' ) ); 
     430                        $wp_list_table->redirect( network_admin_url( 'users.php' ) ); 
    431431                } 
    432432                exit(); 
    433433        break; 
  • wp-admin/network/themes.php

     
    4040                        check_admin_referer('enable-theme_' . $_GET['theme']); 
    4141                        $allowed_themes[ $_GET['theme'] ] = true; 
    4242                        update_site_option( 'allowedthemes', $allowed_themes ); 
    43                         wp_redirect( add_query_arg( 'enabled', '1', $referer ) ); 
     43                        $wp_list_table->redirect( add_query_arg( 'enabled', '1', $referer ) ); 
    4444                        exit; 
    4545                        break; 
    4646                case 'disable': 
    4747                        check_admin_referer('disable-theme_' . $_GET['theme']); 
    4848                        unset( $allowed_themes[ $_GET['theme'] ] ); 
    4949                        update_site_option( 'allowedthemes', $allowed_themes ); 
    50                         wp_redirect( add_query_arg( 'disabled', '1', $referer ) ); 
     50                        $wp_list_table->redirect( add_query_arg( 'disabled', '1', $referer ) ); 
    5151                        exit; 
    5252                        break; 
    5353                case 'enable-selected': 
    5454                        check_admin_referer('bulk-themes'); 
    5555                        $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 
    5656                        if ( empty($themes) ) { 
    57                                 wp_redirect( add_query_arg( 'error', 'none', $referer ) ); 
     57                                $wp_list_table->redirect( add_query_arg( 'error', 'none', $referer ) ); 
    5858                                exit; 
    5959                        } 
    6060                        foreach( (array) $themes as $theme ) 
    6161                                $allowed_themes[ $theme ] = true; 
    6262                        update_site_option( 'allowedthemes', $allowed_themes ); 
    63                         wp_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); 
     63                        $wp_list_table->redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); 
    6464                        exit; 
    6565                        break; 
    6666                case 'disable-selected': 
    6767                        check_admin_referer('bulk-themes'); 
    6868                        $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 
    6969                        if ( empty($themes) ) { 
    70                                 wp_redirect( add_query_arg( 'error', 'none', $referer ) ); 
     70                                $wp_list_table->redirect( add_query_arg( 'error', 'none', $referer ) ); 
    7171                                exit; 
    7272                        } 
    7373                        foreach( (array) $themes as $theme ) 
    7474                                unset( $allowed_themes[ $theme ] ); 
    7575                        update_site_option( 'allowedthemes', $allowed_themes ); 
    76                         wp_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); 
     76                        $wp_list_table->redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); 
    7777                        exit; 
    7878                        break; 
    7979                case 'delete-selected': 
     
    8989                                unset( $themes[ get_option( 'stylesheet' ) ] ); 
    9090 
    9191                        if ( empty( $themes ) ) { 
    92                                 wp_redirect( add_query_arg( 'error', 'none', $referer ) ); 
     92                                $wp_list_table->redirect( add_query_arg( 'error', 'none', $referer ) ); 
    9393                                exit; 
    9494                        } 
    9595 
     
    104104                                        $theme_info[ $theme ] = $data; 
    105105                                } 
    106106                        } 
    107                          
     107 
    108108                        if ( empty( $themes ) ) { 
    109                                 wp_redirect( add_query_arg( 'error', 'main', $referer ) ); 
     109                                $wp_list_table->redirect( add_query_arg( 'error', 'main', $referer ) ); 
    110110                                exit; 
    111111                        } 
    112112 
  • wp-admin/edit.php

     
    4141        check_admin_referer('bulk-posts'); 
    4242 
    4343        $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() ); 
    44         $sendback = $wp_list_table->add_query_args( $sendback ); 
    4544        if ( strpos($sendback, 'post.php') !== false ) 
    4645                $sendback = admin_url($post_new_file); 
    4746 
     
    123122 
    124123        $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view'), $sendback ); 
    125124 
    126         wp_redirect($sendback); 
     125        $wp_list_table->redirect( $sendback ); 
    127126        exit(); 
    128127} elseif ( ! empty($_REQUEST['_wp_http_referer']) ) { 
    129128         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); 
  • wp-admin/link-manager.php

     
    2727                        wp_delete_link( $link_id ); 
    2828                } 
    2929 
    30                 wp_redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) ); 
     30                $wp_list_table->redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) ); 
    3131                exit; 
    3232        } 
    3333} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {