| [ Index ] |
PHP Cross Reference of Wordpress 2.9.1 |
[Summary view] [Print] [Text view]
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 // Ensure that Blogs appear in search engines by default 53 $blog_public = 1; 54 if ( isset($_POST) && !empty($_POST) ) { 55 $blog_public = isset($_POST['blog_public']); 56 } 57 58 if ( ! is_null( $error ) ) { 59 ?> 60 <p><?php printf( __('<strong>ERROR</strong>: %s'), $error); ?></p> 61 <?php } ?> 62 <form id="setup" method="post" action="install.php?step=2"> 63 <table class="form-table"> 64 <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> 67 </tr> 68 <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 </tr> 73 <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> 75 </tr> 76 </table> 77 <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e('Install WordPress'); ?>" class="button" /></p> 78 </form> 79 <?php 80 } 81 82 // 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>');} 84 85 $php_version = phpversion(); 86 $mysql_version = $wpdb->db_version(); 87 $php_compat = version_compare( $php_version, $required_php_version, '>=' ); 88 $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); 89 90 if ( !$mysql_compat && !$php_compat ) 91 $compat = sprintf( __('You cannot install because WordPress %1$s 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 ); 92 elseif ( !$php_compat ) 93 $compat = sprintf( __('You cannot install because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); 94 elseif ( !$mysql_compat ) 95 $compat = sprintf( __('You cannot install because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); 96 97 if ( !$mysql_compat || !$php_compat ) { 98 display_header(); 99 die('<h1>' . __('Insufficient Requirements') . '</h1><p>' . $compat . '</p></body></html>'); 100 } 101 102 switch($step) { 103 case 0: 104 case 1: // in case people are directly linking to this 105 display_header(); 106 ?> 107 <h1><?php _e('Welcome'); ?></h1> 108 <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> 109 <!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step'); ?></a></h2>--> 110 111 <h1><?php _e('Information needed'); ?></h1> 112 <p><?php _e('Please provide the following information. Don’t worry, you can always change these settings later.'); ?></p> 113 114 115 116 <?php 117 display_setup_form(); 118 break; 119 case 2: 120 if ( !empty($wpdb->error) ) 121 wp_die($wpdb->error->get_error_message()); 122 123 display_header(); 124 // Fill in the data we gathered 125 $weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : ''; 126 $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : ''; 127 $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0; 128 // check e-mail address 129 $error = false; 130 if (empty($admin_email)) { 131 // TODO: poka-yoke 132 display_setup_form( __('you must provide an e-mail address.') ); 133 $error = true; 134 } else if (!is_email($admin_email)) { 135 // TODO: poka-yoke 136 display_setup_form( __('that isn’t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>') ); 137 $error = true; 138 } 139 140 if ( $error === false ) { 141 $wpdb->show_errors(); 142 $result = wp_install($weblog_title, 'admin', $admin_email, $public); 143 extract($result, EXTR_SKIP); 144 ?> 145 146 <h1><?php _e('Success!'); ?></h1> 147 148 <p><?php printf(__('WordPress has been installed. Were you expecting more steps? Sorry to disappoint.'), ''); ?></p> 149 150 <table class="form-table"> 151 <tr> 152 <th><?php _e('Username'); ?></th> 153 <td><code>admin</code></td> 154 </tr> 155 <tr> 156 <th><?php _e('Password'); ?></th> 157 <td><?php if ( !empty( $password ) ) { 158 echo '<code>'. $password .'</code><br />'; 159 } 160 echo '<p>'. $password_message .'</p>'; ?></td> 161 </tr> 162 </table> 163 164 <p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p> 165 166 <?php 167 } 168 break; 169 } 170 ?> 171 <script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script> 172 </body> 173 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 8 00:19:48 2010 | Cross-referenced by PHPXref 0.7 |