mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Change dav handle configuration (move to /index.php/dav/)
This commit is contained in:
parent
1c50b8df07
commit
248aab17c2
7 changed files with 40 additions and 23 deletions
|
|
@ -14,7 +14,6 @@ if (!\defined('RAINLOOP_APP_ROOT_PATH'))
|
||||||
}
|
}
|
||||||
else if (0 === \strpos($sClassName, 'Sabre') && false !== \strpos($sClassName, '\\'))
|
else if (0 === \strpos($sClassName, 'Sabre') && false !== \strpos($sClassName, '\\'))
|
||||||
{
|
{
|
||||||
include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/SabreDAV/MbStringFix.php';
|
|
||||||
return include RAINLOOP_APP_LIBRARIES_PATH.'Sabre/'.\str_replace('\\', '/', \substr($sClassName, 6)).'.php';
|
return include RAINLOOP_APP_LIBRARIES_PATH.'Sabre/'.\str_replace('\\', '/', \substr($sClassName, 6)).'.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -997,7 +997,7 @@ class Actions
|
||||||
|
|
||||||
$aResult['ContactsEnable'] = (bool) $oConfig->Get('contacts', 'enable', false);
|
$aResult['ContactsEnable'] = (bool) $oConfig->Get('contacts', 'enable', false);
|
||||||
$aResult['ContactsSharing'] = (bool) $oConfig->Get('contacts', 'allow_sharing', false);
|
$aResult['ContactsSharing'] = (bool) $oConfig->Get('contacts', 'allow_sharing', false);
|
||||||
$aResult['ContactsSync'] = (bool) $oConfig->Get('labs', 'sync_allow_dav', false);
|
$aResult['ContactsSync'] = (bool) $oConfig->Get('contacts', 'allow_sync', false);
|
||||||
$aResult['ContactsPdoType'] = $this->ValidateContactPdoType(\trim($this->Config()->Get('contacts', 'type', 'sqlite')));
|
$aResult['ContactsPdoType'] = $this->ValidateContactPdoType(\trim($this->Config()->Get('contacts', 'type', 'sqlite')));
|
||||||
$aResult['ContactsPdoDsn'] = (string) $oConfig->Get('contacts', 'pdo_dsn', '');
|
$aResult['ContactsPdoDsn'] = (string) $oConfig->Get('contacts', 'pdo_dsn', '');
|
||||||
$aResult['ContactsPdoType'] = (string) $oConfig->Get('contacts', 'type', '');
|
$aResult['ContactsPdoType'] = (string) $oConfig->Get('contacts', 'type', '');
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ class Application extends \RainLoop\Config\AbstractConfig
|
||||||
'contacts' => array(
|
'contacts' => array(
|
||||||
'enable' => array(false, 'Enable contacts'),
|
'enable' => array(false, 'Enable contacts'),
|
||||||
'allow_sharing' => array(true),
|
'allow_sharing' => array(true),
|
||||||
|
'allow_sync' => array(false),
|
||||||
'suggestions_limit' => array(30),
|
'suggestions_limit' => array(30),
|
||||||
'type' => array('sqlite', ''),
|
'type' => array('sqlite', ''),
|
||||||
'pdo_dsn' => array('mysql:host=127.0.0.1;port=3306;dbname=rainloop', ''),
|
'pdo_dsn' => array('mysql:host=127.0.0.1;port=3306;dbname=rainloop', ''),
|
||||||
|
|
@ -200,10 +201,7 @@ Enables caching in the system'),
|
||||||
'ignore_folders_subscription' => array(false,
|
'ignore_folders_subscription' => array(false,
|
||||||
'Experimental settings. Handle with care.
|
'Experimental settings. Handle with care.
|
||||||
'),
|
'),
|
||||||
'sync_allow_dav' => array(false),
|
|
||||||
'sync_dav_host' => array(''),
|
|
||||||
'sync_dav_digest_auth' => array(false),
|
'sync_dav_digest_auth' => array(false),
|
||||||
|
|
||||||
'allow_message_append' => array(false),
|
'allow_message_append' => array(false),
|
||||||
'date_from_headers' => array(false),
|
'date_from_headers' => array(false),
|
||||||
'cache_system_data' => array(true),
|
'cache_system_data' => array(true),
|
||||||
|
|
|
||||||
|
|
@ -100,23 +100,29 @@ class Service
|
||||||
$this->oActions->KeenIO('Install');
|
$this->oActions->KeenIO('Install');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->oActions->Config()->Get('labs', 'sync_allow_dav', false))
|
$bCached = false;
|
||||||
|
$sResult = '';
|
||||||
|
$sPathInfo = \trim(\trim($this->oHttp->GetServer('PATH_INFO', '')), ' /');
|
||||||
|
if (!empty($sPathInfo))
|
||||||
{
|
{
|
||||||
$sDavDomain = \trim($this->oActions->Config()->Get('labs', 'sync_dav_host', ''));
|
if ('dav' !== \substr($sPathInfo, 0, 3))
|
||||||
if (!empty($sDavDomain) && $sDavDomain === $this->oHttp->GetHost())
|
|
||||||
{
|
{
|
||||||
$this->oServiceActions->HostDav();
|
$sPathInfo = '';
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$bCached = false;
|
if (empty($sPathInfo))
|
||||||
$sResult = '';
|
|
||||||
$sQuery = \trim(\trim($this->oHttp->GetServer('QUERY_STRING', '')), ' /');
|
|
||||||
$iPos = \strpos($sQuery, '&');
|
|
||||||
if (0 < $iPos)
|
|
||||||
{
|
{
|
||||||
$sQuery = \substr($sQuery, 0, $iPos);
|
$sQuery = \trim(\trim($this->oHttp->GetServer('QUERY_STRING', '')), ' /');
|
||||||
|
$iPos = \strpos($sQuery, '&');
|
||||||
|
if (0 < $iPos)
|
||||||
|
{
|
||||||
|
$sQuery = \substr($sQuery, 0, $iPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sQuery = $sPathInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->oActions->Plugins()->RunHook('filter.http-query', array(&$sQuery));
|
$this->oActions->Plugins()->RunHook('filter.http-query', array(&$sQuery));
|
||||||
|
|
|
||||||
|
|
@ -715,6 +715,8 @@ class ServiceActions
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/SabreDAV/MbStringFix.php';
|
||||||
|
|
||||||
\set_error_handler(function ($errno, $errstr, $errfile, $errline ) {
|
\set_error_handler(function ($errno, $errstr, $errfile, $errline ) {
|
||||||
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
|
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
|
||||||
});
|
});
|
||||||
|
|
@ -743,18 +745,17 @@ class ServiceActions
|
||||||
$oPrincipalCollection, $oAddressBookRoot
|
$oPrincipalCollection, $oAddressBookRoot
|
||||||
));
|
));
|
||||||
|
|
||||||
$oServer->setBaseUri('/');
|
$aPath = \trim($this->oHttp->GetPath(), '/\\ ');
|
||||||
|
$oServer->setBaseUri((0 < \strlen($aPath) ? '/'.$aPath : '').'/index.php/dav/');
|
||||||
|
// $oServer->setBaseUri('/');
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
$oServer->addPlugin(new \Sabre\DAV\Auth\Plugin($oAuthBackend, 'RainLoop'));
|
$oServer->addPlugin(new \Sabre\DAV\Auth\Plugin($oAuthBackend, 'RainLoop'));
|
||||||
$oServer->addPlugin(new \Sabre\DAV\Browser\Plugin());
|
$oServer->addPlugin(new \Sabre\DAV\Browser\Plugin());
|
||||||
$oServer->addPlugin(new \Sabre\CardDAV\Plugin());
|
$oServer->addPlugin(new \Sabre\CardDAV\Plugin());
|
||||||
$oServer->addPlugin(new \Sabre\DAVACL\Plugin());
|
$oServer->addPlugin(new \Sabre\DAVACL\Plugin());
|
||||||
|
|
||||||
$oServer->addPlugin(new \RainLoop\SabreDAV\Logger($this->Logger()));
|
$oServer->addPlugin(new \RainLoop\SabreDAV\Logger($this->Logger()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$oServer->exec();
|
$oServer->exec();
|
||||||
}
|
}
|
||||||
catch (\Exception $oException)
|
catch (\Exception $oException)
|
||||||
|
|
@ -763,6 +764,19 @@ class ServiceActions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function ServiceDav()
|
||||||
|
{
|
||||||
|
if ($this->oActions->Config()->Get('contacts', 'allow_sync', false))
|
||||||
|
{
|
||||||
|
$this->HostDav();
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2771,7 +2771,7 @@ ko.bindingHandlers.command = {
|
||||||
jqElement.toggleClass('command-can-not-be-execute', !bResult);
|
jqElement.toggleClass('command-can-not-be-execute', !bResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
jqElement.toggleClass('command-disabled disable disabled', !bResult);
|
jqElement.toggleClass('command-disabled disable disabled', !bResult).toggleClass('no-disabled', !!bResult);
|
||||||
|
|
||||||
if (jqElement.is('input') || jqElement.is('button'))
|
if (jqElement.is('input') || jqElement.is('button'))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2771,7 +2771,7 @@ ko.bindingHandlers.command = {
|
||||||
jqElement.toggleClass('command-can-not-be-execute', !bResult);
|
jqElement.toggleClass('command-can-not-be-execute', !bResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
jqElement.toggleClass('command-disabled disable disabled', !bResult);
|
jqElement.toggleClass('command-disabled disable disabled', !bResult).toggleClass('no-disabled', !!bResult);
|
||||||
|
|
||||||
if (jqElement.is('input') || jqElement.is('button'))
|
if (jqElement.is('input') || jqElement.is('button'))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue