]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/install.php
Wordpress 2.7.1
[autoinstalls/wordpress.git] / wp-admin / install.php
1 <?php
2 /**
3  * WordPress Installer
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 /**
10  * We are installing WordPress.
11  *
12  * @since unknown
13  * @var bool
14  */
15 define('WP_INSTALLING', true);
16
17 /** Load WordPress Bootstrap */
18 require_once('../wp-load.php');
19
20 /** Load WordPress Administration Upgrade API */
21 require_once('./includes/upgrade.php');
22
23 if (isset($_GET['step']))
24         $step = $_GET['step'];
25 else
26         $step = 0;
27
28 /**
29  * Display install header.
30  *
31  * @since unknown
32  * @package WordPress
33  * @subpackage Installer
34  */
35 function display_header() {
36 header( 'Content-Type: text/html; charset=utf-8' );
37 ?>
38 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
39 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
40 <head>
41         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
42         <title><?php _e('WordPress &rsaquo; Installation'); ?></title>
43         <?php wp_admin_css( 'install', true ); ?>
44 </head>
45 <body>
46 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
47
48 <?php
49 }//end function display_header();
50
51 // Let's check to make sure WP isn't already installed.
52 if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}
53
54 switch($step) {
55         case 0:
56         case 1: // in case people are directly linking to this
57           display_header();
58 ?>
59 <h1><?php _e('Welcome'); ?></h1>
60 <p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure.  Otherwise, just fill in the information below and you\'ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
61 <!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step'); ?></a></h2>-->
62
63 <h1><?php _e('Information needed'); ?></h1>
64 <p><?php _e("Please provide the following information.  Don't worry, you can always change these settings later."); ?></p>
65
66 <form id="setup" method="post" action="install.php?step=2">
67         <table class="form-table">
68                 <tr>
69                         <th scope="row"><label for="weblog_title"><?php _e('Blog Title'); ?></label></th>
70                         <td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
71                 </tr>
72                 <tr>
73                         <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th>
74                         <td><input name="admin_email" type="text" id="admin_email" size="25" /><br />
75                         <?php _e('Double-check your email address before continuing.'); ?>
76                 </tr>
77                 <tr>
78                         <td colspan="2"><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
79                 </tr>
80         </table>
81         <p class="step"><input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" /></p>
82 </form>
83
84 <?php
85                 break;
86         case 2:
87                 if ( !empty($wpdb->error) )
88                         wp_die($wpdb->error->get_error_message());
89
90                 display_header();
91                 // Fill in the data we gathered
92                 $weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : '';
93                 $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : '';
94                 $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0;
95                 // check e-mail address
96                 if (empty($admin_email)) {
97                         // TODO: poka-yoke
98                         die('<p>'.__("<strong>ERROR</strong>: you must provide an e-mail address.").'</p>');
99                 } else if (!is_email($admin_email)) {
100                         // TODO: poka-yoke
101                         die('<p>'.__('<strong>ERROR</strong>: that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>').'</p>');
102                 }
103
104                 $wpdb->show_errors();
105                 $result = wp_install($weblog_title, 'admin', $admin_email, $public);
106                 extract($result, EXTR_SKIP);
107 ?>
108
109 <h1><?php _e('Success!'); ?></h1>
110
111 <p><?php printf(__('WordPress has been installed. Were you expecting more steps? Sorry to disappoint.'), ''); ?></p>
112
113 <table class="form-table">
114         <tr>
115                 <th><?php _e('Username'); ?></th>
116                 <td><code>admin</code></td>
117         </tr>
118         <tr>
119                 <th><?php _e('Password'); ?></th>
120                 <td><code><?php echo $password; ?></code><br />
121                         <?php echo '<p>'.__('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.').'</p>'; ?></td>
122         </tr>
123 </table>
124
125 <p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
126
127 <?php
128                 break;
129 }
130 ?>
131 <script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
132 </body>
133 </html>