Code refactoring

This commit is contained in:
RainLoop Team 2014-10-15 19:11:50 +04:00
parent 6acba46339
commit 819ba4a2ef
6 changed files with 94 additions and 47 deletions

View file

@ -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;
}
}

View file

@ -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);
}

View file

@ -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'))
{

View file

@ -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);