]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/setup-config.php
WordPress 4.7.2-scripts
[autoinstalls/wordpress.git] / wp-admin / setup-config.php
index befa6937edea073f9bcbddd9681a13bc7e605458..1404c32599163e9a0b56b6cf3f0b39ac36de764c 100644 (file)
@@ -5,8 +5,6 @@
  * The permissions for the base directory must allow for writing files in order
  * for the wp-config.php to be created using this page.
  *
- * @internal This file must be parsable by PHP4.
- *
  * @package WordPress
  * @subpackage Administration
  */
@@ -28,7 +26,9 @@ define('WP_SETUP_CONFIG', true);
  */
 error_reporting(0);
 
-define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
+if ( ! defined( 'ABSPATH' ) ) {
+       define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
+}
 
 require( ABSPATH . 'wp-settings.php' );
 
@@ -99,7 +99,7 @@ function setup_config_display_header( $body_classes = array() ) {
        <?php wp_admin_css( 'install', true ); ?>
 </head>
 <body class="<?php echo implode( ' ', $body_classes ); ?>">
-<p id="logo"><a href="<?php esc_attr_e( 'https://wordpress.org/' ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p>
+<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p>
 <?php
 } // end function setup_config_display_header();
 
@@ -276,6 +276,12 @@ switch($step) {
        if ( ! empty( $wpdb->error ) )
                wp_die( $wpdb->error->get_error_message() . $tryagain_link );
 
+       $wpdb->query( "SELECT $prefix" );
+       if ( ! $wpdb->last_error ) {
+               // MySQL was able to parse the prefix as a value, which we don't want. Bail.
+               wp_die( __( '<strong>ERROR</strong>: "Table Prefix" is invalid.' ) );
+       }
+
        // Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password().
        try {
                $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';
@@ -308,7 +314,6 @@ switch($step) {
        }
 
        $key = 0;
-       // Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
        foreach ( $config_file as $line_num => $line ) {
                if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
                        $config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";