| [ XREF Home ] [ Index ] |
PHP Cross Reference of WordPress TrunkProvided by Yoast |
[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_NETWORK_ADMIN_PAGE', 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 add_contextual_help($current_screen, 107 '<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>' . 108 '<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>' . 109 '<p>' . __('The next screen for Network 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>' . 110 '<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>' . 111 '<p>' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Howdy (Username) dropdown in the upper right of the administration area.') . '</p>' . 112 '<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 soon in a future version.') . '</p>' . 113 '<p><strong>' . __('For more information:') . '</strong></p>' . 114 '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' . 115 '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>' . 116 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 117 ); 118 119 include ( ABSPATH . 'wp-admin/admin-header.php' ); 120 ?> 121 <div class="wrap"> 122 <?php screen_icon('tools'); ?> 123 <h2><?php echo esc_html( $title ); ?></h2> 124 125 <?php 126 /** 127 * Prints step 1 for Network installation process. 128 * 129 * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network 130 * should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo. 131 * 132 * @since 3.0.0 133 */ 134 function network_step1( $errors = false ) { 135 global $is_apache; 136 137 if ( get_option( 'siteurl' ) != get_option( 'home' ) ) { 138 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>'; 139 echo '</div>'; 140 include ( ABSPATH . 'wp-admin/admin-footer.php' ); 141 die(); 142 } 143 144 if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) { 145 echo '<div class="error"><p><strong>' . __('Error:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>'; 146 echo '</div>'; 147 include ( ABSPATH . 'wp-admin/admin-footer.php' ); 148 die(); 149 } 150 151 $active_plugins = get_option( 'active_plugins' ); 152 if ( ! empty( $active_plugins ) ) { 153 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>'; 154 echo '</div>'; 155 include ( ABSPATH . 'wp-admin/admin-footer.php' ); 156 die(); 157 } 158 159 $hostname = get_clean_basedomain(); 160 $has_ports = strstr( $hostname, ':' ); 161 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { 162 echo '<div class="error"><p><strong>' . __( 'Error:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; 163 echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>'; 164 echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>'; 165 echo '</div>'; 166 include ( ABSPATH . 'wp-admin/admin-footer.php' ); 167 die(); 168 } 169 170 echo '<form method="post" action="">'; 171 172 wp_nonce_field( 'install-network-1' ); 173 174 $error_codes = array(); 175 if ( is_wp_error( $errors ) ) { 176 echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>'; 177 foreach ( $errors->get_error_messages() as $error ) 178 echo "<p>$error</p>"; 179 echo '</div>'; 180 $error_codes = $errors->get_error_codes(); 181 } 182 183 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' ) 184 echo '<div class="error"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; 185 186 $site_name = ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) ); 187 $admin_email = ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' ); 188 ?> 189 <p><?php _e( 'Welcome to the Network installation process!' ); ?></p> 190 <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> 191 <?php 192 193 if ( isset( $_POST['subdomain_install'] ) ) { 194 $subdomain_install = (bool) $_POST['subdomain_install']; 195 } elseif ( apache_mod_loaded('mod_rewrite') ) { // assume nothing 196 $subdomain_install = true; 197 } elseif ( !allow_subdirectory_install() ) { 198 $subdomain_install = true; 199 } else { 200 $subdomain_install = false; 201 if ( $got_mod_rewrite = got_mod_rewrite() ) // dangerous assumptions 202 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>'; 203 elseif ( $is_apache ) 204 echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> ' . __( 'It looks like the Apache <code>mod_rewrite</code> module is not installed.' ) . '</p>'; 205 if ( $got_mod_rewrite || $is_apache ) // Protect against mod_rewrite mimicry (but ! Apache) 206 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>'; 207 } 208 209 if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?> 210 <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3> 211 <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> 212 <p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p> 213 <?php // @todo: Link to an MS readme? ?> 214 <table class="form-table"> 215 <tr> 216 <th><label><input type='radio' name='subdomain_install' value='1'<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th> 217 <td><?php printf( _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ), $hostname ); ?></td> 218 </tr> 219 <tr> 220 <th><label><input type='radio' name='subdomain_install' value='0'<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th> 221 <td><?php printf( _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ), $hostname ); ?></td> 222 </tr> 223 </table> 224 225 <?php 226 endif; 227 228 $is_www = ( 0 === strpos( $hostname, 'www.' ) ); 229 if ( $is_www ) : 230 ?> 231 <h3><?php esc_html_e( 'Server Address' ); ?></h3> 232 <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 ); ?></h3> 233 <table class="form-table"> 234 <tr> 235 <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> 236 <td> 237 <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?> 238 </td> 239 </tr> 240 </table> 241 <?php endif; ?> 242 243 <h3><?php esc_html_e( 'Network Details' ); ?></h3> 244 <table class="form-table"> 245 <?php if ( 'localhost' == $hostname ) : ?> 246 <tr> 247 <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th> 248 <td><?php 249 _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.' ); 250 // Uh oh: 251 if ( !allow_subdirectory_install() ) 252 echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; 253 ?></td> 254 </tr> 255 <?php elseif ( !allow_subdomain_install() ) : ?> 256 <tr> 257 <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th> 258 <td><?php 259 _e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' ); 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_subdirectory_install() ) : ?> 266 <tr> 267 <th scope="row"><?php esc_html_e( 'Sub-domain Install' ); ?></th> 268 <td><?php _e( 'Because your install is not new, the sites in your WordPress network must use sub-domains.' ); 269 echo ' <strong>' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; 270 ?></td> 271 </tr> 272 <?php endif; ?> 273 <?php if ( ! $is_www ) : ?> 274 <tr> 275 <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> 276 <td> 277 <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?> 278 </td> 279 </tr> 280 <?php endif; ?> 281 <tr> 282 <th scope='row'><?php esc_html_e( 'Network Title' ); ?></th> 283 <td> 284 <input name='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' /> 285 <br /><?php _e( 'What would you like to call your network?' ); ?> 286 </td> 287 </tr> 288 <tr> 289 <th scope='row'><?php esc_html_e( 'Admin E-mail Address' ); ?></th> 290 <td> 291 <input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' /> 292 <br /><?php _e( 'Your email address.' ); ?> 293 </td> 294 </tr> 295 </table> 296 <?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?> 297 </form> 298 <?php 299 } 300 301 /** 302 * Prints step 2 for Network installation process. 303 * 304 * @since 3.0.0 305 */ 306 function network_step2( $errors = false ) { 307 global $base, $wpdb; 308 $hostname = get_clean_basedomain(); 309 310 if ( ! isset( $base ) ) 311 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); 312 313 // Wildcard DNS message. 314 if ( is_wp_error( $errors ) ) 315 echo '<div class="error">' . $errors->get_error_message() . '</div>'; 316 317 if ( $_POST ) { 318 if ( allow_subdomain_install() ) 319 $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; 320 else 321 $subdomain_install = false; 322 } else { 323 if ( is_multisite() ) { 324 $subdomain_install = is_subdomain_install(); 325 ?> 326 <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p> 327 <?php 328 } else { 329 $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); 330 ?> 331 <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div> 332 <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> 333 <?php 334 } 335 } 336 337 if ( $_POST || ! is_multisite() ) { 338 ?> 339 <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3> 340 <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p> 341 <div class="updated inline"><p><?php 342 if ( file_exists( ABSPATH . '.htaccess' ) ) 343 printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' ); 344 elseif ( file_exists( ABSPATH . 'web.config' ) ) 345 printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' ); 346 else 347 _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' ); 348 ?></p></div> 349 <?php 350 } 351 ?> 352 <ol> 353 <li><p><?php 354 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 ); 355 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' ) 356 echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong'; 357 ?></p></li> 358 <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> 359 <textarea class="code" readonly="readonly" cols="100" rows="7"> 360 define( 'MULTISITE', true ); 361 define( 'SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?> ); 362 $base = '<?php echo $base; ?>'; 363 define( 'DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>' ); 364 define( 'PATH_CURRENT_SITE', '<?php echo $base; ?>' ); 365 define( 'SITE_ID_CURRENT_SITE', 1 ); 366 define( 'BLOG_ID_CURRENT_SITE', 1 );</textarea> 367 <?php 368 $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); 369 foreach ( $keys_salts as $c => $v ) { 370 if ( defined( $c ) ) 371 unset( $keys_salts[ $c ] ); 372 } 373 if ( ! empty( $keys_salts ) ) { 374 $keys_salts_str = ''; 375 $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); 376 if ( is_wp_error( $from_api ) ) { 377 foreach ( $keys_salts as $c => $v ) { 378 $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; 379 } 380 } else { 381 $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); 382 foreach ( $keys_salts as $c => $v ) { 383 $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; 384 } 385 } 386 $num_keys_salts = count( $keys_salts ); 387 ?> 388 <p><?php 389 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> 390 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea> 391 <?php 392 } 393 ?> 394 </li> 395 <?php 396 if ( iis7_supports_permalinks() ) : 397 398 if ( $subdomain_install ) { 399 $web_config_file = 400 '<?xml version="1.0" encoding="UTF-8"?> 401 <configuration> 402 <system.webServer> 403 <rewrite> 404 <rules> 405 <rule name="WordPress Rule 1" stopProcessing="true"> 406 <match url="^index\.php$" ignoreCase="false" /> 407 <action type="None" /> 408 </rule> 409 <rule name="WordPress Rule 2" stopProcessing="true"> 410 <match url="^files/(.+)" ignoreCase="false" /> 411 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> 412 </rule> 413 <rule name="WordPress Rule 3" stopProcessing="true"> 414 <match url="^" ignoreCase="false" /> 415 <conditions logicalGrouping="MatchAny"> 416 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 417 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 418 </conditions> 419 <action type="None" /> 420 </rule> 421 <rule name="WordPress Rule 4" stopProcessing="true"> 422 <match url="." ignoreCase="false" /> 423 <action type="Rewrite" url="index.php" /> 424 </rule> 425 </rules> 426 </rewrite> 427 </system.webServer> 428 </configuration>'; 429 } else { 430 $web_config_file = 431 '<?xml version="1.0" encoding="UTF-8"?> 432 <configuration> 433 <system.webServer> 434 <rewrite> 435 <rules> 436 <rule name="WordPress Rule 1" stopProcessing="true"> 437 <match url="^index\.php$" ignoreCase="false" /> 438 <action type="None" /> 439 </rule> 440 <rule name="WordPress Rule 2" stopProcessing="true"> 441 <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" /> 442 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" /> 443 </rule> 444 <rule name="WordPress Rule 3" stopProcessing="true"> 445 <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> 446 <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> 447 </rule> 448 <rule name="WordPress Rule 4" stopProcessing="true"> 449 <match url="^" ignoreCase="false" /> 450 <conditions logicalGrouping="MatchAny"> 451 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 452 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 453 </conditions> 454 <action type="None" /> 455 </rule> 456 <rule name="WordPress Rule 5" stopProcessing="true"> 457 <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" /> 458 <action type="Rewrite" url="{R:2}" /> 459 </rule> 460 <rule name="WordPress Rule 6" stopProcessing="true"> 461 <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> 462 <action type="Rewrite" url="{R:2}" /> 463 </rule> 464 <rule name="WordPress Rule 7" stopProcessing="true"> 465 <match url="." ignoreCase="false" /> 466 <action type="Rewrite" url="index.php" /> 467 </rule> 468 </rules> 469 </rewrite> 470 </system.webServer> 471 </configuration>'; 472 } 473 ?> 474 <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> 475 <textarea class="code" readonly="readonly" cols="100" rows="20"> 476 <?php echo esc_textarea( $web_config_file ); ?> 477 </textarea></li> 478 </ol> 479 480 <?php else : // end iis7_supports_permalinks(). construct an htaccess file instead: 481 482 $htaccess_file = 'RewriteEngine On 483 RewriteBase ' . $base . ' 484 RewriteRule ^index\.php$ - [L] 485 486 # uploaded files 487 RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n"; 488 489 if ( ! $subdomain_install ) 490 $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n"; 491 492 $htaccess_file .= "\n" . 'RewriteCond %{REQUEST_FILENAME} -f [OR] 493 RewriteCond %{REQUEST_FILENAME} -d 494 RewriteRule ^ - [L]'; 495 496 // @todo custom content dir. 497 if ( ! $subdomain_install ) 498 $htaccess_file .= "\nRewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]\nRewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]"; 499 500 $htaccess_file .= "\nRewriteRule . index.php [L]"; 501 502 ?> 503 <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> 504 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>"> 505 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li> 506 </ol> 507 508 <?php endif; // end IIS/Apache code branches. 509 510 if ( !is_multisite() ) { ?> 511 <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> 512 <?php 513 } 514 } 515 516 if ( $_POST ) { 517 518 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); 519 520 check_admin_referer( 'install-network-1' ); 521 522 require_once ( ABSPATH . 'wp-admin/includes/upgrade.php' ); 523 // create network tables 524 install_network(); 525 $hostname = get_clean_basedomain(); 526 $subdomain_install = !allow_subdomain_install() ? false : (bool) $_POST['subdomain_install']; 527 if ( ! network_domain_check() ) { 528 $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install ); 529 if ( is_wp_error( $result ) ) { 530 if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) 531 network_step2( $result ); 532 else 533 network_step1( $result ); 534 } else { 535 network_step2(); 536 } 537 } else { 538 network_step2(); 539 } 540 } elseif ( is_multisite() || network_domain_check() ) { 541 network_step2(); 542 } else { 543 network_step1(); 544 } 545 ?> 546 </div> 547 548 <?php include ( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jun 1 08:30:02 2011 |
Cross-referenced by PHPXref 0.7 Provided by Yoast and awesome WordPress Hosting |