WordPress.org

Make WordPress Core

Ticket #11796: 11796.diff

File 11796.diff, 5.5 KB (added by nacin, 4 years ago)
  • wp-includes/ms-load.php

     
    2121 
    2222// Fix empty PHP_SELF 
    2323$PHP_SELF = $_SERVER['PHP_SELF']; 
    24 if ( empty($PHP_SELF) || ( empty($PHP_SELF) && constant( 'VHOST' ) == 'no' && $current_blog->path != '/' ) ) 
     24if ( empty($PHP_SELF) || ( empty($PHP_SELF) && !is_subdomain_install() && $current_blog->path != '/' ) ) 
    2525        $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); 
    2626 
    2727wp_cache_init(); // need to init cache again after blog_id is set 
  • wp-includes/ms-settings.php

     
    11<?php 
    22 
    33/** 
    4  * Whether a subdomain configuration is enabled 
     4 * Whether a subdomain configuration is enabled. 
    55 * 
     6 * Interprets <code>define('VHOST', 'no')</code> as false for backwards compatability. 
     7 * 
    68 * @since 3.0 
    79 * 
    810 * @return bool True if subdomain configuration is enabled, false otherwise. 
    911 */ 
    1012function is_subdomain_install() { 
    11         if ( defined('VHOST') && VHOST == 'yes' ) 
     13        if ( defined('VHOST') && VHOST && VHOST != 'no' ) 
    1214                return true; 
    1315 
    1416        return false; 
  • wp-admin/includes/schema.php

     
    619619 * 
    620620 * @param int $network_id id of network to populate 
    621621 */ 
    622 function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $vhost = 'no' ) { 
     622function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $vhost = false ) { 
    623623        global $wpdb, $current_site, $wp_version, $wp_db_version, $wp_rewrite; 
    624624 
    625625        $msg = ''; 
     
    701701                update_usermeta( $site_user->ID, 'primary_blog', 1 ); 
    702702        } 
    703703 
    704         if ( $vhost == 'yes' ) 
     704        if ( $vhost && $vhost != 'no' ) // 'no' for compat 
    705705                update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/'); 
    706706        else 
    707707                update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/'); 
    708708 
    709709        $wp_rewrite->flush_rules(); 
    710710 
    711         if ( $vhost == 'yes' ) { 
     711        if ( $vhost && $vhost != 'no' ) { // 'no' for compat 
    712712                $vhost_ok = false; 
    713713                $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! 
    714714                $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); 
  • wp-admin/includes/wp-config.ms

     
    9393// remember to change WP_CONTENT too. 
    9494// define( "UPLOADBLOGSDIR", "fileserver" ); 
    9595 
    96 // If VHOST is 'yes' uncomment and set this to a URL to redirect if a blog does not exist or is a 404 on the main blog. (Useful if signup is disabled) 
     96// If VHOST is true uncomment and set this to a URL to redirect if a blog does not exist or is a 404 on the main blog. (Useful if signup is disabled) 
    9797// For example, the browser will redirect to http://examples.com/ for the following: define( 'NOBLOGREDIRECT', 'http://example.com/' ); 
    9898// Set this value to %siteurl% to redirect to the root of the site 
    9999// define( 'NOBLOGREDIRECT', '' ); 
  • wp-admin/options-network.php

     
    142142                <p><strong>Note</strong> It looks like <code>mod_rewrite</code> is not installed.</p> 
    143143                <?php } ?> 
    144144                <p class="blog-address"> 
    145                         <label><input type='radio' name='vhost' value='yes' <?php if( $rewrite_enabled ) echo 'checked="checked"'; ?> /> Sub-domains (like <code>blog1.example.com</code>)</label><br /> 
    146                         <label><input type='radio' name='vhost' value='no' <?php if( !$rewrite_enabled ) echo 'checked="checked"'; ?> /> Sub-directories (like <code>example.com/blog1</code>)</label> 
     145                        <label><input type='radio' name='vhost' value='1' <?php if( $rewrite_enabled ) echo 'checked="checked"'; ?> /> Sub-domains (like <code>blog1.example.com</code>)</label><br /> 
     146                        <label><input type='radio' name='vhost' value='0' <?php if( !$rewrite_enabled ) echo 'checked="checked"'; ?> /> Sub-directories (like <code>example.com/blog1</code>)</label> 
    147147                </p> 
    148148 
    149149                <h2>Server Address</h2> 
     
    197197function step2_config() { 
    198198        global $base, $wpdb, $vhost; 
    199199 
    200         $vhost   = stripslashes($_POST['vhost' ]); 
     200        $vhost   = (bool) stripslashes($_POST['vhost' ]); 
    201201        $prefix  = $wpdb->base_prefix; 
    202202 
    203203        $config_sample = ABSPATH . 'wp-admin/includes/wp-config.ms'; 
     
    224224                                $output = str_replace("localhost", DB_HOST, $line); 
    225225                                break; 
    226226                        case "define('VHOST',": 
    227                                 $output = str_replace("VHOSTSETTING", $vhost, $line); 
     227                                $output = str_replace("'VHOSTSETTING'", $vhost ? 'true' : 'false', $line); 
    228228                                break; 
    229229                        case '$table_prefix  =': 
    230230                                $output = str_replace('wp_', $prefix, $line); 
     
    285285                // create network tables 
    286286                $domain = get_clean_basedomain(); 
    287287                install_network(); 
    288                 populate_network( 1, $domain, sanitize_email( $_POST[ 'email' ] ), $_POST[ 'weblog_title' ], $base, $_POST[ 'vhost' ] ); 
     288                populate_network( 1, $domain, sanitize_email( $_POST[ 'email' ] ), $_POST[ 'weblog_title' ], $base, (bool) $_POST[ 'vhost' ] ); 
    289289                // create wp-config.php / htaccess 
    290290                step2(); 
    291291        break;