mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 06:57:03 +03:00
parent
dde42c6190
commit
e211899c7b
12 changed files with 191 additions and 18 deletions
89
rainloop/v/0.0.0/app/libraries/RainLoop/Api.php
Normal file
89
rainloop/v/0.0.0/app/libraries/RainLoop/Api.php
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
namespace RainLoop;
|
||||
|
||||
class Api
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \RainLoop\Actions
|
||||
*/
|
||||
private static function Actions()
|
||||
{
|
||||
static $oActions = null;
|
||||
if (null === $oActions)
|
||||
{
|
||||
$oActions = \RainLoop\Actions::NewInstance();
|
||||
}
|
||||
|
||||
return $oActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \RainLoop\Application
|
||||
*/
|
||||
public static function Config()
|
||||
{
|
||||
return self::Actions()->Config();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function Handle()
|
||||
{
|
||||
static $bOne = null;
|
||||
if ($bOne)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!\class_exists('MailSo\Version'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (self::Config()->Get('labs', 'disable_iconv_if_mbstring_supported') &&
|
||||
\class_exists('MailSo\Capa') && \MailSo\Base\Utils::IsMbStringSupported())
|
||||
{
|
||||
\MailSo\Capa::$ICONV = false;
|
||||
}
|
||||
|
||||
$bOne = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sEmail
|
||||
* @param string $sPassword
|
||||
* @param string $sLogin = ''
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function GetUserSsoHash($sEmail, $sPassword, $sLogin = '')
|
||||
{
|
||||
$sSsoHash = \sha1(\rand(10000, 99999).$sEmail.$sPassword.$sLogin.\microtime(true));
|
||||
|
||||
return self::Actions()->Cacher()->Set(self::Actions()->BuildSsoCacherKey($sSsoHash), \RainLoop\Utils::EncodeKeyValues(array(
|
||||
'Email' => $sEmail,
|
||||
'Password' => $sPassword,
|
||||
'Login' => $sLogin
|
||||
))) ? $sSsoHash : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSsoHash
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function ClearUserSsoHash($sSsoHash)
|
||||
{
|
||||
return self::Actions()->Delete(self::Actions()->BuildSsoCacherKey($sSsoHash));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue