Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network.php

    r17323 r15225  
    1919        wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
    2020
    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 }
     21if ( is_multisite() && ! defined( 'MULTISITE' ) )
     22        wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
    2923
    3024// We need to create references to ms global tables to enable Network.
    … …  
    9690        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.' ) );
    9791
    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 }
     92$title = __( 'Create a Network of WordPress Sites' );
     93$parent_file = 'tools.php';
    10594
    10695add_contextual_help($current_screen,
    … …  
    112101        '<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>' .
    113102        '<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_SubPanel" target="_blank">Documentation on the Network Screen</a>') . '</p>' .
     103        '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">General Network Creation Documentation</a>') . '</p>' .
     104        '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_SubPanel" target="_blank">Tools > Network Documentation</a>') . '</p>' .
    116105        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    117106);
    118107
    119 include( ABSPATH . 'wp-admin/admin-header.php' );
     108include( './admin-header.php' );
    120109?>
    121110<div class="wrap">
    122 <?php screen_icon('tools'); ?>
     111<?php screen_icon(); ?>
    123112<h2><?php echo esc_html( $title ); ?></h2>
    124113
    … …  
    138127                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>';
    139128                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' );
     129                include ('./admin-footer.php' );
    148130                die();
    149131        }
    … …  
    153135                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>';
    154136                echo '</div>';
    155                 include( ABSPATH . 'wp-admin/admin-footer.php' );
     137                include( './admin-footer.php' );
    156138                die();
    157139        }
    … …  
    164146                echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';
    165147                echo '</div>';
    166                 include( ABSPATH . 'wp-admin/admin-footer.php' );
     148                include( './admin-footer.php' );
    167149                die();
    168150        }
    … …  
    294276                        </tr>
    295277                </table>
    296                 <?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>
     278                <p class='submit'><input class="button-primary" name='submit' type='submit' value='<?php esc_attr_e( 'Install' ); ?>' /></p>
    297279        </form>
    298         <?php
     280                <?php
    299281}
    300282
    … …  
    308290        $hostname = get_clean_basedomain();
    309291
    310         if ( ! isset( $base ) )
    311                 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
    312 
    313292        // Wildcard DNS message.
    314293        if ( is_wp_error( $errors ) )
    … …  
    316295
    317296        if ( $_POST ) {
    318                 if ( allow_subdomain_install() )
    319                         $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
    320                 else
    321                         $subdomain_install = false;
     297                $subdomain_install = allow_subdomain_install() ? ( allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true ) : false;
    322298        } else {
    323299                if ( is_multisite() ) {
    324300                        $subdomain_install = is_subdomain_install();
    325301?>
    326         <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
    327 <?php
    328                 } else {
     302        <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>
     303<?php   } else {
    329304                        $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
    330305?>
    … …  
    340315                <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
    341316                <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' );
     317                        if ( iis7_supports_permalinks() )
     318                                _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
    346319                        else
    347                                 _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
     320                                _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>.htaccess</code> files.' );
    348321                ?></p></div>
    349322<?php
    … …  
    352325                <ol>
    353326                        <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 );
     327                                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 );
    355328                                if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
    356329                                        echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong';
    … …  
    372345        }
    373346        if ( ! empty( $keys_salts ) ) {
    374                 $keys_salts_str = '';
    375347                $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
    376348                if ( is_wp_error( $from_api ) ) {
    377349                        foreach ( $keys_salts as $c => $v ) {
    378                                 $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );";
     350                                $keys_salts[ $c ] = wp_generate_password( 64, true, true );
    379351                        }
    380352                } else {
    381353                        $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) );
    382354                        foreach ( $keys_salts as $c => $v ) {
    383                                 $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
     355                                $keys_salts[ $c ] = substr( array_shift( $from_api ), 28, 64 );
    384356                        }
    385357                }
    … …  
    388360        <p><?php
    389361                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>
     362        <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php
     363        foreach ( $keys_salts as $c => $v ) {
     364                echo "\ndefine( '$c', '$v' );";
     365        }
     366?></textarea>
    391367<?php
    392368        }
    … …  
    455431                </rule>
    456432                <rule name="WordPress Rule 5" stopProcessing="true">
    457                     <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" />
     433                    <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
    458434                    <action type="Rewrite" url="{R:2}" />
    459435                </rule>
    … …  
    474450                <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
    475451                <textarea class="code" readonly="readonly" cols="100" rows="20">
    476                 <?php echo esc_textarea( $web_config_file ); ?>
     452                <?php echo wp_htmledit_pre( $web_config_file ); ?>
    477453                </textarea></li>
    478454                </ol>
    … …  
    496472                // @todo custom content dir.
    497473                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]";
     474                        $htaccess_file .= "\nRewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]\nRewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]";
    499475
    500476                $htaccess_file .= "\nRewriteRule . index.php [L]";
    … …  
    503479                <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
    504480                <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>">
    505 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li>
     481<?php echo wp_htmledit_pre( $htaccess_file ); ?></textarea></li>
    506482                </ol>
    507483
    … …  
    514490}
    515491
     492$base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
     493
    516494if ( $_POST ) {
    517 
    518         $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
    519 
    520495        check_admin_referer( 'install-network-1' );
    521496
    … …  
    546521</div>
    547522
    548 <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
     523<?php include( './admin-footer.php' ); ?>
Note: See TracChangeset for help on using the changeset viewer.