Ticket #14913: console-multisite.diff
File console-multisite.diff, 3.3 KB (added by , 12 years ago) |
---|
-
wp-includes/ms-settings.php
Property changes on: . ___________________________________________________________________ Added: svn:ignore + .wp-tests-version
22 22 23 23 if ( !isset( $current_site ) || !isset( $current_blog ) ) { 24 24 25 $domain = addslashes( $_SERVER['HTTP_HOST'] ); 26 if ( false !== strpos( $domain, ':' ) ) { 27 if ( substr( $domain, -3 ) == ':80' ) { 28 $domain = substr( $domain, 0, -3 ); 29 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); 30 } elseif ( substr( $domain, -4 ) == ':443' ) { 31 $domain = substr( $domain, 0, -4 ); 32 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); 33 } else { 34 wp_load_translations_early(); 35 wp_die( __( 'Multisite only works without the port number in the URL.' ) ); 25 if ( isset( $_SERVER['HTTP_HOST'] ) ) { 26 $domain = addslashes( $_SERVER['HTTP_HOST'] ); 27 if ( false !== strpos( $domain, ':' ) ) { 28 if ( substr( $domain, -3 ) == ':80' ) { 29 $domain = substr( $domain, 0, -3 ); 30 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); 31 } elseif ( substr( $domain, -4 ) == ':443' ) { 32 $domain = substr( $domain, 0, -4 ); 33 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); 34 } else { 35 wp_load_translations_early(); 36 wp_die( __( 'Multisite only works without the port number in the URL.' ) ); 37 } 36 38 } 39 } else { 40 $domain = DOMAIN_CURRENT_SITE; 37 41 } 38 42 39 43 $domain = rtrim( $domain, '.' ); … … 41 45 if ( substr( $cookie_domain, 0, 4 ) == 'www.' ) 42 46 $cookie_domain = substr( $cookie_domain, 4 ); 43 47 44 $path = preg_replace( '|([a-z0-9-]+.php.*)|', '', $_SERVER['REQUEST_URI'] ); 45 $path = str_replace ( '/wp-admin/', '/', $path ); 46 $path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path ); 47 48 if ( isset( $_SERVER['REQUEST_URI'] ) ) { 49 $path = preg_replace( '|([a-z0-9-]+.php.*)|', '', $_SERVER['REQUEST_URI'] ); 50 $path = str_replace ( '/wp-admin/', '/', $path ); 51 $path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path ); 52 } else { 53 $path = '/'; 54 } 55 48 56 $current_site = wpmu_current_site(); 49 57 if ( ! isset( $current_site->blog_id ) ) 50 58 $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) ); … … 63 71 } else 64 72 $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); 65 73 } else { 66 $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) ); 74 if ( isset( $_SERVER[ 'REQUEST_URI' ] ) ) 75 $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) ); 76 else 77 $blogname = htmlspecialchars( $path ); 78 67 79 if ( false !== strpos( $blogname, '/' ) ) 68 80 $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) ); 69 81 if ( false !== strpos( $blogname, '?' ) ) … … 94 106 95 107 if ( ! defined( 'WP_INSTALLING' ) ) { 96 108 if ( $current_site && ! $current_blog ) { 97 if ( $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) {109 if ( isset( $_SERVER[ 'HTTP_HOST' ] ) && $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) { 98 110 header( 'Location: http://' . $current_site->domain . $current_site->path ); 99 111 exit; 100 112 }