]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-activate.php
Wordpress 3.3.1-scripts
[autoinstalls/wordpress.git] / wp-activate.php
1 <?php
2 define( 'WP_INSTALLING', true );
3
4 /** Sets up the WordPress Environment. */
5 require( dirname(__FILE__) . '/wp-load.php' );
6
7 require( './wp-blog-header.php' );
8
9 if ( !is_multisite() ) {
10         wp_redirect( site_url( '/wp-login.php?action=register' ) );
11         die();
12 }
13
14 if ( is_object( $wp_object_cache ) )
15         $wp_object_cache->cache_enabled = false;
16
17 do_action( 'activate_header' );
18
19 function do_activate_header() {
20         do_action( 'activate_wp_head' );
21 }
22 add_action( 'wp_head', 'do_activate_header' );
23
24 function wpmu_activate_stylesheet() {
25         ?>
26         <style type="text/css">
27                 form { margin-top: 2em; }
28                 #submit, #key { width: 90%; font-size: 24px; }
29                 #language { margin-top: .5em; }
30                 .error { background: #f66; }
31                 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; }
32         </style>
33         <?php
34 }
35 add_action( 'wp_head', 'wpmu_activate_stylesheet' );
36
37 get_header();
38 ?>
39
40 <div id="content" class="widecolumn">
41         <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
42
43                 <h2><?php _e('Activation Key Required') ?></h2>
44                 <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
45                         <p>
46                             <label for="key"><?php _e('Activation Key:') ?></label>
47                             <br /><input type="text" name="key" id="key" value="" size="50" />
48                         </p>
49                         <p class="submit">
50                             <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
51                         </p>
52                 </form>
53
54         <?php } else {
55
56                 $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
57                 $result = wpmu_activate_signup($key);
58                 if ( is_wp_error($result) ) {
59                         if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
60                             $signup = $result->get_error_data();
61                                 ?>
62                                 <h2><?php _e('Your account is now active!'); ?></h2>
63                                 <?php
64                                 echo '<p class="lead-in">';
65                                 if ( $signup->domain . $signup->path == '' ) {
66                                         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() );
67                                 } else {
68                                         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() );
69                                 }
70                                 echo '</p>';
71                         } else {
72                                 ?>
73                                 <h2><?php _e('An error occurred during the activation'); ?></h2>
74                                 <?php
75                             echo '<p>'.$result->get_error_message().'</p>';
76                         }
77                 } else {
78                         extract($result);
79                         $url = get_blogaddress_by_id( (int) $blog_id);
80                         $user = new WP_User( (int) $user_id);
81                         ?>
82                         <h2><?php _e('Your account is now active!'); ?></h2>
83
84                         <div id="signup-welcome">
85                                 <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
86                                 <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $password; ?></p>
87                         </div>
88
89                         <?php if ( $url != network_home_url('', 'http') ) : ?>
90                                 <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>
91                         <?php else: ?>
92                                 <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>
93                         <?php endif;
94                 }
95         }
96         ?>
97 </div>
98 <script type="text/javascript">
99         var key_input = document.getElementById('key');
100         key_input && key_input.focus();
101 </script>
102 <?php get_footer(); ?>