WordPress.org

Make WordPress Core

Ticket #5477: 5477.r10258.diff

File 5477.r10258.diff, 5.3 KB (added by jacobsantos, 13 years ago)

Patch is based off of r10258

  • install.php

     
    4848<?php
    4949}//end function display_header();
    5050
    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();
     51function display_setup_form( $error = null ) {
     52        if ( ! is_null( $error ) ) {
    5853?>
    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 
     54<p><strong><?php _e('ERROR'); ?></strong>: <?php echo $error; ?></p>
     55<?php } ?>
    6656<form id="setup" method="post" action="install.php?step=2">
    6757        <table class="form-table">
    6858                <tr>
    6959                        <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>
     60                        <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo ( isset($_POST['weblog_title']) ? $_POST['weblog_title'] : '' ); ?>" /></td>
    7161                </tr>
    7262                <tr>
    7363                        <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 />
     64                        <td><input name="admin_email" type="text" id="admin_email" size="25" value="<?php echo ( isset($_POST['admin_email']) ? $_POST['admin_email'] : '' ); ?>" /><br />
    7565                        <?php _e('Double-check your email address before continuing.'); ?>
    7666                </tr>
    7767                <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>
     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>
    7969                </tr>
    8070        </table>
    8171        <p class="step"><input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" /></p>
    8272</form>
     73<?php
     74}
    8375
     76// Let's check to make sure WP isn't already installed.
     77if ( 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
     79switch($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
    8493<?php
     94                display_setup_form();
    8595                break;
    8696        case 2:
    8797                if ( !empty($wpdb->error) )
     
    93103                $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : '';
    94104                $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0;
    95105                // check e-mail address
     106                $error = false;
    96107                if (empty($admin_email)) {
    97108                        // TODO: poka-yoke
    98                         die('<p>'.__("<strong>ERROR</strong>: you must provide an e-mail address.").'</p>');
     109                        display_setup_form( __('you must provide an e-mail address.') );
     110                        $error = true;
    99111                } else if (!is_email($admin_email)) {
    100112                        // 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>');
     113                        display_setup_form( __('that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>') );
     114                        $error = true;
    102115                }
    103116
    104                 $wpdb->show_errors();
    105                 $result = wp_install($weblog_title, 'admin', $admin_email, $public);
    106                 extract($result, EXTR_SKIP);
     117                if ( $error === false ) {
     118                        $wpdb->show_errors();
     119                        $result = wp_install($weblog_title, 'admin', $admin_email, $public);
     120                        extract($result, EXTR_SKIP);
    107121?>
    108122
    109123<h1><?php _e('Success!'); ?></h1>
     
    125139<p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
    126140
    127141<?php
     142                }
    128143                break;
    129144}
    130145?>