From 1629343f47aa7011eb3644161f14bf1f27add333 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 11 Oct 2007 11:45:27 +0000 Subject: [PATCH] fixed instance selection by server-name to additionally find instance names containing only the domain-part (eg. www.domain.com matches instance domain.com, if no www.domain.com instance exists) --- phpgwapi/inc/functions.inc.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index 2927f7e94b..ceed39ca60 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -117,15 +117,26 @@ if (!isset($GLOBALS['egw_info']['server']['default_domain']) || // allow to overwrite the default domain !isset($GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']])) - { + { if(isset($GLOBALS['egw_domain'][$_SERVER['SERVER_NAME']])) { $GLOBALS['egw_info']['server']['default_domain'] = $_SERVER['SERVER_NAME']; } else { - reset($GLOBALS['egw_domain']); - list($GLOBALS['egw_info']['server']['default_domain']) = each($GLOBALS['egw_domain']); + $domain_part = explode('.',$_SERVER['SERVER_NAME']); + array_shift($domain_part); + $domain_part = implode('.',$domain_part); + if(isset($GLOBALS['egw_domain'][$domain_part])) + { + $GLOBALS['egw_info']['server']['default_domain'] = $domain_part; + } + else + { + reset($GLOBALS['egw_domain']); + list($GLOBALS['egw_info']['server']['default_domain']) = each($GLOBALS['egw_domain']); + } + unset($domain_part); } } if (isset($_POST['login'])) // on login