[bugs] [Bug 992] New - Horde::url() use wrong server name from register.php(.dist)

bugs@bugs.horde.org bugs@bugs.horde.org
Fri, 5 Jul 2002 03:13:45 -0300


http://bugs.horde.org/show_bug.cgi?id=992

*** shadow/992	Fri Jul  5 03:13:45 2002
--- shadow/992.tmp.11650	Fri Jul  5 03:13:45 2002
***************
*** 0 ****
--- 1,46 ----
+ Bug#: 992
+ Product: Horde
+ Version: 2.1 Unstable
+ Platform: PHP Code
+ OS/Version: All
+ Status: NEW   
+ Resolution: 
+ Severity: normal
+ Priority: P2
+ Component: IMP
+ Area: BUILD
+ AssignedTo: chuck@horde.org                            
+ ReportedBy: neat@263.net               
+ URL: 
+ Summary: Horde::url() use wrong server name from register.php(.dist)
+ 
+ when using virtual host, the SERVER_NAME generated by apache was always same. 
+ so if I using some other virtual host name to access horde, I get wrong 
+ redirect because the redirect url was generated by SERVER_NAME in the 
+ config/register.php(.dist).
+ my fix is:
+ 
+ $tmphost=$GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'];
+ $tmppos=strpos($rmphost,':');
+ if($tmppos!==FALSE){
+         $tmphost=substr($tmphost,0,$tmppos);
+ }
+ unset($tmppos);
+ 
+ $this->applications['horde'] = array(
+     'fileroot' => dirname(__FILE__) . '/..',
+     'webroot' => '/horde',
+     'initial_page' => 'login.php',
+     'icon' => '/horde/graphics/home.gif',
+     'name' => _("Horde"),
+     'allow_guests' => true,
+     'show' => true,
+     'templates' => dirname(__FILE__) . '/../templates',
+     //'cookie_domain' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'],
+     'cookie_domain' => $tmphost,
+     'cookie_path' => '/horde',
+     //'server_name' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'],
+     'server_name' => $tmphost,
+     'server_port' => $GLOBALS['HTTP_SERVER_VARS']['SERVER_PORT']
+ );
+ unset($tmphost);