summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-06-11 20:42:31 +0000
committerDries Buytaert <dries@buytaert.net>2003-06-11 20:42:31 +0000
commit9e813c08a499cbc6e2a5c130ce391023620a9c31 (patch)
tree8dcf11bd7812fdbabbd52d740bf0d6103006d538
parenta8c6f0d0afe86d3067cbdc196db9885798ac7e46 (diff)
downloadbrdo-9e813c08a499cbc6e2a5c130ce391023620a9c31.tar.gz
brdo-9e813c08a499cbc6e2a5c130ce391023620a9c31.tar.bz2
- Bugfix: when clean URLs are enabled, the cookie path was not always set correctly when the
user logged using the user block from within a subdirectory. Patch by Ulf Rompe.
-rw-r--r--modules/user.module7
-rw-r--r--modules/user/user.module7
2 files changed, 8 insertions, 6 deletions
diff --git a/modules/user.module b/modules/user.module
index 6a6c1d91d..bc18b2b75 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -510,7 +510,7 @@ function user_auth_help_links() {
/*** User features *********************************************************/
function user_login($edit = array(), $msg = "") {
- global $user;
+ global $user, $base_url;
/*
** If we are already logged on, go to the user page instead.
@@ -591,11 +591,12 @@ function user_login($edit = array(), $msg = "") {
** that the session won't expire.
*/
+ $path = preg_replace("/.+\/\/[^\/]+(.*)/", "\$1/", $base_url);
if ($edit["remember_me"]) {
- setcookie(session_name(), session_id(), time() + 3600 * 24 * 365);
+ setcookie(session_name(), session_id(), time() + 3600 * 24 * 365, $path);
}
else {
- setcookie(session_name(), session_id());
+ setcookie(session_name(), session_id(), FALSE, $path);
}
/*
diff --git a/modules/user/user.module b/modules/user/user.module
index 6a6c1d91d..bc18b2b75 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -510,7 +510,7 @@ function user_auth_help_links() {
/*** User features *********************************************************/
function user_login($edit = array(), $msg = "") {
- global $user;
+ global $user, $base_url;
/*
** If we are already logged on, go to the user page instead.
@@ -591,11 +591,12 @@ function user_login($edit = array(), $msg = "") {
** that the session won't expire.
*/
+ $path = preg_replace("/.+\/\/[^\/]+(.*)/", "\$1/", $base_url);
if ($edit["remember_me"]) {
- setcookie(session_name(), session_id(), time() + 3600 * 24 * 365);
+ setcookie(session_name(), session_id(), time() + 3600 * 24 * 365, $path);
}
else {
- setcookie(session_name(), session_id());
+ setcookie(session_name(), session_id(), FALSE, $path);
}
/*