Add sync_dav_domain configuration for custom dav domain

This commit is contained in:
RainLoop Team 2013-12-26 03:54:50 +04:00
parent fde3e8241e
commit bc6c320ecb
3 changed files with 40 additions and 15 deletions

View file

@ -948,8 +948,20 @@ class Actions
$aResult['ContactsSyncPabUrl'] = '';
if ($aResult['ContactsSyncIsAllowed'])
{
$sDavDomain = (string) $oConfig->Get('labs', 'sync_dav_domain', '');
if (empty($sDavDomain))
{
$aResult['ContactsSyncServer'] = $this->Http()->GetHost(false, true, true);
}
else
{
$sDavDomain = \rtrim($sDavDomain, '/\\ ');
$sDavDomainWithoutScheme = \preg_replace('/https?:\/\//i', '', \trim($sDavDomain));
$aResult['ContactsSyncServer'] = $sDavDomainWithoutScheme;
}
$aResult['ContactsSyncUser'] = $oAccount->ParentEmailHelper();
try
@ -961,10 +973,22 @@ class Actions
$this->Logger()->WriteException($oException);
}
if (empty($sDavDomain))
{
$sUrl = \rtrim(\trim($this->Http()->GetScheme().'://'.$this->Http()->GetHost(true, false).$this->Http()->GetPath()), '/\\');
$sUrl = \preg_replace('/index\.php(.*)$/i', '', $sUrl);
$aResult['ContactsSyncPabUrl'] = $sUrl.'/index.php/dav/addressbooks/'.$oAccount->ParentEmailHelper().'/default/';
$aResult['ContactsSyncPabUrl'] = $sUrl.'/index.php/dav';
}
else
{
$aResult['ContactsSyncPabUrl'] = \preg_match('/^https?:\/\//i', $sDavDomain) ? $sDavDomain : 'http://'.$sDavDomain;
}
if (!empty($aResult['ContactsSyncPabUrl']))
{
$aResult['ContactsSyncPabUrl'] .= '/addressbooks/'.$oAccount->ParentEmailHelper().'/default/';
}
}
$oSettings = $this->SettingsProvider()->Load($oAccount);
@ -4196,7 +4220,7 @@ class Actions
{
$oSettings = $this->SettingsProvider()->Load($oAccount);
$this->PersonalAddressBookProvider($oAccount)->IncFrec($oAccount, \array_values($aArrayToFrec),
$this->PersonalAddressBookProvider($oAccount)->IncFrec($oAccount->ParentEmailHelper(), \array_values($aArrayToFrec),
!!$oSettings->GetConf('ContactsAutosave', false));
}
}

View file

@ -202,6 +202,7 @@ Enables caching in the system'),
'Experimental settings. Handle with care.
'),
'sync_dav_digest_auth' => array(false),
'sync_dav_domain' => array(''),
'sync_use_dav_browser' => array(true),
'allow_message_append' => array(false),
'date_from_headers' => array(false),