50 /** Check for and define SUBDOMAIN_INSTALL and the deprecated VHOST constant. */ |
50 /** Check for and define SUBDOMAIN_INSTALL and the deprecated VHOST constant. */ |
51 ms_subdomain_constants(); |
51 ms_subdomain_constants(); |
52 |
52 |
53 // This block will process a request if the current network or current site objects |
53 // This block will process a request if the current network or current site objects |
54 // have not been populated in the global scope through something like `sunrise.php`. |
54 // have not been populated in the global scope through something like `sunrise.php`. |
55 if ( !isset( $current_site ) || !isset( $current_blog ) ) { |
55 if ( ! isset( $current_site ) || ! isset( $current_blog ) ) { |
56 |
56 |
57 $domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) ); |
57 $domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) ); |
58 if ( substr( $domain, -3 ) == ':80' ) { |
58 if ( substr( $domain, -3 ) == ':80' ) { |
59 $domain = substr( $domain, 0, -3 ); |
59 $domain = substr( $domain, 0, -3 ); |
60 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); |
60 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); |
61 } elseif ( substr( $domain, -4 ) == ':443' ) { |
61 } elseif ( substr( $domain, -4 ) == ':443' ) { |
62 $domain = substr( $domain, 0, -4 ); |
62 $domain = substr( $domain, 0, -4 ); |
63 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); |
63 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); |
64 } |
64 } |
65 |
65 |
66 $path = stripslashes( $_SERVER['REQUEST_URI'] ); |
66 $path = stripslashes( $_SERVER['REQUEST_URI'] ); |
67 if ( is_admin() ) { |
67 if ( is_admin() ) { |
94 wp_load_core_site_options( $site_id ); |
94 wp_load_core_site_options( $site_id ); |
95 } |
95 } |
96 |
96 |
97 $wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php |
97 $wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php |
98 $wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id ); |
98 $wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id ); |
99 $table_prefix = $wpdb->get_blog_prefix(); |
99 $table_prefix = $wpdb->get_blog_prefix(); |
100 $_wp_switched_stack = array(); |
100 $_wp_switched_stack = array(); |
101 $switched = false; |
101 $switched = false; |
102 |
102 |
103 // need to init cache again after blog_id is set |
103 // need to init cache again after blog_id is set |
104 wp_start_object_cache(); |
104 wp_start_object_cache(); |
105 |
105 |
106 if ( ! $current_site instanceof WP_Network ) { |
106 if ( ! $current_site instanceof WP_Network ) { |