21
$valid_error_codes = array( 'already_active', 'blog_taken' );
23
list( $activate_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
24
$activate_cookie = 'wp-activate-' . COOKIEHASH;
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'] ) ) {
33
} elseif ( ! empty( $_POST['key'] ) ) {
38
$redirect_url = remove_query_arg( 'key' );
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 );
45
$result = wpmu_activate_signup( $key );
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 );
55
if ( $result === null || ( is_wp_error( $result ) && 'invalid_key' === $result->get_error_code() ) ) {
57
} elseif ( is_wp_error( $result ) ) {
58
$error_code = $result->get_error_code();
60
if ( ! in_array( $error_code, $valid_error_codes ) ) {
23
67
if ( is_object( $wp_object_cache ) )
71
115
add_action( 'wp_head', 'wpmu_activate_stylesheet' );
116
add_action( 'wp_head', 'wp_sensitive_page_meta' );
73
118
get_header( 'wp-activate' );
76
121
<div id="signup-content" class="widecolumn">
77
122
<div class="wp-activate-container">
78
<?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
123
<?php if ( ! $key ) { ?>
80
125
<h2><?php _e('Activation Key Required') ?></h2>
81
126
<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
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();
99
<h2><?php _e('Your account is now active!'); ?></h2>
101
echo '<p class="lead-in">';
102
if ( $signup->domain . $signup->path == '' ) {
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' ),
109
wp_lostpassword_url()
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 ),
118
wp_lostpassword_url()
137
if ( is_wp_error( $result ) && in_array( $result->get_error_code(), $valid_error_codes ) ) {
138
$signup = $result->get_error_data();
140
<h2><?php _e( 'Your account is now active!' ); ?></h2>
142
echo '<p class="lead-in">';
143
if ( $signup->domain . $signup->path == '' ) {
145
/* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */
146
__( '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>.' ),
147
network_site_url( 'wp-login.php', 'login' ),
150
wp_lostpassword_url()
124
<h2><?php _e( 'An error occurred during the activation' ); ?></h2>
154
/* translators: 1: site URL, 2: username, 3: user email, 4: lost password URL */
155
__( '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>.' ),
156
sprintf( '<a href="http://%1$s">%1$s</a>', $signup->domain ),
159
wp_lostpassword_url()
163
} elseif ( $result === null || is_wp_error( $result ) ) {
165
<h2><?php _e( 'An error occurred during the activation' ); ?></h2>
166
<?php if ( is_wp_error( $result ) ) : ?>
125
167
<p><?php echo $result->get_error_message(); ?></p>
129
171
$url = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : '';
130
172
$user = get_userdata( (int) $result['user_id'] );