]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-activate.php
6a474b12fb2bc7d43c0cc39d27efc1d0e1954e3b
[autoinstalls/wordpress.git] / wp-activate.php
1 <?php
2 /**
3  * Confirms that the activation key that is sent in an email after a user signs
4  * up for a new blog matches the key for that user and then displays confirmation.
5  *
6  * @package WordPress
7  */
8
9 define( 'WP_INSTALLING', true );
10
11 /** Sets up the WordPress Environment. */
12 require( dirname(__FILE__) . '/wp-load.php' );
13
14 require( './wp-blog-header.php' );
15
16 if ( !is_multisite() ) {
17         wp_redirect( site_url( '/wp-login.php?action=register' ) );
18         die();
19 }
20
21 if ( is_object( $wp_object_cache ) )
22         $wp_object_cache->cache_enabled = false;
23
24 do_action( 'activate_header' );
25
26 /**
27  * Adds an action hook specific to this page that fires on wp_head
28  *
29  * @since MU
30  */
31 function do_activate_header() {
32         do_action( 'activate_wp_head' );
33 }
34 add_action( 'wp_head', 'do_activate_header' );
35
36 /**
37  * Loads styles specific to this page.
38  *
39  * @since MU
40  */
41 function wpmu_activate_stylesheet() {
42         ?>
43         <style type="text/css">
44                 form { margin-top: 2em; }
45                 #submit, #key { width: 90%; font-size: 24px; }
46                 #language { margin-top: .5em; }
47                 .error { background: #f66; }
48                 span.h3 { padding: 0 8px; font-size: 1.3em; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; font-weight: bold; color: #333; }
49         </style>
50         <?php
51 }
52 add_action( 'wp_head', 'wpmu_activate_stylesheet' );
53
54 get_header();
55 ?>
56
57 <div id="content" class="widecolumn">
58         <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
59
60                 <h2><?php _e('Activation Key Required') ?></h2>
61                 <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
62                         <p>
63                             <label for="key"><?php _e('Activation Key:') ?></label>
64                             <br /><input type="text" name="key" id="key" value="" size="50" />
65                         </p>
66                         <p class="submit">
67                             <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
68                         </p>
69                 </form>
70
71         <?php } else {
72
73                 $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
74                 $result = wpmu_activate_signup($key);
75                 if ( is_wp_error($result) ) {
76                         if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
77                             $signup = $result->get_error_data();
78                                 ?>
79                                 <h2><?php _e('Your account is now active!'); ?></h2>
80                                 <?php
81                                 echo '<p class="lead-in">';
82                                 if ( $signup->domain . $signup->path == '' ) {
83                                         printf( __('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>.'), network_site_url( 'wp-login.php', 'login' ), $signup->user_login, $signup->user_email, wp_lostpassword_url() );
84                                 } else {
85                                         printf( __('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>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url() );
86                                 }
87                                 echo '</p>';
88                         } else {
89                                 ?>
90                                 <h2><?php _e('An error occurred during the activation'); ?></h2>
91                                 <?php
92                             echo '<p>'.$result->get_error_message().'</p>';
93                         }
94                 } else {
95                         extract($result);
96                         $url = get_blogaddress_by_id( (int) $blog_id);
97                         $user = get_userdata( (int) $user_id);
98                         ?>
99                         <h2><?php _e('Your account is now active!'); ?></h2>
100
101                         <div id="signup-welcome">
102                                 <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
103                                 <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $password; ?></p>
104                         </div>
105
106                         <?php if ( $url != network_home_url('', 'http') ) : ?>
107                                 <p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, $url . 'wp-login.php' ); ?></p>
108                         <?php else: ?>
109                                 <p class="view"><?php 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() ); ?></p>
110                         <?php endif;
111                 }
112         }
113         ?>
114 </div>
115 <script type="text/javascript">
116         var key_input = document.getElementById('key');
117         key_input && key_input.focus();
118 </script>
119 <?php get_footer(); ?>