Changeset 594

Show
Ignore:
Timestamp:
06/24/06 08:17:14 (2 years ago)
Author:
donncha
Message:

Lookup fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wpmu-settings.php

    r593 r594  
    2424        $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) ); 
    2525        if( constant( 'VHOST' ) == 'yes' ) { 
    26                 $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) ); 
    27                 $current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$sitedomain' AND path='$path'" ); 
     26                $current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$domain' AND path='$path'" ); 
    2827                if( $current_site == null ) { 
    29                         $path = '/'; 
    30                         $current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$sitedomain' AND path='$path'" ); 
    31                         if( $current_site == null && defined( "WP_INSTALLING" ) == false ) 
    32                                 die( "No WPMU site defined on this host." ); 
     28                        $current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$domain' AND path='/'" ); 
     29                        if( $current_site == null ) { 
     30                                $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) ); 
     31                                $current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$sitedomain' AND path='$path'" ); 
     32                                if( $current_site == null ) { 
     33                                        $path = '/'; 
     34                                        $current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$sitedomain' AND path='$path'" ); 
     35                                        if( $current_site == null && defined( "WP_INSTALLING" ) == false ) 
     36                                                die( "No WPMU site defined on this host." ); 
     37                                } 
     38                        } else { 
     39                                $path = '/'; 
     40                        } 
    3341                } 
    3442        } else { 
     
    4452 
    4553 
    46 // Get site and blog details 
     54if( constant( 'VHOST' ) == 'yes' ) { 
     55        $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain'"); 
     56        if( $current_blog != null ) 
     57                $current_site = $wpdb->get_row("SELECT * FROM $wpdb->site WHERE id='{$current_blog->site_id}'"); 
     58} else { 
     59        $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) ); 
     60        if( strpos( $blogname, '/' ) ) 
     61                $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) ); 
     62        if( $blogname == '' || $blogname == 'blog' || $blogname == 'wp-admin' || $blogname == 'files' || $blogname == 'feed' ) { 
     63                $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain' AND path = '$path'"); 
     64        } else { 
     65                $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain' AND path = '{$path}{$blogname}/'"); 
     66        } 
     67
     68 
    4769if( defined( "WP_INSTALLING" ) == false ) { 
    48         if( constant( 'VHOST' ) == 'yes' ) { 
    49                 $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain'"); 
    50                 if( $current_blog != null ) 
    51                         $current_site = $wpdb->get_row("SELECT * FROM $wpdb->site WHERE id='{$current_blog->site_id}'"); 
    52         } else { 
    53                 $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) ); 
    54                 if( strpos( $blogname, '/' ) ) 
    55                         $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) ); 
    56                 if( $blogname == '' || $blogname == 'blog' || $blogname == 'wp-admin' || $blogname == 'files' || $blogname == 'feed' ) { 
    57                         $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain' AND path = '$path'"); 
    58                 } else { 
    59                         $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain' AND path = '{$path}{$blogname}/'"); 
    60                 } 
    61         } 
    62  
    6370        if( $current_blog == false || $current_site == false ) 
    6471                is_installed(); 
     72} 
    6573 
    66        $blog_id = $current_blog->blog_id; 
    67        $public  = $current_blog->public; 
    68        $site_id = $current_blog->site_id; 
     74$blog_id = $current_blog->blog_id; 
     75$public  = $current_blog->public; 
     76$site_id = $current_blog->site_id; 
    6977 
    70        if( $site_id == 0 ) 
    71                $site_id = 1; 
     78if( $site_id == 0 ) 
     79        $site_id = 1; 
    7280 
    73        $current_site->site_name = $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = '$site_id' AND meta_key = 'site_name'" ); 
    74        if( $current_site->site_name == null ) 
    75                $current_site->site_name = ucfirst( $current_site->domain ); 
    76 
     81$current_site->site_name = $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = '$site_id' AND meta_key = 'site_name'" ); 
     82if( $current_site->site_name == null ) 
     83        $current_site->site_name = ucfirst( $current_site->domain ); 
     84 
    7785if( $blog_id == false ) { 
    7886    // no blog found, are we installing? Check if the table exists.