Changeset 1364
- Timestamp:
- 07/10/08 12:02:26 (1 year ago)
- Files:
-
- trunk/wp-includes/wpmu-functions.php (modified) (6 diffs)
- trunk/wp-signup.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/wpmu-functions.php
r1354 r1364 328 328 return; 329 329 330 if ( empty($switched_stack) ) 331 $switched_stack = array(); 332 333 $switched_stack[] = $blog_id; 334 330 335 if ( $blog_id == $new_blog ) 331 336 return; 332 333 if ( empty($switched_stack) )334 $switched_stack = array();335 336 $switched_stack[] = $blog_id;337 337 338 338 $wpdb->set_blog_id($new_blog); … … 894 894 } 895 895 896 function wpmu_validate_blog_signup($blog _id, $blog_title, $user = '') {896 function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') { 897 897 global $wpdb, $domain, $base; 898 898 899 $blog _id = sanitize_user( $blog_id);899 $blogname = sanitize_user( $blogname ); 900 900 $blog_title = strip_tags( $blog_title ); 901 901 $blog_title = substr( $blog_title, 0, 50 ); … … 908 908 } 909 909 910 if ( empty( $blog _id) )911 $errors->add('blog _id', __("Please enter a blog name"));910 if ( empty( $blogname ) ) 911 $errors->add('blogname', __("Please enter a blog name")); 912 912 913 913 $maybe = array(); 914 preg_match( "/[a-z0-9]+/", $blog _id, $maybe );915 if( $blog _id!= $maybe[0] ) {916 $errors->add('blog _id', __("Only lowercase letters and numbers allowed"));917 } 918 if( in_array( $blog _id, $illegal_names ) == true ) {919 $errors->add('blog _id', __("That name is not allowed"));920 } 921 if( strlen( $blog _id) < 4 && !is_site_admin() ) {922 $errors->add('blog _id', __("Blog name must be at least 4 characters"));923 } 924 925 if ( strpos( " " . $blog _id, "_" ) != false )926 $errors->add('blog _id', __("Sorry, blog names may not contain the character '_'!"));914 preg_match( "/[a-z0-9]+/", $blogname, $maybe ); 915 if( $blogname != $maybe[0] ) { 916 $errors->add('blogname', __("Only lowercase letters and numbers allowed")); 917 } 918 if( in_array( $blogname, $illegal_names ) == true ) { 919 $errors->add('blogname', __("That name is not allowed")); 920 } 921 if( strlen( $blogname ) < 4 && !is_site_admin() ) { 922 $errors->add('blogname', __("Blog name must be at least 4 characters")); 923 } 924 925 if ( strpos( " " . $blogname, "_" ) != false ) 926 $errors->add('blogname', __("Sorry, blog names may not contain the character '_'!")); 927 927 928 928 // all numeric? 929 929 $match = array(); 930 preg_match( '/[0-9]*/', $blog _id, $match );931 if ( $match[0] == $blog _id)932 $errors->add('blog _id', __("Sorry, blog names must have letters too!"));933 934 $blog _id = apply_filters( "newblog_id", $blog_id);930 preg_match( '/[0-9]*/', $blogname, $match ); 931 if ( $match[0] == $blogname ) 932 $errors->add('blogname', __("Sorry, blog names must have letters too!")); 933 934 $blogname = apply_filters( "newblogname", $blogname ); 935 935 936 936 $blog_title = stripslashes( $blog_title ); … … 941 941 // Check if the domain/path has been used already. 942 942 if( constant( "VHOST" ) == 'yes' ) { 943 $mydomain = "$blog _id.$domain";943 $mydomain = "$blogname.$domain"; 944 944 $path = $base; 945 945 } else { 946 946 $mydomain = "$domain"; 947 $path = $base.$blog _id.'/';947 $path = $base.$blogname.'/'; 948 948 } 949 949 if ( domain_exists($mydomain, $path) ) 950 $errors->add('blog _id', __("Sorry, that blog already exists!"));951 952 if ( username_exists($blog _id) ) {953 if ( !is_object($user) && ( $user->user_login != $blog _id) )954 $errors->add('blog _id', __("Sorry, that blog is reserved!"));950 $errors->add('blogname', __("Sorry, that blog already exists!")); 951 952 if ( username_exists($blogname) ) { 953 if ( !is_object($user) && ( $user->user_login != $blogname ) ) 954 $errors->add('blogname', __("Sorry, that blog is reserved!")); 955 955 } 956 956 … … 966 966 $wpdb->query("DELETE FROM $wpdb->signups WHERE domain = '$mydomain' AND path = '$path'"); 967 967 } else { 968 $errors->add('blog _id', __("That blog is currently reserved but may be available in a couple days."));969 } 970 } 971 972 $result = array('domain' => $mydomain, 'path' => $path, 'blog _id' => $blog_id, 'blog_title' => $blog_title,968 $errors->add('blogname', __("That blog is currently reserved but may be available in a couple days.")); 969 } 970 } 971 972 $result = array('domain' => $mydomain, 'path' => $path, 'blogname' => $blogname, 'blog_title' => $blog_title, 973 973 'errors' => $errors); 974 974 … … 1166 1166 1167 1167 if ( is_array($meta) ) foreach ($meta as $key => $value) { 1168 update_blog_status( $blog_id, $key, $value ); 1169 update_option( $blog_id, $key, $value ); 1170 } 1171 1172 add_option( $blog_id, 'WPLANG', get_site_option( 'WPLANG' ) ); 1173 1174 update_option( $blog_id, 'blog_public', $meta['public'] ); 1175 delete_blog_option( $blog_id, 'public' ); 1168 if( $key == 'public' || $key == 'archived' || $key == 'mature' || $key == 'spam' || $key == 'deleted' || $key == 'lang_id' ) { 1169 update_blog_status( $blog_id, $key, $value ); 1170 } else { 1171 update_option( $blog_id, $key, $value ); 1172 } 1173 } 1174 1175 add_option( 'WPLANG', get_site_option( 'WPLANG' ) ); 1176 1177 update_option( 'blog_public', $meta['public'] ); 1176 1178 1177 1179 if(get_usermeta( $user_id, 'primary_blog' ) == 1 ) trunk/wp-signup.php
r1330 r1364 35 35 .mu_register #blog_title, 36 36 .mu_register #user_email, 37 .mu_register #blog _id,37 .mu_register #blogname, 38 38 .mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; } 39 39 .mu_register .prefix_address, … … 52 52 <div class="mu_register"> 53 53 <?php 54 function show_blog_form($blog _id= '', $blog_title = '', $errors = '') {54 function show_blog_form($blogname = '', $blog_title = '', $errors = '') { 55 55 global $current_site; 56 56 // Blog name 57 57 if( constant( "VHOST" ) == 'no' ) 58 echo '<label for="blog _id">' . __('Blog Name:') . '</label>';58 echo '<label for="blogname">' . __('Blog Name:') . '</label>'; 59 59 else 60 echo '<label for="blog _id">' . __('Blog Domain:') . '</label>';61 62 if ( $errmsg = $errors->get_error_message('blog _id') ) { ?>60 echo '<label for="blogname">' . __('Blog Domain:') . '</label>'; 61 62 if ( $errmsg = $errors->get_error_message('blogname') ) { ?> 63 63 <p class="error"><?php echo $errmsg ?></p> 64 64 <?php } 65 65 66 66 if( constant( "VHOST" ) == 'no' ) { 67 echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blog _id" type="text" id="blog_id" value="'.$blog_id.'" maxlength="50" /><br />';67 echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /><br />'; 68 68 } else { 69 echo '<input name="blog _id" type="text" id="blog_id" value="'.$blog_id.'" maxlength="50" /><span class="suffix_address">.' . $current_site->domain . $current_site->path . '</span><br />';69 echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /><span class="suffix_address">.' . $current_site->domain . $current_site->path . '</span><br />'; 70 70 } 71 71 if ( !is_user_logged_in() ) { … … 111 111 $user = wp_get_current_user(); 112 112 113 return wpmu_validate_blog_signup($_POST['blog _id'], $_POST['blog_title'], $user);113 return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user); 114 114 } 115 115 … … 140 140 } 141 141 142 function signup_another_blog($blog _id= '', $blog_title = '', $errors = '') {142 function signup_another_blog($blogname = '', $blog_title = '', $errors = '') { 143 143 global $current_user, $current_site; 144 144 … … 148 148 149 149 // allow definition of default variables 150 $filtered_results = apply_filters('signup_another_blog_init', array('blog _id' => $blog_id, 'blog_title' => $blog_title, 'errors' => $errors ));151 $blog _id = $filtered_results['blog_id'];150 $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); 151 $blogname = $filtered_results['blogname']; 152 152 $blog_title = $filtered_results['blog_title']; 153 153 $errors = $filtered_results['errors']; … … 178 178 <input type="hidden" name="stage" value="gimmeanotherblog" /> 179 179 <?php do_action( "signup_hidden_fields" ); ?> 180 <?php show_blog_form($blog _id, $blog_title, $errors); ?>180 <?php show_blog_form($blogname, $blog_title, $errors); ?> 181 181 <p> 182 182 <input id="submit" type="submit" name="submit" class="submit" value="<?php _e('Create Blog »') ?>" /></p> … … 186 186 187 187 function validate_another_blog_signup() { 188 global $wpdb, $current_user, $blog _id, $blog_title, $errors, $domain, $path;188 global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path; 189 189 $current_user = wp_get_current_user(); 190 190 if( !is_user_logged_in() ) … … 195 195 196 196 if ( $errors->get_error_code() ) { 197 signup_another_blog($blog _id, $blog_title, $errors);197 signup_another_blog($blogname, $blog_title, $errors); 198 198 return false; 199 199 } … … 291 291 } 292 292 293 function signup_blog($user_name = '', $user_email = '', $blog _id= '', $blog_title = '', $errors = '') {293 function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') { 294 294 if ( !is_wp_error($errors) ) 295 295 $errors = new WP_Error(); 296 296 297 297 // allow definition of default variables 298 $filtered_results = apply_filters('signup_blog_init', array('user_name' => $user_name, 'user_email' => $user_email, 'blog _id' => $blog_id, 'blog_title' => $blog_title, 'errors' => $errors ));298 $filtered_results = apply_filters('signup_blog_init', array('user_name' => $user_name, 'user_email' => $user_email, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); 299 299 $user_name = $filtered_results['user_name']; 300 300 $user_email = $filtered_results['user_email']; 301 $blog _id = $filtered_results['blog_id'];301 $blogname = $filtered_results['blogname']; 302 302 $blog_title = $filtered_results['blog_title']; 303 303 $errors = $filtered_results['errors']; 304 304 305 if ( empty($blog _id) )306 $blog _id= $user_name;305 if ( empty($blogname) ) 306 $blogname = $user_name; 307 307 ?> 308 308 <form id="setupform" method="post" action="wp-signup.php"> … … 311 311 <input type="hidden" name="user_email" value="<?php echo $user_email ?>" /> 312 312 <?php do_action( "signup_hidden_fields" ); ?> 313 <?php show_blog_form($blog _id, $blog_title, $errors); ?>313 <?php show_blog_form($blogname, $blog_title, $errors); ?> 314 314 <p> 315 315 <input id="submit" type="submit" name="submit" class="submit" value="<?php _e('Signup »') ?>" /></p> … … 328 328 } 329 329 330 $result = wpmu_validate_blog_signup($_POST['blog _id'], $_POST['blog_title']);330 $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']); 331 331 extract($result); 332 332 333 333 if ( $errors->get_error_code() ) { 334 signup_blog($user_name, $user_email, $blog _id, $blog_title, $errors);334 signup_blog($user_name, $user_email, $blogname, $blog_title, $errors); 335 335 return false; 336 336 } … … 352 352 <p><?php printf(__('Check your inbox at <strong>%s</strong> and click the link given. It should arrive within 30 minutes.'), $user_email) ?></p> 353 353 <p><?php _e('If you do not activate your blog within two days, you will have to sign up again.'); ?></p> 354 <h2><?php _e('Still waiting for your email?') ?></h2>354 <h2><?php _e('Still waiting for your email?'); ?></h2> 355 355 <p> 356 356 <?php _e("If you haven't received your email yet, there are a number of things you can do:") ?>
