| [ 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 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 class="wp-core-ui"> 76 <h1 id="logo"><a href="<?php echo esc_url( __( 'http://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></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( wp_unslash( $_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 102 switch ( $_GET['action'] ) { 103 104 case 'deleteblog': 105 if ( ! current_user_can( 'delete_sites' ) ) 106 wp_die( __( 'You do not have permission to access this page.' ) ); 107 108 $updated_action = 'not_deleted'; 109 if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) { 110 wpmu_delete_blog( $id, true ); 111 $updated_action = 'delete'; 112 } 113 break; 114 115 case 'allblogs': 116 if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) { 117 $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; 118 119 foreach ( (array) $_POST['allblogs'] as $key => $val ) { 120 if ( $val != '0' && $val != $current_site->blog_id ) { 121 switch ( $doaction ) { 122 case 'delete': 123 if ( ! current_user_can( 'delete_site', $val ) ) 124 wp_die( __( 'You are not allowed to delete the site.' ) ); 125 126 $updated_action = 'all_delete'; 127 wpmu_delete_blog( $val, true ); 128 break; 129 130 case 'spam': 131 case 'notspam': 132 $updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam'; 133 update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' ); 134 break; 135 } 136 } else { 137 wp_die( __( 'You are not allowed to change the current site.' ) ); 138 } 139 } 140 } else { 141 wp_redirect( network_admin_url( 'sites.php' ) ); 142 exit(); 143 } 144 break; 145 146 case 'archiveblog': 147 case 'unarchiveblog': 148 update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' ); 149 break; 150 151 case 'activateblog': 152 update_blog_status( $id, 'deleted', '0' ); 153 do_action( 'activate_blog', $id ); 154 break; 155 156 case 'deactivateblog': 157 do_action( 'deactivate_blog', $id ); 158 update_blog_status( $id, 'deleted', '1' ); 159 break; 160 161 case 'unspamblog': 162 case 'spamblog': 163 update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' ); 164 break; 165 166 case 'unmatureblog': 167 case 'matureblog': 168 update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' ); 169 break; 170 } 171 172 if ( empty( $updated_action ) && in_array( $_GET['action'], $manage_actions ) ) 173 $updated_action = $_GET['action']; 174 175 if ( ! empty( $updated_action ) ) { 176 wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) ); 177 exit(); 178 } 179 } 180 181 $msg = ''; 182 if ( isset( $_GET['updated'] ) ) { 183 switch ( $_GET['updated'] ) { 184 case 'all_notspam': 185 $msg = __( 'Sites removed from spam.' ); 186 break; 187 case 'all_spam': 188 $msg = __( 'Sites marked as spam.' ); 189 break; 190 case 'all_delete': 191 $msg = __( 'Sites deleted.' ); 192 break; 193 case 'delete': 194 $msg = __( 'Site deleted.' ); 195 break; 196 case 'not_deleted': 197 $msg = __( 'You do not have permission to delete that site.' ); 198 break; 199 case 'archiveblog': 200 $msg = __( 'Site archived.' ); 201 break; 202 case 'unarchiveblog': 203 $msg = __( 'Site unarchived.' ); 204 break; 205 case 'activateblog': 206 $msg = __( 'Site activated.' ); 207 break; 208 case 'deactivateblog': 209 $msg = __( 'Site deactivated.' ); 210 break; 211 case 'unspamblog': 212 $msg = __( 'Site removed from spam.' ); 213 break; 214 case 'spamblog': 215 $msg = __( 'Site marked as spam.' ); 216 break; 217 default: 218 $msg = apply_filters( 'network_sites_updated_message_' . $_GET['updated'], __( 'Settings saved.' ) ); 219 break; 220 } 221 222 if ( ! empty( $msg ) ) 223 $msg = '<div class="updated" id="message"><p>' . $msg . '</p></div>'; 224 } 225 226 $wp_list_table->prepare_items(); 227 228 require_once ( '../admin-header.php' ); 229 ?> 230 231 <div class="wrap"> 232 <?php screen_icon( 'ms-admin' ); ?> 233 <h2><?php _e( 'Sites' ) ?> 234 235 <?php if ( current_user_can( 'create_sites') ) : ?> 236 <a href="<?php echo network_admin_url('site-new.php'); ?>" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'site' ); ?></a> 237 <?php endif; ?> 238 239 <?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) { 240 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); 241 } ?> 242 </h2> 243 244 <?php echo $msg; ?> 245 246 <form action="" method="get" id="ms-search"> 247 <?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?> 248 <input type="hidden" name="action" value="blogs" /> 249 </form> 250 251 <form id="form-site-list" action="sites.php?action=allblogs" method="post"> 252 <?php $wp_list_table->display(); ?> 253 </form> 254 </div> 255 <?php 256 257 require_once ( '../admin-footer.php' ); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon May 20 03:56:25 2013 | Hosted by follow the white rabbit. |