Changeset 44024 for branches/4.9/src/wp-activate.php
- Timestamp:
- 12/13/2018 12:33:05 AM (4 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-activate.php
r43066 r44024 17 17 wp_redirect( wp_registration_url() ); 18 18 die(); 19 } 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 ( ! empty( $_GET['key'] ) ) { 30 $key = $_GET['key']; 31 } elseif ( ! empty( $_POST['key'] ) ) { 32 $key = $_POST['key']; 33 } 34 35 if ( $key ) { 36 $redirect_url = remove_query_arg( 'key' ); 37 38 if ( $redirect_url !== remove_query_arg( false ) ) { 39 setcookie( $activate_cookie, $key, 0, $activate_path, COOKIE_DOMAIN, is_ssl(), true ); 40 wp_safe_redirect( $redirect_url ); 41 exit; 42 } else { 43 $result = wpmu_activate_signup( $key ); 44 } 45 } 46 47 if ( $result === null && isset( $_COOKIE[ $activate_cookie ] ) ) { 48 $key = $_COOKIE[ $activate_cookie ]; 49 $result = wpmu_activate_signup( $key ); 50 setcookie( $activate_cookie, ' ', time() - YEAR_IN_SECONDS, $activate_path, COOKIE_DOMAIN, is_ssl(), true ); 51 } 52 53 if ( $result === null || ( is_wp_error( $result ) && 'invalid_key' === $result->get_error_code() ) ) { 54 status_header( 404 ); 55 } elseif ( is_wp_error( $result ) ) { 56 $error_code = $result->get_error_code(); 57 58 if ( ! in_array( $error_code, $valid_error_codes ) ) { 59 status_header( 400 ); 60 } 19 61 } 20 62 … … 70 112 } 71 113 add_action( 'wp_head', 'wpmu_activate_stylesheet' ); 114 add_action( 'wp_head', 'wp_sensitive_page_meta' ); 72 115 73 116 get_header( 'wp-activate' ); … … 76 119 <div id="signup-content" class="widecolumn"> 77 120 <div class="wp-activate-container"> 78 <?php if ( empty($_GET['key']) && empty($_POST['key'])) { ?>121 <?php if ( ! $key ) { ?> 79 122 80 123 <h2><?php _e('Activation Key Required') ?></h2> … … 90 133 91 134 <?php } else { 92 93 $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key']; 94 $result = wpmu_activate_signup( $key ); 95 if ( is_wp_error($result) ) { 96 if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) { 97 $signup = $result->get_error_data(); 98 ?> 99 <h2><?php _e('Your account is now active!'); ?></h2> 100 <?php 101 echo '<p class="lead-in">'; 102 if ( $signup->domain . $signup->path == '' ) { 103 printf( 104 /* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */ 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>.' ), 106 network_site_url( 'wp-login.php', 'login' ), 107 $signup->user_login, 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>'; 135 if ( is_wp_error( $result ) && in_array( $result->get_error_code(), $valid_error_codes ) ) { 136 $signup = $result->get_error_data(); 137 ?> 138 <h2><?php _e( 'Your account is now active!' ); ?></h2> 139 <?php 140 echo '<p class="lead-in">'; 141 if ( $signup->domain . $signup->path == '' ) { 142 printf( 143 /* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */ 144 __( '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>.' ), 145 network_site_url( 'wp-login.php', 'login' ), 146 $signup->user_login, 147 $signup->user_email, 148 wp_lostpassword_url() 149 ); 122 150 } else { 123 ?> 124 <h2><?php _e( 'An error occurred during the activation' ); ?></h2> 151 printf( 152 /* translators: 1: site URL, 2: username, 3: user email, 4: lost password URL */ 153 __( '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>.' ), 154 sprintf( '<a href="http://%1$s">%1$s</a>', $signup->domain ), 155 $signup->user_login, 156 $signup->user_email, 157 wp_lostpassword_url() 158 ); 159 } 160 echo '</p>'; 161 } elseif ( $result === null || is_wp_error( $result ) ) { 162 ?> 163 <h2><?php _e( 'An error occurred during the activation' ); ?></h2> 164 <?php if ( is_wp_error( $result ) ) : ?> 125 165 <p><?php echo $result->get_error_message(); ?></p> 126 <?php127 }166 <?php endif; ?> 167 <?php 128 168 } else { 129 169 $url = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : '';
Note: See TracChangeset
for help on using the changeset viewer.