7 */ |
7 */ |
8 |
8 |
9 define( 'WP_INSTALLING', true ); |
9 define( 'WP_INSTALLING', true ); |
10 |
10 |
11 /** Sets up the WordPress Environment. */ |
11 /** Sets up the WordPress Environment. */ |
12 require( dirname(__FILE__) . '/wp-load.php' ); |
12 require( dirname( __FILE__ ) . '/wp-load.php' ); |
13 |
13 |
14 require( dirname( __FILE__ ) . '/wp-blog-header.php' ); |
14 require( dirname( __FILE__ ) . '/wp-blog-header.php' ); |
15 |
15 |
16 if ( !is_multisite() ) { |
16 if ( ! is_multisite() ) { |
17 wp_redirect( wp_registration_url() ); |
17 wp_redirect( wp_registration_url() ); |
18 die(); |
18 die(); |
19 } |
19 } |
20 |
20 |
|
21 $valid_error_codes = array( 'already_active', 'blog_taken' ); |
|
22 |
|
23 list( $activate_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
24 $activate_cookie = 'wp-activate-' . COOKIEHASH; |
|
25 |
|
26 $key = ''; |
|
27 $result = null; |
|
28 |
|
29 if ( isset( $_GET['key'] ) && isset( $_POST['key'] ) && $_GET['key'] !== $_POST['key'] ) { |
|
30 wp_die( __( 'A key value mismatch has been detected. Please follow the link provided in your activation email.' ), __( 'An error occurred during the activation' ), 400 ); |
|
31 } elseif ( ! empty( $_GET['key'] ) ) { |
|
32 $key = $_GET['key']; |
|
33 } elseif ( ! empty( $_POST['key'] ) ) { |
|
34 $key = $_POST['key']; |
|
35 } |
|
36 |
|
37 if ( $key ) { |
|
38 $redirect_url = remove_query_arg( 'key' ); |
|
39 |
|
40 if ( $redirect_url !== remove_query_arg( false ) ) { |
|
41 setcookie( $activate_cookie, $key, 0, $activate_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
42 wp_safe_redirect( $redirect_url ); |
|
43 exit; |
|
44 } else { |
|
45 $result = wpmu_activate_signup( $key ); |
|
46 } |
|
47 } |
|
48 |
|
49 if ( $result === null && isset( $_COOKIE[ $activate_cookie ] ) ) { |
|
50 $key = $_COOKIE[ $activate_cookie ]; |
|
51 $result = wpmu_activate_signup( $key ); |
|
52 setcookie( $activate_cookie, ' ', time() - YEAR_IN_SECONDS, $activate_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
53 } |
|
54 |
|
55 if ( $result === null || ( is_wp_error( $result ) && 'invalid_key' === $result->get_error_code() ) ) { |
|
56 status_header( 404 ); |
|
57 } elseif ( is_wp_error( $result ) ) { |
|
58 $error_code = $result->get_error_code(); |
|
59 |
|
60 if ( ! in_array( $error_code, $valid_error_codes ) ) { |
|
61 status_header( 400 ); |
|
62 } |
|
63 } |
|
64 |
21 nocache_headers(); |
65 nocache_headers(); |
22 |
66 |
23 if ( is_object( $wp_object_cache ) ) |
67 if ( is_object( $wp_object_cache ) ) { |
24 $wp_object_cache->cache_enabled = false; |
68 $wp_object_cache->cache_enabled = false; |
|
69 } |
25 |
70 |
26 // Fix for page title |
71 // Fix for page title |
27 $wp_query->is_404 = false; |
72 $wp_query->is_404 = false; |
28 |
73 |
29 /** |
74 /** |
62 <style type="text/css"> |
107 <style type="text/css"> |
63 form { margin-top: 2em; } |
108 form { margin-top: 2em; } |
64 #submit, #key { width: 90%; font-size: 24px; } |
109 #submit, #key { width: 90%; font-size: 24px; } |
65 #language { margin-top: .5em; } |
110 #language { margin-top: .5em; } |
66 .error { background: #f66; } |
111 .error { background: #f66; } |
67 span.h3 { padding: 0 8px; font-size: 1.3em; font-weight: bold; } |
112 span.h3 { padding: 0 8px; font-size: 1.3em; font-weight: 600; } |
68 </style> |
113 </style> |
69 <?php |
114 <?php |
70 } |
115 } |
71 add_action( 'wp_head', 'wpmu_activate_stylesheet' ); |
116 add_action( 'wp_head', 'wpmu_activate_stylesheet' ); |
|
117 add_action( 'wp_head', 'wp_sensitive_page_meta' ); |
72 |
118 |
73 get_header( 'wp-activate' ); |
119 get_header( 'wp-activate' ); |
74 ?> |
120 ?> |
75 |
121 |
76 <div id="signup-content" class="widecolumn"> |
122 <div id="signup-content" class="widecolumn"> |
77 <div class="wp-activate-container"> |
123 <div class="wp-activate-container"> |
78 <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?> |
124 <?php if ( ! $key ) { ?> |
79 |
125 |
80 <h2><?php _e('Activation Key Required') ?></h2> |
126 <h2><?php _e( 'Activation Key Required' ); ?></h2> |
81 <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>"> |
127 <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url( 'wp-activate.php' ); ?>"> |
82 <p> |
128 <p> |
83 <label for="key"><?php _e('Activation Key:') ?></label> |
129 <label for="key"><?php _e( 'Activation Key:' ); ?></label> |
84 <br /><input type="text" name="key" id="key" value="" size="50" /> |
130 <br /><input type="text" name="key" id="key" value="" size="50" /> |
85 </p> |
131 </p> |
86 <p class="submit"> |
132 <p class="submit"> |
87 <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" /> |
133 <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e( 'Activate' ); ?>" /> |
88 </p> |
134 </p> |
89 </form> |
135 </form> |
90 |
136 |
91 <?php } else { |
137 <?php |
92 |
138 } else { |
93 $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key']; |
139 if ( is_wp_error( $result ) && in_array( $result->get_error_code(), $valid_error_codes ) ) { |
94 $result = wpmu_activate_signup( $key ); |
140 $signup = $result->get_error_data(); |
95 if ( is_wp_error($result) ) { |
141 ?> |
96 if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) { |
142 <h2><?php _e( 'Your account is now active!' ); ?></h2> |
97 $signup = $result->get_error_data(); |
143 <?php |
98 ?> |
144 echo '<p class="lead-in">'; |
99 <h2><?php _e('Your account is now active!'); ?></h2> |
145 if ( $signup->domain . $signup->path == '' ) { |
100 <?php |
146 printf( |
101 echo '<p class="lead-in">'; |
147 /* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */ |
102 if ( $signup->domain . $signup->path == '' ) { |
148 __( 'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ), |
103 printf( |
149 network_site_url( 'wp-login.php', 'login' ), |
104 /* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */ |
150 $signup->user_login, |
105 __( 'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ), |
151 $signup->user_email, |
106 network_site_url( 'wp-login.php', 'login' ), |
152 wp_lostpassword_url() |
107 $signup->user_login, |
153 ); |
108 $signup->user_email, |
|
109 wp_lostpassword_url() |
|
110 ); |
|
111 } else { |
|
112 printf( |
|
113 /* translators: 1: site URL, 2: username, 3: user email, 4: lost password URL */ |
|
114 __( 'Your site at %1$s is active. You may now log in to your site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ), |
|
115 sprintf( '<a href="http://%1$s">%1$s</a>', $signup->domain ), |
|
116 $signup->user_login, |
|
117 $signup->user_email, |
|
118 wp_lostpassword_url() |
|
119 ); |
|
120 } |
|
121 echo '</p>'; |
|
122 } else { |
154 } else { |
123 ?> |
155 printf( |
124 <h2><?php _e( 'An error occurred during the activation' ); ?></h2> |
156 /* translators: 1: site URL, 2: username, 3: user email, 4: lost password URL */ |
|
157 __( 'Your site at %1$s is active. You may now log in to your site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ), |
|
158 sprintf( '<a href="http://%1$s">%1$s</a>', $signup->domain ), |
|
159 $signup->user_login, |
|
160 $signup->user_email, |
|
161 wp_lostpassword_url() |
|
162 ); |
|
163 } |
|
164 echo '</p>'; |
|
165 } elseif ( $result === null || is_wp_error( $result ) ) { |
|
166 ?> |
|
167 <h2><?php _e( 'An error occurred during the activation' ); ?></h2> |
|
168 <?php if ( is_wp_error( $result ) ) : ?> |
125 <p><?php echo $result->get_error_message(); ?></p> |
169 <p><?php echo $result->get_error_message(); ?></p> |
126 <?php |
170 <?php endif; ?> |
127 } |
171 <?php |
128 } else { |
172 } else { |
129 $url = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : ''; |
173 $url = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : ''; |
130 $user = get_userdata( (int) $result['user_id'] ); |
174 $user = get_userdata( (int) $result['user_id'] ); |
131 ?> |
175 ?> |
132 <h2><?php _e('Your account is now active!'); ?></h2> |
176 <h2><?php _e( 'Your account is now active!' ); ?></h2> |
133 |
177 |
134 <div id="signup-welcome"> |
178 <div id="signup-welcome"> |
135 <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p> |
179 <p><span class="h3"><?php _e( 'Username:' ); ?></span> <?php echo $user->user_login; ?></p> |
136 <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p> |
180 <p><span class="h3"><?php _e( 'Password:' ); ?></span> <?php echo $result['password']; ?></p> |
137 </div> |
181 </div> |
138 |
182 |
139 <?php if ( $url && $url != network_home_url( '', 'http' ) ) : |
183 <?php |
|
184 if ( $url && $url != network_home_url( '', 'http' ) ) : |
140 switch_to_blog( (int) $result['blog_id'] ); |
185 switch_to_blog( (int) $result['blog_id'] ); |
141 $login_url = wp_login_url(); |
186 $login_url = wp_login_url(); |
142 restore_current_blog(); |
187 restore_current_blog(); |
143 ?> |
188 ?> |
144 <p class="view"><?php |
189 <p class="view"> |
|
190 <?php |
145 /* translators: 1: site URL, 2: login URL */ |
191 /* translators: 1: site URL, 2: login URL */ |
146 printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' ), $url, esc_url( $login_url ) ); |
192 printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' ), $url, esc_url( $login_url ) ); |
147 ?></p> |
193 ?> |
148 <?php else: ?> |
194 </p> |
149 <p class="view"><?php |
195 <?php else : ?> |
|
196 <p class="view"> |
|
197 <?php |
150 /* translators: 1: login URL, 2: network home URL */ |
198 /* translators: 1: login URL, 2: network home URL */ |
151 printf( __( 'Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url( 'wp-login.php', 'login' ), network_home_url() ); |
199 printf( __( 'Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url( 'wp-login.php', 'login' ), network_home_url() ); |
152 ?></p> |
200 ?> |
153 <?php endif; |
201 </p> |
|
202 <?php |
|
203 endif; |
154 } |
204 } |
155 } |
205 } |
156 ?> |
206 ?> |
157 </div> |
207 </div> |
158 </div> |
208 </div> |
159 <script type="text/javascript"> |
209 <script type="text/javascript"> |
160 var key_input = document.getElementById('key'); |
210 var key_input = document.getElementById('key'); |
161 key_input && key_input.focus(); |
211 key_input && key_input.focus(); |
162 </script> |
212 </script> |
163 <?php get_footer( 'wp-activate' ); |
213 <?php |
|
214 get_footer( 'wp-activate' ); |