Ticket #19599: 19599.2.patch
| File 19599.2.patch, 5.8 KB (added by SergeyBiryukov, 17 months ago) |
|---|
-
wp-includes/default-constants.php
140 140 * @since 3.0.0 141 141 */ 142 142 function wp_cookie_constants( ) { 143 global $wp_default_secret_key;144 145 143 /** 146 144 * Used to guarantee unique hash cookies 147 145 * @since 1.5 … … 155 153 } 156 154 157 155 /** 158 * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php159 * @since 2.5.0160 */161 $wp_default_secret_key = 'put your unique phrase here';162 163 /**164 156 * @since 2.0.0 165 157 */ 166 158 if ( !defined('USER_COOKIE') ) -
wp-includes/pluggable.php
1313 1313 * @return string Salt value 1314 1314 */ 1315 1315 function wp_salt($scheme = 'auth') { 1316 global $wp_default_secret_key; 1316 $secret_keys = array(); 1317 1318 if ( defined( 'SECRET_KEY' ) && ( '' != SECRET_KEY ) ) 1319 $secret_keys['secret_key'] = SECRET_KEY; 1320 if ( defined( 'AUTH_KEY' ) && ( '' != AUTH_KEY ) ) 1321 $secret_keys['auth_key'] = AUTH_KEY; 1322 if ( defined( 'SECURE_AUTH_KEY' ) && ( '' != SECURE_AUTH_KEY ) ) 1323 $secret_keys['secure_auth_key'] = SECURE_AUTH_KEY; 1324 if ( defined( 'LOGGED_IN_KEY' ) && ( '' != LOGGED_IN_KEY ) ) 1325 $secret_keys['logged_in_key'] = LOGGED_IN_KEY; 1326 if ( defined( 'NONCE_KEY' ) && ( '' != NONCE_KEY ) ) 1327 $secret_keys['nonce_key'] = NONCE_KEY; 1328 if ( defined( 'SECRET_SALT' ) && ( '' != SECRET_SALT ) ) 1329 $secret_keys['secret_salt'] = SECRET_SALT; 1330 if ( defined( 'AUTH_SALT' ) && ( '' != AUTH_SALT ) ) 1331 $secret_keys['auth_salt'] = AUTH_SALT; 1332 if ( defined( 'SECURE_AUTH_SALT' ) && ( '' != SECURE_AUTH_SALT ) ) 1333 $secret_keys['secure_auth_salt'] = SECURE_AUTH_SALT; 1334 if ( defined( 'LOGGED_IN_SALT' ) && ( '' != LOGGED_IN_SALT ) ) 1335 $secret_keys['logged_in_salt'] = LOGGED_IN_SALT; 1336 if ( defined( 'NONCE_SALT' ) && ( '' != NONCE_SALT ) ) 1337 $secret_keys['nonce_salt'] = NONCE_SALT; 1338 1339 $wp_default_secret_key = ''; 1340 if ( !empty( $secret_keys ) ) { 1341 $secret_keys_count = array_count_values( $secret_keys ); 1342 arsort( $secret_keys_count ); 1343 if ( array_shift( array_values( $secret_keys_count ) ) > 2 ) 1344 $wp_default_secret_key = array_shift( array_keys( $secret_keys_count ) ); 1345 } 1346 1317 1347 $secret_key = ''; 1318 if ( defined('SECRET_KEY') && ('' != SECRET_KEY) && ( $wp_default_secret_key != SECRET_KEY) )1319 $secret_key = SECRET_KEY;1348 if ( !empty( $secret_keys['secret_key'] ) && ( $wp_default_secret_key != $secret_keys['secret_key'] ) ) 1349 $secret_key = $secret_keys['secret_key']; 1320 1350 1321 1351 if ( 'auth' == $scheme ) { 1322 if ( defined('AUTH_KEY') && ('' != AUTH_KEY) && ( $wp_default_secret_key != AUTH_KEY) )1323 $secret_key = AUTH_KEY;1352 if ( !empty( $secret_keys['auth_key'] ) && ( $wp_default_secret_key != $secret_keys['auth_key'] ) ) 1353 $secret_key = $secret_keys['auth_key']; 1324 1354 1325 if ( defined('AUTH_SALT') && ('' != AUTH_SALT) && ( $wp_default_secret_key != AUTH_SALT) ) {1326 $salt = AUTH_SALT;1327 } elseif ( defined('SECRET_SALT') && ('' != SECRET_SALT) && ( $wp_default_secret_key != SECRET_SALT) ) {1328 $salt = SECRET_SALT;1355 if ( !empty( $secret_keys['auth_salt'] ) && ( $wp_default_secret_key != $secret_keys['auth_salt'] ) ) { 1356 $salt = $secret_keys['auth_salt']; 1357 } elseif ( !empty( $secret_keys['secret_salt'] ) && ( $wp_default_secret_key != $secret_keys['secret_salt'] ) ) { 1358 $salt = $secret_keys['secret_salt']; 1329 1359 } else { 1330 1360 $salt = get_site_option('auth_salt'); 1331 1361 if ( empty($salt) ) { … … 1334 1364 } 1335 1365 } 1336 1366 } elseif ( 'secure_auth' == $scheme ) { 1337 if ( defined('SECURE_AUTH_KEY') && ('' != SECURE_AUTH_KEY) && ( $wp_default_secret_key != SECURE_AUTH_KEY) )1338 $secret_key = SECURE_AUTH_KEY;1367 if ( !empty( $secret_keys['secure_auth_key'] ) && ( $wp_default_secret_key != $secret_keys['secure_auth_key'] ) ) 1368 $secret_key = $secret_keys['secure_auth_key']; 1339 1369 1340 if ( defined('SECURE_AUTH_SALT') && ('' != SECURE_AUTH_SALT) && ( $wp_default_secret_key != SECURE_AUTH_SALT) ) {1341 $salt = SECURE_AUTH_SALT;1370 if ( !empty( $secret_keys['secure_auth_salt'] ) && ( $wp_default_secret_key != $secret_keys['secure_auth_salt'] ) ) { 1371 $salt = $secret_keys['secure_auth_salt']; 1342 1372 } else { 1343 1373 $salt = get_site_option('secure_auth_salt'); 1344 1374 if ( empty($salt) ) { … … 1347 1377 } 1348 1378 } 1349 1379 } elseif ( 'logged_in' == $scheme ) { 1350 if ( defined('LOGGED_IN_KEY') && ('' != LOGGED_IN_KEY) && ( $wp_default_secret_key != LOGGED_IN_KEY) )1351 $secret_key = LOGGED_IN_KEY;1380 if ( !empty( $secret_keys['logged_in_key'] ) && ( $wp_default_secret_key != $secret_keys['logged_in_key'] ) ) 1381 $secret_key = $secret_keys['logged_in_key']; 1352 1382 1353 if ( defined('LOGGED_IN_SALT') && ('' != LOGGED_IN_SALT) && ( $wp_default_secret_key != LOGGED_IN_SALT) ) {1354 $salt = LOGGED_IN_SALT;1383 if ( !empty( $secret_keys['logged_in_salt'] ) && ( $wp_default_secret_key != $secret_keys['logged_in_salt'] ) ) { 1384 $salt = $secret_keys['logged_in_salt']; 1355 1385 } else { 1356 1386 $salt = get_site_option('logged_in_salt'); 1357 1387 if ( empty($salt) ) { … … 1360 1390 } 1361 1391 } 1362 1392 } elseif ( 'nonce' == $scheme ) { 1363 if ( defined('NONCE_KEY') && ('' != NONCE_KEY) && ( $wp_default_secret_key != NONCE_KEY) )1364 $secret_key = NONCE_KEY;1393 if ( !empty( $secret_keys['nonce_key'] ) && ( $wp_default_secret_key != $secret_keys['nonce_key'] ) ) 1394 $secret_key = $secret_keys['nonce_key']; 1365 1395 1366 if ( defined('NONCE_SALT') && ('' != NONCE_SALT) && ( $wp_default_secret_key != NONCE_SALT) ) {1367 $salt = NONCE_SALT;1396 if ( !empty( $secret_keys['nonce_salt'] ) && ( $wp_default_secret_key != $secret_keys['nonce_salt'] ) ) { 1397 $salt = $secret_keys['nonce_salt']; 1368 1398 } else { 1369 1399 $salt = get_site_option('nonce_salt'); 1370 1400 if ( empty($salt) ) {
