summaryrefslogtreecommitdiffstats
path: root/wpmu-settings.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-23 15:55:37 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-23 15:55:37 +0000
commit0472551f330f2df86f2a49a53481eb0f3ed48f15 (patch)
tree4c84553ef1821b64efbfdc6e91f16553aacb25bf /wpmu-settings.php
parent655a7fc3d336fb36671e2d8ab5bda4229aecfdce (diff)
downloadwordpress-mu-0472551f330f2df86f2a49a53481eb0f3ed48f15.tar.gz
wordpress-mu-0472551f330f2df86f2a49a53481eb0f3ed48f15.tar.xz
wordpress-mu-0472551f330f2df86f2a49a53481eb0f3ed48f15.zip
Installer, signup and vhosts lookup fixes
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@593 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wpmu-settings.php')
-rw-r--r--wpmu-settings.php43
1 files changed, 33 insertions, 10 deletions
diff --git a/wpmu-settings.php b/wpmu-settings.php
index 8cda5a3..c349e36 100644
--- a/wpmu-settings.php
+++ b/wpmu-settings.php
@@ -15,24 +15,45 @@ $path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path );
$wpdb->hide_errors();
-// Get site and blog details
-if( defined( "WP_INSTALLING" ) == false ) {
+#$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 ) );
if( constant( 'VHOST' ) == 'yes' ) {
- $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain'");
- if( $current_blog != null )
- $current_site = $wpdb->get_row("SELECT * FROM $wpdb->site WHERE id='{$current_blog->site_id}'");
+ $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) );
+ $current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$sitedomain' AND path='$path'" );
+ 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." );
+ }
} else {
- $path = substr( $_SERVER[ 'REQUEST_URI' ], 0, 1 + strpos( $_SERVER[ 'REQUEST_URI' ], '/', 1 ) );
$current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$domain' AND path='$path'" );
if( $current_site == null ) {
$path = '/';
$current_site = $wpdb->get_row( "SELECT * FROM $wpdb->site WHERE domain = '$domain' AND path='$path'" );
- if( $current_site == null )
+ if( $current_site == null && defined( "WP_INSTALLING" ) == false )
die( "No WPMU site defined on this host." );
}
- $blogname = htmlspecialchars( str_replace( $path, '', $_SERVER[ 'REQUEST_URI' ] ) );
- $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) );
- if( $blogname == '' || $blogname == 'blog' || $blogname == 'wp-admin' || $blogname == 'files' ) {
+ }
+}
+
+
+// Get site and blog details
+if( defined( "WP_INSTALLING" ) == false ) {
+ if( constant( 'VHOST' ) == 'yes' ) {
+ $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain'");
+ if( $current_blog != null )
+ $current_site = $wpdb->get_row("SELECT * FROM $wpdb->site WHERE id='{$current_blog->site_id}'");
+ } else {
+ $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) );
+ if( strpos( $blogname, '/' ) )
+ $blogname = substr( $blogname, 0, strpos( $blogname, '/' ) );
+ if( $blogname == '' || $blogname == 'blog' || $blogname == 'wp-admin' || $blogname == 'files' || $blogname == 'feed' ) {
$current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain' AND path = '$path'");
} else {
$current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain' AND path = '{$path}{$blogname}/'");
@@ -50,6 +71,8 @@ if( defined( "WP_INSTALLING" ) == false ) {
$site_id = 1;
$current_site->site_name = $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = '$site_id' AND meta_key = 'site_name'" );
+ if( $current_site->site_name == null )
+ $current_site->site_name = ucfirst( $current_site->domain );
}
if( $blog_id == false ) {
// no blog found, are we installing? Check if the table exists.