You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

163 lines
5.3 KiB

  1. <?php
  2. /**
  3. * Confirms that the activation key that is sent in an email after a user signs
  4. * up for a new site matches the key for that user and then displays confirmation.
  5. *
  6. * @package WordPress
  7. */
  8. define( 'WP_INSTALLING', true );
  9. /** Sets up the WordPress Environment. */
  10. require( dirname(__FILE__) . '/wp-load.php' );
  11. require( dirname( __FILE__ ) . '/wp-blog-header.php' );
  12. if ( !is_multisite() ) {
  13. wp_redirect( wp_registration_url() );
  14. die();
  15. }
  16. if ( is_object( $wp_object_cache ) )
  17. $wp_object_cache->cache_enabled = false;
  18. // Fix for page title
  19. $wp_query->is_404 = false;
  20. /**
  21. * Fires before the Site Activation page is loaded.
  22. *
  23. * @since 3.0.0
  24. */
  25. do_action( 'activate_header' );
  26. /**
  27. * Adds an action hook specific to this page.
  28. *
  29. * Fires on {@see 'wp_head'}.
  30. *
  31. * @since MU
  32. */
  33. function do_activate_header() {
  34. /**
  35. * Fires before the Site Activation page is loaded.
  36. *
  37. * Fires on the {@see 'wp_head'} action.
  38. *
  39. * @since 3.0.0
  40. */
  41. do_action( 'activate_wp_head' );
  42. }
  43. add_action( 'wp_head', 'do_activate_header' );
  44. /**
  45. * Loads styles specific to this page.
  46. *
  47. * @since MU
  48. */
  49. function wpmu_activate_stylesheet() {
  50. ?>
  51. <style type="text/css">
  52. form { margin-top: 2em; }
  53. #submit, #key { width: 90%; font-size: 24px; }
  54. #language { margin-top: .5em; }
  55. .error { background: #f66; }
  56. span.h3 { padding: 0 8px; font-size: 1.3em; font-weight: bold; }
  57. </style>
  58. <?php
  59. }
  60. add_action( 'wp_head', 'wpmu_activate_stylesheet' );
  61. get_header( 'wp-activate' );
  62. ?>
  63. <div id="signup-content" class="widecolumn">
  64. <div class="wp-activate-container">
  65. <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
  66. <h2><?php _e('Activation Key Required') ?></h2>
  67. <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
  68. <p>
  69. <label for="key"><?php _e('Activation Key:') ?></label>
  70. <br /><input type="text" name="key" id="key" value="" size="50" />
  71. </p>
  72. <p class="submit">
  73. <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
  74. </p>
  75. </form>
  76. <?php } else {
  77. $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
  78. $result = wpmu_activate_signup( $key );
  79. if ( is_wp_error($result) ) {
  80. if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
  81. $signup = $result->get_error_data();
  82. ?>
  83. <h2><?php _e('Your account is now active!'); ?></h2>
  84. <?php
  85. echo '<p class="lead-in">';
  86. if ( $signup->domain . $signup->path == '' ) {
  87. printf(
  88. /* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */
  89. __( 'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. 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>.' ),
  90. network_site_url( 'wp-login.php', 'login' ),
  91. $signup->user_login,
  92. $signup->user_email,
  93. wp_lostpassword_url()
  94. );
  95. } else {
  96. printf(
  97. /* translators: 1: site URL, 2: site domain, 3: username, 4: user email, 5: lost password URL */
  98. __( 'Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of &#8220;%3$s&#8221;. Please check your email inbox at %4$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="%5$s">reset your password</a>.' ),
  99. 'http://' . $signup->domain,
  100. $signup->domain,
  101. $signup->user_login,
  102. $signup->user_email,
  103. wp_lostpassword_url()
  104. );
  105. }
  106. echo '</p>';
  107. } else {
  108. ?>
  109. <h2><?php _e( 'An error occurred during the activation' ); ?></h2>
  110. <p><?php echo $result->get_error_message(); ?></p>
  111. <?php
  112. }
  113. } else {
  114. $url = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : '';
  115. $user = get_userdata( (int) $result['user_id'] );
  116. ?>
  117. <h2><?php _e('Your account is now active!'); ?></h2>
  118. <div id="signup-welcome">
  119. <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
  120. <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p>
  121. </div>
  122. <?php if ( $url && $url != network_home_url( '', 'http' ) ) :
  123. switch_to_blog( (int) $result['blog_id'] );
  124. $login_url = wp_login_url();
  125. restore_current_blog();
  126. ?>
  127. <p class="view"><?php
  128. /* translators: 1: site URL, 2: login URL */
  129. 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 ) );
  130. ?></p>
  131. <?php else: ?>
  132. <p class="view"><?php
  133. /* translators: 1: login URL, 2: network home URL */
  134. 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() );
  135. ?></p>
  136. <?php endif;
  137. }
  138. }
  139. ?>
  140. </div>
  141. </div>
  142. <script type="text/javascript">
  143. var key_input = document.getElementById('key');
  144. key_input && key_input.focus();
  145. </script>
  146. <?php get_footer( 'wp-activate' );