]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/network.php
Wordpress 3.3.1-scripts
[autoinstalls/wordpress.git] / wp-admin / network.php
index a2951641f82a9530d79229b0344a37b921b7d894..a3b09e8182ec0bf15627c9e3cc69e78f9e138a74 100644 (file)
@@ -10,7 +10,7 @@
  * @subpackage Administration
  */
 
  * @subpackage Administration
  */
 
-define( 'WP_NETWORK_ADMIN_PAGE', true );
+define( 'WP_INSTALLING_NETWORK', true );
 
 /** WordPress Administration Bootstrap */
 require_once( './admin.php' );
 
 /** WordPress Administration Bootstrap */
 require_once( './admin.php' );
@@ -18,8 +18,14 @@ require_once( './admin.php' );
 if ( ! is_super_admin() )
        wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
 
 if ( ! is_super_admin() )
        wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
 
-if ( is_multisite() && ! defined( 'MULTISITE' ) )
-       wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
+if ( is_multisite() ) {
+       if ( ! is_network_admin() ) {
+               wp_redirect( network_admin_url( 'setup.php' ) );
+               exit;
+       }
+       if ( ! defined( 'MULTISITE' ) )
+               wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
+}
 
 // We need to create references to ms global tables to enable Network.
 foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table )
 
 // We need to create references to ms global tables to enable Network.
 foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table )
@@ -89,26 +95,41 @@ function get_clean_basedomain() {
 if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) )
        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.' ) );
 
 if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) )
        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.' ) );
 
-$title = __( 'Create a Network of WordPress Sites' );
-$parent_file = 'tools.php';
+if ( is_network_admin() ) {
+       $title = __( 'Network Setup' );
+       $parent_file = 'settings.php';
+} else {
+       $title = __( 'Create a Network of WordPress Sites' );
+       $parent_file = 'tools.php';
+}
 
 
-add_contextual_help($current_screen,
-       '<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>' .
+$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>' .
        '<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>' .
        '<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>' .
-       '<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>' .
+       '<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>' .
        '<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>' .
        '<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>' .
-       '<p>' . __('Refreshing your browser will take you to a screen with an archive of those added lines of code. A set of six links under Super Admin will appear at the top of the main left navigation menu. The multisite network is now enabled.') . '</p>' .
-       '<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 soon in a future version.') . '</p>' .
+       '<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>' .
+       '<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>' .
+       '<p><strong>' . __('For more information:') . '</strong></p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>';
+
+get_current_screen()->add_help_tab( array(
+       'id'      => 'network',
+       'title'   => __('Network'),
+       'content' => $network_help,
+) );
+
+get_current_screen()->set_help_sidebar(
        '<p><strong>' . __('For more information:') . '</strong></p>' .
        '<p><strong>' . __('For more information:') . '</strong></p>' .
-       '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">General Network Creation Documentation</a>') . '</p>' .
-       '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_SubPanel" target="_blank">Tools > Network Documentation</a>') . '</p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
+       '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>' .
        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
 );
 
        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
 );
 
-include( './admin-header.php' );
+include( ABSPATH . 'wp-admin/admin-header.php' );
 ?>
 <div class="wrap">
 ?>
 <div class="wrap">
-<?php screen_icon(); ?>
+<?php screen_icon('tools'); ?>
 <h2><?php echo esc_html( $title ); ?></h2>
 
 <?php
 <h2><?php echo esc_html( $title ); ?></h2>
 
 <?php
@@ -124,9 +145,16 @@ function network_step1( $errors = false ) {
        global $is_apache;
 
        if ( get_option( 'siteurl' ) != get_option( 'home' ) ) {
        global $is_apache;
 
        if ( get_option( 'siteurl' ) != get_option( 'home' ) ) {
-               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>';
+               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>';
+               echo '</div>';
+               include ( ABSPATH . 'wp-admin/admin-footer.php' );
+               die();
+       }
+
+       if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) {
+               echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>';
                echo '</div>';
                echo '</div>';
-               include ('./admin-footer.php' );
+               include ( ABSPATH . 'wp-admin/admin-footer.php' );
                die();
        }
 
                die();
        }
 
@@ -134,18 +162,18 @@ function network_step1( $errors = false ) {
        if ( ! empty( $active_plugins ) ) {
                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>';
                echo '</div>';
        if ( ! empty( $active_plugins ) ) {
                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>';
                echo '</div>';
-               include( './admin-footer.php' );
+               include( ABSPATH . 'wp-admin/admin-footer.php' );
                die();
        }
 
        $hostname = get_clean_basedomain();
        $has_ports = strstr( $hostname, ':' );
        if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {
                die();
        }
 
        $hostname = get_clean_basedomain();
        $has_ports = strstr( $hostname, ':' );
        if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {
-               echo '<div class="error"><p><strong>' . __( 'Error:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
+               echo '<div class="error"><p><strong>' . __( 'ERROR:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
                echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>';
                echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';
                echo '</div>';
                echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>';
                echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';
                echo '</div>';
-               include( './admin-footer.php' );
+               include( ABSPATH . 'wp-admin/admin-footer.php' );
                die();
        }
 
                die();
        }
 
@@ -211,7 +239,7 @@ function network_step1( $errors = false ) {
                if ( $is_www ) :
                ?>
                <h3><?php esc_html_e( 'Server Address' ); ?></h3>
                if ( $is_www ) :
                ?>
                <h3><?php esc_html_e( 'Server Address' ); ?></h3>
-               <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>
+               <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>
                <table class="form-table">
                        <tr>
                                <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
                <table class="form-table">
                        <tr>
                                <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
@@ -275,9 +303,9 @@ function network_step1( $errors = false ) {
                                </td>
                        </tr>
                </table>
                                </td>
                        </tr>
                </table>
-               <p class='submit'><input class="button-primary" name='submit' type='submit' value='<?php esc_attr_e( 'Install' ); ?>' /></p>
+               <?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>
        </form>
        </form>
-               <?php
+       <?php
 }
 
 /**
 }
 
 /**
@@ -289,18 +317,25 @@ function network_step2( $errors = false ) {
        global $base, $wpdb;
        $hostname = get_clean_basedomain();
 
        global $base, $wpdb;
        $hostname = get_clean_basedomain();
 
+       if ( ! isset( $base ) )
+               $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
+
        // Wildcard DNS message.
        if ( is_wp_error( $errors ) )
                echo '<div class="error">' . $errors->get_error_message() . '</div>';
 
        if ( $_POST ) {
        // Wildcard DNS message.
        if ( is_wp_error( $errors ) )
                echo '<div class="error">' . $errors->get_error_message() . '</div>';
 
        if ( $_POST ) {
-               $subdomain_install = allow_subdomain_install() ? ( allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true ) : false;
+               if ( allow_subdomain_install() )
+                       $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
+               else
+                       $subdomain_install = false;
        } else {
                if ( is_multisite() ) {
                        $subdomain_install = is_subdomain_install();
 ?>
        } else {
                if ( is_multisite() ) {
                        $subdomain_install = is_subdomain_install();
 ?>
-       <div class="updated"><p><strong><?php _e( 'Notice: The Network feature is already enabled.' ); ?></strong> <?php _e( 'The original configuration steps are shown here for reference.' ); ?></p></div>
-<?php  } else {
+       <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
+<?php
+               } else {
                        $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
 ?>
        <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
                        $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
 ?>
        <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
@@ -314,19 +349,21 @@ function network_step2( $errors = false ) {
                <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
                <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
                <div class="updated inline"><p><?php
                <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
                <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
                <div class="updated inline"><p><?php
-                       if ( iis7_supports_permalinks() )
-                               _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
+                       if ( file_exists( ABSPATH . '.htaccess' ) )
+                               printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' );
+                       elseif ( file_exists( ABSPATH . 'web.config' ) )
+                               printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' );
                        else
                        else
-                               _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>.htaccess</code> files.' );
+                               _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
                ?></p></div>
 <?php
        }
 ?>
                <ol>
                        <li><p><?php
                ?></p></div>
 <?php
        }
 ?>
                <ol>
                        <li><p><?php
-                               printf( __( 'Create a <code>blogs.dir</code> directory in <code>%s</code>. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR );
+                               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 );
                                if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
                                if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
-                                       echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong';
+                                       echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong>';
                        ?></p></li>
                        <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>:' ), ABSPATH ); ?></p>
                                <textarea class="code" readonly="readonly" cols="100" rows="7">
                        ?></p></li>
                        <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>:' ), ABSPATH ); ?></p>
                                <textarea class="code" readonly="readonly" cols="100" rows="7">
@@ -344,26 +381,23 @@ define( 'BLOG_ID_CURRENT_SITE', 1 );</textarea>
                        unset( $keys_salts[ $c ] );
        }
        if ( ! empty( $keys_salts ) ) {
                        unset( $keys_salts[ $c ] );
        }
        if ( ! empty( $keys_salts ) ) {
+               $keys_salts_str = '';
                $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
                if ( is_wp_error( $from_api ) ) {
                        foreach ( $keys_salts as $c => $v ) {
                $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
                if ( is_wp_error( $from_api ) ) {
                        foreach ( $keys_salts as $c => $v ) {
-                               $keys_salts[ $c ] = wp_generate_password( 64, true, true );
+                               $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );";
                        }
                } else {
                        $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) );
                        foreach ( $keys_salts as $c => $v ) {
                        }
                } else {
                        $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) );
                        foreach ( $keys_salts as $c => $v ) {
-                               $keys_salts[ $c ] = substr( array_shift( $from_api ), 28, 64 );
+                               $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
                        }
                }
                $num_keys_salts = count( $keys_salts );
 ?>
        <p><?php
                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>
                        }
                }
                $num_keys_salts = count( $keys_salts );
 ?>
        <p><?php
                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>
-       <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php
-       foreach ( $keys_salts as $c => $v ) {
-               echo "\ndefine( '$c', '$v' );";
-       }
-?></textarea>
+       <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
 <?php
        }
 ?>
 <?php
        }
 ?>
@@ -430,8 +464,8 @@ define( 'BLOG_ID_CURRENT_SITE', 1 );</textarea>
                     <action type="None" />
                 </rule>
                 <rule name="WordPress Rule 5" stopProcessing="true">
                     <action type="None" />
                 </rule>
                 <rule name="WordPress Rule 5" stopProcessing="true">
-                    <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
-                    <action type="Rewrite" url="{R:2}" />
+                    <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" />
+                    <action type="Rewrite" url="{R:1}" />
                 </rule>
                 <rule name="WordPress Rule 6" stopProcessing="true">
                     <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                 </rule>
                 <rule name="WordPress Rule 6" stopProcessing="true">
                     <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
@@ -449,7 +483,7 @@ define( 'BLOG_ID_CURRENT_SITE', 1 );</textarea>
        ?>
                <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
                <textarea class="code" readonly="readonly" cols="100" rows="20">
        ?>
                <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
                <textarea class="code" readonly="readonly" cols="100" rows="20">
-               <?php echo wp_htmledit_pre( $web_config_file ); ?>
+               <?php echo esc_textarea( $web_config_file ); ?>
                </textarea></li>
                </ol>
 
                </textarea></li>
                </ol>
 
@@ -471,14 +505,14 @@ RewriteRule ^ - [L]';
 
                // @todo custom content dir.
                if ( ! $subdomain_install )
 
                // @todo custom content dir.
                if ( ! $subdomain_install )
-                       $htaccess_file .= "\nRewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]\nRewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]";
+                       $htaccess_file .= "\nRewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]\nRewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]";
 
                $htaccess_file .= "\nRewriteRule . index.php [L]";
 
                ?>
                <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
                <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>">
 
                $htaccess_file .= "\nRewriteRule . index.php [L]";
 
                ?>
                <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
                <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>">
-<?php echo wp_htmledit_pre( $htaccess_file ); ?></textarea></li>
+<?php echo esc_textarea( $htaccess_file ); ?></textarea></li>
                </ol>
 
        <?php endif; // end IIS/Apache code branches.
                </ol>
 
        <?php endif; // end IIS/Apache code branches.
@@ -489,16 +523,17 @@ RewriteRule ^ - [L]';
        }
 }
 
        }
 }
 
-$base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
-
 if ( $_POST ) {
 if ( $_POST ) {
+
+       $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
+
        check_admin_referer( 'install-network-1' );
 
        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
        // create network tables
        install_network();
        $hostname = get_clean_basedomain();
        check_admin_referer( 'install-network-1' );
 
        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
        // create network tables
        install_network();
        $hostname = get_clean_basedomain();
-       $subdomain_install = !allow_subdomain_install() ? false : (bool) $_POST['subdomain_install'];
+       $subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false;
        if ( ! network_domain_check() ) {
                $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install );
                if ( is_wp_error( $result ) ) {
        if ( ! network_domain_check() ) {
                $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install );
                if ( is_wp_error( $result ) ) {
@@ -520,4 +555,4 @@ if ( $_POST ) {
 ?>
 </div>
 
 ?>
 </div>
 
-<?php include( './admin-footer.php' ); ?>
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>