Changeset 664

Show
Ignore:
Timestamp:
07/12/06 16:03:02 (2 years ago)
Author:
donncha
Message:

If we can't find the site, then point them towards the main page of the only site in the db.

Files:

Legend:

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

    r655 r664  
    1616$wpdb->hide_errors(); 
    1717 
    18 #$sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); 
    19 #if( count( $sites ) == 1 ) { 
    20         #$current_site = $sites[0]; 
    21 #} 
    2218         
    2319if( isset( $current_site ) == false ) { 
     
    3329                                        $path = '/'; 
    3430                                        $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." ); 
     31                                        if( $current_site == null && defined( "WP_INSTALLING" ) == false ) { 
     32                                                $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); 
     33                                                if( count( $sites ) == 1 ) { 
     34                                                        $current_site = $sites[0]; 
     35                                                        die( "That blog does not exist. Please try <a href='http://{$current_site->domain}{$current_site->path}'>http://{$current_site->domain}{$current_site->path}</a>" ); 
     36                                                } else { 
     37                                                        die( "No WPMU site defined on this host." ); 
     38                                                } 
     39                                        } 
    3740                                } 
    3841                        } else { 
     
    4548                        $path = '/'; 
    4649                        $current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$domain' AND path='$path'" ); 
    47                         if( $current_site == null && defined( "WP_INSTALLING" ) == false ) 
    48                                 die( "No WPMU site defined on this host." ); 
     50                        if( $current_site == null && defined( "WP_INSTALLING" ) == false ) { 
     51                                $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); 
     52                                if( count( $sites ) == 1 ) { 
     53                                        $current_site = $sites[0]; 
     54                                        die( "That blog does not exist. Please try <a href='http://{$current_site->domain}{$current_site->path}'>http://{$current_site->domain}{$current_site->path}</a>" ); 
     55                                } else { 
     56                                        die( "No WPMU site defined on this host." ); 
     57                                } 
     58                        } 
    4959                } 
    5060        }