]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/network.php
WordPress 4.1-scripts
[autoinstalls/wordpress.git] / wp-admin / network.php
index c7b115f6fa9d2a879e9383e414807d1a84a82936..051295a1047b2e13e3402b00254f7b0e11d0738f 100644 (file)
@@ -39,8 +39,11 @@ foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table )
  */
 function network_domain_check() {
        global $wpdb;
-       if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
+
+       $sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );
+       if ( $wpdb->get_var( $sql ) ) {
                return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );
+       }
        return false;
 }
 
@@ -153,7 +156,7 @@ function network_step1( $errors = false ) {
        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>';
-               include ( ABSPATH . 'wp-admin/admin-footer.php' );
+               include( ABSPATH . 'wp-admin/admin-footer.php' );
                die();
        }
 
@@ -219,11 +222,11 @@ function network_step1( $errors = false ) {
                <?php // @todo: Link to an MS readme? ?>
                <table class="form-table">
                        <tr>
-                               <th><label><input type='radio' name='subdomain_install' value='1'<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
+                               <th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
                                <td><?php printf( _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ), $hostname ); ?></td>
                        </tr>
                        <tr>
-                               <th><label><input type='radio' name='subdomain_install' value='0'<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>
+                               <th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>
                                <td><?php printf( _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ), $hostname ); ?></td>
                        </tr>
                </table>
@@ -380,13 +383,14 @@ function network_step2( $errors = false ) {
 ?>
                <ol>
                        <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>
-                               <textarea class="code" readonly="readonly" cols="100" rows="6">
+                               <textarea class="code" readonly="readonly" cols="100" rows="7">
 define('MULTISITE', true);
 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>);
 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>');
 define('PATH_CURRENT_SITE', '<?php echo $base; ?>');
 define('SITE_ID_CURRENT_SITE', 1);
-define('BLOG_ID_CURRENT_SITE', 1);</textarea>
+define('BLOG_ID_CURRENT_SITE', 1);
+</textarea>
 <?php
        $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' );
        foreach ( $keys_salts as $c => $v ) {
@@ -436,7 +440,7 @@ define('BLOG_ID_CURRENT_SITE', 1);</textarea>
                                        $web_config_file .= '
                 <rule name="WordPress Rule for Files" stopProcessing="true">
                     <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />
-                    <action type="Rewrite" url="' . $iis_rewrite_base . 'wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
+                    <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" />
                 </rule>';
                 }
                 $web_config_file .= '
@@ -467,7 +471,8 @@ define('BLOG_ID_CURRENT_SITE', 1);</textarea>
             </rules>
         </rewrite>
     </system.webServer>
-</configuration>';
+</configuration>
+';
 
                echo '<li><p>';
                /* translators: 1: a filename like .htaccess. 2: a file path. */
@@ -486,7 +491,7 @@ define('BLOG_ID_CURRENT_SITE', 1);</textarea>
                $ms_files_rewriting = '';
                if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
                        $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^";
-                       $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}wp-includes/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
+                       $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
                }
 
                $htaccess_file = <<<EOF
@@ -503,6 +508,7 @@ RewriteRule ^ - [L]
 RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L]
 RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L]
 RewriteRule . index.php [L]
+
 EOF;
 
                echo '<li><p>';
@@ -530,7 +536,7 @@ if ( $_POST ) {
        check_admin_referer( 'install-network-1' );
 
        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
-       // create network tables
+       // Create network tables.
        install_network();
        $base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
        $subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false;