Make WordPress Core

Ticket #20779: 20779.diff

File 20779.diff, 1.5 KB (added by nacin, 13 years ago)
  • wp-admin/maint/repair.php

     
    2525
    2626if ( ! defined( 'WP_ALLOW_REPAIR' ) ) {
    2727        echo '<p>' . __( 'To allow use of this page to automatically repair database problems, please add the following line to your <code>wp-config.php</code> file. Once this line is added to your config, reload this page.' ) . "</p><code>define('WP_ALLOW_REPAIR', true);</code>";
     28
     29        $default_key = 'put your unique phrase here';
     30        $missing_key = false;
     31        $duplicated_keys = array();
     32
     33        foreach ( array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ) as $key ) {
     34                if ( defined( $key ) )
     35                        $duplicated_keys[ constant( $key ) ] = isset( $duplicated_keys[ constant( $key ) ] );
     36                else
     37                        $missing_key = true;
     38        }
     39
     40        if ( isset( $duplicated_keys[ $default_key ] ) )
     41                $duplicated_keys[ $default_key ] = true;
     42        $duplicated_keys = array_filter( $duplicated_keys );
     43       
     44        if ( $duplicated_keys || $missing_key )
     45                echo '<p>' . sprintf( __( 'While you are in your <code>wp-config.php</code> file, you should also make sure you have the 8 unique phrases in place. You can generate these using the <a href="%s">WordPress.org secret key service</a>.' ), 'https://api.wordpress.org/secret-key/1.1/salt/' ) . '</p>';
    2846} elseif ( isset( $_GET['repair'] ) ) {
    2947        check_admin_referer( 'repair_db' );
    3048