From 6d2fd5258498b422ff05c5cc0fa5ec4093e3abaf Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Mon, 18 Jul 2005 19:55:24 +0000 Subject: [PATCH] Let advanced users override cookies. git-svn-id: https://develop.svn.wordpress.org/trunk@2725 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/pluggable-functions.php | 16 ++++++++-------- wp-includes/vars.php | 4 ---- wp-settings.php | 13 ++++++++++++- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/wp-includes/pluggable-functions.php b/wp-includes/pluggable-functions.php index c32f8523a2..b76b2630e1 100644 --- a/wp-includes/pluggable-functions.php +++ b/wp-includes/pluggable-functions.php @@ -191,22 +191,22 @@ function wp_setcookie($username, $password, $already_md5 = false, $home = '', $s $cookiehash = md5($siteurl); } - setcookie('wordpressuser_'. $cookiehash, $username, time() + 31536000, $cookiepath); - setcookie('wordpresspass_'. $cookiehash, $password, time() + 31536000, $cookiepath); + setcookie(USER_COOKIE, $username, time() + 31536000, $cookiepath, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, $password, time() + 31536000, $cookiepath, COOKIE_DOMAIN); if ( $cookiepath != $sitecookiepath ) { - setcookie('wordpressuser_'. $cookiehash, $username, time() + 31536000, $sitecookiepath); - setcookie('wordpresspass_'. $cookiehash, $password, time() + 31536000, $sitecookiepath); + setcookie(USER_COOKIE, $username, time() + 31536000, $sitecookiepath, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, $password, time() + 31536000, $sitecookiepath, COOKIE_DOMAIN); } } endif; if ( !function_exists('wp_clearcookie') ) : function wp_clearcookie() { - setcookie('wordpressuser_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH); - setcookie('wordpresspass_' . COOKIEHASH, ' ', time() - 31536000, COOKIEPATH); - setcookie('wordpressuser_' . COOKIEHASH, ' ', time() - 31536000, SITECOOKIEPATH); - setcookie('wordpresspass_' . COOKIEHASH, ' ', time() - 31536000, SITECOOKIEPATH); + setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN); + setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); + setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN); } endif; diff --git a/wp-includes/vars.php b/wp-includes/vars.php index 494f28544c..2e1dcecd2d 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -106,8 +106,4 @@ foreach($wpsmiliestrans as $smiley => $img) { $wp_smiliesreplace[] = " $smiley_masked "; } -// Path for cookies -define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('home') . '/' ) ); -define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('siteurl') . '/' ) ); - ?> \ No newline at end of file diff --git a/wp-settings.php b/wp-settings.php index 8d2b18f125..99509d574d 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -56,7 +56,7 @@ if ( defined('CUSTOM_USER_TABLE') ) $wpdb->users = CUSTOM_USER_TABLE; if ( defined('CUSTOM_USER_META_TABLE') ) $wpdb->usermeta = CUSTOM_USER_META_TABLE; - + // We're going to need to keep this around for a few months even though we're not using it internally $tableposts = $wpdb->posts; @@ -104,6 +104,17 @@ if (!strstr($_SERVER['PHP_SELF'], 'install.php') && !strstr($_SERVER['PHP_SELF'] define('COOKIEHASH', $cookiehash); endif; +if ( !defined('USER_COOKIE') ) + define('USER_COOKIE', 'wordpressuser_'. COOKIEHASH); +if ( !defined('PASS_COOKIE') ) + define('PASS_COOKIE', 'wordpresspass_'. COOKIEHASH); +if ( !defined('COOKIEPATH') ) + define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('home') . '/' ) ); +if ( !defined('SITECOOKIEPATH') ) + define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('siteurl') . '/' ) ); +if ( !defined('COOKIE_DOMAIN') ) + define('COOKIE_DOMAIN', false); + require (ABSPATH . WPINC . '/vars.php'); do_action('core_files_loaded');