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