diff options
-rw-r--r-- | index.php | 14 | ||||
-rw-r--r-- | wp-inst/wp-includes/wpmu-functions.php | 23 | ||||
-rw-r--r-- | wp-inst/wp-signup.php | 16 |
3 files changed, 30 insertions, 23 deletions
@@ -264,6 +264,9 @@ function step2() { $vhost = $_POST['vhost' ]; $prefix = 'wp_'; $base = stripslashes( dirname( $_SERVER["SCRIPT_NAME"] ) ); + if( $base != "/") { + $base .= "/"; + } // Test the db connection. define('DB_NAME', $dbname); @@ -297,7 +300,7 @@ function step2() { case "define('DB_HOST'": fwrite($handle, str_replace("localhost", $dbhost, $line)); break; - case "define('VHOST', ": + case "define('VHOST',": fwrite($handle, str_replace("VHOSTSETTING", $vhost, $line)); break; case '$table_prefix =': @@ -321,9 +324,9 @@ function printuserdetailsform( $weblog_title = 'My new Blog', $username = '', $e print " <form method='post' action='index.php'> <input type='hidden' name='action' value='step3'> - <p>To finish setting up your blog, please fill in the folling form and click <q>Submit</q>.</p> + <p>To finish setting up your blog, please fill in the following form and click <q>Submit</q>.</p> <h2>Server Address</h2> - <p><label>What is the Internet address of your site? <input type='text' name='basedomain' value='{$hostname}'><br />You should enter the shortest address possible. For example, use <em>example.com</em> instead of <em>www.example.com</em> but if you are going to use an address like <em>blogs.example.com</em> then enter that unaltered in the box above.</label></p> + <p><label>What is the Internet address of your site? You should enter the shortest address possible. For example, use <em>example.com</em> instead of <em>www.example.com</em> but if you are going to use an address like <em>blogs.example.com</em> then enter that unaltered in the box above.<br /><b>Server Address:</b> <input type='text' name='basedomain' value='{$hostname}'></label></p> <h2>Blog Details</h2> <table width='100%'> <tr> @@ -346,8 +349,7 @@ function printuserdetailsform( $weblog_title = 'My new Blog', $username = '', $e function step3() { global $wpdb, $current_site; $base = stripslashes( dirname( $_SERVER["SCRIPT_NAME"] ) ); - if( $base != "/") - { + if( $base != "/") { $base .= "/"; } $domain = $wpdb->escape( $_POST[ 'basedomain' ] ); @@ -366,7 +368,7 @@ function step3() { $wpdb->query( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'blog_upload_space', '10' )" ); $wpdb->query( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'fileupload_maxk', '1500' )" ); $wpdb->query( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'site_admins', '" . serialize( array( 'admin' ) ) . "' )" ); - + $wpdb->query( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'illegal_names', '" . serialize( array( "www", "web", "root", "admin", "main", "invite", "administrator" ) ) . "' )" ); $wpdb->query( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, 1, 'welcome_email', 'Dear User, Your new SITE_NAME blog has been successfully set up at: diff --git a/wp-inst/wp-includes/wpmu-functions.php b/wp-inst/wp-includes/wpmu-functions.php index 6bf4dd3..4dd1269 100644 --- a/wp-inst/wp-includes/wpmu-functions.php +++ b/wp-inst/wp-includes/wpmu-functions.php @@ -953,9 +953,15 @@ function wpmu_validate_blog_signup($blog_id, $blog_title, $user = '') { if ( empty( $blog_title ) ) $errors->add('blog_title', __("Please enter a blog title")); - // Check if the domain has been used already. - $mydomain = "$blog_id.$domain"; - if ( domain_exists($mydomain, $base) ) + // Check if the domain/path has been used already. + if( constant( "VHOST" ) == 'yes' ) { + $mydomain = "$blog_id.$domain"; + $path = $base; + } else { + $mydomain = "$domain"; + $path = $base.$blog_id.'/'; + } + if ( domain_exists($mydomain, $path) ) $errors->add('blog_id', __("Sorry, that blog already exists!")); if ( username_exists($blog_id) ) { @@ -965,20 +971,20 @@ function wpmu_validate_blog_signup($blog_id, $blog_title, $user = '') { // Has someone already signed up for this domain? // TODO: Check email too? - $signup = $wpdb->get_row("SELECT * FROM $wpdb->signups WHERE domain = '$mydomain'"); + $signup = $wpdb->get_row("SELECT * FROM $wpdb->signups WHERE domain = '$mydomain' AND path = '$path'"); if ( ! empty($signup) ) { $registered_at = mysql2date('U', $signup->registered); $now = current_time( 'timestamp', true ); $diff = $now - $registered_at; // If registered more than two days ago, cancel registration and let this signup go through. if ( $diff > 172800 ) { - $wpdb->query("DELETE FROM $wpdb->signups WHERE domain = '$mydomain'"); + $wpdb->query("DELETE FROM $wpdb->signups WHERE domain = '$mydomain' AND path = '$path'"); } else { $errors->add('blog_id', __("That blog is currently reserved but may be available in a couple days.")); } } - $result = array('domain' => $mydomain, 'path' => $base, 'blog_id' => $blog_id, 'blog_title' => $blog_title, + $result = array('domain' => $mydomain, 'path' => $path, 'blog_id' => $blog_id, 'blog_title' => $blog_title, 'errors' => $errors); return apply_filters('wpmu_validate_blog_signup', $result); @@ -1023,9 +1029,9 @@ function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_emai $activate_url = "http://{$domain}{$path}/wp-activate.php?key=$key"; } $message_headers = 'From: ' . stripslashes($title) . ' <support@' . $_SERVER[ 'SERVER_NAME' ] . '>'; - $message = sprintf(__("To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your blog here:\n\n%s"), $activate_url, "http://$domain"); + $message = sprintf(__("To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your blog here:\n\n%s"), $activate_url, "http://$domain.$path"); // TODO: Don't hard code activation link. - $subject = sprintf(__('Activate %s'), $domain); + $subject = sprintf(__('Activate %s'), $domain.$path); wp_mail($user_email, $subject, $message, $message_headers); } @@ -1159,6 +1165,7 @@ function domain_exists($domain, $path, $site_id = 1) { function insert_blog($domain, $path, $site_id) { global $wpdb; + $path = trailingslashit( $path ); $query = "INSERT INTO $wpdb->blogs ( blog_id, site_id, domain, path, registered ) VALUES ( NULL, '$site_id', '$domain', '$path', NOW( ))"; $result = $wpdb->query( $query ); if ( ! $result ) diff --git a/wp-inst/wp-signup.php b/wp-inst/wp-signup.php index 4c389a6..671e3e6 100644 --- a/wp-inst/wp-signup.php +++ b/wp-inst/wp-signup.php @@ -42,9 +42,9 @@ function show_blog_form($blog_id = '', $blog_title = '', $errors = '') { ?><p><strong><?php echo $errmsg ?></strong></p><?php
}
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 />';
+ print '<span style="font-size: 20px">' . $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 />';
+ 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">' . $current_site->domain . $current_site->path . '</span><br />';
}
if ( !is_user_logged_in() ) {
print '(<strong>Your address will be ';
@@ -150,8 +150,7 @@ function signup_another_blog($blog_id = '', $blog_title = '', $errors = '') { $blogs = get_blogs_of_user($current_user->ID);
if ( ! empty($blogs) ) foreach ( $blogs as $blog ) {
- $display = str_replace(".$domain", '', $blog->domain);
- echo "<li><a href='" . get_real_siteurl( $blog->domain, $blog->path ) . "'>$display</a></li>";
+ echo "<li><a href='" . $blog->domain . $blog->path . "'>" . $blog->domain . $blog->path . "</a></li>";
}
?>
</ul>
@@ -190,10 +189,9 @@ 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'), $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>
+<h2><?php printf(__('%s Is Yours'), $domain.$path ) ?></h2>
+<p><?php printf(__('<a href="http://%1$s">http://%2$s</a> is your new blog. <a href="%3$s">Login</a> as "%4$s" using your existing password.'), $domain.$path, $domain.$path, $domain.$path . "wp-login.php", $user_name) ?></p>
<?php
do_action('signup_finished');
}
@@ -217,7 +215,7 @@ function signup_user($user_name = '', $user_email = '', $errors = '') { <label for="signupblog">Gimme a blog! (Like username.<?php echo $current_site->domain ?>)</label>
<br />
<input id="signupuser" type="radio" name="signup_for" value="user" />
-<label for="signupuser">Just an username, please.</label>
+<label for="signupuser">Just a username, please.</label>
</p>
</td>
</tr>
@@ -309,7 +307,7 @@ function validate_blog_signup() { function confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta) {
?>
-<h2><?php printf(__('%s Is Yours'), $domain) ?></h2>
+<h2><?php printf(__('%s Is Yours'), $domain.$path) ?></h2>
<p><?php _e('But, before you can start using your blog, <strong>you must activate it</strong>.') ?></p>
<p><?php printf(__('Check your inbox at <strong>%1$s</strong> and click the link given. '), $user_email) ?></p>
<p><?php _e('If you do not activate your blog within two days, you will have to sign up again.'); ?></p>
|