X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..ac7339a398e6df50f722bc9616291ce5447d8e5e:/wp-admin/network.php diff --git a/wp-admin/network.php b/wp-admin/network.php index 2931cbbc..fdc0a51b 100644 --- a/wp-admin/network.php +++ b/wp-admin/network.php @@ -13,7 +13,7 @@ define( 'WP_INSTALLING_NETWORK', true ); /** WordPress Administration Bootstrap */ -require_once( './admin.php' ); +require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! is_super_admin() ) wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); @@ -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; } @@ -51,20 +54,27 @@ function network_domain_check() { * @return bool Whether subdomain install is allowed */ function allow_subdomain_install() { - $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'siteurl' ) ); - if( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) ) + $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); + if( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) return false; return true; } /** - * Allow subdirectory install + * Allow subdirectory install. * * @since 3.0.0 * @return bool Whether subdirectory install is allowed */ function allow_subdirectory_install() { global $wpdb; + /** + * Filter whether to enable the subdirectory install feature in Multisite. + * + * @since 3.0.0 + * + * @param bool true Whether to enable the subdirectory install feature in Multisite. Default is false. + */ if ( apply_filters( 'allow_subdirectory_install', false ) ) return true; @@ -106,12 +116,12 @@ if ( is_network_admin() ) { $network_help = '
' . __('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.') . '
' . __('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).') . '
' . '' . __('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.') . '
' . - '' . __('Add a blogs.dir
directory under /wp-content
and add the designated lines of code to wp-config.php (just before /*...stop editing...*/
) and .htaccess
(replacing the existing WordPress rules).') . '
' . __('Add the designated lines of code to wp-config.php (just before /*...stop editing...*/
) and .htaccess
(replacing the existing WordPress rules).') . '
' . __('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.') . '
' . '' . __('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 in a future version.') . '
' . '' . __('For more information:') . '
' . - '' . __('Documentation on Creating a Network') . '
' . - '' . __('Documentation on the Network Screen') . '
'; + '' . __('Documentation on Creating a Network') . '
' . + '' . __('Documentation on the Network Screen') . '
'; get_current_screen()->add_help_tab( array( 'id' => 'network', @@ -121,15 +131,14 @@ get_current_screen()->add_help_tab( array( get_current_screen()->set_help_sidebar( '' . __('For more information:') . '
' . - '' . __('Documentation on Creating a Network') . '
' . - '' . __('Documentation on the Network Screen') . '
' . - '' . __('Support Forums') . '
' + '' . __('Documentation on Creating a Network') . '
' . + '' . __('Documentation on the Network Screen') . '
' . + '' . __('Support Forums') . '
' ); 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' ) ) ) . '
' . __('ERROR:') . ' ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '