Add multi-domain support for SyncML

This commit is contained in:
Jörg Lehrke 2009-11-22 17:40:32 +00:00
parent f6a3622115
commit e340d34810

View File

@ -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;