Change dav handle configuration (move to /index.php/dav/)

This commit is contained in:
RainLoop Team 2013-12-23 20:11:42 +04:00
parent 1c50b8df07
commit 248aab17c2
7 changed files with 40 additions and 23 deletions

View file

@ -14,7 +14,6 @@ if (!\defined('RAINLOOP_APP_ROOT_PATH'))
}
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';
}

View file

@ -997,7 +997,7 @@ class Actions
$aResult['ContactsEnable'] = (bool) $oConfig->Get('contacts', 'enable', 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['ContactsPdoDsn'] = (string) $oConfig->Get('contacts', 'pdo_dsn', '');
$aResult['ContactsPdoType'] = (string) $oConfig->Get('contacts', 'type', '');

View file

@ -84,6 +84,7 @@ class Application extends \RainLoop\Config\AbstractConfig
'contacts' => array(
'enable' => array(false, 'Enable contacts'),
'allow_sharing' => array(true),
'allow_sync' => array(false),
'suggestions_limit' => array(30),
'type' => array('sqlite', ''),
'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,
'Experimental settings. Handle with care.
'),
'sync_allow_dav' => array(false),
'sync_dav_host' => array(''),
'sync_dav_digest_auth' => array(false),
'allow_message_append' => array(false),
'date_from_headers' => array(false),
'cache_system_data' => array(true),

View file

@ -100,23 +100,29 @@ class Service
$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 (!empty($sDavDomain) && $sDavDomain === $this->oHttp->GetHost())
if ('dav' !== \substr($sPathInfo, 0, 3))
{
$this->oServiceActions->HostDav();
return $this;
$sPathInfo = '';
}
}
$bCached = false;
$sResult = '';
$sQuery = \trim(\trim($this->oHttp->GetServer('QUERY_STRING', '')), ' /');
$iPos = \strpos($sQuery, '&');
if (0 < $iPos)
if (empty($sPathInfo))
{
$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));

View file

@ -715,6 +715,8 @@ class ServiceActions
{
try
{
include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/SabreDAV/MbStringFix.php';
\set_error_handler(function ($errno, $errstr, $errfile, $errline ) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
});
@ -743,18 +745,17 @@ class ServiceActions
$oPrincipalCollection, $oAddressBookRoot
));
$oServer->setBaseUri('/');
$aPath = \trim($this->oHttp->GetPath(), '/\\ ');
$oServer->setBaseUri((0 < \strlen($aPath) ? '/'.$aPath : '').'/index.php/dav/');
// $oServer->setBaseUri('/');
// Plugins
$oServer->addPlugin(new \Sabre\DAV\Auth\Plugin($oAuthBackend, 'RainLoop'));
$oServer->addPlugin(new \Sabre\DAV\Browser\Plugin());
$oServer->addPlugin(new \Sabre\CardDAV\Plugin());
$oServer->addPlugin(new \Sabre\DAVACL\Plugin());
$oServer->addPlugin(new \RainLoop\SabreDAV\Logger($this->Logger()));
$oServer->exec();
}
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
*/

View file

@ -2771,7 +2771,7 @@ ko.bindingHandlers.command = {
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'))
{

View file

@ -2771,7 +2771,7 @@ ko.bindingHandlers.command = {
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'))
{