Make WordPress Core


Ignore:
Timestamp:
12/10/2011 06:26:48 PM (15 years ago)
Author:
ryan
Message:

Best practice, use wp_safe_redirect() when dealing with referrers. Props nacin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network/sites.php

    r19514 r19579  
    6464                        if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {
    6565                                wpmu_delete_blog( $id, true );
    66                                 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'delete' ), wp_get_referer() ) );
     66                                wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'delete' ), wp_get_referer() ) );
    6767                        } else {
    68                                 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'not_deleted' ), wp_get_referer() ) );
     68                                wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'not_deleted' ), wp_get_referer() ) );
    6969                        }
    7070
    … …  
    111111                                }
    112112
    113                                 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) );
     113                                wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) );
    114114                        } else {
    115115                                wp_redirect( network_admin_url( 'sites.php' ) );
    … …  
    124124
    125125                        update_blog_status( $id, 'archived', '1' );
    126                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'archive' ), wp_get_referer() ) );
     126                        wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'archive' ), wp_get_referer() ) );
    127127                        exit();
    128128                break;
    … …  
    134134
    135135                        update_blog_status( $id, 'archived', '0' );
    136                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unarchive' ), wp_get_referer() ) );
     136                        wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unarchive' ), wp_get_referer() ) );
    137137                        exit();
    138138                break;
    … …  
    145145                        update_blog_status( $id, 'deleted', '0' );
    146146                        do_action( 'activate_blog', $id );
    147                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'activate' ), wp_get_referer() ) );
     147                        wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'activate' ), wp_get_referer() ) );
    148148                        exit();
    149149                break;
    … …  
    156156                        do_action( 'deactivate_blog', $id );
    157157                        update_blog_status( $id, 'deleted', '1' );
    158                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'deactivate' ), wp_get_referer() ) );
     158                        wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'deactivate' ), wp_get_referer() ) );
    159159                        exit();
    160160                break;
    … …  
    166166
    167167                        update_blog_status( $id, 'spam', '0' );
    168                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unspam' ), wp_get_referer() ) );
     168                        wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unspam' ), wp_get_referer() ) );
    169169                        exit();
    170170                break;
    … …  
    176176
    177177                        update_blog_status( $id, 'spam', '1' );
    178                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'spam' ), wp_get_referer() ) );
     178                        wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'spam' ), wp_get_referer() ) );
    179179                        exit();
    180180                break;
    … …  
    186186
    187187                        update_blog_status( $id, 'mature', '0' );
    188                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unmature' ), wp_get_referer() ) );
     188                        wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unmature' ), wp_get_referer() ) );
    189189                        exit();
    190190                break;
    … …  
    196196
    197197                        update_blog_status( $id, 'mature', '1' );
    198                         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'mature' ), wp_get_referer() ) );
     198                        wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'mature' ), wp_get_referer() ) );
    199199                        exit();
    200200                break;
Note: See TracChangeset for help on using the changeset viewer.