Changeset 1254

Show
Ignore:
Timestamp:
04/22/08 14:51:22 (8 months ago)
Author:
donncha
Message:

Warn the site admin if SECRET_SALT and SECRET_SALT are not defined

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/includes/mu.php

    r1251 r1254  
    640640add_action( 'media_buttons', 'mu_media_buttons' ); 
    641641remove_action( 'media_buttons', 'media_buttons' ); 
     642 
     643/* Warn the admin if SECRET SALT information is missing from wp-config.php */ 
     644function secret_salt_warning() { 
     645        if( !is_site_admin() ) 
     646                return; 
     647        if( !defined( 'SECRET_KEY' ) || !defined( 'SECRET_SALT' ) ) { 
     648                $salt1 = wp_generate_password() . wp_generate_password(); 
     649                $salt2 = wp_generate_password() . wp_generate_password(); 
     650                $msg = sprintf( __( 'Warning! You must define SECRET_KEY and SECRET_SALT in <strong>%swp-config.php</strong><br />Please add the following code before the line, <code>/* That\'s all, stop editing! Happy blogging. */</code>' ), ABSPATH ); 
     651                $msg .= "<blockquote>define('SECRET_KEY', '$salt1');<br />define('SECRET_SALT', '$salt2');</blockquote>"; 
     652 
     653                echo "<div id='update-nag'>$msg</div>"; 
     654        } 
     655} 
     656add_action( 'admin_notices', 'secret_salt_warning' ); 
     657 
    642658?>