From bc6c320ecbb860ea2a328fd5be3604958bd74bf2 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Thu, 26 Dec 2013 03:54:50 +0400 Subject: [PATCH] Add sync_dav_domain configuration for custom dav domain --- .../0.0.0/app/libraries/RainLoop/Actions.php | 36 +++++++++++++++---- .../libraries/RainLoop/Config/Application.php | 1 + rainloop/v/0.0.0/static/css/app.css | 18 +++++----- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index f8a7400e4..c7253929e 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -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); - - $aResult['ContactsSyncPabUrl'] = $sUrl.'/index.php/dav/addressbooks/'.$oAccount->ParentEmailHelper().'/default/'; + 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'; + } + 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)); } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 9d57b44d1..16e6e481f 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -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), diff --git a/rainloop/v/0.0.0/static/css/app.css b/rainloop/v/0.0.0/static/css/app.css index a84655cbb..67e3b55ce 100644 --- a/rainloop/v/0.0.0/static/css/app.css +++ b/rainloop/v/0.0.0/static/css/app.css @@ -637,7 +637,7 @@ border-radius: 8px; } - + /*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */ /* ============================================================================= @@ -1142,7 +1142,7 @@ table { border-collapse: collapse; border-spacing: 0; } - + @charset "UTF-8"; @font-face { @@ -1474,7 +1474,7 @@ table { .icon-mail:before { content: "\e062"; } - + /** initial setup **/ .nano { /* @@ -1591,7 +1591,7 @@ table { .nano > .pane2:hover > .slider2, .nano > .pane2.active > .slider2 { background-color: rgba(0, 0, 0, 0.4); } - + /* Magnific Popup CSS */ .mfp-bg { top: 0; @@ -1956,7 +1956,7 @@ img.mfp-img { right: 0; padding-top: 0; } - + /* overlay at start */ .mfp-fade.mfp-bg { @@ -2002,7 +2002,7 @@ img.mfp-img { -moz-transform: translateX(50px); transform: translateX(50px); } - + .simple-pace { -webkit-pointer-events: none; pointer-events: none; @@ -2073,7 +2073,7 @@ img.mfp-img { @keyframes simple-pace-stripe-animation { 0% { transform: none; transform: none; } 100% { transform: translate(-32px, 0); transform: translate(-32px, 0); } -} +} .inputosaurus-container { background-color:#fff; border:1px solid #bcbec0; @@ -2141,7 +2141,7 @@ img.mfp-img { box-shadow:none; } .inputosaurus-input-hidden { display:none; } - + .flag-wrapper { width: 24px; height: 16px; @@ -2182,7 +2182,7 @@ img.mfp-img { .flag.flag-pt-br {background-position: -192px -11px} .flag.flag-cn, .flag.flag-zh-tw, .flag.flag-zh-cn, .flag.flag-zh-hk {background-position: -208px -22px} - + /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ .clearfix { *zoom: 1;