WordPress.org

Make WordPress Core

Changeset 12674


Ignore:
Timestamp:
01/08/10 21:25:01 (5 years ago)
Author:
wpmuguru
Message:

Add is_subdomain_install() to ms code - Fixes #11796

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r12672 r12674  
    733733 
    734734function avoid_blog_page_permalink_collision( $data, $postarr ) { 
    735     if( constant( 'VHOST' ) == 'yes' ) 
     735    if( is_subdomain_install() ) 
    736736        return $data; 
    737737    if( $data[ 'post_type' ] != 'page' ) 
  • trunk/wp-admin/ms-edit.php

    r12646 r12674  
    7171                if ( is_numeric( $dashboard_blog ) ) 
    7272                    wp_die( __( 'Dashboard blog_id must be a blog that already exists' ) ); 
    73                 if ( constant( 'VHOST' ) == 'yes' ) { 
     73                if ( is_subdomain_install() ) { 
    7474                    $domain = $dashboard_blog . '.' . $current_site->domain; 
    7575                    $path = $current_site->path; 
     
    146146            wp_die( __('Invalid email address') ); 
    147147 
    148         if( constant( 'VHOST' ) == 'yes' ) { 
     148        if( is_subdomain_install() ) { 
    149149            $newdomain = $domain.".".$current_site->domain; 
    150150            $path = $base; 
  • trunk/wp-admin/ms-options.php

    r12632 r12674  
    5656                    <label><input name="registration" type="radio" id="registration4" value='blog' <?php echo get_site_option('registration') == 'blog' ? 'checked="checked"' : ''; ?> /> <?php _e('Only logged in users can create new blogs.'); ?></label><br /> 
    5757                    <p><?php _e('Disable or enable registration and who or what can be registered. (Default=all)'); ?></p> 
    58                     <?php if( constant( 'VHOST' ) == 'yes' ) { 
     58                    <?php if( is_subdomain_install() ) { 
    5959                        echo "<p>" . __('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.') . "</p>"; 
    6060                    } ?> 
  • trunk/wp-admin/ms-sites.php

    r12646 r12674  
    402402        <?php 
    403403        // define the columns to display, the syntax is 'internal name' => 'display name' 
    404         $blogname_columns = ( constant( "VHOST" ) == 'yes' ) ? __('Domain') : __('Path'); 
     404        $blogname_columns = ( is_subdomain_install() ) ? __('Domain') : __('Path'); 
    405405        $posts_columns = array( 
    406406            'id'           => __('ID'), 
     
    458458                    echo "<tr $bgcolour class='$class'>"; 
    459459 
    460                     $blogname = ( constant( "VHOST" ) == 'yes' ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path']; 
     460                    $blogname = ( is_subdomain_install() ) ? str_replace('.'.$current_site->domain, '', $blog['domain']) : $blog['path']; 
    461461                    foreach( $posts_columns as $column_name=>$column_display_name ) { 
    462462                        switch($column_name) { 
     
    587587                        <th style="text-align:center;" scope='row'><?php _e('Blog Address') ?></th> 
    588588                        <td> 
    589                         <?php if ( constant( "VHOST" ) == 'yes' ) { ?> 
     589                        <?php if ( is_subdomain_install() ) { ?> 
    590590                            <input name="blog[domain]" type="text" title="<?php _e('Domain') ?>"/>.<?php echo $current_site->domain;?> 
    591591                        <?php } else { 
  • trunk/wp-config-sample.php

    • Property svn:eol-style changed from CRLF to native
  • trunk/wp-includes/ms-functions.php

    r12673 r12674  
    3232    global $current_site; 
    3333 
    34     if( defined( "VHOST" ) && constant( "VHOST" ) == 'yes' ) { 
     34    if( is_subdomain_install() ) { 
    3535        if( $blogname == 'main' ) 
    3636            $blogname = 'www'; 
     
    4242 
    4343function get_blogaddress_by_domain( $domain, $path ){ 
    44     if( defined( "VHOST" ) && constant( "VHOST" ) == 'yes' ) { 
     44    if( is_subdomain_install() ) { 
    4545        $url = "http://".$domain.$path; 
    4646    } else { 
     
    109109        return $blog_id; 
    110110 
    111     if ( defined('VHOST') && constant( 'VHOST' ) == 'yes' ) { 
     111    if ( is_subdomain_install() ) { 
    112112        $domain = $name . '.' . $current_site->domain; 
    113113        $path = $current_site->path; 
     
    10341034 
    10351035    // do not allow users to create a blog that conflicts with a page on the main blog. 
    1036     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 ) ) ) { 
     1036    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 ) ) ) { 
    10371037        $errors->add( 'blogname', __( "Sorry, you may not use that blog name" ) ); 
    10381038    } 
     
    10521052 
    10531053    // Check if the domain/path has been used already. 
    1054     if( constant( "VHOST" ) == 'yes' ) { 
     1054    if( is_subdomain_install() ) { 
    10551055        $mydomain = "$blogname.$domain"; 
    10561056        $path = $base; 
     
    11391139 
    11401140    // Send email with activation link. 
    1141     if( constant( "VHOST" ) == 'no' || $current_site->id != 1 ) { 
     1141    if( !is_subdomain_install() || $current_site->id != 1 ) { 
    11421142        $activate_url = "http://" . $current_site->domain . $current_site->path . "wp-activate.php?key=$key"; 
    11431143    } else { 
     
    12681268function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id = 1) { 
    12691269    $domain = preg_replace( "/\s+/", '', sanitize_user( $domain, true ) ); 
    1270     if( constant( 'VHOST' ) == 'yes' ) 
     1270    if( is_subdomain_install() ) 
    12711271        $domain = str_replace( '@', '', $domain ); 
    12721272    $title = strip_tags( $title ); 
  • trunk/wp-includes/ms-settings.php

    r12632 r12674  
    11<?php 
     2 
     3/** 
     4 * Whether a subdomain configuration is enabled 
     5 * 
     6 * @since 3.0 
     7 * 
     8 * @return bool True if subdomain configuration is enabled, false otherwise. 
     9 */ 
     10function is_subdomain_install() { 
     11    if ( defined('VHOST') && VHOST == 'yes' ) 
     12        return true; 
     13 
     14    return false; 
     15} 
     16 
    217if( isset( $current_site ) && isset( $current_blog ) ) 
    318    return; 
     
    6681    } 
    6782    $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) ); 
    68     if( constant( 'VHOST' ) == 'yes' ) { 
     83    if( is_subdomain_install() ) { 
    6984        $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path) ); 
    7085        if( $current_site != null ) 
     
    114129    $current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" ); 
    115130 
    116 if( constant( 'VHOST' ) == 'yes' ) { 
     131if( is_subdomain_install() ) { 
    117132    $current_blog = wp_cache_get( 'current_blog_' . $domain, 'site-options' ); 
    118133    if( !$current_blog ) { 
     
    144159} 
    145160 
    146 if( defined( "WP_INSTALLING" ) == false && constant( 'VHOST' ) == 'yes' && !is_object( $current_blog ) ) { 
     161if( defined( "WP_INSTALLING" ) == false && is_subdomain_install() && !is_object( $current_blog ) ) { 
    147162    if( defined( 'NOBLOGREDIRECT' ) ) { 
    148163        $destination = constant( 'NOBLOGREDIRECT' ); 
  • trunk/wp-signup.php

    r12672 r12674  
    5757    global $current_site; 
    5858    // Blog name 
    59     if( constant( "VHOST" ) == 'no' ) 
     59    if( !is_subdomain_install() ) 
    6060        echo '<label for="blogname">' . __('Blog Name:') . '</label>'; 
    6161    else 
     
    6666    <?php } 
    6767 
    68     if( constant( "VHOST" ) == 'no' ) { 
     68    if( !is_subdomain_install() ) { 
    6969        echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="50" /><br />'; 
    7070    } else { 
     
    7373    if ( !is_user_logged_in() ) { 
    7474        print '(<strong>' . __( 'Your address will be ' ); 
    75         if( constant( "VHOST" ) == 'no' ) { 
     75        if( !is_subdomain_install() ) { 
    7676            print $current_site->domain . $current_site->path . __( 'blogname' ); 
    7777        } else { 
     
    421421            } 
    422422            if ($newblogname) { 
    423                 if( constant( "VHOST" ) == 'no' ) 
     423                if( !is_subdomain_install() ) 
    424424                    $newblog = 'http://' . $current_site->domain . $current_site->path . $newblogname . '/'; 
    425425                else 
Note: See TracChangeset for help on using the changeset viewer.