Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r15225 r17323  
    1919        wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
    2020
    21 if ( is_multisite() && ! defined( 'MULTISITE' ) )
    22         wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
     21if ( 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}
    2329
    2430// We need to create references to ms global tables to enable Network.
     
    9096        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.' ) );
    9197
    92 $title = __( 'Create a Network of WordPress Sites' );
    93 $parent_file = 'tools.php';
     98if ( 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}
    94105
    95106add_contextual_help($current_screen,
     
    101112        '<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>' .
    102113        '<p><strong>' . __('For more information:') . '</strong></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>' .
     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>' .
    105116        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    106117);
    107118
    108 include( './admin-header.php' );
     119include( ABSPATH . 'wp-admin/admin-header.php' );
    109120?>
    110121<div class="wrap">
    111 <?php screen_icon(); ?>
     122<?php screen_icon('tools'); ?>
    112123<h2><?php echo esc_html( $title ); ?></h2>
    113124
     
    127138                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>';
    128139                echo '</div>';
    129                 include ('./admin-footer.php' );
     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' );
    130148                die();
    131149        }
     
    135153                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>';
    136154                echo '</div>';
    137                 include( './admin-footer.php' );
     155                include( ABSPATH . 'wp-admin/admin-footer.php' );
    138156                die();
    139157        }
     
    146164                echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';
    147165                echo '</div>';
    148                 include( './admin-footer.php' );
     166                include( ABSPATH . 'wp-admin/admin-footer.php' );
    149167                die();
    150168        }
     
    276294                        </tr>
    277295                </table>
    278                 <p class='submit'><input class="button-primary" name='submit' type='submit' value='<?php esc_attr_e( 'Install' ); ?>' /></p>
     296                <?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>
    279297        </form>
    280                 <?php
     298        <?php
    281299}
    282300
     
    290308        $hostname = get_clean_basedomain();
    291309
     310        if ( ! isset( $base ) )
     311                $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
     312
    292313        // Wildcard DNS message.
    293314        if ( is_wp_error( $errors ) )
     
    295316
    296317        if ( $_POST ) {
    297                 $subdomain_install = allow_subdomain_install() ? ( allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true ) : false;
     318                if ( allow_subdomain_install() )
     319                        $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
     320                else
     321                        $subdomain_install = false;
    298322        } else {
    299323                if ( is_multisite() ) {
    300324                        $subdomain_install = is_subdomain_install();
    301325?>
    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 {
     326        <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
     327<?php
     328                } else {
    304329                        $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
    305330?>
     
    315340                <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
    316341                <div class="updated inline"><p><?php
    317                         if ( iis7_supports_permalinks() )
     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
    318347                                _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
    319                         else
    320                                 _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>.htaccess</code> files.' );
    321348                ?></p></div>
    322349<?php
     
    325352                <ol>
    326353                        <li><p><?php
    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 );
     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 );
    328355                                if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
    329356                                        echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong';
     
    345372        }
    346373        if ( ! empty( $keys_salts ) ) {
     374                $keys_salts_str = '';
    347375                $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
    348376                if ( is_wp_error( $from_api ) ) {
    349377                        foreach ( $keys_salts as $c => $v ) {
    350                                 $keys_salts[ $c ] = wp_generate_password( 64, true, true );
     378                                $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );";
    351379                        }
    352380                } else {
    353381                        $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) );
    354382                        foreach ( $keys_salts as $c => $v ) {
    355                                 $keys_salts[ $c ] = substr( array_shift( $from_api ), 28, 64 );
     383                                $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
    356384                        }
    357385                }
     
    360388        <p><?php
    361389                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>
    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>
     390        <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
    367391<?php
    368392        }
     
    431455                </rule>
    432456                <rule name="WordPress Rule 5" stopProcessing="true">
    433                     <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
     457                    <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" />
    434458                    <action type="Rewrite" url="{R:2}" />
    435459                </rule>
     
    450474                <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
    451475                <textarea class="code" readonly="readonly" cols="100" rows="20">
    452                 <?php echo wp_htmledit_pre( $web_config_file ); ?>
     476                <?php echo esc_textarea( $web_config_file ); ?>
    453477                </textarea></li>
    454478                </ol>
     
    472496                // @todo custom content dir.
    473497                if ( ! $subdomain_install )
    474                         $htaccess_file .= "\nRewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]\nRewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]";
     498                        $htaccess_file .= "\nRewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]\nRewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]";
    475499
    476500                $htaccess_file .= "\nRewriteRule . index.php [L]";
     
    479503                <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
    480504                <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>">
    481 <?php echo wp_htmledit_pre( $htaccess_file ); ?></textarea></li>
     505<?php echo esc_textarea( $htaccess_file ); ?></textarea></li>
    482506                </ol>
    483507
     
    490514}
    491515
    492 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
    493 
    494516if ( $_POST ) {
     517
     518        $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
     519
    495520        check_admin_referer( 'install-network-1' );
    496521
     
    521546</div>
    522547
    523 <?php include( './admin-footer.php' ); ?>
     548<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Note: See TracChangeset for help on using the changeset viewer.