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(dirname(dirname(__FILE__)) . '/wp-load.php');
|
---|
19 |
|
---|
20 | /** Load WordPress Administration Upgrade API */
|
---|
21 | require_once(dirname(__FILE__) . '/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 › 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 | function display_setup_form( $error = null ) {
|
---|
52 | if ( ! is_null( $error ) ) {
|
---|
53 | ?>
|
---|
54 | <p><?php printf( __('<strong>ERROR</strong>: %s'), $error); ?></p>
|
---|
55 | <?php } ?>
|
---|
56 | <form id="setup" method="post" action="install.php?step=2">
|
---|
57 | <table class="form-table">
|
---|
58 | <tr>
|
---|
59 | <th scope="row"><label for="weblog_title"><?php _e('Blog Title'); ?></label></th>
|
---|
60 | <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo ( isset($_POST['weblog_title']) ? esc_attr($_POST['weblog_title']) : '' ); ?>" /></td>
|
---|
61 | </tr>
|
---|
62 | <tr>
|
---|
63 | <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th>
|
---|
64 | <td><input name="admin_email" type="text" id="admin_email" size="25" value="<?php echo ( isset($_POST['admin_email']) ? esc_attr($_POST['admin_email']) : '' ); ?>" /><br />
|
---|
65 | <?php _e('Double-check your email address before continuing.'); ?>
|
---|
66 | </tr>
|
---|
67 | <tr>
|
---|
68 | <td colspan="2"><label><input type="checkbox" name="blog_public" value="1"<?php if( isset($_POST) && ! empty($_POST) && isset( $_POST['blog_public'] ) ) : ?> checked="checked"<?php endif; ?> /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
|
---|
69 | </tr>
|
---|
70 | </table>
|
---|
71 | <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e('Install WordPress'); ?>" class="button" /></p>
|
---|
72 | </form>
|
---|
73 | <?php
|
---|
74 | }
|
---|
75 |
|
---|
76 | // Let's check to make sure WP isn't already installed.
|
---|
77 | 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>');}
|
---|
78 |
|
---|
79 | switch($step) {
|
---|
80 | case 0:
|
---|
81 | case 1: // in case people are directly linking to this
|
---|
82 | display_header();
|
---|
83 | ?>
|
---|
84 | <h1><?php _e('Welcome'); ?></h1>
|
---|
85 | <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>
|
---|
86 | <!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step'); ?></a></h2>-->
|
---|
87 |
|
---|
88 | <h1><?php _e('Information needed'); ?></h1>
|
---|
89 | <p><?php _e('Please provide the following information. Don’t worry, you can always change these settings later.'); ?></p>
|
---|
90 |
|
---|
91 |
|
---|
92 |
|
---|
93 | <?php
|
---|
94 | display_setup_form();
|
---|
95 | break;
|
---|
96 | case 2:
|
---|
97 | if ( !empty($wpdb->error) )
|
---|
98 | wp_die($wpdb->error->get_error_message());
|
---|
99 |
|
---|
100 | display_header();
|
---|
101 | // Fill in the data we gathered
|
---|
102 | $weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : '';
|
---|
103 | $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : '';
|
---|
104 | $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0;
|
---|
105 | // check e-mail address
|
---|
106 | $error = false;
|
---|
107 | if (empty($admin_email)) {
|
---|
108 | // TODO: poka-yoke
|
---|
109 | display_setup_form( __('you must provide an e-mail address.') );
|
---|
110 | $error = true;
|
---|
111 | } else if (!is_email($admin_email)) {
|
---|
112 | // TODO: poka-yoke
|
---|
113 | display_setup_form( __('that isn’t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>') );
|
---|
114 | $error = true;
|
---|
115 | }
|
---|
116 |
|
---|
117 | if ( $error === false ) {
|
---|
118 | $wpdb->show_errors();
|
---|
119 | $result = wp_install($weblog_title, 'admin', $admin_email, $public);
|
---|
120 | extract($result, EXTR_SKIP);
|
---|
121 | ?>
|
---|
122 |
|
---|
123 | <h1><?php _e('Success!'); ?></h1>
|
---|
124 |
|
---|
125 | <p><?php printf(__('WordPress has been installed. Were you expecting more steps? Sorry to disappoint.'), ''); ?></p>
|
---|
126 |
|
---|
127 | <table class="form-table">
|
---|
128 | <tr>
|
---|
129 | <th><?php _e('Username'); ?></th>
|
---|
130 | <td><code>admin</code></td>
|
---|
131 | </tr>
|
---|
132 | <tr>
|
---|
133 | <th><?php _e('Password'); ?></th>
|
---|
134 | <td><?php if ( !empty( $password ) ) {
|
---|
135 | echo '<code>'. $password .'</code><br />';
|
---|
136 | }
|
---|
137 | echo '<p>'. $password_message .'</p>'; ?></td>
|
---|
138 | </tr>
|
---|
139 | </table>
|
---|
140 |
|
---|
141 | <p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
|
---|
142 |
|
---|
143 | <?php
|
---|
144 | }
|
---|
145 | break;
|
---|
146 | }
|
---|
147 | ?>
|
---|
148 | <script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
|
---|
149 | </body>
|
---|
150 | </html>
|
---|