Changeset 22064
- Timestamp:
- 09/27/2012 05:11:07 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/network/sites.php
r21003 r22064 17 17 wp_die( __( 'You do not have permission to access this page.' ) ); 18 18 19 $wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table');19 $wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' ); 20 20 $pagenum = $wp_list_table->get_pagenum(); 21 21 … … 23 23 $parent_file = 'sites.php'; 24 24 25 add_screen_option( 'per_page', array( 'label' => _x( 'Sites', 'sites per page (screen options)' )) );25 add_screen_option( 'per_page', array( 'label' => _x( 'Sites', 'sites per page (screen options)' ) ) ); 26 26 27 27 get_current_screen()->add_help_tab( array( … … 52 52 do_action( 'wpmuadminedit' , '' ); 53 53 54 if ( 'confirm' === $_GET['action'] ) { 55 check_admin_referer( 'confirm' ); 56 57 if ( ! headers_sent() ) { 58 nocache_headers(); 59 header( 'Content-Type: text/html; charset=utf-8' ); 60 } 61 if ( $current_site->blog_id == $id ) 62 wp_die( __( 'You are not allowed to change the current site.' ) ); 63 ?> 64 <!DOCTYPE html> 65 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 66 <head> 67 <title><?php _e( 'WordPress › Confirm your action' ); ?></title> 68 69 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 70 <?php 71 wp_admin_css( 'install', true ); 72 wp_admin_css( 'ie', true ); 73 ?> 74 </head> 75 <body> 76 <h1 id="logo"><img alt="WordPress" src="<?php echo esc_attr( admin_url( 'images/wordpress-logo.png?ver=20120216' ) ); ?>" /></h1> 77 <form action="sites.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post"> 78 <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" /> 79 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> 80 <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" /> 81 <?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?> 82 <p><?php echo esc_html( stripslashes( $_GET['msg'] ) ); ?></p> 83 <?php submit_button( __('Confirm'), 'button' ); ?> 84 </form> 85 </body> 86 </html> 87 <?php 88 exit(); 89 } 90 91 $updated_action = ''; 92 93 $manage_actions = array( 'deleteblog', 'allblogs', 'archiveblog', 'unarchiveblog', 'activateblog', 'deactivateblog', 'unspamblog', 'spamblog', 'unmatureblog', 'matureblog' ); 94 if ( in_array( $_GET['action'], $manage_actions ) ) { 95 $action = $_GET['action']; 96 if ( 'allblogs' === $action ) 97 $action = 'bulk-sites'; 98 99 check_admin_referer( $action ); 100 } 101 54 102 switch ( $_GET['action'] ) { 55 case 'updateblog':56 // No longer used.57 break;58 103 59 104 case 'deleteblog': 60 check_admin_referer('deleteblog'); 61 if ( ! ( current_user_can( 'manage_sites' ) && current_user_can( 'delete_sites' ) ) ) 105 if ( ! current_user_can( 'delete_sites' ) ) 62 106 wp_die( __( 'You do not have permission to access this page.' ) ); 63 107 108 $updated_action = 'not_deleted'; 64 109 if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) { 65 110 wpmu_delete_blog( $id, true ); 66 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'delete' ), wp_get_referer() ) ); 67 } else { 68 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'not_deleted' ), wp_get_referer() ) ); 111 $updated_action = 'delete'; 69 112 } 70 71 exit();72 113 break; 73 114 74 115 case 'allblogs': 75 116 if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) { 76 check_admin_referer( 'bulk-sites' );77 78 if ( ! current_user_can( 'manage_sites' ) )79 wp_die( __( 'You do not have permission to access this page.' ) );80 81 117 $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; 82 $blogfunction = ''; 83 118 84 119 foreach ( (array) $_POST['allblogs'] as $key => $val ) { 85 120 if ( $val != '0' && $val != $current_site->blog_id ) { … … 88 123 if ( ! current_user_can( 'delete_site', $val ) ) 89 124 wp_die( __( 'You are not allowed to delete the site.' ) ); 90 $blogfunction = 'all_delete'; 125 126 $updated_action = 'all_delete'; 91 127 wpmu_delete_blog( $val, true ); 92 128 break; 93 129 94 130 case 'spam': 95 $blogfunction = 'all_spam';96 update_blog_status( $val, 'spam', '1' );97 set_time_limit( 60 );98 break;99 100 131 case 'notspam': 101 $ blogfunction ='all_notspam';102 update_blog_status( $val, 'spam', '0' );132 $updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam'; 133 update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' ); 103 134 set_time_limit( 60 ); 104 135 break; … … 108 139 } 109 140 } 110 111 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) );112 141 } else { 113 142 wp_redirect( network_admin_url( 'sites.php' ) ); 143 exit(); 114 144 } 115 exit();116 145 break; 117 146 118 147 case 'archiveblog': 119 check_admin_referer( 'archiveblog' );120 if ( ! current_user_can( 'manage_sites' ) )121 wp_die( __( 'You do not have permission to access this page.' ) );122 123 update_blog_status( $id, 'archived', '1' );124 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'archive' ), wp_get_referer() ) );125 exit();126 break;127 128 148 case 'unarchiveblog': 129 check_admin_referer( 'unarchiveblog' ); 130 if ( ! current_user_can( 'manage_sites' ) ) 131 wp_die( __( 'You do not have permission to access this page.' ) ); 132 133 update_blog_status( $id, 'archived', '0' ); 134 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unarchive' ), wp_get_referer() ) ); 135 exit(); 149 update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' ); 136 150 break; 137 151 138 152 case 'activateblog': 139 check_admin_referer( 'activateblog' );140 if ( ! current_user_can( 'manage_sites' ) )141 wp_die( __( 'You do not have permission to access this page.' ) );142 143 153 update_blog_status( $id, 'deleted', '0' ); 144 154 do_action( 'activate_blog', $id ); 145 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'activate' ), wp_get_referer() ) );146 exit();147 155 break; 148 156 149 157 case 'deactivateblog': 150 check_admin_referer( 'deactivateblog' );151 if ( ! current_user_can( 'manage_sites' ) )152 wp_die( __( 'You do not have permission to access this page.' ) );153 154 158 do_action( 'deactivate_blog', $id ); 155 159 update_blog_status( $id, 'deleted', '1' ); 156 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'deactivate' ), wp_get_referer() ) );157 exit();158 160 break; 159 161 160 162 case 'unspamblog': 161 check_admin_referer( 'unspamblog' );162 if ( ! current_user_can( 'manage_sites' ) )163 wp_die( __( 'You do not have permission to access this page.' ) );164 165 update_blog_status( $id, 'spam', '0' );166 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unspam' ), wp_get_referer() ) );167 exit();168 break;169 170 163 case 'spamblog': 171 check_admin_referer( 'spamblog' ); 172 if ( ! current_user_can( 'manage_sites' ) ) 173 wp_die( __( 'You do not have permission to access this page.' ) ); 174 175 update_blog_status( $id, 'spam', '1' ); 176 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'spam' ), wp_get_referer() ) ); 177 exit(); 178 break; 179 164 update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' ); 165 break; 166 180 167 case 'unmatureblog': 181 check_admin_referer( 'unmatureblog' );182 if ( ! current_user_can( 'manage_sites' ) )183 wp_die( __( 'You do not have permission to access this page.' ) );184 185 update_blog_status( $id, 'mature', '0' );186 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unmature' ), wp_get_referer() ) );187 exit();188 break;189 190 168 case 'matureblog': 191 check_admin_referer( 'matureblog' ); 192 if ( ! current_user_can( 'manage_sites' ) ) 193 wp_die( __( 'You do not have permission to access this page.' ) ); 194 195 update_blog_status( $id, 'mature', '1' ); 196 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'mature' ), wp_get_referer() ) ); 197 exit(); 198 break; 199 200 // Common 201 case 'confirm': 202 check_admin_referer( 'confirm' ); 203 if ( !headers_sent() ) { 204 nocache_headers(); 205 header( 'Content-Type: text/html; charset=utf-8' ); 206 } 207 if ( $current_site->blog_id == $id ) 208 wp_die( __( 'You are not allowed to change the current site.' ) ); 209 ?> 210 <!DOCTYPE html> 211 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 212 <head> 213 <title><?php _e( 'WordPress › Confirm your action' ); ?></title> 214 215 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 216 <?php 217 wp_admin_css( 'install', true ); 218 wp_admin_css( 'ie', true ); 219 ?> 220 </head> 221 <body> 222 <h1 id="logo"><img alt="WordPress" src="<?php echo esc_attr( admin_url( 'images/wordpress-logo.png?ver=20120216' ) ); ?>" /></h1> 223 <form action="sites.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post"> 224 <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" /> 225 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> 226 <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" /> 227 <?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?> 228 <p><?php echo esc_html( stripslashes( $_GET['msg'] ) ); ?></p> 229 <?php submit_button( __('Confirm'), 'button' ); ?> 230 </form> 231 </body> 232 </html> 233 <?php 234 exit(); 235 break; 169 update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' ); 170 break; 171 } 172 173 if ( empty( $updated_action ) && in_array( $_GET['action'], $manage_actions ) ) 174 $updated_action = $_GET['action']; 175 176 if ( ! empty( $updated_action ) ) { 177 wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) ); 178 exit(); 236 179 } 237 180 } 238 181 239 182 $msg = ''; 240 if ( isset( $_ REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) {241 switch ( $_ REQUEST['action'] ) {183 if ( isset( $_GET['updated'] ) ) { 184 switch ( $_GET['updated'] ) { 242 185 case 'all_notspam': 243 186 $msg = __( 'Sites removed from spam.' ); … … 255 198 $msg = __( 'You do not have permission to delete that site.' ); 256 199 break; 257 case 'archive ':200 case 'archiveblog': 258 201 $msg = __( 'Site archived.' ); 259 202 break; 260 case 'unarchive ':203 case 'unarchiveblog': 261 204 $msg = __( 'Site unarchived.' ); 262 205 break; 263 case 'activate ':206 case 'activateblog': 264 207 $msg = __( 'Site activated.' ); 265 208 break; 266 case 'deactivate ':209 case 'deactivateblog': 267 210 $msg = __( 'Site deactivated.' ); 268 211 break; 269 case 'unspam ':212 case 'unspamblog': 270 213 $msg = __( 'Site removed from spam.' ); 271 214 break; 272 case 'spam ':215 case 'spamblog': 273 216 $msg = __( 'Site marked as spam.' ); 274 217 break; 275 218 default: 276 $msg = apply_filters( 'network_sites_updated_message_' . $_REQUEST['action'] , __( 'Settings saved.' ) ); 277 break; 278 } 279 if ( $msg ) 219 $msg = apply_filters( 'network_sites_updated_message_' . $_GET['updated'], __( 'Settings saved.' ) ); 220 break; 221 } 222 223 if ( ! empty( $msg ) ) 280 224 $msg = '<div class="updated" id="message"><p>' . $msg . '</p></div>'; 281 225 } … … 287 231 288 232 <div class="wrap"> 289 <?php screen_icon( 'ms-admin'); ?>290 <h2><?php _e( 'Sites') ?>291 <?php echo $msg; ?> 233 <?php screen_icon( 'ms-admin' ); ?> 234 <h2><?php _e( 'Sites' ) ?> 235 292 236 <?php if ( current_user_can( 'create_sites') ) : ?> 293 237 <a href="<?php echo network_admin_url('site-new.php'); ?>" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'site' ); ?></a> 294 238 <?php endif; ?> 295 239 … … 299 243 </h2> 300 244 245 <?php echo $msg; ?> 246 301 247 <form action="" method="get" id="ms-search"> 302 248 <?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?>
Note: See TracChangeset
for help on using the changeset viewer.