diff --git a/rainloop/v/0.0.0/app/handle.php b/rainloop/v/0.0.0/app/handle.php index fb4483642..34ee78e44 100644 --- a/rainloop/v/0.0.0/app/handle.php +++ b/rainloop/v/0.0.0/app/handle.php @@ -5,8 +5,13 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH')) \define('RAINLOOP_APP_LIBRARIES_PATH', \rtrim(\realpath(__DIR__), '\\/').'/libraries/'); \define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper')); - \spl_autoload_register(function ($sClassName) { - + /** + * @param string $sClassName + * + * @return mixed + */ + function RainLoopSplAutoloadRegisterFunction($sClassName) + { if (0 === \strpos($sClassName, 'RainLoop') && false !== \strpos($sClassName, '\\')) { return include RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/'.\str_replace('\\', '/', \substr($sClassName, 9)).'.php'; @@ -31,34 +36,36 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH')) } return false; - }); + } + + \spl_autoload_register('RainLoopSplAutoloadRegisterFunction', false); } if (\class_exists('RainLoop\Service')) { - $oException = null; if (!\class_exists('MailSo\Version')) { - try - { - include APP_VERSION_ROOT_PATH.'app/libraries/MailSo/MailSo.php'; - } - catch (\Exception $oException) {} + include APP_VERSION_ROOT_PATH.'app/libraries/MailSo/MailSo.php'; } - if (!$oException) + if (\class_exists('MailSo\Version')) { - if (isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API']) + if (isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API'] && !\defined('APP_API_STARTED')) { - $_ENV['RAINLOOP_INCLUDE_AS_API'] = false; + \define('APP_API_STARTED', true); \RainLoop\Api::Handle(); } else if (!\defined('APP_STARTED')) { \define('APP_STARTED', true); - \RainLoop\Service::NewInstance()->Handle(); + \RainLoop\Api::Handle(); + \RainLoop\Service::Handle(); } } } +else if (\function_exists('RainLoopSplAutoloadRegisterFunction')) +{ + \spl_autoload_unregister('RainLoopSplAutoloadRegisterFunction'); +} return ''; \ No newline at end of file diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/MailSo.php b/rainloop/v/0.0.0/app/libraries/MailSo/MailSo.php index 552d943b9..89accb572 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/MailSo.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/MailSo.php @@ -7,10 +7,18 @@ if (!\defined('MAILSO_LIBRARY_ROOT_PATH')) \define('MAILSO_LIBRARY_ROOT_PATH', \defined('MAILSO_LIBRARY_USE_PHAR') ? 'phar://mailso.phar/' : \rtrim(\realpath(__DIR__), '\\/').'/'); - \spl_autoload_register(function ($sClassName) { + /** + * @param string $sClassName + * + * @return mixed + */ + function MailSoSplAutoloadRegisterFunction($sClassName) + { return (0 === \strpos($sClassName, 'MailSo') && false !== \strpos($sClassName, '\\')) ? include MAILSO_LIBRARY_ROOT_PATH.\str_replace('\\', '/', \substr($sClassName, 7)).'.php' : false; - }); + } + + \spl_autoload_register('MailSo\MailSoSplAutoloadRegisterFunction', false); if (\class_exists('MailSo\Base\Loader')) { @@ -18,6 +26,6 @@ if (!\defined('MAILSO_LIBRARY_ROOT_PATH')) } else { - throw new \Exception('MailSo initialisation error'); + \spl_autoload_unregister('MailSo\MailSoSplAutoloadRegisterFunction'); } } \ No newline at end of file diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Api.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Api.php index 750fbf377..2f0bde03f 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Api.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Api.php @@ -10,6 +10,34 @@ class Api private function __construct() { } + + /** + * @return bool + */ + public static function RunResult() + { + return true; + } + + /** + * @staticvar bool $bOne + * @return bool + */ + public static function Handle() + { + static $bOne = null; + if (null === $bOne) + { + $bOne = \class_exists('MailSo\Version'); + if ($bOne) + { + \RainLoop\Api::SetupDefaultMailSoConfig(); + $bOne = \RainLoop\Api::RunResult(); + } + } + + return $bOne; + } /** * @return \RainLoop\Actions @@ -41,28 +69,6 @@ class Api return \RainLoop\Api::Actions()->Logger(); } - /** - * @return bool - */ - public static function Handle() - { - static $bOne = null; - if ($bOne) - { - return true; - } - - if (!\class_exists('MailSo\Version')) - { - return false; - } - - \RainLoop\Api::SetupDefaultMailSoConfig(); - - $bOne = true; - return true; - } - /** * @return string */ @@ -193,6 +199,6 @@ class Api public static function LogoutCurrentLogginedUser() { \RainLoop\Utils::ClearCookie('rlsession'); - return false; + return true; } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/SettingsInterface.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/SettingsInterface.php index 05a0a83c0..cc425dadb 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/SettingsInterface.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/SettingsInterface.php @@ -18,4 +18,11 @@ interface SettingsInterface * @return bool */ public function Save(\RainLoop\Account $oAccount, array $aSettings); + + /** + * @param string $sEmail + * + * @return bool + */ + public function ClearByEmail($sEmail); } \ No newline at end of file diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php index 9cd84de65..e5d7fc215 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php @@ -35,8 +35,6 @@ class Service \ini_set('display_errors', 1); } - \RainLoop\Api::SetupDefaultMailSoConfig(); - $sServer = \trim($this->oActions->Config()->Get('security', 'custom_server_signature', '')); if (0 < \strlen($sServer)) { @@ -54,20 +52,43 @@ class Service @\header('Location: https://'.$this->oHttp->GetHost(false, false).$this->oHttp->GetUrl(), true); exit(); } + + $this->localHandle(); } /** - * @return \RainLoop\Service + * @return bool */ - public static function NewInstance() + public function RunResult() { - return new self(); + return true; + } + + /** + * @staticvar bool $bOne + * @return bool + */ + public static function Handle() + { + static $bOne = null; + if (null === $bOne) + { + $oService = null; + if (\class_exists('MailSo\Version')) + { + $oService = new self(); + } + + $bOne = $oService->RunResult(); + } + + return $bOne; } /** * @return \RainLoop\Service */ - public function Handle() + private function localHandle() { if (!\class_exists('MailSo\Version')) { diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index 33750ff78..802bdc84a 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -941,8 +941,6 @@ class ServiceActions $sEmail = \trim($this->oHttp->GetRequest('Email', '')); $sPassword = $this->oHttp->GetRequest('Password', ''); - \RainLoop\Api::Handle(); - $sResult = \RainLoop\Api::GetUserSsoHash($sEmail, $sPassword); $bLogout = 0 === \strlen($sResult);