1 <?php |
1 <?php |
2 |
2 |
3 /** Sets up the WordPress Environment. */ |
3 /** Sets up the WordPress Environment. */ |
4 require( dirname( __FILE__ ) . '/wp-load.php' ); |
4 require __DIR__ . '/wp-load.php'; |
5 |
5 |
6 add_action( 'wp_head', 'wp_no_robots' ); |
6 add_action( 'wp_head', 'wp_no_robots' ); |
7 |
7 |
8 require( dirname( __FILE__ ) . '/wp-blog-header.php' ); |
8 require __DIR__ . '/wp-blog-header.php'; |
9 |
9 |
10 nocache_headers(); |
10 nocache_headers(); |
11 |
11 |
12 if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ) ) ) { |
12 if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ), true ) ) { |
13 wp_redirect( network_home_url() ); |
13 wp_redirect( network_home_url() ); |
14 die(); |
14 die(); |
15 } |
15 } |
16 |
16 |
17 /** |
17 /** |
129 $site = $current_network->domain . $current_network->path . __( 'sitename' ); |
129 $site = $current_network->domain . $current_network->path . __( 'sitename' ); |
130 } else { |
130 } else { |
131 $site = __( 'domain' ) . '.' . $site_domain . $current_network->path; |
131 $site = __( 'domain' ) . '.' . $site_domain . $current_network->path; |
132 } |
132 } |
133 |
133 |
134 /* translators: %s: site address */ |
134 printf( |
135 echo '<p>(<strong>' . sprintf( __( 'Your address will be %s.' ), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>'; |
135 '<p>(<strong>%s</strong>) %s</p>', |
136 } |
136 /* translators: %s: Site address. */ |
137 |
137 sprintf( __( 'Your address will be %s.' ), $site ), |
138 // Blog Title |
138 __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) |
|
139 ); |
|
140 } |
|
141 |
|
142 // Site Title. |
139 ?> |
143 ?> |
140 <label for="blog_title"><?php _e( 'Site Title:' ); ?></label> |
144 <label for="blog_title"><?php _e( 'Site Title:' ); ?></label> |
141 <?php |
145 <?php |
142 $errmsg = $errors->get_error_message( 'blog_title' ); |
146 $errmsg = $errors->get_error_message( 'blog_title' ); |
143 if ( $errmsg ) { |
147 if ( $errmsg ) { |
163 if ( isset( $_POST['WPLANG'] ) ) { |
167 if ( isset( $_POST['WPLANG'] ) ) { |
164 $lang = $_POST['WPLANG']; |
168 $lang = $_POST['WPLANG']; |
165 } |
169 } |
166 |
170 |
167 // Use US English if the default isn't available. |
171 // Use US English if the default isn't available. |
168 if ( ! in_array( $lang, $languages ) ) { |
172 if ( ! in_array( $lang, $languages, true ) ) { |
169 $lang = ''; |
173 $lang = ''; |
170 } |
174 } |
171 |
175 |
172 wp_dropdown_languages( |
176 wp_dropdown_languages( |
173 array( |
177 array( |
183 <?php |
187 <?php |
184 endif; // Languages. |
188 endif; // Languages. |
185 |
189 |
186 $blog_public_on_checked = ''; |
190 $blog_public_on_checked = ''; |
187 $blog_public_off_checked = ''; |
191 $blog_public_off_checked = ''; |
188 if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) { |
192 if ( isset( $_POST['blog_public'] ) && '0' === $_POST['blog_public'] ) { |
189 $blog_public_off_checked = 'checked="checked"'; |
193 $blog_public_off_checked = 'checked="checked"'; |
190 } else { |
194 } else { |
191 $blog_public_on_checked = 'checked="checked"'; |
195 $blog_public_on_checked = 'checked="checked"'; |
192 } |
196 } |
193 ?> |
197 ?> |
194 |
198 |
195 <div id="privacy"> |
199 <div id="privacy"> |
196 <p class="privacy-intro"> |
200 <p class="privacy-intro"> |
197 <label for="blog_public_on"><?php _e( 'Privacy:' ); ?></label> |
201 <?php _e( 'Privacy:' ); ?> |
198 <?php _e( 'Allow search engines to index this site.' ); ?> |
202 <?php _e( 'Allow search engines to index this site.' ); ?> |
199 <br style="clear:both" /> |
203 <br style="clear:both" /> |
200 <label class="checkbox" for="blog_public_on"> |
204 <label class="checkbox" for="blog_public_on"> |
201 <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php echo $blog_public_on_checked; ?> /> |
205 <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php echo $blog_public_on_checked; ?> /> |
202 <strong><?php _e( 'Yes' ); ?></strong> |
206 <strong><?php _e( 'Yes' ); ?></strong> |
247 function show_user_form( $user_name = '', $user_email = '', $errors = '' ) { |
251 function show_user_form( $user_name = '', $user_email = '', $errors = '' ) { |
248 if ( ! is_wp_error( $errors ) ) { |
252 if ( ! is_wp_error( $errors ) ) { |
249 $errors = new WP_Error(); |
253 $errors = new WP_Error(); |
250 } |
254 } |
251 |
255 |
252 // User name |
256 // Username. |
253 echo '<label for="user_name">' . __( 'Username:' ) . '</label>'; |
257 echo '<label for="user_name">' . __( 'Username:' ) . '</label>'; |
254 $errmsg = $errors->get_error_message( 'user_name' ); |
258 $errmsg = $errors->get_error_message( 'user_name' ); |
255 if ( $errmsg ) { |
259 if ( $errmsg ) { |
256 echo '<p class="error">' . $errmsg . '</p>'; |
260 echo '<p class="error">' . $errmsg . '</p>'; |
257 } |
261 } |
332 |
336 |
333 $blogname = $filtered_results['blogname']; |
337 $blogname = $filtered_results['blogname']; |
334 $blog_title = $filtered_results['blog_title']; |
338 $blog_title = $filtered_results['blog_title']; |
335 $errors = $filtered_results['errors']; |
339 $errors = $filtered_results['errors']; |
336 |
340 |
337 /* translators: %s: Network's site name. */ |
341 /* translators: %s: Network title. */ |
338 echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>'; |
342 echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>'; |
339 |
343 |
340 if ( $errors->has_errors() ) { |
344 if ( $errors->has_errors() ) { |
341 echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>'; |
345 echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>'; |
342 } |
346 } |
432 // Handle the language setting for the new site. |
436 // Handle the language setting for the new site. |
433 if ( ! empty( $_POST['WPLANG'] ) ) { |
437 if ( ! empty( $_POST['WPLANG'] ) ) { |
434 |
438 |
435 $languages = signup_get_available_languages(); |
439 $languages = signup_get_available_languages(); |
436 |
440 |
437 if ( in_array( $_POST['WPLANG'], $languages ) ) { |
441 if ( in_array( $_POST['WPLANG'], $languages, true ) ) { |
438 $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) ); |
442 $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) ); |
439 |
443 |
440 if ( $language ) { |
444 if ( $language ) { |
441 $blog_meta_defaults['WPLANG'] = $language; |
445 $blog_meta_defaults['WPLANG'] = $language; |
442 } |
446 } |
451 * @since MU (3.0.0) |
455 * @since MU (3.0.0) |
452 * @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead. |
456 * @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead. |
453 * |
457 * |
454 * @param array $blog_meta_defaults An array of default blog meta variables. |
458 * @param array $blog_meta_defaults An array of default blog meta variables. |
455 */ |
459 */ |
456 $meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults ); |
460 $meta_defaults = apply_filters_deprecated( 'signup_create_blog_meta', array( $blog_meta_defaults ), '3.0.0', 'add_signup_meta' ); |
457 |
461 |
458 /** |
462 /** |
459 * Filters the new default site meta variables. |
463 * Filters the new default site meta variables. |
460 * |
464 * |
461 * @since 3.0.0 |
465 * @since 3.0.0 |
512 ); |
516 ); |
513 |
517 |
514 ?> |
518 ?> |
515 <h2> |
519 <h2> |
516 <?php |
520 <?php |
517 /* translators: %s: site name */ |
521 /* translators: %s: Site title. */ |
518 printf( __( 'The site %s is yours.' ), $site ); |
522 printf( __( 'The site %s is yours.' ), $site ); |
519 ?> |
523 ?> |
520 </h2> |
524 </h2> |
521 <p> |
525 <p> |
522 <?php |
526 <?php |
523 printf( |
527 printf( |
524 /* translators: 1: link to new site, 2: login URL, 3: username */ |
528 /* translators: 1: Link to new site, 2: Login URL, 3: Username. */ |
525 __( '%1$s is your new site. <a href="%2$s">Log in</a> as “%3$s” using your existing password.' ), |
529 __( '%1$s is your new site. <a href="%2$s">Log in</a> as “%3$s” using your existing password.' ), |
526 sprintf( |
530 sprintf( |
527 '<a href="%s">%s</a>', |
531 '<a href="%s">%s</a>', |
528 esc_url( $home_url ), |
532 esc_url( $home_url ), |
529 untrailingslashit( $domain . $path ) |
533 untrailingslashit( $domain . $path ) |
586 |
590 |
587 ?> |
591 ?> |
588 |
592 |
589 <h2> |
593 <h2> |
590 <?php |
594 <?php |
591 /* translators: %s: name of the network */ |
595 /* translators: %s: Name of the network. */ |
592 printf( __( 'Get your own %s account in seconds' ), get_network()->site_name ); |
596 printf( __( 'Get your own %s account in seconds' ), get_network()->site_name ); |
593 ?> |
597 ?> |
594 </h2> |
598 </h2> |
595 <form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate"> |
599 <form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate"> |
596 <input type="hidden" name="stage" value="validate-user-signup" /> |
600 <input type="hidden" name="stage" value="validate-user-signup" /> |
635 if ( $errors->has_errors() ) { |
639 if ( $errors->has_errors() ) { |
636 signup_user( $user_name, $user_email, $errors ); |
640 signup_user( $user_name, $user_email, $errors ); |
637 return false; |
641 return false; |
638 } |
642 } |
639 |
643 |
640 if ( 'blog' == $_POST['signup_for'] ) { |
644 if ( 'blog' === $_POST['signup_for'] ) { |
641 signup_blog( $user_name, $user_email ); |
645 signup_blog( $user_name, $user_email ); |
642 return false; |
646 return false; |
643 } |
647 } |
644 |
648 |
645 /** This filter is documented in wp-signup.php */ |
649 /** This filter is documented in wp-signup.php */ |
659 */ |
663 */ |
660 function confirm_user_signup( $user_name, $user_email ) { |
664 function confirm_user_signup( $user_name, $user_email ) { |
661 ?> |
665 ?> |
662 <h2> |
666 <h2> |
663 <?php |
667 <?php |
664 /* translators: %s: username */ |
668 /* translators: %s: Username. */ |
665 printf( __( '%s is your new username' ), $user_name ) |
669 printf( __( '%s is your new username' ), $user_name ) |
666 ?> |
670 ?> |
667 </h2> |
671 </h2> |
668 <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ); ?></p> |
672 <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ); ?></p> |
669 <p> |
673 <p> |
670 <?php |
674 <?php |
671 /* translators: %s: email address */ |
675 /* translators: %s: Email address. */ |
672 printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); |
676 printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); |
673 ?> |
677 ?> |
674 </p> |
678 </p> |
675 <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p> |
679 <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p> |
676 <?php |
680 <?php |
783 // Handle the language setting for the new site. |
787 // Handle the language setting for the new site. |
784 if ( ! empty( $_POST['WPLANG'] ) ) { |
788 if ( ! empty( $_POST['WPLANG'] ) ) { |
785 |
789 |
786 $languages = signup_get_available_languages(); |
790 $languages = signup_get_available_languages(); |
787 |
791 |
788 if ( in_array( $_POST['WPLANG'], $languages ) ) { |
792 if ( in_array( $_POST['WPLANG'], $languages, true ) ) { |
789 $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) ); |
793 $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) ); |
790 |
794 |
791 if ( $language ) { |
795 if ( $language ) { |
792 $signup_meta['WPLANG'] = $language; |
796 $signup_meta['WPLANG'] = $language; |
793 } |
797 } |
805 /** |
809 /** |
806 * New site signup confirmation |
810 * New site signup confirmation |
807 * |
811 * |
808 * @since MU (3.0.0) |
812 * @since MU (3.0.0) |
809 * |
813 * |
810 * @param string $domain The domain URL |
814 * @param string $domain The domain URL. |
811 * @param string $path The site root path |
815 * @param string $path The site root path. |
812 * @param string $blog_title The new site title |
816 * @param string $blog_title The new site title. |
813 * @param string $user_name The user's username |
817 * @param string $user_name The user's username. |
814 * @param string $user_email The user's email address |
818 * @param string $user_email The user's email address. |
815 * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup() |
819 * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup(). |
816 */ |
820 */ |
817 function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) { |
821 function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) { |
818 ?> |
822 ?> |
819 <h2> |
823 <h2> |
820 <?php |
824 <?php |
821 /* translators: %s: site address */ |
825 /* translators: %s: Site address. */ |
822 printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) |
826 printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) |
823 ?> |
827 ?> |
824 </h2> |
828 </h2> |
825 |
829 |
826 <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ); ?></p> |
830 <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ); ?></p> |
827 <p> |
831 <p> |
828 <?php |
832 <?php |
829 /* translators: %s: email address */ |
833 /* translators: %s: Email address. */ |
830 printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); |
834 printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); |
831 ?> |
835 ?> |
832 </p> |
836 </p> |
833 <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p> |
837 <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p> |
834 <h2><?php _e( 'Still waiting for your email?' ); ?></h2> |
838 <h2><?php _e( 'Still waiting for your email?' ); ?></h2> |
837 <ul id="noemail-tips"> |
841 <ul id="noemail-tips"> |
838 <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ); ?></strong></p></li> |
842 <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ); ?></strong></p></li> |
839 <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ); ?></p></li> |
843 <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ); ?></p></li> |
840 <li> |
844 <li> |
841 <?php |
845 <?php |
842 /* translators: %s: email address */ |
846 /* translators: %s: Email address. */ |
843 printf( __( 'Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email.' ), $user_email ); |
847 printf( __( 'Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email.' ), $user_email ); |
844 ?> |
848 ?> |
845 </li> |
849 </li> |
846 </ul> |
850 </ul> |
847 </p> |
851 </p> |
881 * in a callback hooked to the 'signup_get_available_languages' filter before this point. |
885 * in a callback hooked to the 'signup_get_available_languages' filter before this point. |
882 */ |
886 */ |
883 return array_intersect_assoc( $languages, get_available_languages() ); |
887 return array_intersect_assoc( $languages, get_available_languages() ); |
884 } |
888 } |
885 |
889 |
886 // Main |
890 // Main. |
887 $active_signup = get_site_option( 'registration', 'none' ); |
891 $active_signup = get_site_option( 'registration', 'none' ); |
888 |
892 |
889 /** |
893 /** |
890 * Filters the type of site sign-up. |
894 * Filters the type of site sign-up. |
891 * |
895 * |
916 break; |
920 break; |
917 } |
921 } |
918 |
922 |
919 echo ' '; |
923 echo ' '; |
920 |
924 |
921 /* translators: %s: network settings URL */ |
925 /* translators: %s: URL to Network Settings screen. */ |
922 printf( __( 'To change or disable registration go to your <a href="%s">Options page</a>.' ), esc_url( network_admin_url( 'settings.php' ) ) ); |
926 printf( __( 'To change or disable registration go to your <a href="%s">Options page</a>.' ), esc_url( network_admin_url( 'settings.php' ) ) ); |
923 echo '</div>'; |
927 echo '</div>'; |
924 } |
928 } |
925 |
929 |
926 $newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null; |
930 $newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null; |
928 $current_user = wp_get_current_user(); |
932 $current_user = wp_get_current_user(); |
929 if ( 'none' === $active_signup ) { |
933 if ( 'none' === $active_signup ) { |
930 _e( 'Registration has been disabled.' ); |
934 _e( 'Registration has been disabled.' ); |
931 } elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) { |
935 } elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) { |
932 $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) ); |
936 $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) ); |
933 /* translators: %s: login URL */ |
937 /* translators: %s: Login URL. */ |
934 printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); |
938 printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); |
935 } else { |
939 } else { |
936 $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; |
940 $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; |
937 switch ( $stage ) { |
941 switch ( $stage ) { |
938 case 'validate-user-signup': |
942 case 'validate-user-signup': |
977 if ( $newblogname ) { |
981 if ( $newblogname ) { |
978 $newblog = get_blogaddress_by_name( $newblogname ); |
982 $newblog = get_blogaddress_by_name( $newblogname ); |
979 |
983 |
980 if ( 'blog' === $active_signup || 'all' === $active_signup ) { |
984 if ( 'blog' === $active_signup || 'all' === $active_signup ) { |
981 printf( |
985 printf( |
982 /* translators: %s: site address */ |
986 /* translators: %s: Site address. */ |
983 '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>', |
987 '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>', |
984 '<strong>' . $newblog . '</strong>' |
988 '<strong>' . $newblog . '</strong>' |
985 ); |
989 ); |
986 } else { |
990 } else { |
987 printf( |
991 printf( |
988 /* translators: %s: site address */ |
992 /* translators: %s: Site address. */ |
989 '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>', |
993 '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>', |
990 '<strong>' . $newblog . '</strong>' |
994 '<strong>' . $newblog . '</strong>' |
991 ); |
995 ); |
992 } |
996 } |
993 } |
997 } |