]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/install.php
WordPress 4.4.1-scripts
[autoinstalls/wordpress.git] / wp-admin / install.php
index ffa33ce79b36a0c9587316c0d68ddf5362b65da3..0e30ec0c915008a1cc683b7a11ee341890837bec 100644 (file)
 <?php
 <?php
-define('WP_INSTALLING', true);
-if (!file_exists('../wp-config.php')) 
-    die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
-
-require_once('../wp-config.php');
-require_once('./upgrade-functions.php');
-
-$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
-$guessurl = str_replace('/wp-admin/install.php?step=2', '', $schema . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) );
-
-if (isset($_GET['step']))
-       $step = $_GET['step'];
-else
-       $step = 0;
-header( 'Content-Type: text/html; charset=utf-8' );
+/**
+ * WordPress Installer
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+// Sanity check.
+if ( false ) {
 ?>
 ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-       <title><?php _e('WordPress &rsaquo; Installation'); ?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-       <style media="screen" type="text/css">
-       <!--
-       html {
-               background: #eee;
-       }
-       body {
-               background: #fff;
-               color: #000;
-               font-family: Georgia, "Times New Roman", Times, serif;
-               margin-left: 20%;
-               margin-right: 20%;
-               padding: .2em 2em;
-       }
-       
-       h1 {
-               color: #006;
-               font-size: 18px;
-               font-weight: lighter;
-       }
-       
-       h2 {
-               font-size: 16px;
-       }
-       
-       p, li, dt {
-               line-height: 140%;
-               padding-bottom: 2px;
-       }
+       <title>Error: PHP is not running</title>
+</head>
+<body class="wp-core-ui">
+       <p id="logo"><a href="https://wordpress.org/">WordPress</a></p>
+       <h1>Error: PHP is not running</h1>
+       <p>WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p>
+</body>
+</html>
+<?php
+}
 
 
-       ul, ol {
-               padding: 5px 5px 5px 20px;
-       }
-       #logo {
-               margin-bottom: 2em;
+/**
+ * We are installing WordPress.
+ *
+ * @since 1.5.1
+ * @var bool
+ */
+define( 'WP_INSTALLING', true );
+
+/** Load WordPress Bootstrap */
+require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+
+/** Load WordPress Administration Upgrade API */
+require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+
+/** Load WordPress Translation Install API */
+require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
+
+/** Load wpdb */
+require_once( ABSPATH . WPINC . '/wp-db.php' );
+
+nocache_headers();
+
+$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0;
+
+/**
+ * Display install header.
+ *
+ * @since 2.5.0
+ *
+ * @param string $body_classes
+ */
+function display_header( $body_classes = '' ) {
+       header( 'Content-Type: text/html; charset=utf-8' );
+       if ( is_rtl() ) {
+               $body_classes .= 'rtl';
        }
        }
-       .step a, .step input {
-               font-size: 2em;
+       if ( $body_classes ) {
+               $body_classes = ' ' . $body_classes;
        }
        }
-       td input {
-               font-size: 1.5em;
-       }
-       .step, th {
-               text-align: right;
-       }
-       #footer {
-               text-align: center; 
-               border-top: 1px solid #ccc; 
-               padding-top: 1em; 
-               font-style: italic;
-       }
-       -->
-       </style>
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+<head>
+       <meta name="viewport" content="width=device-width" />
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+       <meta name="robots" content="noindex,nofollow" />
+       <title><?php _e( 'WordPress &rsaquo; Installation' ); ?></title>
+       <?php
+               wp_admin_css( 'install', true );
+               wp_admin_css( 'dashicons', true );
+       ?>
 </head>
 </head>
-<body>
-<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
-<?php
-// Let's check to make sure WP isn't already installed.
-$wpdb->hide_errors();
-$installed = $wpdb->get_results("SELECT * FROM $wpdb->users");
-if ($installed) 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>');
-$wpdb->show_errors();
-
-switch($step) {
+<body class="wp-core-ui<?php echo $body_classes ?>">
+<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p>
 
 
-       case 0:
-?>
-<p><?php printf(__('Welcome to WordPress installation. We&#8217;re now going to go through a few steps to get you up and running with the latest in personal publishing platforms. You may want to peruse the <a href="%s">ReadMe documentation</a> at your leisure.'), '../readme.html'); ?></p>
-       <h2 class="step"><a href="install.php?step=1"><?php _e('First Step &raquo;'); ?></a></h2>
 <?php
 <?php
-       break;
+} // end display_header()
+
+/**
+ * Display installer setup form.
+ *
+ * @since 2.8.0
+ *
+ * @param string|null $error
+ */
+function display_setup_form( $error = null ) {
+       global $wpdb;
+
+       $sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->users ) );
+       $user_table = ( $wpdb->get_var( $sql ) != null );
+
+       // Ensure that Blogs appear in search engines by default.
+       $blog_public = 1;
+       if ( isset( $_POST['weblog_title'] ) ) {
+               $blog_public = isset( $_POST['blog_public'] );
+       }
 
 
-       case 1:
+       $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
+       $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
+       $admin_email  = isset( $_POST['admin_email']  ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : '';
 
 
+       if ( ! is_null( $error ) ) {
 ?>
 ?>
-<h1><?php _e('First Step'); ?></h1>
-<p><?php _e("Before we begin we need a little bit of information. Don't worry, you can always change these later."); ?></p>
-
-<form id="setup" method="post" action="install.php?step=2">
-<table width="100%">
-<tr>
-<th width="33%"><?php _e('Weblog title:'); ?></th>
-<td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
-</tr>
-<tr>
-<th><?php _e('Your e-mail:'); ?></th>
-       <td><input name="admin_email" type="text" id="admin_email" size="25" /></td>
-</tr>
-</table>
-<p><em><?php _e('Double-check that email address before continuing.'); ?></em></p>
-<h2 class="step">
-<input type="submit" name="Submit" value="<?php _e('Continue to Second Step &raquo;'); ?>" />
-</h2>
+<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1>
+<p class="message"><?php echo $error; ?></p>
+<?php } ?>
+<form id="setup" method="post" action="install.php?step=2" novalidate="novalidate">
+       <table class="form-table">
+               <tr>
+                       <th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th>
+                       <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td>
+               </tr>
+               <tr>
+                       <th scope="row"><label for="user_login"><?php _e('Username'); ?></label></th>
+                       <td>
+                       <?php
+                       if ( $user_table ) {
+                               _e('User(s) already exists.');
+                               echo '<input name="user_name" type="hidden" value="admin" />';
+                       } else {
+                               ?><input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" />
+                               <p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p>
+                       <?php
+                       } ?>
+                       </td>
+               </tr>
+               <?php if ( ! $user_table ) : ?>
+               <tr class="form-field form-required user-pass1-wrap">
+                       <th scope="row">
+                               <label for="pass1">
+                                       <?php _e( 'Password' ); ?>
+                               </label>
+                       </th>
+                       <td>
+                               <div class="">
+                                       <?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?>
+                                       <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
+                                       <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset( $_POST['admin_password'] ); ?>" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
+                                               <span class="dashicons dashicons-hidden"></span>
+                                               <span class="text"><?php _e( 'Hide' ); ?></span>
+                                       </button>
+                                       <div id="pass-strength-result" aria-live="polite"></div>
+                               </div>
+                               <p><span class="description important hide-if-no-js">
+                               <strong><?php _e( 'Important:' ); ?></strong>
+                               <?php /* translators: The non-breaking space prevents 1Password from thinking the text "log in" should trigger a password save prompt. */ ?>
+                               <?php _e( 'You will need this password to log&nbsp;in. Please store it in a secure location.' ); ?></span></p>
+                       </td>
+               </tr>
+               <tr class="form-field form-required user-pass2-wrap hide-if-js">
+                       <th scope="row">
+                               <label for="pass2"><?php _e( 'Repeat Password' ); ?>
+                                       <span class="description"><?php _e( '(required)' ); ?></span>
+                               </label>
+                       </th>
+                       <td>
+                               <input name="admin_password2" type="password" id="pass2" autocomplete="off" />
+                       </td>
+               </tr>
+               <tr class="pw-weak">
+                       <th scope="row"><?php _e( 'Confirm Password' ); ?></th>
+                       <td>
+                               <label>
+                                       <input type="checkbox" name="pw_weak" class="pw-checkbox" />
+                                       <?php _e( 'Confirm use of weak password' ); ?>
+                               </label>
+                       </td>
+               </tr>
+               <?php endif; ?>
+               <tr>
+                       <th scope="row"><label for="admin_email"><?php _e( 'Your Email' ); ?></label></th>
+                       <td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php echo esc_attr( $admin_email ); ?>" />
+                       <p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
+               </tr>
+               <tr>
+                       <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?></th>
+                       <td>
+                               <fieldset>
+                                       <legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
+                                       <?php
+                                       if ( has_action( 'blog_privacy_selector' ) ) { ?>
+                                               <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> />
+                                               <label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/>
+                                               <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( 0, $blog_public ); ?> />
+                                               <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
+                                               <p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
+                                               <?php
+                                               /** This action is documented in wp-admin/options-reading.php */
+                                               do_action( 'blog_privacy_selector' );
+                                        } else { ?>
+                                               <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( 0, $blog_public ); ?> />
+                                               <?php _e( 'Discourage search engines from indexing this site' ); ?></label>
+                                               <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
+                                       <?php } ?>
+                               </fieldset>
+                       </td>
+               </tr>
+       </table>
+       <p class="step"><?php submit_button( __( 'Install WordPress' ), 'large', 'Submit', false, array( 'id' => 'submit' ) ); ?></p>
+       <input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" />
 </form>
 </form>
-
 <?php
 <?php
-       break;
-       case 2:
+} // end display_setup_form()
 
 
-// Fill in the data we gathered
-$weblog_title = stripslashes($_POST['weblog_title']);
-$admin_email = stripslashes($_POST['admin_email']);
-// check e-mail address
-if (empty($admin_email)) {
-       die (__("<strong>ERROR</strong>: please type your e-mail address"));
-} else if (!is_email($admin_email)) {
-       die (__("<strong>ERROR</strong>: the e-mail address isn't correct"));
+// Let's check to make sure WP isn't already installed.
+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><p class="step"><a href="' . esc_url( wp_login_url() ) . '" class="button button-large">' . __( 'Log In' ) . '</a></p></body></html>' );
 }
 }
-       
-?>
-<h1><?php _e('Second Step'); ?></h1>
-<p><?php _e('Now we&#8217;re going to create the database tables and fill them with some default data.'); ?></p>
-
-
-<?php
-flush();
-
-// Set everything up
-wp_cache_flush();
-make_db_current_silent();
-populate_options();
-populate_roles();
-
-update_option('blogname', $weblog_title);
-update_option('admin_email', $admin_email);
-
-// Now drop in some default links
-$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".$wpdb->escape(__('Blogroll'))."')");
-$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 1, 'http://blogs.linux.ie/xeer/feed/', '');");
-$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/', '');");
-$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/', '');");
-$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/', '');");
-$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zed1.com/journalized/', 'Mike', 1, 'http://zed1.com/journalized/feed/', '');");
-$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://www.alexking.org/', 'Alex', 1, 'http://www.alexking.org/blog/wp-rss2.php', '');");
-$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://dougal.gunters.org/', 'Dougal', 1, 'http://dougal.gunters.org/feed/', '');");
-
-// Default category
-$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count, category_description) VALUES ('0', '".$wpdb->escape(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."', '1', '')");
-
-// First post
-$now = date('Y-m-d H:i:s');
-$now_gmt = gmdate('Y-m-d H:i:s');
-$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, comment_count, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1', '', '', '')");
-
-$wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
-
-// Default comment
-$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.'))."')");
 
 
-// First Page
-
-$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static', '', '', '')");
-$wp_rewrite->flush_rules();
-
-// Set up admin user
-$random_password = substr(md5(uniqid(microtime())), 0, 6);
-$display_name_array = explode('@', $admin_email);
-$display_name = $display_name_array[0];
-$wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_email, user_registered, display_name, user_nicename) VALUES ( '1', 'admin', MD5('$random_password'), '$admin_email', NOW(), '$display_name', 'admin')");
-$wpdb->query("INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ({$wpdb->insert_id}, '{$table_prefix}user_level', '10');");
-$admin_caps = serialize(array('administrator' => true));
-$wpdb->query("INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ({$wpdb->insert_id}, '{$table_prefix}capabilities', '{$admin_caps}');");
+/**
+ * @global string $wp_version
+ * @global string $required_php_version
+ * @global string $required_mysql_version
+ * @global wpdb   $wpdb
+ */
+global $wp_version, $required_php_version, $required_mysql_version;
+
+$php_version    = phpversion();
+$mysql_version  = $wpdb->db_version();
+$php_compat     = version_compare( $php_version, $required_php_version, '>=' );
+$mysql_compat   = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
+
+if ( !$mysql_compat && !$php_compat )
+       $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.' ), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
+elseif ( !$php_compat )
+       $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_php_version, $php_version );
+elseif ( !$mysql_compat )
+       $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_mysql_version, $mysql_version );
+
+if ( !$mysql_compat || !$php_compat ) {
+       display_header();
+       die( '<h1>' . __( 'Insufficient Requirements' ) . '</h1><p>' . $compat . '</p></body></html>' );
+}
 
 
-$message_headers = 'From: ' . $weblog_title . ' <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
-$message = sprintf(__("Your new WordPress blog has been successfully set up at:
+if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) {
+       display_header();
+       die( '<h1>' . __( 'Configuration Error' ) . '</h1><p>' . __( 'Your <code>wp-config.php</code> file has an empty database table prefix, which is not supported.' ) . '</p></body></html>' );
+}
 
 
-%1\$s
+// Set error message if DO_NOT_UPGRADE_GLOBAL_TABLES isn't set as it will break install.
+if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
+       display_header();
+       die( '<h1>' . __( 'Configuration Error' ) . '</h1><p>' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when installing WordPress.' ) . '</p></body></html>' );
+}
 
 
-You can log in to the administrator account with the following information:
+/**
+ * @global string    $wp_local_package
+ * @global WP_Locale $wp_locale
+ */
+$language = '';
+if ( ! empty( $_REQUEST['language'] ) ) {
+       $language = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] );
+} elseif ( isset( $GLOBALS['wp_local_package'] ) ) {
+       $language = $GLOBALS['wp_local_package'];
+}
 
 
-Username: admin
-Password: %2\$s
+switch($step) {
+       case 0: // Step 0
+
+               if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
+                       display_header( 'language-chooser' );
+                       echo '<form id="setup" method="post" action="?step=1">';
+                       wp_install_language_form( $languages );
+                       echo '</form>';
+                       break;
+               }
+
+               // Deliberately fall through if we can't reach the translations API.
+
+       case 1: // Step 1, direct link or from language chooser.
+               if ( ! empty( $language ) ) {
+                       $loaded_language = wp_download_language_pack( $language );
+                       if ( $loaded_language ) {
+                               load_default_textdomain( $loaded_language );
+                               $GLOBALS['wp_locale'] = new WP_Locale();
+                       }
+               }
+
+               display_header();
+?>
+<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1>
+<p><?php _e( 'Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you&#8217;ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ); ?></p>
 
 
-We hope you enjoy your new weblog. Thanks!
+<h2><?php _e( 'Information needed' ); ?></h2>
+<p><?php _e( 'Please provide the following information. Don&#8217;t worry, you can always change these settings later.' ); ?></p>
 
 
---The WordPress Team
-http://wordpress.org/
-"), $guessurl, $random_password);
+<?php
+               display_setup_form();
+               break;
+       case 2:
+               if ( ! empty( $language ) && load_default_textdomain( $language ) ) {
+                       $loaded_language = $language;
+                       $GLOBALS['wp_locale'] = new WP_Locale();
+               } else {
+                       $loaded_language = 'en_US';
+               }
+
+               if ( ! empty( $wpdb->error ) )
+                       wp_die( $wpdb->error->get_error_message() );
+
+               display_header();
+               // Fill in the data we gathered
+               $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
+               $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
+               $admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : '';
+               $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : '';
+               $admin_email  = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : '';
+               $public       = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 1;
+
+               // Check email address.
+               $error = false;
+               if ( empty( $user_name ) ) {
+                       // TODO: poka-yoke
+                       display_setup_form( __( 'Please provide a valid username.' ) );
+                       $error = true;
+               } elseif ( $user_name != sanitize_user( $user_name, true ) ) {
+                       display_setup_form( __( 'The username you provided has invalid characters.' ) );
+                       $error = true;
+               } elseif ( $admin_password != $admin_password_check ) {
+                       // TODO: poka-yoke
+                       display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
+                       $error = true;
+               } elseif ( empty( $admin_email ) ) {
+                       // TODO: poka-yoke
+                       display_setup_form( __( 'You must provide an email address.' ) );
+                       $error = true;
+               } elseif ( ! is_email( $admin_email ) ) {
+                       // TODO: poka-yoke
+                       display_setup_form( __( 'Sorry, that isn&#8217;t a valid email address. Email addresses look like <code>username@example.com</code>.' ) );
+                       $error = true;
+               }
+
+               if ( $error === false ) {
+                       $wpdb->show_errors();
+                       $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language );
+?>
 
 
-@wp_mail($admin_email, __('New WordPress Blog'), $message, $message_headers);
+<h1><?php _e( 'Success!' ); ?></h1>
+
+<p><?php _e( 'WordPress has been installed. Were you expecting more steps? Sorry to disappoint.' ); ?></p>
+
+<table class="form-table install-success">
+       <tr>
+               <th><?php _e( 'Username' ); ?></th>
+               <td><?php echo esc_html( sanitize_user( $user_name, true ) ); ?></td>
+       </tr>
+       <tr>
+               <th><?php _e( 'Password' ); ?></th>
+               <td><?php
+               if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ): ?>
+                       <code><?php echo esc_html( $result['password'] ) ?></code><br />
+               <?php endif ?>
+                       <p><?php echo $result['password_message'] ?></p>
+               </td>
+       </tr>
+</table>
 
 
-wp_cache_flush();
-?>
+<p class="step"><a href="<?php echo esc_url( wp_login_url() ); ?>" class="button button-large"><?php _e( 'Log In' ); ?></a></p>
 
 
-<p><em><?php _e('Finished!'); ?></em></p>
-
-<p><?php printf(__('Now you can <a href="%1$s">log in</a> with the <strong>username</strong> "<code>admin</code>" and <strong>password</strong> "<code>%2$s</code>".'), '../wp-login.php', $random_password); ?></p>
-<p><?php _e('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you. If you lose it, you will have to delete the tables from the database yourself, and re-install WordPress. So to review:'); ?>
-</p>
-<dl>
-<dt><?php _e('Username'); ?></dt>
-<dd><code>admin</code></dd>
-<dt><?php _e('Password'); ?></dt>
-<dd><code><?php echo $random_password; ?></code></dd>
-       <dt><?php _e('Login address'); ?></dt>
-<dd><a href="../wp-login.php">wp-login.php</a></dd>
-</dl>
-<p><?php _e('Were you expecting more steps? Sorry to disappoint. All done! :)'); ?></p>
 <?php
 <?php
-       break;
+               }
+               break;
 }
 }
+if ( !wp_is_mobile() ) {
 ?>
 ?>
-<p id="footer"><?php _e('<a href="http://wordpress.org/">WordPress</a>, personal publishing platform.'); ?></p>
+<script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
+<?php } ?>
+<?php wp_print_scripts( 'user-profile' ); ?>
+<?php wp_print_scripts( 'language-chooser' ); ?>
+<script type="text/javascript">
+jQuery( function( $ ) {
+       $( '.hide-if-no-js' ).removeClass( 'hide-if-no-js' );
+} );
+</script>
 </body>
 </html>
 </body>
 </html>