X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/a5227bf01edbe6660486c9f5c0f0ed7b7fea3130..f9001779751f83dc8a10e478bfecb4d8dd5f964c:/wp-admin/network.php diff --git a/wp-admin/network.php b/wp-admin/network.php index a2951641..6a9aca33 100644 --- a/wp-admin/network.php +++ b/wp-admin/network.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_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 ) @@ -89,8 +95,13 @@ function get_clean_basedomain() { if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) wp_die( __( 'You must define the WP_ALLOW_MULTISITE 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, '

' . __('This screen allows you to configure a network as having subdomains (site1.example.com) or subdirectories (example.com/site1). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '

' . @@ -100,15 +111,15 @@ add_contextual_help($current_screen, '

' . __('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.') . '

' . '

' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with “/blog/” from the main site. This disabling will be addressed soon in a future version.') . '

' . '

' . __('For more information:') . '

' . - '

' . __('General Network Creation Documentation') . '

' . - '

' . __('Tools > Network Documentation') . '

' . + '

' . __('Documentation on Creating a Network') . '

' . + '

' . __('Documentation on the Network Screen') . '

' . '

' . __('Support Forums') . '

' ); -include( './admin-header.php' ); +include( ABSPATH . 'wp-admin/admin-header.php' ); ?>
- +

' . __('Error:') . ' ' . sprintf( __( 'Your WordPress address must match your Site address before creating a Network. See General Settings.' ), esc_url( admin_url( 'options-general.php' ) ) ) . '

'; echo ''; - include ('./admin-footer.php' ); + include ( ABSPATH . 'wp-admin/admin-footer.php' ); + die(); + } + + if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) { + echo '

' . __('Error:') . ' ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '

'; + echo ''; + include ( ABSPATH . 'wp-admin/admin-footer.php' ); die(); } @@ -134,7 +152,7 @@ function network_step1( $errors = false ) { if ( ! empty( $active_plugins ) ) { echo '

' . __('Warning:') . ' ' . sprintf( __( 'Please deactivate your plugins before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '

' . __( 'Once the network is created, you may reactivate your plugins.' ) . '

'; echo ''; - include( './admin-footer.php' ); + include( ABSPATH . 'wp-admin/admin-footer.php' ); die(); } @@ -145,7 +163,7 @@ function network_step1( $errors = false ) { echo '

' . sprintf( __( 'You cannot use port numbers such as %s.' ), $has_ports ) . '

'; echo '' . __( 'Return to Dashboard' ) . ''; echo ''; - include( './admin-footer.php' ); + include( ABSPATH . 'wp-admin/admin-footer.php' ); die(); } @@ -275,9 +293,9 @@ function network_step1( $errors = false ) { -

' />

+ - ' . $errors->get_error_message() . ''; 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(); ?> -

-

+get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); ?>

@@ -314,17 +339,19 @@ function network_step2( $errors = false ) {

Caution: We recommend you back up your existing wp-config.php file.' ); + if ( file_exists( ABSPATH . '.htaccess' ) ) + printf( __( 'Caution: We recommend you back up your existing wp-config.php and %s files.' ), '.htaccess' ); + elseif ( file_exists( ABSPATH . 'web.config' ) ) + printf( __( 'Caution: We recommend you back up your existing wp-config.php and %s files.' ), 'web.config' ); else - _e( 'Caution: We recommend you back up your existing wp-config.php and .htaccess files.' ); + _e( 'Caution: We recommend you back up your existing wp-config.php file.' ); ?>

  1. blogs.dir directory in %s. 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 blogs.dir directory at %s/blogs.dir. 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' ) echo ' ' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '

  2. @@ -344,26 +371,23 @@ define( 'BLOG_ID_CURRENT_SITE', 1 ); 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 ) { - $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 ) { - $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 ); ?>

    wp-config.php file.', 'These unique authentication keys are also missing from your wp-config.php file.', $num_keys_salts ); ?>

    - + @@ -430,7 +454,7 @@ define( 'BLOG_ID_CURRENT_SITE', 1 ); - + @@ -449,7 +473,7 @@ define( 'BLOG_ID_CURRENT_SITE', 1 ); ?>
  3. web.config file in %s, replacing other WordPress rules:' ), ABSPATH ); ?>

@@ -471,14 +495,14 @@ RewriteRule ^ - [L]'; // @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]"; ?>
  • .htaccess file in %s, replacing other WordPress rules:' ), ABSPATH ); ?>

  • + - +