diff --git a/index.php b/index.php index 0531f800d..5ba5d470e 100644 --- a/index.php +++ b/index.php @@ -10,7 +10,6 @@ if (!defined('APP_VERSION')) if (file_exists(APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/index.php')) { include APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/index.php'; - exit(0); } else { diff --git a/rainloop/v/0.0.0/app/handle.php b/rainloop/v/0.0.0/app/handle.php index 1d9aa0545..ece49ec3b 100644 --- a/rainloop/v/0.0.0/app/handle.php +++ b/rainloop/v/0.0.0/app/handle.php @@ -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(); } } } diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Api.php b/rainloop/v/0.0.0/app/src/RainLoop/Api.php index 2f0bde03f..f9b0d6d50 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Api.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Api.php @@ -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); + } + } } diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Common/RainLoopFacebookRedirectLoginHelper.php b/rainloop/v/0.0.0/app/src/RainLoop/Common/RainLoopFacebookRedirectLoginHelper.php index 7f53388e6..f0ecd0094 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Common/RainLoopFacebookRedirectLoginHelper.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Common/RainLoopFacebookRedirectLoginHelper.php @@ -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; } diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook.php b/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook.php index 44838dffb..49f393109 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook.php @@ -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)) diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook/Classes/Contact.php b/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook/Classes/Contact.php index 60daf2410..cfd4916e8 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook/Classes/Contact.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook/Classes/Contact.php @@ -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; } } diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook/PdoAddressBook.php b/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook/PdoAddressBook.php index b234af3cd..0e1680316 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook/PdoAddressBook.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Providers/AddressBook/PdoAddressBook.php @@ -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); diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Social.php b/rainloop/v/0.0.0/app/src/RainLoop/Social.php index f4a638725..8dea13ee0 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Social.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Social.php @@ -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', ''))); diff --git a/rainloop/v/0.0.0/index.php b/rainloop/v/0.0.0/index.php index 42e95440a..3298399c6 100644 --- a/rainloop/v/0.0.0/index.php +++ b/rainloop/v/0.0.0/index.php @@ -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); + } }