mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 00:17:03 +03:00
Fixed ownCloud integration (Closes #378)
This commit is contained in:
parent
2d287f0b8d
commit
bfafe95975
9 changed files with 71 additions and 23 deletions
|
|
@ -10,7 +10,6 @@ if (!defined('APP_VERSION'))
|
||||||
if (file_exists(APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/index.php'))
|
if (file_exists(APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/index.php'))
|
||||||
{
|
{
|
||||||
include APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/index.php';
|
include APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/index.php';
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
|
||||||
\define('RAINLOOP_APP_LIBRARIES_PATH', RAINLOOP_APP_PATH.'libraries/');
|
\define('RAINLOOP_APP_LIBRARIES_PATH', RAINLOOP_APP_PATH.'libraries/');
|
||||||
\define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper'));
|
\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'))
|
if (!defined('RL_BACKWARD_CAPABILITY'))
|
||||||
{
|
{
|
||||||
\define('RL_BACKWARD_CAPABILITY', true);
|
\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';
|
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';
|
if (0 === \strpos($sClassName, 'Facebook') && false !== \strpos($sClassName, '\\'))
|
||||||
}
|
|
||||||
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);
|
return include RAINLOOP_APP_LIBRARIES_PATH.'Facebook/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php';
|
||||||
include_once RAINLOOP_APP_PATH.'src/RainLoop/Common/MbStringFix.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;
|
return false;
|
||||||
|
|
@ -57,16 +62,23 @@ if (\class_exists('RainLoop\Service'))
|
||||||
|
|
||||||
if (\class_exists('MailSo\Version'))
|
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);
|
if (!\defined('APP_API_STARTED'))
|
||||||
\RainLoop\Api::Handle();
|
{
|
||||||
|
\define('APP_API_STARTED', true);
|
||||||
|
|
||||||
|
\RainLoop\Api::Handle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!\defined('APP_STARTED'))
|
else if (!\defined('APP_STARTED'))
|
||||||
{
|
{
|
||||||
\define('APP_STARTED', true);
|
\define('APP_STARTED', true);
|
||||||
|
|
||||||
\RainLoop\Api::Handle();
|
\RainLoop\Api::Handle();
|
||||||
\RainLoop\Service::Handle();
|
\RainLoop\Service::Handle();
|
||||||
|
|
||||||
|
\RainLoop\Api::ExitOnEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class Api
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
@ -18,7 +18,7 @@ class Api
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @staticvar bool $bOne
|
* @staticvar bool $bOne
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
@ -201,4 +201,15 @@ class Api
|
||||||
\RainLoop\Utils::ClearCookie('rlsession');
|
\RainLoop\Utils::ClearCookie('rlsession');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function ExitOnEnd()
|
||||||
|
{
|
||||||
|
if (!\defined('RAINLOOP_EXIT_ON_END'))
|
||||||
|
{
|
||||||
|
\define('RAINLOOP_EXIT_ON_END', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class RainLoopFacebookRedirectLoginHelper extends \Facebook\FacebookRedirectLogi
|
||||||
$this->rlUserHash = (string) $config['rlUserHash'];
|
$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;
|
$this->rlStorageProvaider = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,8 @@ class AddressBook extends \RainLoop\Providers\AbstractProvider
|
||||||
public function ImportVcfFile($sEmail, $sVcfData)
|
public function ImportVcfFile($sEmail, $sVcfData)
|
||||||
{
|
{
|
||||||
$iCount = 0;
|
$iCount = 0;
|
||||||
if ($this->IsActive() && \is_string($sVcfData))
|
|
||||||
|
if (\class_exists('Sabre\DAV\Client') && $this->IsActive() && \is_string($sVcfData))
|
||||||
{
|
{
|
||||||
$sVcfData = \trim($sVcfData);
|
$sVcfData = \trim($sVcfData);
|
||||||
if ("\xef\xbb\xbf" === \substr($sVcfData, 0, 3))
|
if ("\xef\xbb\xbf" === \substr($sVcfData, 0, 3))
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,8 @@ class Contact
|
||||||
*/
|
*/
|
||||||
public function RegenerateContactStr()
|
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();
|
$this->UpdateDependentValues();
|
||||||
|
|
||||||
|
if (!\class_exists('Sabre\DAV\Client'))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$oVCard = null;
|
$oVCard = null;
|
||||||
if (0 < \strlen($sPreVCard))
|
if (0 < \strlen($sPreVCard))
|
||||||
{
|
{
|
||||||
|
|
@ -482,6 +488,11 @@ class Contact
|
||||||
{
|
{
|
||||||
$this->Properties = array();
|
$this->Properties = array();
|
||||||
|
|
||||||
|
if (!\class_exists('Sabre\DAV\Client'))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($sEtag))
|
if (!empty($sEtag))
|
||||||
{
|
{
|
||||||
$this->Etag = $sEtag;
|
$this->Etag = $sEtag;
|
||||||
|
|
@ -579,5 +590,7 @@ class Contact
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->UpdateDependentValues();
|
$this->UpdateDependentValues();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,11 @@ class PdoAddressBook
|
||||||
|
|
||||||
$sPath = $aUrl['path'];
|
$sPath = $aUrl['path'];
|
||||||
|
|
||||||
|
if (!\class_exists('Sabre\DAV\Client'))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$oClient = new \Sabre\DAV\Client($aSettings);
|
$oClient = new \Sabre\DAV\Client($aSettings);
|
||||||
$oClient->setVerifyPeer(false);
|
$oClient->setVerifyPeer(false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -812,7 +812,9 @@ class Social
|
||||||
|
|
||||||
if (\version_compare(PHP_VERSION, '5.4.0', '>=') &&
|
if (\version_compare(PHP_VERSION, '5.4.0', '>=') &&
|
||||||
$oConfig->Get('social', 'fb_enable', false) && '' !== $sAppID &&
|
$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,
|
\Facebook\FacebookSession::setDefaultApplication($sAppID,
|
||||||
\trim($oConfig->Get('social', 'fb_app_secret', '')));
|
\trim($oConfig->Get('social', 'fb_app_secret', '')));
|
||||||
|
|
|
||||||
|
|
@ -189,4 +189,9 @@ Options -Indexes
|
||||||
}
|
}
|
||||||
|
|
||||||
include APP_VERSION_ROOT_PATH.'app/handle.php';
|
include APP_VERSION_ROOT_PATH.'app/handle.php';
|
||||||
|
|
||||||
|
if (defined('RAINLOOP_EXIT_ON_END') && RAINLOOP_EXIT_ON_END)
|
||||||
|
{
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue