]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/setup-config.php
WordPress 3.9.2-scripts
[autoinstalls/wordpress.git] / wp-admin / setup-config.php
index 82d06e99dc6ad959a6d40d8e87e8792e4dbe9015..2b5b7f89fb6bb2f14ed4dbc9123b8fa8f02c4b28 100644 (file)
@@ -13,8 +13,6 @@
 
 /**
  * We are installing.
- *
- * @package WordPress
  */
 define('WP_INSTALLING', true);
 
@@ -55,6 +53,9 @@ wp_load_translations_early();
 // Turn register_globals off.
 wp_unregister_GLOBALS();
 
+// Standardize $_SERVER variables across setups.
+wp_fix_server_vars();
+
 require_once(ABSPATH . WPINC . '/compat.php');
 require_once(ABSPATH . WPINC . '/class-wp-error.php');
 require_once(ABSPATH . WPINC . '/formatting.php');
@@ -62,11 +63,14 @@ require_once(ABSPATH . WPINC . '/formatting.php');
 // Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
 wp_magic_quotes();
 
-if ( ! file_exists( ABSPATH . 'wp-config-sample.php' ) )
+// Support wp-config-sample.php one level up, for the develop repo.
+if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
+       $config_file = file( ABSPATH . 'wp-config-sample.php' );
+elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) )
+       $config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' );
+else
        wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.' ) );
 
-$config_file = file(ABSPATH . 'wp-config-sample.php');
-
 // Check if wp-config.php has been created
 if ( file_exists( ABSPATH . 'wp-config.php' ) )
        wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ), 'install.php' ) . '</p>' );
@@ -82,8 +86,6 @@ $step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0;
  *
  * @ignore
  * @since 2.3.0
- * @package WordPress
- * @subpackage Installer_WP_Config
  */
 function setup_config_display_header() {
        global $wp_version;
@@ -93,6 +95,7 @@ function setup_config_display_header() {
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
 <head>
+<meta name="viewport" content="width=device-width" />
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title><?php _e( 'WordPress &rsaquo; Setup Configuration File' ); ?></title>
 <link rel="stylesheet" href="css/install.css?ver=<?php echo preg_replace( '/[^0-9a-z\.-]/i', '', $wp_version ); ?>" type="text/css" />
@@ -100,7 +103,7 @@ function setup_config_display_header() {
 
 </head>
 <body class="wp-core-ui<?php if ( is_rtl() ) echo ' rtl'; ?>">
-<h1 id="logo"><a href="<?php esc_attr_e( 'http://wordpress.org/' ); ?>"><?php _e( 'WordPress' ); ?></a></h1>
+<h1 id="logo"><a href="<?php esc_attr_e( 'https://wordpress.org/' ); ?>"><?php _e( 'WordPress' ); ?></a></h1>
 <?php
 } // end function setup_config_display_header();
 
@@ -195,12 +198,11 @@ switch($step) {
        if ( ! $no_api ) {
                require_once( ABSPATH . WPINC . '/class-http.php' );
                require_once( ABSPATH . WPINC . '/http.php' );
-               wp_fix_server_vars();
                /**#@+
                 * @ignore
                 */
                function get_bloginfo() {
-                       return ( ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . str_replace( $_SERVER['PHP_SELF'], '/wp-admin/setup-config.php', '' ) );
+                       return wp_guess_url();
                }
                /**#@-*/
                $secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
@@ -275,12 +277,19 @@ el.select();
 </script>
 <?php
        else :
-               $handle = fopen(ABSPATH . 'wp-config.php', 'w');
+               // If this file doesn't exist, then we are using the wp-config-sample.php
+               // file one level up, which is for the develop repo.
+               if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
+                       $path_to_wp_config = ABSPATH . 'wp-config.php';
+               else
+                       $path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
+
+               $handle = fopen( $path_to_wp_config, 'w' );
                foreach( $config_file as $line ) {
-                       fwrite($handle, $line);
+                       fwrite( $handle, $line );
                }
-               fclose($handle);
-               chmod(ABSPATH . 'wp-config.php', 0666);
+               fclose( $handle );
+               chmod( $path_to_wp_config, 0666 );
                setup_config_display_header();
 ?>
 <p><?php _e( "All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;" ); ?></p>