diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index 58778ec7b8..1646309e9f 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -732,7 +732,7 @@ function site_admin_notice() { add_action( 'admin_notices', 'site_admin_notice' ); function avoid_blog_page_permalink_collision( $data, $postarr ) { - if( constant( 'VHOST' ) == 'yes' ) + if( is_subdomain_install() ) return $data; if( $data[ 'post_type' ] != 'page' ) return $data; diff --git a/wp-admin/ms-edit.php b/wp-admin/ms-edit.php index c26f6ca6a7..22ba6a85d0 100644 --- a/wp-admin/ms-edit.php +++ b/wp-admin/ms-edit.php @@ -70,7 +70,7 @@ switch( $_GET['action'] ) { if ( false === $blog_details ) { if ( is_numeric( $dashboard_blog ) ) wp_die( __( 'Dashboard blog_id must be a blog that already exists' ) ); - if ( constant( 'VHOST' ) == 'yes' ) { + if ( is_subdomain_install() ) { $domain = $dashboard_blog . '.' . $current_site->domain; $path = $current_site->path; } else { @@ -145,7 +145,7 @@ switch( $_GET['action'] ) { if( !is_email( $email ) ) wp_die( __('Invalid email address') ); - if( constant( 'VHOST' ) == 'yes' ) { + if( is_subdomain_install() ) { $newdomain = $domain.".".$current_site->domain; $path = $base; } else { diff --git a/wp-admin/ms-options.php b/wp-admin/ms-options.php index 46c622de90..6f641034f2 100644 --- a/wp-admin/ms-options.php +++ b/wp-admin/ms-options.php @@ -55,7 +55,7 @@ if (isset($_GET['updated'])) {

- " . __('If registration is disabled, please set "NOBLOGREDIRECT" in wp-config.php to a url you will redirect visitors to if they visit a non existant blog.') . "

"; } ?> diff --git a/wp-admin/ms-sites.php b/wp-admin/ms-sites.php index 41fe86c83a..4bb24a0c6f 100644 --- a/wp-admin/ms-sites.php +++ b/wp-admin/ms-sites.php @@ -401,7 +401,7 @@ switch( $_GET['action'] ) { 'display name' - $blogname_columns = ( constant( "VHOST" ) == 'yes' ) ? __('Domain') : __('Path'); + $blogname_columns = ( is_subdomain_install() ) ? __('Domain') : __('Path'); $posts_columns = array( 'id' => __('ID'), 'blogname' => $blogname_columns, @@ -457,7 +457,7 @@ switch( $_GET['action'] ) { } echo ""; - $blogname = ( constant( "VHOST" ) == 'yes' ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path']; + $blogname = ( is_subdomain_install() ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path']; foreach( $posts_columns as $column_name=>$column_display_name ) { switch($column_name) { case 'id': ?> @@ -586,7 +586,7 @@ switch( $_GET['action'] ) { - + .domain;?> domain . $current_site->path ?> diff --git a/wp-config-sample.php b/wp-config-sample.php index c884ff0cd7..19cc8ab456 100644 --- a/wp-config-sample.php +++ b/wp-config-sample.php @@ -1,76 +1,76 @@ -domain . $current_site->path ); @@ -41,7 +41,7 @@ function get_blogaddress_by_name( $blogname ) { } function get_blogaddress_by_domain( $domain, $path ){ - if( defined( "VHOST" ) && constant( "VHOST" ) == 'yes' ) { + if( is_subdomain_install() ) { $url = "http://".$domain.$path; } else { if( $domain != $_SERVER['HTTP_HOST'] ) { @@ -108,7 +108,7 @@ function get_id_from_blogname( $name ) { if ( $blog_id ) return $blog_id; - if ( defined('VHOST') && constant( 'VHOST' ) == 'yes' ) { + if ( is_subdomain_install() ) { $domain = $name . '.' . $current_site->domain; $path = $current_site->path; } else { @@ -1033,7 +1033,7 @@ function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') { $errors->add('blogname', __("Sorry, blog names may not contain the character '_'!")); // do not allow users to create a blog that conflicts with a page on the main blog. - if ( constant( "VHOST" ) == 'no' && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) ) { + if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) ) { $errors->add( 'blogname', __( "Sorry, you may not use that blog name" ) ); } @@ -1051,7 +1051,7 @@ function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') { $errors->add('blog_title', __("Please enter a blog title")); // Check if the domain/path has been used already. - if( constant( "VHOST" ) == 'yes' ) { + if( is_subdomain_install() ) { $mydomain = "$blogname.$domain"; $path = $base; } else { @@ -1138,7 +1138,7 @@ function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_emai return false; // Send email with activation link. - if( constant( "VHOST" ) == 'no' || $current_site->id != 1 ) { + if( !is_subdomain_install() || $current_site->id != 1 ) { $activate_url = "http://" . $current_site->domain . $current_site->path . "wp-activate.php?key=$key"; } else { $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; @@ -1267,7 +1267,7 @@ function wpmu_create_user( $user_name, $password, $email) { function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id = 1) { $domain = preg_replace( "/\s+/", '', sanitize_user( $domain, true ) ); - if( constant( 'VHOST' ) == 'yes' ) + if( is_subdomain_install() ) $domain = str_replace( '@', '', $domain ); $title = strip_tags( $title ); $user_id = (int) $user_id; diff --git a/wp-includes/ms-settings.php b/wp-includes/ms-settings.php index 38bcd3eacc..a6a9e301b1 100644 --- a/wp-includes/ms-settings.php +++ b/wp-includes/ms-settings.php @@ -1,4 +1,19 @@ get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) ); if( $current_site != null ) return $current_site; @@ -113,7 +128,7 @@ $current_site = wpmu_current_site(); if( !isset( $current_site->blog_id ) ) $current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" ); -if( constant( 'VHOST' ) == 'yes' ) { +if( is_subdomain_install() ) { $current_blog = wp_cache_get( 'current_blog_' . $domain, 'site-options' ); if( !$current_blog ) { $current_blog = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE domain = %s", $domain) ); @@ -143,7 +158,7 @@ if( constant( 'VHOST' ) == 'yes' ) { } } -if( defined( "WP_INSTALLING" ) == false && constant( 'VHOST' ) == 'yes' && !is_object( $current_blog ) ) { +if( defined( "WP_INSTALLING" ) == false && is_subdomain_install() && !is_object( $current_blog ) ) { if( defined( 'NOBLOGREDIRECT' ) ) { $destination = constant( 'NOBLOGREDIRECT' ); if ( $destination == '%siteurl%' ) diff --git a/wp-signup.php b/wp-signup.php index 71d7002425..2c6642a193 100755 --- a/wp-signup.php +++ b/wp-signup.php @@ -56,7 +56,7 @@ get_header(); function show_blog_form($blogname = '', $blog_title = '', $errors = '') { global $current_site; // Blog name - if( constant( "VHOST" ) == 'no' ) + if( !is_subdomain_install() ) echo ''; else echo ''; @@ -65,14 +65,14 @@ function show_blog_form($blogname = '', $blog_title = '', $errors = '') {

' . $current_site->domain . $current_site->path . '
'; } else { echo '.' . $current_site->domain . $current_site->path . '
'; } if ( !is_user_logged_in() ) { print '(' . __( 'Your address will be ' ); - if( constant( "VHOST" ) == 'no' ) { + if( !is_subdomain_install() ) { print $current_site->domain . $current_site->path . __( 'blogname' ); } else { print __( 'domain.' ) . $current_site->domain . $current_site->path; @@ -420,7 +420,7 @@ if( $active_signup == "none" ) { _e( "You're logged in already. No need to register again!" ); } if ($newblogname) { - if( constant( "VHOST" ) == 'no' ) + if( !is_subdomain_install() ) $newblog = 'http://' . $current_site->domain . $current_site->path . $newblogname . '/'; else $newblog = 'http://' . $newblogname . '.' . $current_site->domain . $current_site->path;