From 76ffd72eb623c17c9ac5fab99991add6da89ee98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Sun, 22 Nov 2009 17:49:09 +0000 Subject: [PATCH] Add multi-domain support for SyncML --- phpgwapi/inc/horde/Horde/SyncML/State_egw.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/horde/Horde/SyncML/State_egw.php b/phpgwapi/inc/horde/Horde/SyncML/State_egw.php index 59a745a809..c08d01c8d5 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/State_egw.php +++ b/phpgwapi/inc/horde/Horde/SyncML/State_egw.php @@ -311,11 +311,21 @@ class EGW_SyncML_State extends Horde_SyncML_State $parts = explode('@',$this->_locName); $this->_account_domain = array_pop($parts); } + $GLOBALS['egw_info']['user']['domain'] = $this->_account_domain; + $GLOBALS['egw_info']['server']['db_host'] = $GLOBALS['egw_domain'][$this->_account_domain]['db_host']; + $GLOBALS['egw_info']['server']['db_port'] = $GLOBALS['egw_domain'][$this->_account_domain]['db_port']; + $GLOBALS['egw_info']['server']['db_name'] = $GLOBALS['egw_domain'][$this->_account_domain]['db_name']; + $GLOBALS['egw_info']['server']['db_user'] = $GLOBALS['egw_domain'][$this->_account_domain]['db_user']; + $GLOBALS['egw_info']['server']['db_pass'] = $GLOBALS['egw_domain'][$this->_account_domain]['db_pass']; + $GLOBALS['egw_info']['server']['db_type'] = $GLOBALS['egw_domain'][$this->_account_domain]['db_type']; + // It work -- don't ask me why. + $this->db = new egw_db($GLOBALS['egw_info']['server']); + $this->db->connect(); + #Horde::logMessage('SyncML: authenticate with username: ' . $this->_locName . ' and password: ' . $this->_password, __FILE__, __LINE__, PEAR_LOG_DEBUG); - if ($GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($this->_locName,$this->_password,'text')) { - + if (($GLOBALS['sessionid'] = $GLOBALS['egw']->session->create($this->_locName,$this->_password,'text'))) { if ($GLOBALS['egw_info']['user']['apps']['syncml']) { $this->_isAuthorized = true; Horde::logMessage('SyncML_EGW: Authentication of ' . $this->_locName . '/' . $GLOBALS['sessionid'] . ' succeded' , __FILE__, __LINE__, PEAR_LOG_DEBUG); @@ -328,6 +338,7 @@ class EGW_SyncML_State extends Horde_SyncML_State Horde::logMessage('SyncML: Authentication of ' . $this->_locName . ' failed' , __FILE__, __LINE__, PEAR_LOG_INFO); } } else { + if ($this->log) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."()\n".var_export($GLOBALS['egw_info'], true)."\n",3,$this->logfile); // store sessionID in a variable, because ->verify maybe resets that value $sessionID = session_id(); $GLOBALS['egw_info']['user']['domain'] = $this->_account_domain;