| [ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Multisite sites administration panel. 4 * 5 * @package WordPress 6 * @subpackage Multisite 7 * @since 3.0.0 8 */ 9 10 /** Load WordPress Administration Bootstrap */ 11 require_once ( './admin.php' ); 12 13 if ( ! is_multisite() ) 14 wp_die( __( 'Multisite support is not enabled.' ) ); 15 16 if ( ! current_user_can( 'manage_sites' ) ) 17 wp_die( __( 'You do not have permission to access this page.' ) ); 18 19 $wp_list_table = _get_list_table('WP_MS_Sites_List_Table'); 20 $pagenum = $wp_list_table->get_pagenum(); 21 22 $title = __( 'Sites' ); 23 $parent_file = 'sites.php'; 24 25 add_screen_option( 'per_page', array('label' => _x( 'Sites', 'sites per page (screen options)' )) ); 26 27 get_current_screen()->add_help_tab( array( 28 'id' => 'overview', 29 'title' => __('Overview'), 30 'content' => 31 '<p>' . __('Add New takes you to the Add New Site screen. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.') . '</p>' . 32 '<p>' . __('This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.') . '</p>' . 33 '<p>' . __('Hovering over each site reveals seven options (three for the primary site):') . '</p>' . 34 '<ul><li>' . __('An Edit link to a separate Edit Site screen.') . '</li>' . 35 '<li>' . __('Dashboard leads to the Dashboard for that site.') . '</li>' . 36 '<li>' . __('Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.') . '</li>' . 37 '<li>' . __('Delete which is a permanent action after the confirmation screens.') . '</li>' . 38 '<li>' . __('Visit to go to the frontend site live.') . '</li></ul>' . 39 '<p>' . __('The site ID is used internally, and is not shown on the front end of the site or to users/viewers.') . '</p>' . 40 '<p>' . __('Clicking on bold headings can re-sort this table.') . '</p>' 41 ) ); 42 43 get_current_screen()->set_help_sidebar( 44 '<p><strong>' . __('For more information:') . '</strong></p>' . 45 '<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' . 46 '<p>' . __('<a href="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' 47 ); 48 49 $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 50 51 if ( isset( $_GET['action'] ) ) { 52 do_action( 'wpmuadminedit' , '' ); 53 54 switch ( $_GET['action'] ) { 55 case 'updateblog': 56 // No longer used. 57 break; 58 59 case 'deleteblog': 60 check_admin_referer('deleteblog'); 61 if ( ! ( current_user_can( 'manage_sites' ) && current_user_can( 'delete_sites' ) ) ) 62 wp_die( __( 'You do not have permission to access this page.' ) ); 63 64 if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) { 65 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() ) ); 69 } 70 71 exit(); 72 break; 73 74 case 'allblogs': 75 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 $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; 82 $blogfunction = ''; 83 84 foreach ( (array) $_POST['allblogs'] as $key => $val ) { 85 if ( $val != '0' && $val != $current_site->blog_id ) { 86 switch ( $doaction ) { 87 case 'delete': 88 if ( ! current_user_can( 'delete_site', $val ) ) 89 wp_die( __( 'You are not allowed to delete the site.' ) ); 90 $blogfunction = 'all_delete'; 91 wpmu_delete_blog( $val, true ); 92 break; 93 94 case 'spam': 95 $blogfunction = 'all_spam'; 96 update_blog_status( $val, 'spam', '1' ); 97 set_time_limit( 60 ); 98 break; 99 100 case 'notspam': 101 $blogfunction = 'all_notspam'; 102 update_blog_status( $val, 'spam', '0' ); 103 set_time_limit( 60 ); 104 break; 105 } 106 } else { 107 wp_die( __( 'You are not allowed to change the current site.' ) ); 108 } 109 } 110 111 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) ); 112 } else { 113 wp_redirect( network_admin_url( 'sites.php' ) ); 114 } 115 exit(); 116 break; 117 118 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 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(); 136 break; 137 138 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 update_blog_status( $id, 'deleted', '0' ); 144 do_action( 'activate_blog', $id ); 145 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'activate' ), wp_get_referer() ) ); 146 exit(); 147 break; 148 149 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 do_action( 'deactivate_blog', $id ); 155 update_blog_status( $id, 'deleted', '1' ); 156 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'deactivate' ), wp_get_referer() ) ); 157 exit(); 158 break; 159 160 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 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 180 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 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; 236 } 237 } 238 239 $msg = ''; 240 if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) { 241 switch ( $_REQUEST['action'] ) { 242 case 'all_notspam': 243 $msg = __( 'Sites removed from spam.' ); 244 break; 245 case 'all_spam': 246 $msg = __( 'Sites marked as spam.' ); 247 break; 248 case 'all_delete': 249 $msg = __( 'Sites deleted.' ); 250 break; 251 case 'delete': 252 $msg = __( 'Site deleted.' ); 253 break; 254 case 'not_deleted': 255 $msg = __( 'You do not have permission to delete that site.' ); 256 break; 257 case 'archive': 258 $msg = __( 'Site archived.' ); 259 break; 260 case 'unarchive': 261 $msg = __( 'Site unarchived.' ); 262 break; 263 case 'activate': 264 $msg = __( 'Site activated.' ); 265 break; 266 case 'deactivate': 267 $msg = __( 'Site deactivated.' ); 268 break; 269 case 'unspam': 270 $msg = __( 'Site removed from spam.' ); 271 break; 272 case 'spam': 273 $msg = __( 'Site marked as spam.' ); 274 break; 275 default: 276 $msg = apply_filters( 'network_sites_updated_message_' . $_REQUEST['action'] , __( 'Settings saved.' ) ); 277 break; 278 } 279 if ( $msg ) 280 $msg = '<div class="updated" id="message"><p>' . $msg . '</p></div>'; 281 } 282 283 $wp_list_table->prepare_items(); 284 285 if ( ! wp_is_large_network( 'sites' ) ) 286 wp_enqueue_script( 'site-search' ); 287 288 require_once ( '../admin-header.php' ); 289 ?> 290 291 <div class="wrap"> 292 <?php screen_icon('ms-admin'); ?> 293 <h2><?php _e('Sites') ?> 294 <?php echo $msg; ?> 295 <?php if ( current_user_can( 'create_sites') ) : ?> 296 <a href="<?php echo network_admin_url('site-new.php'); ?>" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'site' ); ?></a> 297 <?php endif; ?> 298 299 <?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) { 300 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); 301 } ?> 302 </h2> 303 304 <form action="" method="get" id="ms-search"> 305 <?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?> 306 <input type="hidden" name="action" value="blogs" /> 307 </form> 308 309 <form id="form-site-list" action="sites.php?action=allblogs" method="post"> 310 <?php $wp_list_table->display(); ?> 311 </form> 312 </div> 313 <?php 314 315 require_once ( '../admin-footer.php' ); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri May 25 03:56:23 2012 | Hosted by follow the white rabbit. |