]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-activate.php
Wordpress 3.0.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( get_option( 'siteurl' ) . "/wp-login.php?action=register" );
11         die();
12 }
13
14 require_once( ABSPATH . WPINC . '/registration.php');
15
16 if ( is_object( $wp_object_cache ) )
17         $wp_object_cache->cache_enabled = false;
18
19 do_action("activate_header");
20
21 function do_activate_header() {
22         do_action("activate_wp_head");
23 }
24 add_action( 'wp_head', 'do_activate_header' );
25
26 function wpmu_activate_stylesheet() {
27         ?>
28         <style type="text/css">
29                 form { margin-top: 2em; }
30                 #submit, #key { width: 90%; font-size: 24px; }
31                 #language { margin-top: .5em; }
32                 .error { background: #f66; }
33                 span.h3 { padding:0 8px; font-size:1.3em; font-family:'Trebuchet MS','Lucida Grande',Verdana,Arial,Sans-Serif; font-weight:700; color:#333333; }
34         </style>
35         <?php
36 }
37 add_action( 'wp_head', 'wpmu_activate_stylesheet' );
38
39 get_header();
40 ?>
41
42 <div id="content" class="widecolumn">
43         <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
44
45                 <h2><?php _e('Activation Key Required') ?></h2>
46                 <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
47                         <p>
48                             <label for="key"><?php _e('Activation Key:') ?></label>
49                             <br /><input type="text" name="key" id="key" value="" size="50" />
50                         </p>
51                         <p class="submit">
52                             <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
53                         </p>
54                 </form>
55
56         <?php } else {
57
58                 $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
59                 $result = wpmu_activate_signup($key);
60                 if ( is_wp_error($result) ) {
61                         if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
62                             $signup = $result->get_error_data();
63                                 ?>
64                                 <h2><?php _e('Your account is now active!'); ?></h2>
65                                 <?php
66                                 echo '<p class="lead-in">';
67                                 if ( $signup->domain . $signup->path == '' ) {
68                                         printf( __('Your account has been activated. You may now <a href="%1$s">login</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, network_site_url( 'wp-login.php?action=lostpassword', 'login' ) );
69                                 } else {
70                                         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, network_site_url( 'wp-login.php?action=lostpassword' ) );
71                                 }
72                                 echo '</p>';
73                         } else {
74                                 ?>
75                                 <h2><?php _e('An error occurred during the activation'); ?></h2>
76                                 <?php
77                             echo '<p>'.$result->get_error_message().'</p>';
78                         }
79                 } else {
80                         extract($result);
81                         $url = get_blogaddress_by_id( (int) $blog_id);
82                         $user = new WP_User( (int) $user_id);
83                         ?>
84                         <h2><?php _e('Your account is now active!'); ?></h2>
85
86                         <div id="signup-welcome">
87                                 <p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
88                                 <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $password; ?></p>
89                         </div>
90
91                         <?php if ( $url != network_home_url('', 'http') ) : ?>
92                                 <p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Login</a>'), $url, $url . 'wp-login.php' ); ?></p>
93                         <?php else: ?>
94                                 <p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">Login</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?></p>
95                         <?php endif;
96                 }
97         }
98         ?>
99 </div>
100 <script type="text/javascript">
101         var key_input = document.getElementById('key');
102         key_input && key_input.focus();
103 </script>
104 <?php get_footer(); ?>