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