mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Cleanup MailSo Validator
Cleanup removed features
This commit is contained in:
parent
8fe8369b2a
commit
1009398d0c
15 changed files with 65 additions and 192 deletions
|
|
@ -27,7 +27,7 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
|
||||||
{
|
{
|
||||||
if (0 === \strpos($sClassName, $sNamespaceName.'\\'))
|
if (0 === \strpos($sClassName, $sNamespaceName.'\\'))
|
||||||
{
|
{
|
||||||
include RAINLOOP_APP_LIBRARIES_PATH.$sPrefix.\strtr($sClassName, '\\', '/').'.php';
|
include RAINLOOP_APP_LIBRARIES_PATH.\strtr($sClassName, '\\', '/').'.php';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class Crypt
|
||||||
private static function XxteaDecrypt(string $sEncryptedString, string $sKey) : string
|
private static function XxteaDecrypt(string $sEncryptedString, string $sKey) : string
|
||||||
{
|
{
|
||||||
if (\is_callable('xxtea_decrypt')) {
|
if (\is_callable('xxtea_decrypt')) {
|
||||||
return xxtea_decrypt($sString, $sKey);
|
return xxtea_decrypt($sEncryptedString, $sKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
$aV = self::str2long($sEncryptedString, false);
|
$aV = self::str2long($sEncryptedString, false);
|
||||||
|
|
@ -166,6 +166,6 @@ class Crypt
|
||||||
|
|
||||||
private static function int32(int $iN) : int
|
private static function int32(int $iN) : int
|
||||||
{
|
{
|
||||||
return ($n & 0xffffffff);
|
return $iN & 0xffffffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,51 +17,13 @@ namespace MailSo\Base;
|
||||||
*/
|
*/
|
||||||
class Validator
|
class Validator
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function EmailString(string $sEmail, array $aAllowedInternalDomains = array('localhost')) : bool
|
|
||||||
{
|
|
||||||
$bResult = false;
|
|
||||||
if (\MailSo\Base\Validator::NotEmptyString($sEmail, true))
|
|
||||||
{
|
|
||||||
$bResult = false !== \filter_var($sEmail, FILTER_VALIDATE_EMAIL);
|
|
||||||
if (!$bResult)
|
|
||||||
{
|
|
||||||
$aSplit = \explode("@", $sEmail);
|
|
||||||
$bResult = 2 === \count($aSplit) &&
|
|
||||||
\in_array($aSplit[1], $aAllowedInternalDomains) &&
|
|
||||||
false !== \filter_var(($aSplit[0].'@example.com'), FILTER_VALIDATE_EMAIL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $bResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function SimpleEmailString(string $sEmail) : bool
|
|
||||||
{
|
|
||||||
return \MailSo\Base\Validator::NotEmptyString($sEmail, true) &&
|
|
||||||
!!\preg_match('/^[a-zA-Z0-9][a-zA-Z0-9\.\+\-_]*@[a-zA-Z0-9][a-zA-Z0-9\.\+\-_]*$/', $sEmail);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function NotEmptyString(string $sString, bool $bTrim = false) : bool
|
|
||||||
{
|
|
||||||
return \is_string($sString) &&
|
|
||||||
(0 < \strlen($bTrim ? \trim($sString) : $sString));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function NotEmptyArray(array $aList) : bool
|
|
||||||
{
|
|
||||||
return \is_array($aList) && 0 < \count($aList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function RangeInt(int $iNumber, int $iMin = null, int $iMax = null) : bool
|
public static function RangeInt(int $iNumber, int $iMin = null, int $iMax = null) : bool
|
||||||
{
|
{
|
||||||
return \is_int($iNumber) &&
|
return (null === $iMin || $iNumber >= $iMin) && (null === $iMax || $iNumber <= $iMax);
|
||||||
(null !== $iMin && $iNumber >= $iMin || null === $iMin) &&
|
|
||||||
(null !== $iMax && $iNumber <= $iMax || null === $iMax);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function PortInt(int $iPort) : bool
|
public static function PortInt(int $iPort) : bool
|
||||||
{
|
{
|
||||||
return \MailSo\Base\Validator::RangeInt($iPort, 0, 65535);
|
return static::RangeInt($iPort, 0, 65535);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,11 @@ class Hooks
|
||||||
*/
|
*/
|
||||||
static $aCallbacks = array();
|
static $aCallbacks = array();
|
||||||
|
|
||||||
static public function Run(string $sName, array $aArg = array())
|
static public function Run(string $sName, array $aArg = array()) : void
|
||||||
{
|
{
|
||||||
if (isset(\MailSo\Hooks::$aCallbacks[$sName]))
|
if (isset(static::$aCallbacks[$sName]))
|
||||||
{
|
{
|
||||||
foreach (\MailSo\Hooks::$aCallbacks[$sName] as $mCallback)
|
foreach (static::$aCallbacks[$sName] as $mCallback)
|
||||||
{
|
{
|
||||||
\call_user_func_array($mCallback, $aArg);
|
\call_user_func_array($mCallback, $aArg);
|
||||||
}
|
}
|
||||||
|
|
@ -35,16 +35,16 @@ class Hooks
|
||||||
/**
|
/**
|
||||||
* @param mixed $mCallback
|
* @param mixed $mCallback
|
||||||
*/
|
*/
|
||||||
static public function Add(string $sName, $mCallback)
|
static public function Add(string $sName, $mCallback) : void
|
||||||
{
|
{
|
||||||
if (\is_callable($mCallback))
|
if (\is_callable($mCallback))
|
||||||
{
|
{
|
||||||
if (!isset(\MailSo\Hooks::$aCallbacks[$sName]))
|
if (!isset(static::$aCallbacks[$sName]))
|
||||||
{
|
{
|
||||||
\MailSo\Hooks::$aCallbacks[$sName] = array();
|
static::$aCallbacks[$sName] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
\MailSo\Hooks::$aCallbacks[$sName][] = $mCallback;
|
static::$aCallbacks[$sName][] = $mCallback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,8 +172,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
public function Login(string $sLogin, string $sPassword, string $sProxyAuthUser = '',
|
public function Login(string $sLogin, string $sPassword, string $sProxyAuthUser = '',
|
||||||
bool $bUseAuthPlainIfSupported = true, bool $bUseAuthCramMd5IfSupported = true) : self
|
bool $bUseAuthPlainIfSupported = true, bool $bUseAuthCramMd5IfSupported = true) : self
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sLogin, true) ||
|
if (!strlen(\trim($sLogin)) || !strlen(\trim($sPassword)))
|
||||||
!\MailSo\Base\Validator::NotEmptyString($sPassword, true))
|
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
||||||
|
|
@ -341,7 +340,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
public function IsSupported(string $sExtentionName) : bool
|
public function IsSupported(string $sExtentionName) : bool
|
||||||
{
|
{
|
||||||
$bResult = \MailSo\Base\Validator::NotEmptyString($sExtentionName, true);
|
$bResult = strlen(\trim($sExtentionName));
|
||||||
if ($bResult && null === $this->aCapabilityItems)
|
if ($bResult && null === $this->aCapabilityItems)
|
||||||
{
|
{
|
||||||
$this->aCapabilityItems = $this->Capability();
|
$this->aCapabilityItems = $this->Capability();
|
||||||
|
|
@ -762,7 +761,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sFolderName, true))
|
if (!strlen(\trim($sFolderName)))
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
@ -821,7 +820,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
public function Fetch(array $aInputFetchItems, string $sIndexRange, bool $bIndexIsUid) : array
|
public function Fetch(array $aInputFetchItems, string $sIndexRange, bool $bIndexIsUid) : array
|
||||||
{
|
{
|
||||||
$sIndexRange = (string) $sIndexRange;
|
$sIndexRange = (string) $sIndexRange;
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sIndexRange, true))
|
if (!strlen(\trim($sIndexRange)))
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
||||||
|
|
@ -928,7 +927,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
public function MessageSimpleSort(array $aSortTypes, string $sSearchCriterias = 'ALL', bool $bReturnUid = true) : array
|
public function MessageSimpleSort(array $aSortTypes, string $sSearchCriterias = 'ALL', bool $bReturnUid = true) : array
|
||||||
{
|
{
|
||||||
$sCommandPrefix = ($bReturnUid) ? 'UID ' : '';
|
$sCommandPrefix = ($bReturnUid) ? 'UID ' : '';
|
||||||
$sSearchCriterias = !\MailSo\Base\Validator::NotEmptyString($sSearchCriterias, true) || '*' === $sSearchCriterias
|
$sSearchCriterias = !strlen(\trim($sSearchCriterias)) || '*' === $sSearchCriterias
|
||||||
? 'ALL' : $sSearchCriterias;
|
? 'ALL' : $sSearchCriterias;
|
||||||
|
|
||||||
if (!\is_array($aSortTypes) || 0 === \count($aSortTypes))
|
if (!\is_array($aSortTypes) || 0 === \count($aSortTypes))
|
||||||
|
|
@ -1252,7 +1251,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
public function MessageSimpleThread(string $sSearchCriterias = 'ALL', bool $bReturnUid = true, string $sCharset = \MailSo\Base\Enumerations\Charset::UTF_8) : array
|
public function MessageSimpleThread(string $sSearchCriterias = 'ALL', bool $bReturnUid = true, string $sCharset = \MailSo\Base\Enumerations\Charset::UTF_8) : array
|
||||||
{
|
{
|
||||||
$sCommandPrefix = ($bReturnUid) ? 'UID ' : '';
|
$sCommandPrefix = ($bReturnUid) ? 'UID ' : '';
|
||||||
$sSearchCriterias = !\MailSo\Base\Validator::NotEmptyString($sSearchCriterias, true) || '*' === $sSearchCriterias
|
$sSearchCriterias = !strlen(\trim($sSearchCriterias)) || '*' === $sSearchCriterias
|
||||||
? 'ALL' : $sSearchCriterias;
|
? 'ALL' : $sSearchCriterias;
|
||||||
|
|
||||||
$sThreadType = '';
|
$sThreadType = '';
|
||||||
|
|
@ -1390,8 +1389,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
public function MessageStoreFlag(string $sIndexRange, bool $bIndexIsUid, array $aInputStoreItems, string $sStoreAction) : self
|
public function MessageStoreFlag(string $sIndexRange, bool $bIndexIsUid, array $aInputStoreItems, string $sStoreAction) : self
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sIndexRange, true) ||
|
if (!strlen(\trim($sIndexRange)) ||
|
||||||
!\MailSo\Base\Validator::NotEmptyString($sStoreAction, true) ||
|
!strlen(\trim($sStoreAction)) ||
|
||||||
0 === \count($aInputStoreItems))
|
0 === \count($aInputStoreItems))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1462,7 +1461,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
public function SendRequest(string $sCommand, array $aParams = array(), bool $bBreakOnLiteral = false) : string
|
public function SendRequest(string $sCommand, array $aParams = array(), bool $bBreakOnLiteral = false) : string
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sCommand, true) || !\is_array($aParams))
|
$sCommand = \trim($sCommand);
|
||||||
|
if (!\strlen($sCommand))
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
||||||
|
|
@ -1473,14 +1473,11 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
|
|
||||||
$sTag = $this->getNewTag();
|
$sTag = $this->getNewTag();
|
||||||
|
|
||||||
$sCommand = \trim($sCommand);
|
$sRealCommand = $sTag.' '.$sCommand.$this->prepareParamLine($aParams);
|
||||||
$sRealCommand = $sTag.' '.$sCommand.$this->prepearParamLine($aParams);
|
|
||||||
|
|
||||||
$sFakeCommand = '';
|
$sFakeCommand = '';
|
||||||
$aFakeParams = $this->secureRequestParams($sCommand, $aParams);
|
if ($aFakeParams = $this->secureRequestParams($sCommand, $aParams)) {
|
||||||
if (null !== $aFakeParams)
|
$sFakeCommand = $sTag.' '.$sCommand.$this->prepareParamLine($aFakeParams);
|
||||||
{
|
|
||||||
$sFakeCommand = $sTag.' '.$sCommand.$this->prepearParamLine($aFakeParams);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->aTagTimeouts[$sTag] = \microtime(true);
|
$this->aTagTimeouts[$sTag] = \microtime(true);
|
||||||
|
|
@ -1505,19 +1502,11 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
|
|
||||||
private function secureRequestParams(string $sCommand, array $aParams) : ?array
|
private function secureRequestParams(string $sCommand, array $aParams) : ?array
|
||||||
{
|
{
|
||||||
$aResult = null;
|
if ('LOGIN' === $sCommand && isset($aParams[1])) {
|
||||||
switch ($sCommand)
|
$aParams[1] = '"********"';
|
||||||
{
|
return $aParams;
|
||||||
case 'LOGIN':
|
|
||||||
$aResult = $aParams;
|
|
||||||
if (\is_array($aResult) && 2 === count($aResult))
|
|
||||||
{
|
|
||||||
$aResult[1] = '"********"';
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
return $aResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2241,7 +2230,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
return $bResult;
|
return $bResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function prepearParamLine(array $aParams = array()) : string
|
private function prepareParamLine(array $aParams = array()) : string
|
||||||
{
|
{
|
||||||
$sReturn = '';
|
$sReturn = '';
|
||||||
if (\is_array($aParams) && 0 < \count($aParams))
|
if (\is_array($aParams) && 0 < \count($aParams))
|
||||||
|
|
@ -2250,7 +2239,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
{
|
{
|
||||||
if (\is_array($mParamItem) && 0 < \count($mParamItem))
|
if (\is_array($mParamItem) && 0 < \count($mParamItem))
|
||||||
{
|
{
|
||||||
$sReturn .= ' ('.\trim($this->prepearParamLine($mParamItem)).')';
|
$sReturn .= ' ('.\trim($this->prepareParamLine($mParamItem)).')';
|
||||||
}
|
}
|
||||||
else if (\is_string($mParamItem))
|
else if (\is_string($mParamItem))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ abstract class Driver
|
||||||
{
|
{
|
||||||
return \ltrim(
|
return \ltrim(
|
||||||
($this->bTimePrefix ? '['.$sTimePrefix.']' : '').
|
($this->bTimePrefix ? '['.$sTimePrefix.']' : '').
|
||||||
($this->bGuidPrefix ? '['.\MailSo\Log\Logger::Guid().']' : '').
|
($this->bGuidPrefix ? '['.Logger::Guid().']' : '').
|
||||||
($this->bTypedPrefix ? ' '.$this->getTypedPrefix($iType, $sName) : '')
|
($this->bTypedPrefix ? ' '.$this->getTypedPrefix($iType, $sName) : '')
|
||||||
).$sDesc;
|
).$sDesc;
|
||||||
}
|
}
|
||||||
|
|
@ -188,7 +188,7 @@ abstract class Driver
|
||||||
protected function getTimeWithMicroSec() : string
|
protected function getTimeWithMicroSec() : string
|
||||||
{
|
{
|
||||||
$aMicroTimeItems = \explode(' ', \microtime());
|
$aMicroTimeItems = \explode(' ', \microtime());
|
||||||
return \MailSo\Log\Logger::DateHelper($this->sDatePattern, $this->sTimeOffset, $aMicroTimeItems[1]).'.'.
|
return Logger::DateHelper($this->sDatePattern, $this->sTimeOffset, $aMicroTimeItems[1]).'.'.
|
||||||
\str_pad((int) ($aMicroTimeItems[0] * 1000), 3, '0', STR_PAD_LEFT);
|
\str_pad((int) ($aMicroTimeItems[0] * 1000), 3, '0', STR_PAD_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,7 @@ class MailClient
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function Message(string $sFolderName, int $iIndex, bool $bIndexIsUid = true, ?\MailSo\Cache\CacheClient $oCacher = null, int $iBodyTextLimit = 0) : ?\MailSo\Mail\Message
|
public function Message(string $sFolderName, int $iIndex, bool $bIndexIsUid = true, ?\MailSo\Cache\CacheClient $oCacher = null, int $iBodyTextLimit = 0) : ?Message
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::RangeInt($iIndex, 1))
|
if (!\MailSo\Base\Validator::RangeInt($iIndex, 1))
|
||||||
{
|
{
|
||||||
|
|
@ -346,7 +346,7 @@ class MailClient
|
||||||
$aFetchResponse = $this->oImapClient->Fetch($aFetchItems, $iIndex, $bIndexIsUid);
|
$aFetchResponse = $this->oImapClient->Fetch($aFetchItems, $iIndex, $bIndexIsUid);
|
||||||
if (0 < \count($aFetchResponse))
|
if (0 < \count($aFetchResponse))
|
||||||
{
|
{
|
||||||
$oMessage = \MailSo\Mail\Message::NewFetchResponseInstance(
|
$oMessage = Message::NewFetchResponseInstance(
|
||||||
$sFolderName, $aFetchResponse[0], $oBodyStructure);
|
$sFolderName, $aFetchResponse[0], $oBodyStructure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1482,7 +1482,7 @@ class MailClient
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function MessageListByRequestIndexOrUids(\MailSo\Mail\MessageCollection $oMessageCollection, array $aRequestIndexOrUids, bool $bIndexAsUid, bool $bSimple = false)
|
public function MessageListByRequestIndexOrUids(MessageCollection $oMessageCollection, array $aRequestIndexOrUids, bool $bIndexAsUid, bool $bSimple = false)
|
||||||
{
|
{
|
||||||
if (\is_array($aRequestIndexOrUids) && 0 < \count($aRequestIndexOrUids))
|
if (\is_array($aRequestIndexOrUids) && 0 < \count($aRequestIndexOrUids))
|
||||||
{
|
{
|
||||||
|
|
@ -1617,7 +1617,7 @@ class MailClient
|
||||||
public function MessageList(string $sFolderName, int $iOffset = 0, int $iLimit = 10,
|
public function MessageList(string $sFolderName, int $iOffset = 0, int $iLimit = 10,
|
||||||
string $sSearch = '', string $sPrevUidNext = '', ?\MailSo\Cache\CacheClient $oCacher = null,
|
string $sSearch = '', string $sPrevUidNext = '', ?\MailSo\Cache\CacheClient $oCacher = null,
|
||||||
bool $bUseSortIfSupported = false, bool $bUseThreadSortIfSupported = false,
|
bool $bUseSortIfSupported = false, bool $bUseThreadSortIfSupported = false,
|
||||||
string $sThreadUid = '', string $sFilter = '')
|
string $sThreadUid = '', string $sFilter = '') : MessageCollection
|
||||||
{
|
{
|
||||||
$sFilter = \trim($sFilter);
|
$sFilter = \trim($sFilter);
|
||||||
$sSearch = \trim($sSearch);
|
$sSearch = \trim($sSearch);
|
||||||
|
|
@ -1905,7 +1905,7 @@ class MailClient
|
||||||
|
|
||||||
$iCountLimit = $iForeachLimit;
|
$iCountLimit = $iForeachLimit;
|
||||||
|
|
||||||
foreach ($aMailFoldersHelper as $iIndex => /* @var $oImapFolder \MailSo\Mail\Folder */ $oFolder)
|
foreach ($aMailFoldersHelper as $iIndex => /* @var $oImapFolder Folder */ $oFolder)
|
||||||
{
|
{
|
||||||
// mandatory folders
|
// mandatory folders
|
||||||
if ($oFolder && \in_array(\str_replace(' ', '', \strtolower($oFolder->NameRaw())), $aFilteredNames))
|
if ($oFolder && \in_array(\str_replace(' ', '', \strtolower($oFolder->NameRaw())), $aFilteredNames))
|
||||||
|
|
@ -1915,7 +1915,7 @@ class MailClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($aMailFoldersHelper as $iIndex => /* @var $oImapFolder \MailSo\Mail\Folder */ $oFolder)
|
foreach ($aMailFoldersHelper as $iIndex => /* @var $oImapFolder Folder */ $oFolder)
|
||||||
{
|
{
|
||||||
// subscribed folders
|
// subscribed folders
|
||||||
if ($oFolder && $oFolder->IsSubscribed())
|
if ($oFolder && $oFolder->IsSubscribed())
|
||||||
|
|
@ -1943,7 +1943,7 @@ class MailClient
|
||||||
if ($iOptimizationLimit >= \count($aNewMailFoldersHelper))
|
if ($iOptimizationLimit >= \count($aNewMailFoldersHelper))
|
||||||
{
|
{
|
||||||
// name filter
|
// name filter
|
||||||
foreach ($aMailFoldersHelper as $iIndex => /* @var $oImapFolder \MailSo\Mail\Folder */ $oFolder)
|
foreach ($aMailFoldersHelper as $iIndex => /* @var $oImapFolder Folder */ $oFolder)
|
||||||
{
|
{
|
||||||
if ($oFolder && !\preg_match('/[{}\[\]]/', $oFolder->NameRaw()))
|
if ($oFolder && !\preg_match('/[{}\[\]]/', $oFolder->NameRaw()))
|
||||||
{
|
{
|
||||||
|
|
@ -1971,7 +1971,7 @@ class MailClient
|
||||||
if ($iOptimizationLimit >= \count($aNewMailFoldersHelper))
|
if ($iOptimizationLimit >= \count($aNewMailFoldersHelper))
|
||||||
{
|
{
|
||||||
// other
|
// other
|
||||||
foreach ($aMailFoldersHelper as $iIndex => /* @var $oImapFolder \MailSo\Mail\Folder */ $oFolder)
|
foreach ($aMailFoldersHelper as $iIndex => /* @var $oImapFolder Folder */ $oFolder)
|
||||||
{
|
{
|
||||||
if ($oFolder)
|
if ($oFolder)
|
||||||
{
|
{
|
||||||
|
|
@ -2006,7 +2006,7 @@ class MailClient
|
||||||
return $aMailFoldersHelper;
|
return $aMailFoldersHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Folders(string $sParent = '', string $sListPattern = '*', bool $bUseListSubscribeStatus = true, int $iOptimizationLimit = 0) : \MailSo\Mail\FolderCollection
|
public function Folders(string $sParent = '', string $sListPattern = '*', bool $bUseListSubscribeStatus = true, int $iOptimizationLimit = 0) : FolderCollection
|
||||||
{
|
{
|
||||||
$oFolderCollection = false;
|
$oFolderCollection = false;
|
||||||
|
|
||||||
|
|
@ -2101,8 +2101,7 @@ class MailClient
|
||||||
*/
|
*/
|
||||||
public function FolderCreate(string $sFolderNameInUtf8, string $sFolderParentFullNameRaw = '', bool $bSubscribeOnCreation = true, string $sDelimiter = '') : self
|
public function FolderCreate(string $sFolderNameInUtf8, string $sFolderParentFullNameRaw = '', bool $bSubscribeOnCreation = true, string $sDelimiter = '') : self
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sFolderNameInUtf8, true) ||
|
if (!strlen(\trim($sFolderNameInUtf8)))
|
||||||
!\is_string($sFolderParentFullNameRaw))
|
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class Email
|
||||||
*/
|
*/
|
||||||
private function __construct(string $sEmail, string $sDisplayName = '')
|
private function __construct(string $sEmail, string $sDisplayName = '')
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sEmail, true))
|
if (!strlen(\trim($sEmail)))
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
@ -70,7 +70,7 @@ class Email
|
||||||
public static function Parse(string $sEmailAddress) : self
|
public static function Parse(string $sEmailAddress) : self
|
||||||
{
|
{
|
||||||
$sEmailAddress = \MailSo\Base\Utils::Trim($sEmailAddress);
|
$sEmailAddress = \MailSo\Base\Utils::Trim($sEmailAddress);
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sEmailAddress, true))
|
if (!strlen(\trim($sEmailAddress)))
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class EmailDep
|
||||||
*/
|
*/
|
||||||
private function __construct(string $sEmail, string $sDisplayName = '', string $sRemark = '')
|
private function __construct(string $sEmail, string $sDisplayName = '', string $sRemark = '')
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sEmail, true))
|
if (!strlen(\trim($sEmail)))
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +77,7 @@ class EmailDep
|
||||||
public static function Parse(string $sEmailAddress) : \MailSo\Mime\Email
|
public static function Parse(string $sEmailAddress) : \MailSo\Mime\Email
|
||||||
{
|
{
|
||||||
$sEmailAddress = \MailSo\Base\Utils::Trim($sEmailAddress);
|
$sEmailAddress = \MailSo\Base\Utils::Trim($sEmailAddress);
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sEmailAddress, true))
|
if (!strlen(\trim($sEmailAddress)))
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ abstract class NetClient
|
||||||
bool $bVerifySsl = false, bool $bAllowSelfSigned = true,
|
bool $bVerifySsl = false, bool $bAllowSelfSigned = true,
|
||||||
string $sClientCert = '') : void
|
string $sClientCert = '') : void
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sServerName, true) || !\MailSo\Base\Validator::PortInt($iPort))
|
if (!strlen(\trim($sServerName)) || !\MailSo\Base\Validator::PortInt($iPort))
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
public function Login(string $sLogin, string $sPassword, string $sLoginAuthKey = '') : self
|
public function Login(string $sLogin, string $sPassword, string $sLoginAuthKey = '') : self
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sLogin, true) ||
|
if (!strlen(\trim($sLogin)) || !strlen(\trim($sPassword)))
|
||||||
!\MailSo\Base\Validator::NotEmptyString($sPassword, true))
|
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
||||||
|
|
@ -434,7 +433,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
private function sendRequest(string $sRequest) : void
|
private function sendRequest(string $sRequest) : void
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sRequest, true))
|
if (!strlen(\trim($sRequest)))
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
public function Data(string $sData) : self
|
public function Data(string $sData) : self
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sData, true))
|
if (!strlen(\trim($sData)))
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
@ -525,7 +525,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
private function sendRequest(string $sCommand, string $sAddToCommand = '', bool $bSecureLog = false) : void
|
private function sendRequest(string $sCommand, string $sAddToCommand = '', bool $bSecureLog = false) : void
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sCommand, true))
|
if (!strlen(\trim($sCommand)))
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
new \MailSo\Base\Exceptions\InvalidArgumentException(),
|
||||||
|
|
|
||||||
|
|
@ -1053,14 +1053,14 @@ class Actions
|
||||||
if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword))
|
if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword))
|
||||||
{
|
{
|
||||||
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
|
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
|
||||||
if ($oDomain instanceof \RainLoop\Model\Domain)
|
if ($oDomain)
|
||||||
{
|
{
|
||||||
if ($oDomain->ValidateWhiteList($sEmail, $sLogin))
|
if ($oDomain->ValidateWhiteList($sEmail, $sLogin))
|
||||||
{
|
{
|
||||||
$oAccount = \RainLoop\Model\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken, '', '', $sClientCert);
|
$oAccount = \RainLoop\Model\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken, '', '', $sClientCert);
|
||||||
$this->Plugins()->RunHook('filter.acount', array($oAccount));
|
$this->Plugins()->RunHook('filter.acount', array($oAccount));
|
||||||
|
|
||||||
if ($bThrowProvideException && !($oAccount instanceof \RainLoop\Model\Account))
|
if ($bThrowProvideException && !$oAccount)
|
||||||
{
|
{
|
||||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
|
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
|
||||||
}
|
}
|
||||||
|
|
@ -1098,7 +1098,7 @@ class Actions
|
||||||
$oAccount = $this->LoginProvide($aAccountHash[1], $aAccountHash[2], $aAccountHash[3],
|
$oAccount = $this->LoginProvide($aAccountHash[1], $aAccountHash[2], $aAccountHash[3],
|
||||||
empty($aAccountHash[5]) ? '' : $aAccountHash[5], empty($aAccountHash[11]) ? '' : $aAccountHash[11], $bThrowExceptionOnFalse);
|
empty($aAccountHash[5]) ? '' : $aAccountHash[5], empty($aAccountHash[11]) ? '' : $aAccountHash[11], $bThrowExceptionOnFalse);
|
||||||
|
|
||||||
if ($oAccount instanceof \RainLoop\Model\Account)
|
if ($oAccount)
|
||||||
{
|
{
|
||||||
if (!empty($aAccountHash[8]) && !empty($aAccountHash[9])) // init proxy user/password
|
if (!empty($aAccountHash[8]) && !empty($aAccountHash[9])) // init proxy user/password
|
||||||
{
|
{
|
||||||
|
|
@ -1119,7 +1119,7 @@ class Actions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bThrowExceptionOnFalse && !($oResult instanceof \RainLoop\Model\Account))
|
if ($bThrowExceptionOnFalse && !$oResult)
|
||||||
{
|
{
|
||||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
|
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
|
||||||
}
|
}
|
||||||
|
|
@ -1207,7 +1207,6 @@ class Actions
|
||||||
'materialDesign' => (bool) $oConfig->Get('labs', 'use_material_design', true),
|
'materialDesign' => (bool) $oConfig->Get('labs', 'use_material_design', true),
|
||||||
'folderSpecLimit' => (int) $oConfig->Get('labs', 'folders_spec_limit', 50),
|
'folderSpecLimit' => (int) $oConfig->Get('labs', 'folders_spec_limit', 50),
|
||||||
'faviconStatus' => (bool) $oConfig->Get('labs', 'favicon_status', true),
|
'faviconStatus' => (bool) $oConfig->Get('labs', 'favicon_status', true),
|
||||||
'allowCmdInterface' => (bool) $oConfig->Get('labs', 'allow_cmd', false),
|
|
||||||
'listPermanentFiltered' => '' !== \trim(\RainLoop\Api::Config()->Get('labs', 'imap_message_list_permanent_filter', '')),
|
'listPermanentFiltered' => '' !== \trim(\RainLoop\Api::Config()->Get('labs', 'imap_message_list_permanent_filter', '')),
|
||||||
'themes' => $this->GetThemes($bMobile, false),
|
'themes' => $this->GetThemes($bMobile, false),
|
||||||
'languages' => $this->GetLanguages(false),
|
'languages' => $this->GetLanguages(false),
|
||||||
|
|
@ -1388,8 +1387,6 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$oAccount = null;
|
|
||||||
|
|
||||||
$aResult['IncludeBackground'] = $aResult['LoginBackground'];
|
$aResult['IncludeBackground'] = $aResult['LoginBackground'];
|
||||||
$aResult['IncludeCss'] = $aResult['LoginCss'];
|
$aResult['IncludeCss'] = $aResult['LoginCss'];
|
||||||
|
|
||||||
|
|
@ -1496,7 +1493,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
$aResult['UserBackgroundName'] = '';
|
$aResult['UserBackgroundName'] = '';
|
||||||
$aResult['UserBackgroundHash'] = '';
|
$aResult['UserBackgroundHash'] = '';
|
||||||
|
|
||||||
if (!$bAdmin && $oAccount instanceof \RainLoop\Model\Account)
|
if (!$bAdmin && $oAccount)
|
||||||
{
|
{
|
||||||
$aResult['ParentEmail'] = $oAccount->ParentEmail();
|
$aResult['ParentEmail'] = $oAccount->ParentEmail();
|
||||||
|
|
||||||
|
|
@ -1799,7 +1796,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
$sLine = \trim(\implode('.', $aDomainParts), '. ');
|
$sLine = \trim(\implode('.', $aDomainParts), '. ');
|
||||||
|
|
||||||
$oDomain = $oDomainProvider->Load($sLine, false);
|
$oDomain = $oDomainProvider->Load($sLine, false);
|
||||||
if ($oDomain && $oDomain instanceof \RainLoop\Model\Domain)
|
if ($oDomain)
|
||||||
{
|
{
|
||||||
$bAdded = true;
|
$bAdded = true;
|
||||||
$this->Logger()->Write('Check "'.$sLine.'": OK ('.$sEmail.' > '.$sEmail.'@'.$sLine.')',
|
$this->Logger()->Write('Check "'.$sLine.'": OK ('.$sEmail.' > '.$sEmail.'@'.$sLine.')',
|
||||||
|
|
@ -1821,7 +1818,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
{
|
{
|
||||||
$sLine = $sUserHost;
|
$sLine = $sUserHost;
|
||||||
$oDomain = $oDomainProvider->Load($sLine, true);
|
$oDomain = $oDomainProvider->Load($sLine, true);
|
||||||
if ($oDomain && $oDomain instanceof \RainLoop\Model\Domain)
|
if ($oDomain && $oDomain)
|
||||||
{
|
{
|
||||||
$bAdded = true;
|
$bAdded = true;
|
||||||
$this->Logger()->Write('Check "'.$sLine.'" with wildcard: OK ('.$sEmail.' > '.$sEmail.'@'.$sLine.')',
|
$this->Logger()->Write('Check "'.$sLine.'" with wildcard: OK ('.$sEmail.' > '.$sEmail.'@'.$sLine.')',
|
||||||
|
|
@ -1880,17 +1877,12 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
{
|
{
|
||||||
$oAccount = $this->LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken, $sClientCert, true);
|
$oAccount = $this->LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken, $sClientCert, true);
|
||||||
|
|
||||||
if (!($oAccount instanceof \RainLoop\Model\Account))
|
if (!$oAccount)
|
||||||
{
|
{
|
||||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
|
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->Plugins()->RunHook('event.login-post-login-provide', array($oAccount));
|
$this->Plugins()->RunHook('event.login-post-login-provide', array($oAccount));
|
||||||
|
|
||||||
if (!($oAccount instanceof \RainLoop\Model\Account))
|
|
||||||
{
|
|
||||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (\Throwable $oException)
|
catch (\Throwable $oException)
|
||||||
{
|
{
|
||||||
|
|
@ -3372,7 +3364,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
$oDomain = $this->DomainProvider()->LoadOrCreateNewFromAction($this);
|
$oDomain = $this->DomainProvider()->LoadOrCreateNewFromAction($this);
|
||||||
|
|
||||||
return $this->DefaultResponse(__FUNCTION__,
|
return $this->DefaultResponse(__FUNCTION__,
|
||||||
$oDomain instanceof \RainLoop\Model\Domain ? $this->DomainProvider()->Save($oDomain) : false);
|
$oDomain ? $this->DomainProvider()->Save($oDomain) : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DoAdminDomainAliasSave() : array
|
public function DoAdminDomainAliasSave() : array
|
||||||
|
|
@ -4043,7 +4035,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
if (!$bDisable)
|
if (!$bDisable)
|
||||||
{
|
{
|
||||||
$oPlugin = $this->Plugins()->CreatePluginByName($sName);
|
$oPlugin = $this->Plugins()->CreatePluginByName($sName);
|
||||||
if ($oPlugin && ($oPlugin instanceof \RainLoop\Plugins\AbstractPlugin))
|
if ($oPlugin)
|
||||||
{
|
{
|
||||||
$sValue = $oPlugin->Supported();
|
$sValue = $oPlugin->Supported();
|
||||||
if (0 < \strlen($sValue))
|
if (0 < \strlen($sValue))
|
||||||
|
|
@ -4921,7 +4913,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CantGetMessageList, $oException);
|
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CantGetMessageList, $oException);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oMessageList instanceof \MailSo\Mail\MessageCollection)
|
if ($oMessageList)
|
||||||
{
|
{
|
||||||
$this->cacheByKey($sRawKey);
|
$this->cacheByKey($sRawKey);
|
||||||
}
|
}
|
||||||
|
|
@ -6276,7 +6268,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CantGetMessage, $oException);
|
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CantGetMessage, $oException);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oMessage instanceof \MailSo\Mail\Message)
|
if ($oMessage)
|
||||||
{
|
{
|
||||||
$this->Plugins()
|
$this->Plugins()
|
||||||
->RunHook('filter.result-message', array($oMessage))
|
->RunHook('filter.result-message', array($oMessage))
|
||||||
|
|
@ -8168,7 +8160,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
|
|
||||||
$sLanguage = $this->Config()->Get('webmail', 'language', 'en');
|
$sLanguage = $this->Config()->Get('webmail', 'language', 'en');
|
||||||
|
|
||||||
if ($oAccount instanceof \RainLoop\Model\Account)
|
if ($oAccount)
|
||||||
{
|
{
|
||||||
$oSettings = $this->SettingsProvider()->Load($oAccount);
|
$oSettings = $this->SettingsProvider()->Load($oAccount);
|
||||||
if ($oSettings instanceof \RainLoop\Settings)
|
if ($oSettings instanceof \RainLoop\Settings)
|
||||||
|
|
|
||||||
|
|
@ -333,7 +333,6 @@ Enables caching in the system'),
|
||||||
'Experimental settings. Handle with care.
|
'Experimental settings. Handle with care.
|
||||||
'),
|
'),
|
||||||
'ignore_folders_subscription' => array(false),
|
'ignore_folders_subscription' => array(false),
|
||||||
'check_new_password_strength' => array(true),
|
|
||||||
'update_channel' => array('stable'),
|
'update_channel' => array('stable'),
|
||||||
'allow_prefetch' => array(true),
|
'allow_prefetch' => array(true),
|
||||||
'allow_smart_html_links' => array(true),
|
'allow_smart_html_links' => array(true),
|
||||||
|
|
@ -347,7 +346,6 @@ Enables caching in the system'),
|
||||||
'allow_html_editor_biti_buttons' => array(false),
|
'allow_html_editor_biti_buttons' => array(false),
|
||||||
'allow_ctrl_enter_on_compose' => array(true),
|
'allow_ctrl_enter_on_compose' => array(true),
|
||||||
'try_to_detect_hidden_images' => array(false),
|
'try_to_detect_hidden_images' => array(false),
|
||||||
'hide_dangerous_actions' => array(false),
|
|
||||||
'use_app_debug_js' => array(false),
|
'use_app_debug_js' => array(false),
|
||||||
'use_mobile_version_for_tablets' => array(false),
|
'use_mobile_version_for_tablets' => array(false),
|
||||||
'use_app_debug_css' => array(false),
|
'use_app_debug_css' => array(false),
|
||||||
|
|
@ -391,9 +389,6 @@ Enables caching in the system'),
|
||||||
'force_https' => array(false),
|
'force_https' => array(false),
|
||||||
'custom_login_link' => array(''),
|
'custom_login_link' => array(''),
|
||||||
'custom_logout_link' => array(''),
|
'custom_logout_link' => array(''),
|
||||||
'allow_external_login' => array(false),
|
|
||||||
'allow_external_sso' => array(false),
|
|
||||||
'external_sso_key' => array(''),
|
|
||||||
'http_client_ip_check_proxy' => array(false),
|
'http_client_ip_check_proxy' => array(false),
|
||||||
'fast_cache_memcache_host' => array('127.0.0.1'),
|
'fast_cache_memcache_host' => array('127.0.0.1'),
|
||||||
'fast_cache_memcache_port' => array(11211),
|
'fast_cache_memcache_port' => array(11211),
|
||||||
|
|
@ -407,7 +402,6 @@ Enables caching in the system'),
|
||||||
'replace_env_in_configuration' => array(''),
|
'replace_env_in_configuration' => array(''),
|
||||||
'startup_url' => array(''),
|
'startup_url' => array(''),
|
||||||
'strict_html_parser' => array(false),
|
'strict_html_parser' => array(false),
|
||||||
'allow_cmd' => array(false),
|
|
||||||
'dev_email' => array(''),
|
'dev_email' => array(''),
|
||||||
'dev_password' => array('')
|
'dev_password' => array('')
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -884,28 +884,6 @@ class ServiceActions
|
||||||
$oAccount = null;
|
$oAccount = null;
|
||||||
$bLogout = true;
|
$bLogout = true;
|
||||||
|
|
||||||
if ($this->oActions->Config()->Get('labs', 'allow_external_login', false))
|
|
||||||
{
|
|
||||||
$sEmail = \trim($this->oHttp->GetRequest('Email', ''));
|
|
||||||
$sPassword = $this->oHttp->GetRequest('Password', '');
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
|
|
||||||
$this->oActions->AuthToken($oAccount);
|
|
||||||
$bLogout = !($oAccount instanceof \RainLoop\Model\Account);
|
|
||||||
}
|
|
||||||
catch (\Throwable $oException)
|
|
||||||
{
|
|
||||||
$this->oActions->Logger()->WriteException($oException);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($bLogout)
|
|
||||||
{
|
|
||||||
$this->oActions->SetAuthLogoutToken();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (\strtolower($this->oHttp->GetRequest('Output', 'Redirect')))
|
switch (\strtolower($this->oHttp->GetRequest('Output', 'Redirect')))
|
||||||
{
|
{
|
||||||
case 'json':
|
case 'json':
|
||||||
|
|
@ -941,46 +919,6 @@ class ServiceActions
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ServiceExternalSso() : string
|
|
||||||
{
|
|
||||||
$this->oHttp->ServerNoCache();
|
|
||||||
|
|
||||||
$sResult = '';
|
|
||||||
$bLogout = true;
|
|
||||||
$sKey = $this->oActions->Config()->Get('labs', 'external_sso_key', '');
|
|
||||||
if ($this->oActions->Config()->Get('labs', 'allow_external_sso', false) &&
|
|
||||||
!empty($sKey) && $sKey === \trim($this->oHttp->GetRequest('SsoKey', '')))
|
|
||||||
{
|
|
||||||
$sEmail = \trim($this->oHttp->GetRequest('Email', ''));
|
|
||||||
$sPassword = $this->oHttp->GetRequest('Password', '');
|
|
||||||
|
|
||||||
$sResult = \RainLoop\Api::GetUserSsoHash($sEmail, $sPassword);
|
|
||||||
$bLogout = 0 === \strlen($sResult);
|
|
||||||
|
|
||||||
switch (\strtolower($this->oHttp->GetRequest('Output', 'Plain')))
|
|
||||||
{
|
|
||||||
case 'plain':
|
|
||||||
@\header('Content-Type: text/plain');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'json':
|
|
||||||
@\header('Content-Type: application/json; charset=utf-8');
|
|
||||||
$sResult = \MailSo\Base\Utils::Php2js(array(
|
|
||||||
'Action' => 'ExternalSso',
|
|
||||||
'Result' => $sResult
|
|
||||||
), $this->Logger());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($bLogout)
|
|
||||||
{
|
|
||||||
$this->oActions->SetAuthLogoutToken();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function changeAction()
|
private function changeAction()
|
||||||
{
|
{
|
||||||
$this->oHttp->ServerNoCache();
|
$this->oHttp->ServerNoCache();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue