X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/449d082fcc4873c1f7d363a0d9f7409be7f6e77d..312084b5d95c21feb519ff03decf948420e1f6fa:/wp-admin/install.php?ds=sidebyside diff --git a/wp-admin/install.php b/wp-admin/install.php index de5b970d..0e9b87b9 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -15,10 +15,10 @@ define('WP_INSTALLING', true); /** Load WordPress Bootstrap */ -require_once('../wp-load.php'); +require_once(dirname(dirname(__FILE__)) . '/wp-load.php'); /** Load WordPress Administration Upgrade API */ -require_once('./includes/upgrade.php'); +require_once(dirname(__FILE__) . '/includes/upgrade.php'); if (isset($_GET['step'])) $step = $_GET['step']; @@ -48,40 +48,73 @@ header( 'Content-Type: text/html; charset=utf-8' ); '.__('Already Installed').'

'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'

');} +function display_setup_form( $error = null ) { + // Ensure that Blogs appear in search engines by default + $blog_public = 1; + if ( isset($_POST) && !empty($_POST) ) { + $blog_public = isset($_POST['blog_public']); + } -switch($step) { - case 0: - case 1: // in case people are directly linking to this - display_header(); + if ( ! is_null( $error ) ) { ?> -

-

ReadMe documentation 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'); ?>

- - -

-

- +

ERROR: %s'), $error); ?>

+
- + - - +

- +

+
-

+

+'.__('Already Installed').'

'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'

');} + +$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 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 ); +elseif ( !$php_compat ) + $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 ); +elseif ( !$mysql_compat ) + $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 ); + +if ( !$mysql_compat || !$php_compat ) { + display_header(); + die('

' . __('Insufficient Requirements') . '

' . $compat . '

'); +} + +switch($step) { + case 0: + case 1: // in case people are directly linking to this + display_header(); +?> +

+

ReadMe documentation 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'); ?>

+ + +

+

+ + error) ) @@ -93,17 +126,21 @@ switch($step) { $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : ''; $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0; // check e-mail address + $error = false; if (empty($admin_email)) { // TODO: poka-yoke - die('

'.__("ERROR: you must provide an e-mail address.").'

'); + display_setup_form( __('you must provide an e-mail address.') ); + $error = true; } else if (!is_email($admin_email)) { // TODO: poka-yoke - die('

'.__('ERROR: that isn’t a valid e-mail address. E-mail addresses look like: username@example.com').'

'); + display_setup_form( __('that isn’t a valid e-mail address. E-mail addresses look like: username@example.com') ); + $error = true; } - $wpdb->show_errors(); - $result = wp_install($weblog_title, 'admin', $admin_email, $public); - extract($result, EXTR_SKIP); + if ( $error === false ) { + $wpdb->show_errors(); + $result = wp_install($weblog_title, 'admin', $admin_email, $public); + extract($result, EXTR_SKIP); ?>

@@ -117,14 +154,17 @@ switch($step) { -
- '.__('Note that password carefully! It is a random password that was generated just for you.').'

'; ?> + '. $password .'
'; + } + echo '

'. $password_message .'

'; ?>