Fixed ownCloud integration (Closes #378)

This commit is contained in:
RainLoop Team 2014-11-18 00:22:49 +04:00
parent 2d287f0b8d
commit bfafe95975
9 changed files with 71 additions and 23 deletions

View file

@ -6,6 +6,8 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
\define('RAINLOOP_APP_LIBRARIES_PATH', RAINLOOP_APP_PATH.'libraries/');
\define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper'));
\define('RAINLOOP_INCLUDE_AS_API_DEF', isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API']);
if (!defined('RL_BACKWARD_CAPABILITY'))
{
\define('RL_BACKWARD_CAPABILITY', true);
@ -23,23 +25,26 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
{
return include RAINLOOP_APP_PATH.'src/RainLoop/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
}
else if (0 === \strpos($sClassName, 'Facebook') && false !== \strpos($sClassName, '\\'))
else if (!RAINLOOP_INCLUDE_AS_API_DEF)
{
return include RAINLOOP_APP_LIBRARIES_PATH.'Facebook/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
}
else if (0 === \strpos($sClassName, 'GuzzleHttp') && false !== \strpos($sClassName, '\\'))
{
return include RAINLOOP_APP_LIBRARIES_PATH.'GuzzleHttp/'.\str_replace('\\', '/', \substr($sClassName, 11)).'.php';
}
else if (0 === \strpos($sClassName, 'Sabre') && false !== \strpos($sClassName, '\\'))
{
if (!RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED'))
if (0 === \strpos($sClassName, 'Facebook') && false !== \strpos($sClassName, '\\'))
{
\define('RL_MB_FIXED', true);
include_once RAINLOOP_APP_PATH.'src/RainLoop/Common/MbStringFix.php';
return include RAINLOOP_APP_LIBRARIES_PATH.'Facebook/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
}
else if (0 === \strpos($sClassName, 'GuzzleHttp') && false !== \strpos($sClassName, '\\'))
{
return include RAINLOOP_APP_LIBRARIES_PATH.'GuzzleHttp/'.\str_replace('\\', '/', \substr($sClassName, 11)).'.php';
}
else if (0 === \strpos($sClassName, 'Sabre') && false !== \strpos($sClassName, '\\'))
{
if (!RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED'))
{
\define('RL_MB_FIXED', true);
include_once RAINLOOP_APP_PATH.'src/RainLoop/Common/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';
}
}
return false;
@ -57,16 +62,23 @@ if (\class_exists('RainLoop\Service'))
if (\class_exists('MailSo\Version'))
{
if (isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API'] && !\defined('APP_API_STARTED'))
if (RAINLOOP_INCLUDE_AS_API_DEF)
{
\define('APP_API_STARTED', true);
\RainLoop\Api::Handle();
if (!\defined('APP_API_STARTED'))
{
\define('APP_API_STARTED', true);
\RainLoop\Api::Handle();
}
}
else if (!\defined('APP_STARTED'))
{
\define('APP_STARTED', true);
\RainLoop\Api::Handle();
\RainLoop\Service::Handle();
\RainLoop\Api::ExitOnEnd();
}
}
}

View file

@ -10,7 +10,7 @@ class Api
private function __construct()
{
}
/**
* @return bool
*/
@ -18,7 +18,7 @@ class Api
{
return true;
}
/**
* @staticvar bool $bOne
* @return bool
@ -201,4 +201,15 @@ class Api
\RainLoop\Utils::ClearCookie('rlsession');
return true;
}
/**
* @return void
*/
public static function ExitOnEnd()
{
if (!\defined('RAINLOOP_EXIT_ON_END'))
{
\define('RAINLOOP_EXIT_ON_END', true);
}
}
}

View file

@ -64,7 +64,7 @@ class RainLoopFacebookRedirectLoginHelper extends \Facebook\FacebookRedirectLogi
$this->rlUserHash = (string) $config['rlUserHash'];
}
if (!class_exists('\\RainLoop\\Providers\\Storage\\Enumerations\\StorageType') || '' === $this->rlUserHash)
if (!class_exists('RainLoop\Providers\Storage\Enumerations\StorageType') || '' === $this->rlUserHash)
{
$this->rlStorageProvaider = null;
}

View file

@ -317,7 +317,8 @@ class AddressBook extends \RainLoop\Providers\AbstractProvider
public function ImportVcfFile($sEmail, $sVcfData)
{
$iCount = 0;
if ($this->IsActive() && \is_string($sVcfData))
if (\class_exists('Sabre\DAV\Client') && $this->IsActive() && \is_string($sVcfData))
{
$sVcfData = \trim($sVcfData);
if ("\xef\xbb\xbf" === \substr($sVcfData, 0, 3))

View file

@ -150,7 +150,8 @@ class Contact
*/
public function RegenerateContactStr()
{
$this->IdContactStr = \Sabre\DAV\UUIDUtil::getUUID();
$this->IdContactStr = \class_exists('Sabre\DAV\Client') ?
\Sabre\DAV\UUIDUtil::getUUID() : \md5(\microtime(true).'-'.\rand(10000, 99999));
}
/**
@ -185,6 +186,11 @@ class Contact
{
$this->UpdateDependentValues();
if (!\class_exists('Sabre\DAV\Client'))
{
return '';
}
$oVCard = null;
if (0 < \strlen($sPreVCard))
{
@ -482,6 +488,11 @@ class Contact
{
$this->Properties = array();
if (!\class_exists('Sabre\DAV\Client'))
{
return false;
}
if (!empty($sEtag))
{
$this->Etag = $sEtag;
@ -579,5 +590,7 @@ class Contact
}
$this->UpdateDependentValues();
return true;
}
}

View file

@ -232,6 +232,11 @@ class PdoAddressBook
$sPath = $aUrl['path'];
if (!\class_exists('Sabre\DAV\Client'))
{
return false;
}
$oClient = new \Sabre\DAV\Client($aSettings);
$oClient->setVerifyPeer(false);

View file

@ -812,7 +812,9 @@ class Social
if (\version_compare(PHP_VERSION, '5.4.0', '>=') &&
$oConfig->Get('social', 'fb_enable', false) && '' !== $sAppID &&
'' !== \trim($oConfig->Get('social', 'fb_app_secret', '')))
'' !== \trim($oConfig->Get('social', 'fb_app_secret', '')) &&
\class_exists('Facebook\FacebookSession')
)
{
\Facebook\FacebookSession::setDefaultApplication($sAppID,
\trim($oConfig->Get('social', 'fb_app_secret', '')));

View file

@ -189,4 +189,9 @@ Options -Indexes
}
include APP_VERSION_ROOT_PATH.'app/handle.php';
if (defined('RAINLOOP_EXIT_ON_END') && RAINLOOP_EXIT_ON_END)
{
exit(0);
}
}