summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-21 17:36:07 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-06-21 17:36:07 +0000
commit9f63c9fe67acd3e6c600de8e4bec6de823c6e8da (patch)
tree735c69886aa206230c0a8e301a922b0cf19c9c85
parent8fa5ef02569b5b763f886e1bd96d2268639eaea8 (diff)
downloadwordpress-mu-9f63c9fe67acd3e6c600de8e4bec6de823c6e8da.tar.gz
wordpress-mu-9f63c9fe67acd3e6c600de8e4bec6de823c6e8da.tar.xz
wordpress-mu-9f63c9fe67acd3e6c600de8e4bec6de823c6e8da.zip
VHOSTs updates. Things may be a little unstable for a few days.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@586 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-inst/wp-includes/wpmu-functions.php20
-rw-r--r--wp-inst/wp-signup.php20
-rw-r--r--wp-inst/wpmu-settings.php50
3 files changed, 57 insertions, 33 deletions
diff --git a/wp-inst/wp-includes/wpmu-functions.php b/wp-inst/wp-includes/wpmu-functions.php
index e779a12..6bf4dd3 100644
--- a/wp-inst/wp-includes/wpmu-functions.php
+++ b/wp-inst/wp-includes/wpmu-functions.php
@@ -84,11 +84,7 @@ function get_blogaddress_by_id( $blog_id ) {
$bloginfo = get_blog_details( $blog_id, false ); // only get bare details!
- if( defined( "VHOST" ) && constant( "VHOST" ) == 'yes' ) {
- return "http://" . $bloginfo->domain . $bloginfo->path;
- } else {
- return get_blogaddress_by_domain($bloginfo->domain, $bloginfo->path);
- }
+ return get_real_siteurl( $bloginfo->domain, $bloginfo->path );
}
function get_blogaddress_by_name( $blogname ) {
@@ -441,10 +437,8 @@ function get_blogs_of_user( $id ) {
$blog = get_blog_details( $match[1] );
if ( $blog && isset( $blog->domain ) ) {
$blogs[$match[1]]->userblog_id = $match[1];
- $blogs[$match[1]]->domain = $blog->domain;
- } else { // Temporary fix for people who don't get usermeta cleaned up when a blog is deleted
- delete_usermeta( $id, "wp_{$match[1]}_capabilities" );
- delete_usermeta( $id, "wp_{$match[1]}_user_level" );
+ $blogs[$match[1]]->domain = $blog->domain;
+ $blogs[$match[1]]->path = $blog->path;
}
}
}
@@ -1328,4 +1322,12 @@ SITE_NAME" );
wp_mail($user->user_email, $subject, $message, $message_headers);
}
+function get_real_siteurl( $domain, $path ) {
+ if( defined( "VHOST" ) && constant( "VHOST" ) == 'yes' ) {
+ return "http://" . $domain . $path;
+ } else {
+ return get_blogaddress_by_domain($domain, $path);
+ }
+}
+
?>
diff --git a/wp-inst/wp-signup.php b/wp-inst/wp-signup.php
index 636b9ba..4c389a6 100644
--- a/wp-inst/wp-signup.php
+++ b/wp-inst/wp-signup.php
@@ -33,15 +33,22 @@ function show_blog_form($blog_id = '', $blog_title = '', $errors = '') {
else
print '<tr>';
- echo '<th valign="top">' . __('Blog Domain:') . '</th><td>';
+ if( constant( "VHOST" ) == 'no' )
+ echo '<th valign="top">' . __('Blog Name:') . '</th><td>';
+ else
+ echo '<th valign="top">' . __('Blog Domain:') . '</th><td>';
if ( $errmsg = $errors->get_error_message('blog_id') ) {
?><p><strong><?php echo $errmsg ?></strong></p><?php
}
- print '<input name="blog_id" type="text" id="blog_id" value="'.$blog_id.'" maxlength="50" style="width:40%; text-align: right; font-size: 30px;" /><span style="font-size: 30px">.' . $current_site->domain . $current_site->path . '</span><br />';
+ if( constant( "VHOST" ) == 'no' ) {
+ print '<span style="font-size: 20px">' . get_real_siteurl( $current_site->domain, $current_site->path ) . '</span><input name="blog_id" type="text" id="blog_id" value="'.$blog_id.'" maxlength="50" style="width:40%; text-align: left; font-size: 20px;" /><br />';
+ } else {
+ print '<input name="blog_id" type="text" id="blog_id" value="'.$blog_id.'" maxlength="50" style="width:40%; text-align: right; font-size: 20px;" /><span style="font-size: 20px">' . get_real_siteurl( $current_site->domain, $current_site->path ) . '</span><br />';
+ }
if ( !is_user_logged_in() ) {
print '(<strong>Your address will be ';
- if( constant( "VHOST" == 'no' ) ) {
+ if( constant( "VHOST" ) == 'no' ) {
print $current_site->domain . $current_site->path . 'blogname';
} else {
print 'domain.' . $current_site->domain . $current_site->path;
@@ -144,7 +151,7 @@ function signup_another_blog($blog_id = '', $blog_title = '', $errors = '') {
if ( ! empty($blogs) ) foreach ( $blogs as $blog ) {
$display = str_replace(".$domain", '', $blog->domain);
- echo "<li><a href='http://$blog->domain'>$display</a></li>";
+ echo "<li><a href='" . get_real_siteurl( $blog->domain, $blog->path ) . "'>$display</a></li>";
}
?>
</ul>
@@ -183,9 +190,10 @@ function validate_another_blog_signup() {
}
function confirm_another_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta) {
+ $url = get_real_siteurl( $domain, $path );
?>
-<h2><?php printf(__('%s Is Yours'), $domain) ?></h2>
-<p><?php printf(__('<a href="%1$s">%2$s</a> is your new blog. <a href="%3$s">Login</a> as "%4$s" using your existing password.'), "http://${domain}${path}", $domain, "http://${domain}${path}wp-login.php", $user_name) ?></p>
+<h2><?php printf(__('%s Is Yours'), $url ) ?></h2>
+<p><?php printf(__('<a href="%1$s">%2$s</a> is your new blog. <a href="%3$s">Login</a> as "%4$s" using your existing password.'), $url, $url, $url . "wp-login.php", $user_name) ?></p>
<?php
do_action('signup_finished');
}
diff --git a/wp-inst/wpmu-settings.php b/wp-inst/wpmu-settings.php
index f0eeeae..a2f2959 100644
--- a/wp-inst/wpmu-settings.php
+++ b/wp-inst/wpmu-settings.php
@@ -15,28 +15,42 @@ $path = preg_replace( '|(/[a-z0-9-]+?/).*|', '$1', $path );
$wpdb->hide_errors();
-if( constant( 'VHOST' ) == 'yes' )
- $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain'");
-else
- $current_blog = $wpdb->get_row("SELECT * FROM $wpdb->blogs WHERE domain = '$domain' AND path = '$path'");
-
-if( $current_blog == false )
- is_installed();
-
-$blog_id = $current_blog->blog_id;
-$public = $current_blog->public;
-$site_id = $current_blog->site_id;
-
-if( $site_id == 0 )
- $site_id = 1;
+// 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 {
+ $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 )
+ 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' ) {
+ $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 = '$blogname.$domain' AND path = '$path'");
+ }
+ }
-$current_site = $wpdb->get_row("SELECT * FROM $wpdb->site WHERE id='$site_id'");
+ if( $current_blog == false || $current_site == false )
+ is_installed();
-if( $current_site == false )
- is_installed();
+ $blog_id = $current_blog->blog_id;
+ $public = $current_blog->public;
+ $site_id = $current_blog->site_id;
-$current_site->site_name = $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = '$site_id' AND meta_key = 'site_name'" );
+ if( $site_id == 0 )
+ $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( $blog_id == false ) {
// no blog found, are we installing? Check if the table exists.
if ( defined('WP_INSTALLING') ) {