[wp-cvs]
wordpress/wp-includes functions.php, 1.236, 1.237 vars.php,
1.43, 1.44
Ryan Boren
rboren at users.sourceforge.net
Thu Jan 20 04:56:27 GMT 2005
Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18201/wp-includes
Modified Files:
functions.php vars.php
Log Message:
wp_setcookie() and wp_clearcookie(). Set cookies for both siteurl and home if they are not the same. Update cookies whenever home or siteurl change.
Index: vars.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/vars.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** vars.php 7 Jan 2005 22:01:59 -0000 1.43
--- vars.php 20 Jan 2005 04:56:24 -0000 1.44
***************
*** 114,117 ****
--- 114,118 ----
// Path for cookies
define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('home') . '/' ) );
+ define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('siteurl') . '/' ) );
// Some default filters
Index: functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/functions.php,v
retrieving revision 1.236
retrieving revision 1.237
diff -C2 -d -r1.236 -r1.237
*** functions.php 19 Jan 2005 02:21:36 -0000 1.236
--- functions.php 20 Jan 2005 04:56:24 -0000 1.237
***************
*** 1629,1631 ****
--- 1629,1664 ----
}
+ function wp_setcookie($username, $password, $already_md5 = false, $home = '', $siteurl = '') {
+ 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);
+ }
+
+ setcookie('wordpressuser_'. $cookiehash, $username, time() + 31536000, $cookiepath);
+ setcookie('wordpresspass_'. $cookiehash, $password, time() + 31536000, $cookiepath);
+
+ if ( $cookiepath != $sitecookiepath ) {
+ setcookie('wordpressuser_'. $cookiehash, $username, time() + 31536000, $sitecookiepath);
+ setcookie('wordpresspass_'. $cookiehash, $password, time() + 31536000, $sitecookiepath);
+ }
+ }
+
+ 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);
+ }
+
?>
More information about the cvs
mailing list