mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-13 16:44:37 +08:00
Add sync_dav_domain configuration for custom dav domain
This commit is contained in:
parent
fde3e8241e
commit
bc6c320ecb
3 changed files with 40 additions and 15 deletions
|
@ -949,7 +949,19 @@ class Actions
|
|||
|
||||
if ($aResult['ContactsSyncIsAllowed'])
|
||||
{
|
||||
$aResult['ContactsSyncServer'] = $this->Http()->GetHost(false, true, true);
|
||||
$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);
|
||||
}
|
||||
|
||||
$sUrl = \rtrim(\trim($this->Http()->GetScheme().'://'.$this->Http()->GetHost(true, false).$this->Http()->GetPath()), '/\\');
|
||||
$sUrl = \preg_replace('/index\.php(.*)$/i', '', $sUrl);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Reference in a new issue