summaryrefslogtreecommitdiffstats
path: root/wpmu-settings.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-07-12 16:03:02 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-07-12 16:03:02 +0000
commit09f9d533c60fb16d8b31c6a821658dd1d38b0fe6 (patch)
treefa4b7356eacb74f9b0067315057d9ccbead66bff /wpmu-settings.php
parent9b546c68fc36523578d54fec5207a10eb3fc8145 (diff)
downloadwordpress-mu-09f9d533c60fb16d8b31c6a821658dd1d38b0fe6.tar.gz
wordpress-mu-09f9d533c60fb16d8b31c6a821658dd1d38b0fe6.tar.xz
wordpress-mu-09f9d533c60fb16d8b31c6a821658dd1d38b0fe6.zip
If we can't find the site, then point them towards the main page of the only site in the db.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@664 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wpmu-settings.php')
-rw-r--r--wpmu-settings.php26
1 files changed, 18 insertions, 8 deletions
diff --git a/wpmu-settings.php b/wpmu-settings.php
index a1bc003..b98ca02 100644
--- a/wpmu-settings.php
+++ b/wpmu-settings.php
@@ -15,10 +15,6 @@ $path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path );
$wpdb->hide_errors();
-#$sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
-#if( count( $sites ) == 1 ) {
- #$current_site = $sites[0];
-#}
if( isset( $current_site ) == false ) {
$path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) );
@@ -32,8 +28,15 @@ if( isset( $current_site ) == false ) {
if( $current_site == null ) {
$path = '/';
$current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$sitedomain' AND path='$path'" );
- if( $current_site == null && defined( "WP_INSTALLING" ) == false )
- die( "No WPMU site defined on this host." );
+ if( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
+ $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
+ if( count( $sites ) == 1 ) {
+ $current_site = $sites[0];
+ 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>" );
+ } else {
+ die( "No WPMU site defined on this host." );
+ }
+ }
}
} else {
$path = '/';
@@ -44,8 +47,15 @@ if( isset( $current_site ) == false ) {
if( $current_site == null ) {
$path = '/';
$current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$domain' AND path='$path'" );
- if( $current_site == null && defined( "WP_INSTALLING" ) == false )
- die( "No WPMU site defined on this host." );
+ if( $current_site == null && defined( "WP_INSTALLING" ) == false ) {
+ $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" );
+ if( count( $sites ) == 1 ) {
+ $current_site = $sites[0];
+ 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>" );
+ } else {
+ die( "No WPMU site defined on this host." );
+ }
+ }
}
}
}