From 7e1da8f7ad9a1a2ede6c6a35c7dbc9c7d3717eec Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 31 Jul 2004 10:14:52 +0000 Subject: [PATCH] 1) fix for cookie domain, when using a proxy which rewrites the host-name 2) also applied Benjamins fix for the link function from the 1.0 branch - thought I dont know what it fixes ;-) --- phpgwapi/inc/class.sessions.inc.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.sessions.inc.php b/phpgwapi/inc/class.sessions.inc.php index f4f712362b..f190742ea9 100644 --- a/phpgwapi/inc/class.sessions.inc.php +++ b/phpgwapi/inc/class.sessions.inc.php @@ -430,7 +430,8 @@ */ function phpgw_set_cookiedomain() { - $this->cookie_domain = $_SERVER['HTTP_HOST']; + // Use HTTP_X_FORWARDED_HOST if set, which is the case behind a none-transparent proxy + $this->cookie_domain = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']; // remove port from HTTP_HOST if (preg_match("/^(.*):(.*)$/",$this->cookie_domain,$arr)) @@ -1149,11 +1150,23 @@ /* We do this to help prevent any duplicates from being sent. */ if (!is_array($extravars) && $extravars != '') { + $new_extravars = Array(); + $a = explode('&', $extravars); $i = 0; while ($i < count($a)) { $b = split('=', $a[$i],2); + // Check if this value doesn't already exist in new_extravars + if(array_key_exists($b[0], $new_extravars)) + { + // print "Debug::Error !!! " . $b[0] . " ($i) already exists
"; + if( eregi("\[\]", $b[0]) ) + { + $b[0] = eregi_replace("\[\]", "[$i]", $b[0]); + } + } + $new_extravars[$b[0]] = $b[1]; $i++; }