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 ;-)
This commit is contained in:
Ralf Becker 2004-07-31 10:14:52 +00:00
parent be01760302
commit 7e1da8f7ad

View File

@ -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<br>";
if( eregi("\[\]", $b[0]) )
{
$b[0] = eregi_replace("\[\]", "[$i]", $b[0]);
}
}
$new_extravars[$b[0]] = $b[1];
$i++;
}