wp/wp-admin/network.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    37  * @since 3.0.0
    37  * @since 3.0.0
    38  * @return Whether a network exists.
    38  * @return Whether a network exists.
    39  */
    39  */
    40 function network_domain_check() {
    40 function network_domain_check() {
    41 	global $wpdb;
    41 	global $wpdb;
    42 	if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
    42 
       
    43 	$sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );
       
    44 	if ( $wpdb->get_var( $sql ) ) {
    43 		return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );
    45 		return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );
       
    46 	}
    44 	return false;
    47 	return false;
    45 }
    48 }
    46 
    49 
    47 /**
    50 /**
    48  * Allow subdomain install
    51  * Allow subdomain install
   115 	'<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>' .
   118 	'<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>' .
   116 	'<p>' . __('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>' .
   119 	'<p>' . __('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>' .
   117 	'<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>' .
   120 	'<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>' .
   118 	'<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.') . '</p>' .
   121 	'<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.') . '</p>' .
   119 	'<p><strong>' . __('For more information:') . '</strong></p>' .
   122 	'<p><strong>' . __('For more information:') . '</strong></p>' .
   120 	'<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
   123 	'<p>' . __('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
   121 	'<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>';
   124 	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>';
   122 
   125 
   123 get_current_screen()->add_help_tab( array(
   126 get_current_screen()->add_help_tab( array(
   124 	'id'      => 'network',
   127 	'id'      => 'network',
   125 	'title'   => __('Network'),
   128 	'title'   => __('Network'),
   126 	'content' => $network_help,
   129 	'content' => $network_help,
   127 ) );
   130 ) );
   128 
   131 
   129 get_current_screen()->set_help_sidebar(
   132 get_current_screen()->set_help_sidebar(
   130 	'<p><strong>' . __('For more information:') . '</strong></p>' .
   133 	'<p><strong>' . __('For more information:') . '</strong></p>' .
   131 	'<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
   134 	'<p>' . __('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
   132 	'<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>' .
   135 	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>' .
   133 	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
   136 	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
   134 );
   137 );
   135 
   138 
   136 include( ABSPATH . 'wp-admin/admin-header.php' );
   139 include( ABSPATH . 'wp-admin/admin-header.php' );
   137 ?>
   140 ?>
   138 <div class="wrap">
   141 <div class="wrap">
   139 <?php screen_icon('tools'); ?>
       
   140 <h2><?php echo esc_html( $title ); ?></h2>
   142 <h2><?php echo esc_html( $title ); ?></h2>
   141 
   143 
   142 <?php
   144 <?php
   143 /**
   145 /**
   144  * Prints step 1 for Network installation process.
   146  * Prints step 1 for Network installation process.
   152 	global $is_apache;
   154 	global $is_apache;
   153 
   155 
   154 	if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) {
   156 	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>';
   157 		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>';
   158 		echo '</div>';
   157 		include ( ABSPATH . 'wp-admin/admin-footer.php' );
   159 		include( ABSPATH . 'wp-admin/admin-footer.php' );
   158 		die();
   160 		die();
   159 	}
   161 	}
   160 
   162 
   161 	$active_plugins = get_option( 'active_plugins' );
   163 	$active_plugins = get_option( 'active_plugins' );
   162 	if ( ! empty( $active_plugins ) ) {
   164 	if ( ! empty( $active_plugins ) ) {
   175 		echo '</div>';
   177 		echo '</div>';
   176 		include( ABSPATH . 'wp-admin/admin-footer.php' );
   178 		include( ABSPATH . 'wp-admin/admin-footer.php' );
   177 		die();
   179 		die();
   178 	}
   180 	}
   179 
   181 
   180 	echo '<form method="post" action="">';
   182 	echo '<form method="post">';
   181 
   183 
   182 	wp_nonce_field( 'install-network-1' );
   184 	wp_nonce_field( 'install-network-1' );
   183 
   185 
   184 	$error_codes = array();
   186 	$error_codes = array();
   185 	if ( is_wp_error( $errors ) ) {
   187 	if ( is_wp_error( $errors ) ) {
   218 		<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>
   220 		<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>
   219 		<p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>
   221 		<p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>
   220 		<?php // @todo: Link to an MS readme? ?>
   222 		<?php // @todo: Link to an MS readme? ?>
   221 		<table class="form-table">
   223 		<table class="form-table">
   222 			<tr>
   224 			<tr>
   223 				<th><label><input type='radio' name='subdomain_install' value='1'<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
   225 				<th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
   224 				<td><?php printf( _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ), $hostname ); ?></td>
   226 				<td><?php printf(
   225 			</tr>
   227 					/* translators: 1: hostname */
   226 			<tr>
   228 					_x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ),
   227 				<th><label><input type='radio' name='subdomain_install' value='0'<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>
   229 					$hostname
   228 				<td><?php printf( _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ), $hostname ); ?></td>
   230 				); ?></td>
       
   231 			</tr>
       
   232 			<tr>
       
   233 				<th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>
       
   234 				<td><?php printf(
       
   235 					/* translators: 1: hostname */
       
   236 					_x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ),
       
   237 					$hostname
       
   238 				); ?></td>
   229 			</tr>
   239 			</tr>
   230 		</table>
   240 		</table>
   231 
   241 
   232 <?php
   242 <?php
   233 	endif;
   243 	endif;
   290 		<?php endif; ?>
   300 		<?php endif; ?>
   291 			<tr>
   301 			<tr>
   292 				<th scope='row'><?php esc_html_e( 'Network Title' ); ?></th>
   302 				<th scope='row'><?php esc_html_e( 'Network Title' ); ?></th>
   293 				<td>
   303 				<td>
   294 					<input name='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' />
   304 					<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?' ); ?>
   305 					<p class="description">
       
   306 						<?php _e( 'What would you like to call your network?' ); ?>
       
   307 					</p>
   296 				</td>
   308 				</td>
   297 			</tr>
   309 			</tr>
   298 			<tr>
   310 			<tr>
   299 				<th scope='row'><?php esc_html_e( 'Admin E-mail Address' ); ?></th>
   311 				<th scope='row'><?php esc_html_e( 'Network Admin Email' ); ?></th>
   300 				<td>
   312 				<td>
   301 					<input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' />
   313 					<input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' />
   302 					<br /><?php _e( 'Your email address.' ); ?>
   314 					<p class="description">
       
   315 						<?php _e( 'Your email address.' ); ?>
       
   316 					</p>
   303 				</td>
   317 				</td>
   304 			</tr>
   318 			</tr>
   305 		</table>
   319 		</table>
   306 		<?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>
   320 		<?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>
   307 	</form>
   321 	</form>
   324 	$home_path         = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
   338 	$home_path         = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
   325 	$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
   339 	$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
   326 	$rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
   340 	$rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
   327 
   341 
   328 
   342 
   329 	$location_of_wp_config = ABSPATH;
   343 	$location_of_wp_config = $abspath_fix;
   330 	if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) )
   344 	if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
   331 		$location_of_wp_config = trailingslashit( dirname( ABSPATH ) );
   345 		$location_of_wp_config = dirname( $abspath_fix );
       
   346 	}
       
   347 	$location_of_wp_config = trailingslashit( $location_of_wp_config );
   332 
   348 
   333 	// Wildcard DNS message.
   349 	// Wildcard DNS message.
   334 	if ( is_wp_error( $errors ) )
   350 	if ( is_wp_error( $errors ) )
   335 		echo '<div class="error">' . $errors->get_error_message() . '</div>';
   351 		echo '<div class="error">' . $errors->get_error_message() . '</div>';
   336 
   352 
   373 <?php
   389 <?php
   374 	}
   390 	}
   375 ?>
   391 ?>
   376 		<ol>
   392 		<ol>
   377 			<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&#8217;s all, stop editing! Happy blogging. */</code>:' ), $location_of_wp_config ); ?></p>
   393 			<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&#8217;s all, stop editing! Happy blogging. */</code>:' ), $location_of_wp_config ); ?></p>
   378 				<textarea class="code" readonly="readonly" cols="100" rows="6">
   394 				<textarea class="code" readonly="readonly" cols="100" rows="7">
   379 define('MULTISITE', true);
   395 define('MULTISITE', true);
   380 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>);
   396 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>);
   381 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>');
   397 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>');
   382 define('PATH_CURRENT_SITE', '<?php echo $base; ?>');
   398 define('PATH_CURRENT_SITE', '<?php echo $base; ?>');
   383 define('SITE_ID_CURRENT_SITE', 1);
   399 define('SITE_ID_CURRENT_SITE', 1);
   384 define('BLOG_ID_CURRENT_SITE', 1);</textarea>
   400 define('BLOG_ID_CURRENT_SITE', 1);
       
   401 </textarea>
   385 <?php
   402 <?php
   386 	$keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' );
   403 	$keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' );
   387 	foreach ( $keys_salts as $c => $v ) {
   404 	foreach ( $keys_salts as $c => $v ) {
   388 		if ( defined( $c ) )
   405 		if ( defined( $c ) )
   389 			unset( $keys_salts[ $c ] );
   406 			unset( $keys_salts[ $c ] );
   402 				$keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
   419 				$keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
   403 			}
   420 			}
   404 		}
   421 		}
   405 		$num_keys_salts = count( $keys_salts );
   422 		$num_keys_salts = count( $keys_salts );
   406 ?>
   423 ?>
   407 	<p><?php
   424 	<p>
   408 		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>
   425 		<?php
       
   426 			if ( 1 == $num_keys_salts ) {
       
   427 				_e( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.' );
       
   428 			} else {
       
   429 				_e( 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.' );
       
   430 			}
       
   431 		?>
       
   432 		<?php _e( 'To make your installation more secure, you should also add:' ); ?>
       
   433 	</p>
   409 	<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
   434 	<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
   410 <?php
   435 <?php
   411 	}
   436 	}
   412 ?>
   437 ?>
   413 </li>
   438 </li>
   429                 </rule>';
   454                 </rule>';
   430 				if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
   455 				if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
   431 					$web_config_file .= '
   456 					$web_config_file .= '
   432                 <rule name="WordPress Rule for Files" stopProcessing="true">
   457                 <rule name="WordPress Rule for Files" stopProcessing="true">
   433                     <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />
   458                     <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />
   434                     <action type="Rewrite" url="' . $iis_rewrite_base . 'wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
   459                     <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" />
   435                 </rule>';
   460                 </rule>';
   436                 }
   461                 }
   437                 $web_config_file .= '
   462                 $web_config_file .= '
   438                 <rule name="WordPress Rule 2" stopProcessing="true">
   463                 <rule name="WordPress Rule 2" stopProcessing="true">
   439                     <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" />
   464                     <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" />
   460                     <action type="Rewrite" url="index.php" />
   485                     <action type="Rewrite" url="index.php" />
   461                 </rule>
   486                 </rule>
   462             </rules>
   487             </rules>
   463         </rewrite>
   488         </rewrite>
   464     </system.webServer>
   489     </system.webServer>
   465 </configuration>';
   490 </configuration>
   466 
   491 ';
   467 	?>
   492 
   468 		<li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), $home_path ); ?></p>
   493 		echo '<li><p>';
   469 		<?php
   494 		/* translators: 1: a filename like .htaccess. 2: a file path. */
       
   495 		printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
       
   496 			'<code>web.config</code>', '<code>' . $home_path . '</code>' );
       
   497 		echo '</p>';
   470 		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
   498 		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
   471 			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
   499 			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
   472 		?>
   500 		?>
   473 		<textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?>
   501 		<textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?>
   474 		</textarea></li>
   502 		</textarea></li>
   477 	<?php else : // end iis7_supports_permalinks(). construct an htaccess file instead:
   505 	<?php else : // end iis7_supports_permalinks(). construct an htaccess file instead:
   478 
   506 
   479 		$ms_files_rewriting = '';
   507 		$ms_files_rewriting = '';
   480 		if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
   508 		if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
   481 			$ms_files_rewriting = "\n# uploaded files\nRewriteRule ^";
   509 			$ms_files_rewriting = "\n# uploaded files\nRewriteRule ^";
   482 			$ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}wp-includes/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
   510 			$ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
   483 		}
   511 		}
   484 
   512 
   485 		$htaccess_file = <<<EOF
   513 		$htaccess_file = <<<EOF
   486 RewriteEngine On
   514 RewriteEngine On
   487 RewriteBase {$base}
   515 RewriteBase {$base}
   494 RewriteCond %{REQUEST_FILENAME} -d
   522 RewriteCond %{REQUEST_FILENAME} -d
   495 RewriteRule ^ - [L]
   523 RewriteRule ^ - [L]
   496 RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L]
   524 RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L]
   497 RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L]
   525 RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L]
   498 RewriteRule . index.php [L]
   526 RewriteRule . index.php [L]
       
   527 
   499 EOF;
   528 EOF;
   500 
   529 
   501 		?>
   530 		echo '<li><p>';
   502 		<li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), $home_path ); ?></p>
   531 		/* translators: 1: a filename like .htaccess. 2: a file path. */
   503 		<?php
   532 		printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
       
   533 			'<code>.htaccess</code>', '<code>' . $home_path . '</code>' );
       
   534 		echo '</p>';
   504 		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
   535 		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
   505 			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
   536 			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
   506 		?>
   537 		?>
   507 		<textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>">
   538 		<textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>">
   508 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li>
   539 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li>
   509 		</ol>
   540 		</ol>
   510 
   541 
   511 	<?php endif; // end IIS/Apache code branches.
   542 	<?php endif; // end IIS/Apache code branches.
   512 
   543 
   513 	if ( !is_multisite() ) { ?>
   544 	if ( !is_multisite() ) { ?>
   514 		<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>
   545 		<p><?php _e( '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>
   515 <?php
   546 <?php
   516 	}
   547 	}
   517 }
   548 }
   518 
   549 
   519 if ( $_POST ) {
   550 if ( $_POST ) {
   520 
   551 
   521 	check_admin_referer( 'install-network-1' );
   552 	check_admin_referer( 'install-network-1' );
   522 
   553 
   523 	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
   554 	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
   524 	// create network tables
   555 	// Create network tables.
   525 	install_network();
   556 	install_network();
   526 	$base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
   557 	$base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
   527 	$subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false;
   558 	$subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false;
   528 	if ( ! network_domain_check() ) {
   559 	if ( ! network_domain_check() ) {
   529 		$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
   560 		$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );