| [ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Network installation administration panel. 4 * 5 * A multi-step process allowing the user to enable a network of WordPress sites. 6 * 7 * @since 3.0.0 8 * 9 * @package WordPress 10 * @subpackage Administration 11 */ 12 13 define( 'WP_INSTALLING_NETWORK', true ); 14 15 /** WordPress Administration Bootstrap */ 16 require_once ( './admin.php' ); 17 18 if ( ! is_super_admin() ) 19 wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); 20 21 if ( is_multisite() ) { 22 if ( ! is_network_admin() ) { 23 wp_redirect( network_admin_url( 'setup.php' ) ); 24 exit; 25 } 26 if ( ! defined( 'MULTISITE' ) ) 27 wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) ); 28 } 29 30 // We need to create references to ms global tables to enable Network. 31 foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) 32 $wpdb->$table = $prefixed_table; 33 34 /** 35 * Check for an existing network. 36 * 37 * @since 3.0.0 38 * @return Whether a network exists. 39 */ 40 function network_domain_check() { 41 global $wpdb; 42 if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ) 43 return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" ); 44 return false; 45 } 46 47 /** 48 * Allow subdomain install 49 * 50 * @since 3.0.0 51 * @return bool Whether subdomain install is allowed 52 */ 53 function allow_subdomain_install() { 54 $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'siteurl' ) ); 55 if( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) ) 56 return false; 57 58 return true; 59 } 60 /** 61 * Allow subdirectory install 62 * 63 * @since 3.0.0 64 * @return bool Whether subdirectory install is allowed 65 */ 66 function allow_subdirectory_install() { 67 global $wpdb; 68 if ( apply_filters( 'allow_subdirectory_install', false ) ) 69 return true; 70 71 if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) 72 return true; 73 74 $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" ); 75 if ( empty( $post ) ) 76 return true; 77 78 return false; 79 } 80 /** 81 * Get base domain of network. 82 * 83 * @since 3.0.0 84 * @return string Base domain. 85 */ 86 function get_clean_basedomain() { 87 if ( $existing_domain = network_domain_check() ) 88 return $existing_domain; 89 $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); 90 if ( $slash = strpos( $domain, '/' ) ) 91 $domain = substr( $domain, 0, $slash ); 92 return $domain; 93 } 94 95 if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) 96 wp_die( __( 'You must define the <code>WP_ALLOW_MULTISITE</code> constant as true in your wp-config.php file to allow creation of a Network.' ) ); 97 98 if ( is_network_admin() ) { 99 $title = __( 'Network Setup' ); 100 $parent_file = 'settings.php'; 101 } else { 102 $title = __( 'Create a Network of WordPress Sites' ); 103 $parent_file = 'tools.php'; 104 } 105 106 $network_help = '<p>' . __('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '</p>' . 107 '<p>' . __('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).') . '</p>' . 108 '<p>' . __('The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.') . '</p>' . 109 '<p>' . __('Add a <code>blogs.dir</code> directory under <code>/wp-content</code> and add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' . 110 '<p>' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.') . '</p>' . 111 '<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with “/blog/” from the main site. This disabling will be addressed in a future version.') . '</p>' . 112 '<p><strong>' . __('For more information:') . '</strong></p>' . 113 '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' . 114 '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>'; 115 116 get_current_screen()->add_help_tab( array( 117 'id' => 'network', 118 'title' => __('Network'), 119 'content' => $network_help, 120 ) ); 121 122 get_current_screen()->set_help_sidebar( 123 '<p><strong>' . __('For more information:') . '</strong></p>' . 124 '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' . 125 '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>' . 126 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 127 ); 128 129 include ( ABSPATH . 'wp-admin/admin-header.php' ); 130 ?> 131 <div class="wrap"> 132 <?php screen_icon('tools'); ?> 133 <h2><?php echo esc_html( $title ); ?></h2> 134 135 <?php 136 /** 137 * Prints step 1 for Network installation process. 138 * 139 * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network 140 * should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo. 141 * 142 * @since 3.0.0 143 */ 144 function network_step1( $errors = false ) { 145 global $is_apache; 146 147 if ( get_option( 'siteurl' ) != get_option( 'home' ) ) { 148 echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . sprintf( __( 'Your <strong>WordPress address</strong> must match your <strong>Site address</strong> before creating a Network. See <a href="%s">General Settings</a>.' ), esc_url( admin_url( 'options-general.php' ) ) ) . '</p></div>'; 149 echo '</div>'; 150 include ( ABSPATH . 'wp-admin/admin-footer.php' ); 151 die(); 152 } 153 154 if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) { 155 echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>'; 156 echo '</div>'; 157 include ( ABSPATH . 'wp-admin/admin-footer.php' ); 158 die(); 159 } 160 161 $active_plugins = get_option( 'active_plugins' ); 162 if ( ! empty( $active_plugins ) ) { 163 echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf( __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '</p></div><p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>'; 164 echo '</div>'; 165 include ( ABSPATH . 'wp-admin/admin-footer.php' ); 166 die(); 167 } 168 169 $hostname = get_clean_basedomain(); 170 $has_ports = strstr( $hostname, ':' ); 171 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { 172 echo '<div class="error"><p><strong>' . __( 'ERROR:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; 173 echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>'; 174 echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>'; 175 echo '</div>'; 176 include ( ABSPATH . 'wp-admin/admin-footer.php' ); 177 die(); 178 } 179 180 echo '<form method="post" action="">'; 181 182 wp_nonce_field( 'install-network-1' ); 183 184 $error_codes = array(); 185 if ( is_wp_error( $errors ) ) { 186 echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>'; 187 foreach ( $errors->get_error_messages() as $error ) 188 echo "<p>$error</p>"; 189 echo '</div>'; 190 $error_codes = $errors->get_error_codes(); 191 } 192 193 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' ) 194 echo '<div class="error"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; 195 196 $site_name = ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) ); 197 $admin_email = ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' ); 198 ?> 199 <p><?php _e( 'Welcome to the Network installation process!' ); ?></p> 200 <p><?php _e( 'Fill in the information below and you’ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p> 201 <?php 202 203 if ( isset( $_POST['subdomain_install'] ) ) { 204 $subdomain_install = (bool) $_POST['subdomain_install']; 205 } elseif ( apache_mod_loaded('mod_rewrite') ) { // assume nothing 206 $subdomain_install = true; 207 } elseif ( !allow_subdirectory_install() ) { 208 $subdomain_install = true; 209 } else { 210 $subdomain_install = false; 211 if ( $got_mod_rewrite = got_mod_rewrite() ) // dangerous assumptions 212 echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ' . __( 'Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.' ) . '</p>'; 213 elseif ( $is_apache ) 214 echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> ' . __( 'It looks like the Apache <code>mod_rewrite</code> module is not installed.' ) . '</p>'; 215 if ( $got_mod_rewrite || $is_apache ) // Protect against mod_rewrite mimicry (but ! Apache) 216 echo '<p>' . __( 'If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.' ) . '</p></div>'; 217 } 218 219 if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?> 220 <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3> 221 <p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>' ); ?></p> 222 <p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p> 223 <?php // @todo: Link to an MS readme? ?> 224 <table class="form-table"> 225 <tr> 226 <th><label><input type='radio' name='subdomain_install' value='1'<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th> 227 <td><?php printf( _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ), $hostname ); ?></td> 228 </tr> 229 <tr> 230 <th><label><input type='radio' name='subdomain_install' value='0'<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th> 231 <td><?php printf( _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ), $hostname ); ?></td> 232 </tr> 233 </table> 234 235 <?php 236 endif; 237 238 $is_www = ( 0 === strpos( $hostname, 'www.' ) ); 239 if ( $is_www ) : 240 ?> 241 <h3><?php esc_html_e( 'Server Address' ); ?></h3> 242 <p><?php printf( __( 'We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.' ), substr( $hostname, 4 ), $hostname ); ?></p> 243 <table class="form-table"> 244 <tr> 245 <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> 246 <td> 247 <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?> 248 </td> 249 </tr> 250 </table> 251 <?php endif; ?> 252 253 <h3><?php esc_html_e( 'Network Details' ); ?></h3> 254 <table class="form-table"> 255 <?php if ( 'localhost' == $hostname ) : ?> 256 <tr> 257 <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th> 258 <td><?php 259 _e( 'Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.' ); 260 // Uh oh: 261 if ( !allow_subdirectory_install() ) 262 echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; 263 ?></td> 264 </tr> 265 <?php elseif ( !allow_subdomain_install() ) : ?> 266 <tr> 267 <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th> 268 <td><?php 269 _e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' ); 270 // Uh oh: 271 if ( !allow_subdirectory_install() ) 272 echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; 273 ?></td> 274 </tr> 275 <?php elseif ( !allow_subdirectory_install() ) : ?> 276 <tr> 277 <th scope="row"><?php esc_html_e( 'Sub-domain Install' ); ?></th> 278 <td><?php _e( 'Because your install is not new, the sites in your WordPress network must use sub-domains.' ); 279 echo ' <strong>' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; 280 ?></td> 281 </tr> 282 <?php endif; ?> 283 <?php if ( ! $is_www ) : ?> 284 <tr> 285 <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> 286 <td> 287 <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?> 288 </td> 289 </tr> 290 <?php endif; ?> 291 <tr> 292 <th scope='row'><?php esc_html_e( 'Network Title' ); ?></th> 293 <td> 294 <input name='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' /> 295 <br /><?php _e( 'What would you like to call your network?' ); ?> 296 </td> 297 </tr> 298 <tr> 299 <th scope='row'><?php esc_html_e( 'Admin E-mail Address' ); ?></th> 300 <td> 301 <input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' /> 302 <br /><?php _e( 'Your email address.' ); ?> 303 </td> 304 </tr> 305 </table> 306 <?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?> 307 </form> 308 <?php 309 } 310 311 /** 312 * Prints step 2 for Network installation process. 313 * 314 * @since 3.0.0 315 */ 316 function network_step2( $errors = false ) { 317 global $base, $wpdb; 318 $hostname = get_clean_basedomain(); 319 320 if ( ! isset( $base ) ) 321 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); 322 323 // Wildcard DNS message. 324 if ( is_wp_error( $errors ) ) 325 echo '<div class="error">' . $errors->get_error_message() . '</div>'; 326 327 if ( $_POST ) { 328 if ( allow_subdomain_install() ) 329 $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; 330 else 331 $subdomain_install = false; 332 } else { 333 if ( is_multisite() ) { 334 $subdomain_install = is_subdomain_install(); 335 ?> 336 <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p> 337 <?php 338 } else { 339 $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); 340 ?> 341 <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div> 342 <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p> 343 <?php 344 } 345 } 346 347 if ( $_POST || ! is_multisite() ) { 348 ?> 349 <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3> 350 <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p> 351 <div class="updated inline"><p><?php 352 if ( file_exists( ABSPATH . '.htaccess' ) ) 353 printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' ); 354 elseif ( file_exists( ABSPATH . 'web.config' ) ) 355 printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' ); 356 else 357 _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' ); 358 ?></p></div> 359 <?php 360 } 361 ?> 362 <ol> 363 <li><p><?php 364 printf( __( 'Create a <code>blogs.dir</code> directory at <code>%s/blogs.dir</code>. This directory is used to store uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR ); 365 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' ) 366 echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong>'; 367 ?></p></li> 368 <li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That’s all, stop editing! Happy blogging. */</code>:' ), ABSPATH ); ?></p> 369 <textarea class="code" readonly="readonly" cols="100" rows="7"> 370 define('MULTISITE', true); 371 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>); 372 $base = '<?php echo $base; ?>'; 373 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>'); 374 define('PATH_CURRENT_SITE', '<?php echo $base; ?>'); 375 define('SITE_ID_CURRENT_SITE', 1); 376 define('BLOG_ID_CURRENT_SITE', 1);</textarea> 377 <?php 378 $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); 379 foreach ( $keys_salts as $c => $v ) { 380 if ( defined( $c ) ) 381 unset( $keys_salts[ $c ] ); 382 } 383 if ( ! empty( $keys_salts ) ) { 384 $keys_salts_str = ''; 385 $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); 386 if ( is_wp_error( $from_api ) ) { 387 foreach ( $keys_salts as $c => $v ) { 388 $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; 389 } 390 } else { 391 $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); 392 foreach ( $keys_salts as $c => $v ) { 393 $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; 394 } 395 } 396 $num_keys_salts = count( $keys_salts ); 397 ?> 398 <p><?php 399 echo _n( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.', 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.', $num_keys_salts ); ?> <?php _e( 'To make your installation more secure, you should also add:' ) ?></p> 400 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea> 401 <?php 402 } 403 ?> 404 </li> 405 <?php 406 if ( iis7_supports_permalinks() ) : 407 408 if ( $subdomain_install ) { 409 $web_config_file = 410 '<?xml version="1.0" encoding="UTF-8"?> 411 <configuration> 412 <system.webServer> 413 <rewrite> 414 <rules> 415 <rule name="WordPress Rule 1" stopProcessing="true"> 416 <match url="^index\.php$" ignoreCase="false" /> 417 <action type="None" /> 418 </rule> 419 <rule name="WordPress Rule 2" stopProcessing="true"> 420 <match url="^files/(.+)" ignoreCase="false" /> 421 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> 422 </rule> 423 <rule name="WordPress Rule 3" stopProcessing="true"> 424 <match url="^" ignoreCase="false" /> 425 <conditions logicalGrouping="MatchAny"> 426 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 427 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 428 </conditions> 429 <action type="None" /> 430 </rule> 431 <rule name="WordPress Rule 4" stopProcessing="true"> 432 <match url="." ignoreCase="false" /> 433 <action type="Rewrite" url="index.php" /> 434 </rule> 435 </rules> 436 </rewrite> 437 </system.webServer> 438 </configuration>'; 439 } else { 440 $web_config_file = 441 '<?xml version="1.0" encoding="UTF-8"?> 442 <configuration> 443 <system.webServer> 444 <rewrite> 445 <rules> 446 <rule name="WordPress Rule 1" stopProcessing="true"> 447 <match url="^index\.php$" ignoreCase="false" /> 448 <action type="None" /> 449 </rule> 450 <rule name="WordPress Rule 2" stopProcessing="true"> 451 <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" /> 452 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" /> 453 </rule> 454 <rule name="WordPress Rule 3" stopProcessing="true"> 455 <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> 456 <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> 457 </rule> 458 <rule name="WordPress Rule 4" stopProcessing="true"> 459 <match url="^" ignoreCase="false" /> 460 <conditions logicalGrouping="MatchAny"> 461 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 462 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 463 </conditions> 464 <action type="None" /> 465 </rule> 466 <rule name="WordPress Rule 5" stopProcessing="true"> 467 <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" /> 468 <action type="Rewrite" url="{R:1}" /> 469 </rule> 470 <rule name="WordPress Rule 6" stopProcessing="true"> 471 <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> 472 <action type="Rewrite" url="{R:2}" /> 473 </rule> 474 <rule name="WordPress Rule 7" stopProcessing="true"> 475 <match url="." ignoreCase="false" /> 476 <action type="Rewrite" url="index.php" /> 477 </rule> 478 </rules> 479 </rewrite> 480 </system.webServer> 481 </configuration>'; 482 } 483 ?> 484 <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> 485 <textarea class="code" readonly="readonly" cols="100" rows="20"> 486 <?php echo esc_textarea( $web_config_file ); ?> 487 </textarea></li> 488 </ol> 489 490 <?php else : // end iis7_supports_permalinks(). construct an htaccess file instead: 491 492 $htaccess_file = 'RewriteEngine On 493 RewriteBase ' . $base . ' 494 RewriteRule ^index\.php$ - [L] 495 496 # uploaded files 497 RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n"; 498 499 if ( ! $subdomain_install ) 500 $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n"; 501 502 $htaccess_file .= "\n" . 'RewriteCond %{REQUEST_FILENAME} -f [OR] 503 RewriteCond %{REQUEST_FILENAME} -d 504 RewriteRule ^ - [L]'; 505 506 // @todo custom content dir. 507 if ( ! $subdomain_install ) 508 $htaccess_file .= "\nRewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]\nRewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]"; 509 510 $htaccess_file .= "\nRewriteRule . index.php [L]"; 511 512 ?> 513 <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> 514 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>"> 515 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li> 516 </ol> 517 518 <?php endif; // end IIS/Apache code branches. 519 520 if ( !is_multisite() ) { ?> 521 <p><?php printf( __( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.') ); ?> <a href="<?php echo esc_url( site_url( 'wp-login.php' ) ); ?>"><?php _e( 'Log In' ); ?></a></p> 522 <?php 523 } 524 } 525 526 if ( $_POST ) { 527 528 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); 529 530 check_admin_referer( 'install-network-1' ); 531 532 require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' ); 533 // create network tables 534 install_network(); 535 $hostname = get_clean_basedomain(); 536 $subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false; 537 if ( ! network_domain_check() ) { 538 $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install ); 539 if ( is_wp_error( $result ) ) { 540 if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) 541 network_step2( $result ); 542 else 543 network_step1( $result ); 544 } else { 545 network_step2(); 546 } 547 } else { 548 network_step2(); 549 } 550 } elseif ( is_multisite() || network_domain_check() ) { 551 network_step2(); 552 } else { 553 network_step1(); 554 } 555 ?> 556 </div> 557 558 <?php include ( ABSPATH . 'wp-admin/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. |