Changeset 1422
- Timestamp:
- 08/13/08 17:05:18 (4 months ago)
- Files:
-
- trunk/index-install.php (modified) (3 diffs)
- trunk/wp-config-sample.php (modified) (1 diff)
- trunk/wpmu-settings.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/index-install.php
r1351 r1422 338 338 fwrite($handle, str_replace('BASE', $base, $line)); 339 339 break; 340 case "define('DOMAIN_C": 341 $domain = get_clean_basedomain(); 342 fwrite($handle, str_replace("current_site_domain", $domain, $line)); 343 break; 344 case "define('PATH_CUR": 345 fwrite($handle, str_replace("current_site_path", str_replace( 'index.php', '', $_SERVER[ 'REQUEST_URI' ] ), $line)); 346 break; 340 347 case "define('SECRET_K": 341 348 case "define('SECRET_S": … … 355 362 } 356 363 364 function get_clean_basedomain() { 365 global $wpdb; 366 $domain = $wpdb->escape( $_POST[ 'basedomain' ] ); 367 $domain = str_replace( 'http://', '', $domain ); 368 if( substr( $domain, 0, 4 ) == 'www.' ) 369 $domain = substr( $domain, 4 ); 370 if( strpos( $domain, '/' ) ) 371 $domain = substr( $domain, 0, strpos( $domain, '/' ) ); 372 return $domain; 373 } 374 357 375 function step3() { 358 376 global $wpdb, $current_site, $dirs, $wpmu_version; … … 361 379 $base .= "/"; 362 380 } 363 $domain = $wpdb->escape( $_POST[ 'basedomain' ] ); 364 $domain = str_replace( 'http://', '', $domain ); 365 if( substr( $domain, 0, 4 ) == 'www.' ) 366 $domain = substr( $domain, 4 ); 367 if( strpos( $domain, '/' ) ) 368 $domain = substr( $domain, 0, strpos( $domain, '/' ) ); 381 $domain = get_clean_basedomain(); 369 382 $email = $wpdb->escape( $_POST[ 'email' ] ); 370 383 if( $email == '' ) trunk/wp-config-sample.php
r1413 r1422 10 10 define('VHOST', 'VHOSTSETTING'); 11 11 $base = 'BASE'; 12 define('DOMAIN_CURRENT_SITE', 'current_site_domain' ); 13 define('PATH_CURRENT_SITE', 'current_site_path' ); 12 14 13 15 // Change each KEY to a different unique phrase. You won't have to remember the phrases later, trunk/wpmu-settings.php
r1377 r1422 27 27 function wpmu_current_site() { 28 28 global $wpdb, $current_site, $domain, $path, $sites; 29 if( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) { 30 $current_site->id = 1; 31 $current_site->domain = DOMAIN_CURRENT_SITE; 32 $current_site->path = PATH_CURRENT_SITE; 33 return $current_site; 34 } 35 36 $current_site = wp_cache_get( "current_site", "site-options" ); 37 if( $current_site ) 38 return $current_site; 39 40 $wpdb->suppress_errors(); 41 $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site 42 if( count( $sites ) == 1 ) { 43 $current_site = $sites[0]; 44 $path = $current_site->path; 45 wp_cache_set( "current_site", $current_site, "site-options" ); 46 return $current_site; 47 } 29 48 $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) ); 30 49 if( constant( 'VHOST' ) == 'yes' ) { … … 71 90 } 72 91 73 $wpdb->suppress_errors(); 74 $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site 75 if( count( $sites ) == 1 ) { 76 $current_site = $sites[0]; 77 $path = $current_site->path; 78 } else { 79 $current_site = wpmu_current_site(); 80 } 81 92 $current_site = wpmu_current_site(); 82 93 83 94 if( constant( 'VHOST' ) == 'yes' ) {
