summaryrefslogtreecommitdiffstats
path: root/wp-includes/pluggable.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-26 15:45:20 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-26 15:45:20 +0000
commit28781ebb081ab8d99b30a33f5cd911b3b050bcc9 (patch)
treef21e6b7d3dd06002c58dd52ae2eae10d64d62d85 /wp-includes/pluggable.php
parentcbd939114d362bfece3839d7d5d5e07367fd6be8 (diff)
downloadwordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.tar.gz
wordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.tar.xz
wordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.zip
WP Merge to rev 4254
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@770 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/pluggable.php')
-rw-r--r--wp-includes/pluggable.php34
1 files changed, 27 insertions, 7 deletions
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index 2750942..0c33ad7 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -263,7 +263,7 @@ endif;
// Cookie safe redirect. Works around IIS Set-Cookie bug.
// http://support.microsoft.com/kb/q176113/
if ( !function_exists('wp_redirect') ) :
-function wp_redirect($location) {
+function wp_redirect($location, $status = 302) {
global $is_IIS;
$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location);
@@ -272,6 +272,8 @@ function wp_redirect($location) {
$strip = array('%0d', '%0a');
$location = str_replace($strip, '', $location);
+ status_header($status);
+
if ($is_IIS)
header("Refresh: 0;url=$location");
else
@@ -294,22 +296,40 @@ function wp_setcookie($username, $password, $already_md5 = false, $home = '', $s
if ( !$already_md5 )
$password = md5( md5($password) ); // Double hash the password in the cookie.
+ if ( empty($home) )
+ $cookiepath = COOKIEPATH;
+ else
+ $cookiepath = preg_replace('|https?://[^/]+|i', '', $home . '/' );
+
+ if ( empty($siteurl) ) {
+ $sitecookiepath = SITECOOKIEPATH;
+ $cookiehash = COOKIEHASH;
+ } else {
+ $sitecookiepath = preg_replace('|https?://[^/]+|i', '', $siteurl . '/' );
+ $cookiehash = md5($siteurl);
+ }
+
if ( $remember )
$expire = time() + 31536000;
else
$expire = 0;
- global $base;
- setcookie(USER_COOKIE, $username, $expire, $base, COOKIE_DOMAIN);
- setcookie(PASS_COOKIE, $password, $expire, $base, COOKIE_DOMAIN);
+ setcookie(USER_COOKIE, $username, $expire, $cookiepath, COOKIE_DOMAIN);
+ setcookie(PASS_COOKIE, $password, $expire, $cookiepath, COOKIE_DOMAIN);
+
+ if ( $cookiepath != $sitecookiepath ) {
+ setcookie(USER_COOKIE, $username, $expire, $sitecookiepath, COOKIE_DOMAIN);
+ setcookie(PASS_COOKIE, $password, $expire, $sitecookiepath, COOKIE_DOMAIN);
+ }
}
endif;
if ( !function_exists('wp_clearcookie') ) :
function wp_clearcookie() {
- global $base;
- setcookie(USER_COOKIE, ' ', time() - 31536000, $base, COOKIE_DOMAIN);
- setcookie(PASS_COOKIE, ' ', time() - 31536000, $base, COOKIE_DOMAIN);
+ 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;