Improved logging

Small fixes
This commit is contained in:
RainLoop Team 2014-06-06 20:11:38 +04:00
parent 187e44607d
commit 6c28b24aaf
11 changed files with 301 additions and 246 deletions

View file

@ -951,64 +951,67 @@ class Utils
\str_replace($aJsonReplaces[0], $aJsonReplaces[1], $sText)); \str_replace($aJsonReplaces[0], $aJsonReplaces[1], $sText));
} }
/**
* @param array $aInput
*/
public static function ClearArrayUtf8Values(&$aInput)
{
if (\is_array($aInput))
{
foreach ($aInput as $mKey => $mItem)
{
if (\is_string($mItem))
{
$aInput[$mKey] = \MailSo\Base\Utils::Utf8Clear($mItem);
}
else if (\is_array($mItem))
{
\MailSo\Base\Utils::ClearArrayUtf8Values($mItem);
$aInput[$mKey] = $mItem;
}
}
}
}
/** /**
* @param mixed $mInput * @param mixed $mInput
* @param \MailSo\Log\Logger|null $oLogger = null
* *
* @return string * @return string
*/ */
public static function Php2js($mInput) public static function Php2js($mInput, $oLogger = null)
{ {
return \json_encode($mInput, \defined('JSON_UNESCAPED_UNICODE') ? JSON_UNESCAPED_UNICODE : 0); static $iOpt = null;
if (null === $iOpt)
{
$iOpt = \defined('JSON_UNESCAPED_UNICODE') ? JSON_UNESCAPED_UNICODE : 0;
}
// if (\is_null($mInput)) $sResult = @\json_encode($mInput, $iOpt);
// { if (!\is_string($sResult) || '' === $sResult)
// return 'null'; {
// } if ($oLogger instanceof \MailSo\Log\Logger)
// else if ($mInput === false) {
// { $oLogger->Write('json_encode: '.\trim(
// return 'false'; (\MailSo\Base\Utils::FunctionExistsAndEnabled('json_last_error') ? ' [Error Code: '.\json_last_error().']' : '').
// } (\MailSo\Base\Utils::FunctionExistsAndEnabled('json_last_error_msg') ? ' [Error Message: '.\json_last_error_msg().']' : '')
// else if ($mInput === true) ), \MailSo\Log\Enumerations\Type::WARNING, 'JSON'
// { );
// return 'true'; }
// }
// else if (\is_scalar($mInput)) if (\is_array($mInput))
// { {
// if (\is_float($mInput)) if ($oLogger instanceof \MailSo\Log\Logger)
// { {
// $mInput = \str_replace(',', '.', \strval($mInput)); $oLogger->Write('Try to clear Utf8 before json_encode', \MailSo\Log\Enumerations\Type::INFO, 'JSON');
// } }
//
// return '"'.\MailSo\Base\Utils::InlineRebuildStringToJsString($mInput).'"'; \MailSo\Base\Utils::ClearArrayUtf8Values($mInput);
// } $sResult = @\json_encode($mInput, $iOpt);
// }
// $bIsList = true; }
// for ($iIndex = 0, \reset($mInput), $iLen = \count($mInput); $iIndex < $iLen; $iIndex++, \next($mInput))
// { return $sResult;
// if (\key($mInput) !== $iIndex)
// {
// $bIsList = false;
// break;
// }
// }
//
// $aResult = array();
// if ($bIsList)
// {
// foreach ($mInput as $mValue)
// {
// $aResult[] = \MailSo\Base\Utils::Php2js($mValue);
// }
// return '['.\join(',', $aResult).']';
// }
// else
// {
// foreach ($mInput as $sKey => $mValue)
// {
// $aResult[] = \MailSo\Base\Utils::Php2js($sKey).':'.\MailSo\Base\Utils::Php2js($mValue);
// }
// return '{'.\join(',', $aResult).'}';
// }
} }
/** /**

View file

@ -357,8 +357,8 @@ class ImapClient extends \MailSo\Net\NetClient
$this->aCapabilityItems = $this->Capability(); $this->aCapabilityItems = $this->Capability();
} }
return $bResult && is_array($this->aCapabilityItems) && return $bResult && \is_array($this->aCapabilityItems) &&
in_array(strtoupper($sExtentionName), $this->aCapabilityItems); \in_array(\strtoupper($sExtentionName), $this->aCapabilityItems);
} }
/** /**
@ -498,14 +498,14 @@ class ImapClient extends \MailSo\Net\NetClient
{ {
$aReturn = array(); $aReturn = array();
if (is_array($aResult)) if (\is_array($aResult))
{ {
$oImapResponse = null; $oImapResponse = null;
foreach ($aResult as /* @var $oImapResponse \MailSo\Imap\Response */ $oImapResponse) foreach ($aResult as /* @var $oImapResponse \MailSo\Imap\Response */ $oImapResponse)
{ {
if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType && if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType &&
'STATUS' === $oImapResponse->StatusOrIndex && isset($oImapResponse->ResponseList[3]) && 'STATUS' === $oImapResponse->StatusOrIndex && isset($oImapResponse->ResponseList[3]) &&
is_array($oImapResponse->ResponseList[3])) \is_array($oImapResponse->ResponseList[3]))
{ {
$sName = null; $sName = null;
foreach ($oImapResponse->ResponseList[3] as $sArrayItem) foreach ($oImapResponse->ResponseList[3] as $sArrayItem)
@ -540,7 +540,7 @@ class ImapClient extends \MailSo\Net\NetClient
public function FolderStatus($sFolderName, array $aStatusItems) public function FolderStatus($sFolderName, array $aStatusItems)
{ {
$aResult = false; $aResult = false;
if (count($aStatusItems) > 0) if (\count($aStatusItems) > 0)
{ {
$this->SendRequest('STATUS', $this->SendRequest('STATUS',
array($this->EscapeString($sFolderName), $aStatusItems)); array($this->EscapeString($sFolderName), $aStatusItems));
@ -735,7 +735,7 @@ class ImapClient extends \MailSo\Net\NetClient
*/ */
protected function initCurrentFolderInformation($aResult, $sFolderName, $bIsWritable) protected function initCurrentFolderInformation($aResult, $sFolderName, $bIsWritable)
{ {
if (is_array($aResult)) if (\is_array($aResult))
{ {
$oImapResponse = null; $oImapResponse = null;
$oResult = FolderInformation::NewInstance($sFolderName, $bIsWritable); $oResult = FolderInformation::NewInstance($sFolderName, $bIsWritable);
@ -744,13 +744,13 @@ class ImapClient extends \MailSo\Net\NetClient
{ {
if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType) if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType)
{ {
if (count($oImapResponse->ResponseList) > 2 && if (\count($oImapResponse->ResponseList) > 2 &&
'FLAGS' === $oImapResponse->ResponseList[1] && is_array($oImapResponse->ResponseList[2])) 'FLAGS' === $oImapResponse->ResponseList[1] && \is_array($oImapResponse->ResponseList[2]))
{ {
$oResult->Flags = $oImapResponse->ResponseList[2]; $oResult->Flags = $oImapResponse->ResponseList[2];
} }
if (is_array($oImapResponse->OptionalResponse) && count($oImapResponse->OptionalResponse) > 1) if (is_array($oImapResponse->OptionalResponse) && \count($oImapResponse->OptionalResponse) > 1)
{ {
if ('PERMANENTFLAGS' === $oImapResponse->OptionalResponse[0] && if ('PERMANENTFLAGS' === $oImapResponse->OptionalResponse[0] &&
is_array($oImapResponse->OptionalResponse[1])) is_array($oImapResponse->OptionalResponse[1]))
@ -775,9 +775,9 @@ class ImapClient extends \MailSo\Net\NetClient
} }
} }
if (count($oImapResponse->ResponseList) > 2 && if (\count($oImapResponse->ResponseList) > 2 &&
is_string($oImapResponse->ResponseList[2]) && \is_string($oImapResponse->ResponseList[2]) &&
is_numeric($oImapResponse->ResponseList[1])) \is_numeric($oImapResponse->ResponseList[1]))
{ {
switch($oImapResponse->ResponseList[2]) switch($oImapResponse->ResponseList[2])
{ {
@ -889,7 +889,7 @@ class ImapClient extends \MailSo\Net\NetClient
$aFetchItems = \MailSo\Imap\Enumerations\FetchType::ChangeFetchItemsBefourRequest($aInputFetchItems); $aFetchItems = \MailSo\Imap\Enumerations\FetchType::ChangeFetchItemsBefourRequest($aInputFetchItems);
foreach ($aFetchItems as $sName => $mItem) foreach ($aFetchItems as $sName => $mItem)
{ {
if (0 < strlen($sName) && '' !== $mItem) if (0 < \strlen($sName) && '' !== $mItem)
{ {
if (null === $this->aFetchCallbacks) if (null === $this->aFetchCallbacks)
{ {
@ -900,7 +900,7 @@ class ImapClient extends \MailSo\Net\NetClient
} }
} }
$this->SendRequest((($bIndexIsUid) ? 'UID ' : '').'FETCH', array($sIndexRange, array_keys($aFetchItems))); $this->SendRequest((($bIndexIsUid) ? 'UID ' : '').'FETCH', array($sIndexRange, \array_keys($aFetchItems)));
$aResult = $this->validateResponse($this->parseResponse()); $aResult = $this->validateResponse($this->parseResponse());
$this->aFetchCallbacks = null; $this->aFetchCallbacks = null;
@ -938,13 +938,13 @@ class ImapClient extends \MailSo\Net\NetClient
{ {
if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType
&& 'QUOTA' === $oImapResponse->StatusOrIndex && 'QUOTA' === $oImapResponse->StatusOrIndex
&& is_array($oImapResponse->ResponseList) && \is_array($oImapResponse->ResponseList)
&& isset($oImapResponse->ResponseList[3]) && isset($oImapResponse->ResponseList[3])
&& is_array($oImapResponse->ResponseList[3]) && \is_array($oImapResponse->ResponseList[3])
&& 2 < count($oImapResponse->ResponseList[3]) && 2 < \count($oImapResponse->ResponseList[3])
&& 'STORAGE' === strtoupper($oImapResponse->ResponseList[3][0]) && 'STORAGE' === \strtoupper($oImapResponse->ResponseList[3][0])
&& is_numeric($oImapResponse->ResponseList[3][1]) && \is_numeric($oImapResponse->ResponseList[3][1])
&& is_numeric($oImapResponse->ResponseList[3][2]) && \is_numeric($oImapResponse->ResponseList[3][2])
) )
{ {
$aReturn = array( $aReturn = array(
@ -954,10 +954,10 @@ class ImapClient extends \MailSo\Net\NetClient
0 0
); );
if (5 < count($oImapResponse->ResponseList[3]) if (5 < \count($oImapResponse->ResponseList[3])
&& 'MESSAGE' === strtoupper($oImapResponse->ResponseList[3][3]) && 'MESSAGE' === \strtoupper($oImapResponse->ResponseList[3][3])
&& is_numeric($oImapResponse->ResponseList[3][4]) && \is_numeric($oImapResponse->ResponseList[3][4])
&& is_numeric($oImapResponse->ResponseList[3][5]) && \is_numeric($oImapResponse->ResponseList[3][5])
) )
{ {
$aReturn[2] = (int) $oImapResponse->ResponseList[3][4]; $aReturn[2] = (int) $oImapResponse->ResponseList[3][4];
@ -987,7 +987,7 @@ class ImapClient extends \MailSo\Net\NetClient
$sSearchCriterias = !\MailSo\Base\Validator::NotEmptyString($sSearchCriterias, true) || '*' === $sSearchCriterias $sSearchCriterias = !\MailSo\Base\Validator::NotEmptyString($sSearchCriterias, true) || '*' === $sSearchCriterias
? 'ALL' : $sSearchCriterias; ? 'ALL' : $sSearchCriterias;
if (!is_array($aSortTypes) || 0 === count($aSortTypes)) if (!\is_array($aSortTypes) || 0 === \count($aSortTypes))
{ {
$this->writeLogException( $this->writeLogException(
new \MailSo\Base\Exceptions\InvalidArgumentException(), new \MailSo\Base\Exceptions\InvalidArgumentException(),
@ -1018,8 +1018,8 @@ class ImapClient extends \MailSo\Net\NetClient
&& ($sCmd === $oImapResponse->StatusOrIndex || && ($sCmd === $oImapResponse->StatusOrIndex ||
($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex) && !empty($oImapResponse->ResponseList[2]) && ($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex) && !empty($oImapResponse->ResponseList[2]) &&
$sCmd === $oImapResponse->ResponseList[2]) $sCmd === $oImapResponse->ResponseList[2])
&& is_array($oImapResponse->ResponseList) && \is_array($oImapResponse->ResponseList)
&& 2 < count($oImapResponse->ResponseList)) && 2 < \count($oImapResponse->ResponseList))
{ {
$iStart = 2; $iStart = 2;
if ($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex && if ($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex &&
@ -1029,7 +1029,7 @@ class ImapClient extends \MailSo\Net\NetClient
$iStart = 3; $iStart = 3;
} }
for ($iIndex = $iStart, $iLen = count($oImapResponse->ResponseList); $iIndex < $iLen; $iIndex++) for ($iIndex = $iStart, $iLen = \count($oImapResponse->ResponseList); $iIndex < $iLen; $iIndex++)
{ {
$aReturn[] = (int) $oImapResponse->ResponseList[$iIndex]; $aReturn[] = (int) $oImapResponse->ResponseList[$iIndex];
} }
@ -1203,14 +1203,14 @@ class ImapClient extends \MailSo\Net\NetClient
public function MessageSimpleSearch($sSearchCriterias = 'ALL', $bReturnUid = true, $sCharset = '') public function MessageSimpleSearch($sSearchCriterias = 'ALL', $bReturnUid = true, $sCharset = '')
{ {
$sCommandPrefix = ($bReturnUid) ? 'UID ' : ''; $sCommandPrefix = ($bReturnUid) ? 'UID ' : '';
$sSearchCriterias = 0 === strlen($sSearchCriterias) || '*' === $sSearchCriterias $sSearchCriterias = 0 === \strlen($sSearchCriterias) || '*' === $sSearchCriterias
? 'ALL' : $sSearchCriterias; ? 'ALL' : $sSearchCriterias;
$aRequest = array(); $aRequest = array();
if (0 < strlen($sCharset)) if (0 < \strlen($sCharset))
{ {
$aRequest[] = 'CHARSET'; $aRequest[] = 'CHARSET';
$aRequest[] = strtoupper($sCharset); $aRequest[] = \strtoupper($sCharset);
} }
$aRequest[] = $sSearchCriterias; $aRequest[] = $sSearchCriterias;
@ -1228,7 +1228,7 @@ class ImapClient extends \MailSo\Net\NetClient
&& ($sCmd === $oImapResponse->StatusOrIndex || && ($sCmd === $oImapResponse->StatusOrIndex ||
($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex) && !empty($oImapResponse->ResponseList[2]) && ($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex) && !empty($oImapResponse->ResponseList[2]) &&
$sCmd === $oImapResponse->ResponseList[2]) $sCmd === $oImapResponse->ResponseList[2])
&& is_array($oImapResponse->ResponseList) && \is_array($oImapResponse->ResponseList)
&& 2 < count($oImapResponse->ResponseList)) && 2 < count($oImapResponse->ResponseList))
{ {
$iStart = 2; $iStart = 2;
@ -1239,14 +1239,14 @@ class ImapClient extends \MailSo\Net\NetClient
$iStart = 3; $iStart = 3;
} }
for ($iIndex = $iStart, $iLen = count($oImapResponse->ResponseList); $iIndex < $iLen; $iIndex++) for ($iIndex = $iStart, $iLen = \count($oImapResponse->ResponseList); $iIndex < $iLen; $iIndex++)
{ {
$aReturn[] = (int) $oImapResponse->ResponseList[$iIndex]; $aReturn[] = (int) $oImapResponse->ResponseList[$iIndex];
} }
} }
} }
$aReturn = array_reverse($aReturn); $aReturn = \array_reverse($aReturn);
return $aReturn; return $aReturn;
} }
@ -1331,7 +1331,7 @@ class ImapClient extends \MailSo\Net\NetClient
$aRequest = array(); $aRequest = array();
$aRequest[] = $sThreadType; $aRequest[] = $sThreadType;
$aRequest[] = strtoupper($sCharset); $aRequest[] = \strtoupper($sCharset);
$aRequest[] = $sSearchCriterias; $aRequest[] = $sSearchCriterias;
$sCmd = 'THREAD'; $sCmd = 'THREAD';
@ -1348,8 +1348,8 @@ class ImapClient extends \MailSo\Net\NetClient
&& ($sCmd === $oImapResponse->StatusOrIndex || && ($sCmd === $oImapResponse->StatusOrIndex ||
($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex) && !empty($oImapResponse->ResponseList[2]) && ($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex) && !empty($oImapResponse->ResponseList[2]) &&
$sCmd === $oImapResponse->ResponseList[2]) $sCmd === $oImapResponse->ResponseList[2])
&& is_array($oImapResponse->ResponseList) && \is_array($oImapResponse->ResponseList)
&& 2 < count($oImapResponse->ResponseList)) && 2 < \count($oImapResponse->ResponseList))
{ {
$iStart = 2; $iStart = 2;
if ($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex && if ($bReturnUid && 'UID' === $oImapResponse->StatusOrIndex &&
@ -1359,7 +1359,7 @@ class ImapClient extends \MailSo\Net\NetClient
$iStart = 3; $iStart = 3;
} }
for ($iIndex = $iStart, $iLen = count($oImapResponse->ResponseList); $iIndex < $iLen; $iIndex++) for ($iIndex = $iStart, $iLen = \count($oImapResponse->ResponseList); $iIndex < $iLen; $iIndex++)
{ {
$aNewValue = $this->validateThreadItem($oImapResponse->ResponseList[$iIndex]); $aNewValue = $this->validateThreadItem($oImapResponse->ResponseList[$iIndex]);
if (false !== $aNewValue) if (false !== $aNewValue)
@ -1386,7 +1386,7 @@ class ImapClient extends \MailSo\Net\NetClient
*/ */
public function MessageCopy($sToFolder, $sIndexRange, $bIndexIsUid) public function MessageCopy($sToFolder, $sIndexRange, $bIndexIsUid)
{ {
if (0 === strlen($sIndexRange)) if (0 === \strlen($sIndexRange))
{ {
$this->writeLogException( $this->writeLogException(
new \MailSo\Base\Exceptions\InvalidArgumentException(), new \MailSo\Base\Exceptions\InvalidArgumentException(),
@ -1411,7 +1411,7 @@ class ImapClient extends \MailSo\Net\NetClient
*/ */
public function MessageMove($sToFolder, $sIndexRange, $bIndexIsUid) public function MessageMove($sToFolder, $sIndexRange, $bIndexIsUid)
{ {
if (0 === strlen($sIndexRange)) if (0 === \strlen($sIndexRange))
{ {
$this->writeLogException( $this->writeLogException(
new \MailSo\Base\Exceptions\InvalidArgumentException(), new \MailSo\Base\Exceptions\InvalidArgumentException(),
@ -1440,12 +1440,12 @@ class ImapClient extends \MailSo\Net\NetClient
*/ */
public function MessageExpunge($sUidRangeIfSupported = '', $bForceUidExpunge = false) public function MessageExpunge($sUidRangeIfSupported = '', $bForceUidExpunge = false)
{ {
$sUidRangeIfSupported = trim($sUidRangeIfSupported); $sUidRangeIfSupported = \trim($sUidRangeIfSupported);
$sCmd = 'EXPUNGE'; $sCmd = 'EXPUNGE';
$aArguments = array(); $aArguments = array();
if ($bForceUidExpunge && 0 < strlen($sUidRangeIfSupported) && $this->IsSupported('UIDPLUS')) if ($bForceUidExpunge && 0 < \strlen($sUidRangeIfSupported) && $this->IsSupported('UIDPLUS'))
{ {
$sCmd = 'UID '.$sCmd; $sCmd = 'UID '.$sCmd;
$aArguments = array($sUidRangeIfSupported); $aArguments = array($sUidRangeIfSupported);
@ -1470,14 +1470,13 @@ class ImapClient extends \MailSo\Net\NetClient
{ {
if (!\MailSo\Base\Validator::NotEmptyString($sIndexRange, true) || if (!\MailSo\Base\Validator::NotEmptyString($sIndexRange, true) ||
!\MailSo\Base\Validator::NotEmptyString($sStoreAction, true) || !\MailSo\Base\Validator::NotEmptyString($sStoreAction, true) ||
0 === count($aInputStoreItems)) 0 === \count($aInputStoreItems))
{ {
return false; return false;
} }
$sCmd = ($bIndexIsUid) ? 'UID STORE' : 'STORE'; $sCmd = ($bIndexIsUid) ? 'UID STORE' : 'STORE';
return $this->SendRequestWithCheck($sCmd, return $this->SendRequestWithCheck($sCmd, array($sIndexRange, $sStoreAction, $aInputStoreItems));
array($sIndexRange, $sStoreAction, $aInputStoreItems));
} }
/** /**
@ -1517,15 +1516,15 @@ class ImapClient extends \MailSo\Net\NetClient
if (null !== $iUid) if (null !== $iUid)
{ {
$aLastResponse = $this->GetLastResponse(); $aLastResponse = $this->GetLastResponse();
if (is_array($aLastResponse) && 0 < count($aLastResponse) && $aLastResponse[count($aLastResponse) - 1]) if (\is_array($aLastResponse) && 0 < \count($aLastResponse) && $aLastResponse[\count($aLastResponse) - 1])
{ {
$oLast = $aLastResponse[count($aLastResponse) - 1]; $oLast = $aLastResponse[count($aLastResponse) - 1];
if ($oLast && \MailSo\Imap\Enumerations\ResponseType::TAGGED === $oLast->ResponseType && is_array($oLast->OptionalResponse)) if ($oLast && \MailSo\Imap\Enumerations\ResponseType::TAGGED === $oLast->ResponseType && \is_array($oLast->OptionalResponse))
{ {
if (0 < strlen($oLast->OptionalResponse[0]) && if (0 < \strlen($oLast->OptionalResponse[0]) &&
0 < strlen($oLast->OptionalResponse[2]) && 0 < \strlen($oLast->OptionalResponse[2]) &&
'APPENDUID' === strtoupper($oLast->OptionalResponse[0]) && 'APPENDUID' === strtoupper($oLast->OptionalResponse[0]) &&
is_numeric($oLast->OptionalResponse[2]) \is_numeric($oLast->OptionalResponse[2])
) )
{ {
$iUid = (int) $oLast->OptionalResponse[2]; $iUid = (int) $oLast->OptionalResponse[2];
@ -1556,7 +1555,7 @@ class ImapClient extends \MailSo\Net\NetClient
*/ */
public function SendRequest($sCommand, $aParams = array()) public function SendRequest($sCommand, $aParams = array())
{ {
if (!\MailSo\Base\Validator::NotEmptyString($sCommand, true) || !is_array($aParams)) if (!\MailSo\Base\Validator::NotEmptyString($sCommand, true) || !\is_array($aParams))
{ {
$this->writeLogException( $this->writeLogException(
new \MailSo\Base\Exceptions\InvalidArgumentException(), new \MailSo\Base\Exceptions\InvalidArgumentException(),
@ -1567,7 +1566,7 @@ class ImapClient extends \MailSo\Net\NetClient
$sTag = $this->getNewTag(); $sTag = $this->getNewTag();
$sCommand = trim($sCommand); $sCommand = \trim($sCommand);
$sRealCommand = $sTag.' '.$sCommand.$this->prepearParamLine($aParams); $sRealCommand = $sTag.' '.$sCommand.$this->prepearParamLine($aParams);
$sFakeCommand = ''; $sFakeCommand = '';
@ -1577,7 +1576,7 @@ class ImapClient extends \MailSo\Net\NetClient
$sFakeCommand = $sTag.' '.$sCommand.$this->prepearParamLine($aFakeParams); $sFakeCommand = $sTag.' '.$sCommand.$this->prepearParamLine($aFakeParams);
} }
$this->aTagTimeouts[$sTag] = microtime(true); $this->aTagTimeouts[$sTag] = \microtime(true);
$this->sendRaw($sRealCommand, true, $sFakeCommand); $this->sendRaw($sRealCommand, true, $sFakeCommand);
} }
@ -1594,7 +1593,7 @@ class ImapClient extends \MailSo\Net\NetClient
{ {
case 'LOGIN': case 'LOGIN':
$aResult = $aParams; $aResult = $aParams;
if (is_array($aResult) && 2 === count($aResult)) if (\is_array($aResult) && 2 === count($aResult))
{ {
$aResult[1] = '"*******"'; $aResult[1] = '"*******"';
} }
@ -1642,7 +1641,7 @@ class ImapClient extends \MailSo\Net\NetClient
*/ */
private function validateResponse($aResult) private function validateResponse($aResult)
{ {
if (!is_array($aResult) || 0 === $iCnt = count($aResult)) if (!\is_array($aResult) || 0 === $iCnt = \count($aResult))
{ {
$this->writeLogException( $this->writeLogException(
new Exceptions\ResponseNotFoundException(), new Exceptions\ResponseNotFoundException(),
@ -1677,7 +1676,7 @@ class ImapClient extends \MailSo\Net\NetClient
*/ */
protected function parseResponse($sEndTag = null, $bFindCapa = false) protected function parseResponse($sEndTag = null, $bFindCapa = false)
{ {
if (is_resource($this->rConnect)) if (\is_resource($this->rConnect))
{ {
$oImapResponse = null; $oImapResponse = null;
$sEndTag = (null === $sEndTag) ? $this->getCurrentTag() : $sEndTag; $sEndTag = (null === $sEndTag) ? $this->getCurrentTag() : $sEndTag;
@ -1705,7 +1704,7 @@ class ImapClient extends \MailSo\Net\NetClient
{ {
if (isset($this->aTagTimeouts[$sEndTag])) if (isset($this->aTagTimeouts[$sEndTag]))
{ {
$this->writeLog((microtime(true) - $this->aTagTimeouts[$sEndTag]).' ('.$sEndTag.')', $this->writeLog((\microtime(true) - $this->aTagTimeouts[$sEndTag]).' ('.$sEndTag.')',
\MailSo\Log\Enumerations\Type::TIME); \MailSo\Log\Enumerations\Type::TIME);
unset($this->aTagTimeouts[$sEndTag]); unset($this->aTagTimeouts[$sEndTag]);
@ -1749,24 +1748,24 @@ class ImapClient extends \MailSo\Net\NetClient
private function initCapabilityImapResponse($oImapResponse) private function initCapabilityImapResponse($oImapResponse)
{ {
if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType
&& is_array($oImapResponse->ResponseList)) && \is_array($oImapResponse->ResponseList))
{ {
$aList = null; $aList = null;
if (isset($oImapResponse->ResponseList[1]) && is_string($oImapResponse->ResponseList[1]) && if (isset($oImapResponse->ResponseList[1]) && \is_string($oImapResponse->ResponseList[1]) &&
'CAPABILITY' === strtoupper($oImapResponse->ResponseList[1])) 'CAPABILITY' === \strtoupper($oImapResponse->ResponseList[1]))
{ {
$aList = array_slice($oImapResponse->ResponseList, 2); $aList = \array_slice($oImapResponse->ResponseList, 2);
} }
else if ($oImapResponse->OptionalResponse && is_array($oImapResponse->OptionalResponse) && else if ($oImapResponse->OptionalResponse && \is_array($oImapResponse->OptionalResponse) &&
1 < count($oImapResponse->OptionalResponse) && is_string($oImapResponse->OptionalResponse[0]) && 1 < \count($oImapResponse->OptionalResponse) && \is_string($oImapResponse->OptionalResponse[0]) &&
'CAPABILITY' === strtoupper($oImapResponse->OptionalResponse[0])) 'CAPABILITY' === \strtoupper($oImapResponse->OptionalResponse[0]))
{ {
$aList = array_slice($oImapResponse->OptionalResponse, 1); $aList = \array_slice($oImapResponse->OptionalResponse, 1);
} }
if (is_array($aList) && 0 < count($aList)) if (\is_array($aList) && 0 < \count($aList))
{ {
$this->aCapabilityItems = array_map('strtoupper', $aList); $this->aCapabilityItems = \array_map('strtoupper', $aList);
} }
} }
} }
@ -2115,13 +2114,13 @@ class ImapClient extends \MailSo\Net\NetClient
$sAtomBuilder = ''; $sAtomBuilder = '';
} }
$sAtomBuilder .= substr($this->sResponseBuffer, $iCharBlockStartPos, $iPos - $iCharBlockStartPos + 1); $sAtomBuilder .= \substr($this->sResponseBuffer, $iCharBlockStartPos, $iPos - $iCharBlockStartPos + 1);
$iPos++; $iPos++;
$this->iResponseBufParsedPos = $iPos; $this->iResponseBufParsedPos = $iPos;
$sListBlock = $this->partialParseResponseBranch($mNull, $iStackIndex, true, $sListBlock = $this->partialParseResponseBranch($mNull, $iStackIndex, true,
null === $sPreviousAtomUpperCase ? '' : strtoupper($sPreviousAtomUpperCase)); null === $sPreviousAtomUpperCase ? '' : \strtoupper($sPreviousAtomUpperCase));
if (null !== $sListBlock) if (null !== $sListBlock)
{ {
@ -2144,7 +2143,7 @@ class ImapClient extends \MailSo\Net\NetClient
if ($iPos > $iCharBlockStartPos || null !== $sAtomBuilder) if ($iPos > $iCharBlockStartPos || null !== $sAtomBuilder)
{ {
$sLastCharBlock = substr($this->sResponseBuffer, $iCharBlockStartPos, $iPos - $iCharBlockStartPos); $sLastCharBlock = \substr($this->sResponseBuffer, $iCharBlockStartPos, $iPos - $iCharBlockStartPos);
if (null === $sAtomBuilder) if (null === $sAtomBuilder)
{ {
$aList[] = $sLastCharBlock; $aList[] = $sLastCharBlock;
@ -2164,9 +2163,9 @@ class ImapClient extends \MailSo\Net\NetClient
if (null !== $oImapResponse) if (null !== $oImapResponse)
{ {
// if (1 === count($aList)) // if (1 === \count($aList))
if (!$bCountOneInited && 1 === count($aList)) if (!$bCountOneInited && 1 === \count($aList))
// if (isset($aList[0]) && !isset($aList[1])) // fast 1 === count($aList) // if (isset($aList[0]) && !isset($aList[1])) // fast 1 === \count($aList)
{ {
$bCountOneInited = true; $bCountOneInited = true;
@ -2188,9 +2187,9 @@ class ImapClient extends \MailSo\Net\NetClient
$oImapResponse->ResponseType = \MailSo\Imap\Enumerations\ResponseType::UNKNOWN; $oImapResponse->ResponseType = \MailSo\Imap\Enumerations\ResponseType::UNKNOWN;
} }
} }
// else if (2 === count($aList)) // else if (2 === \count($aList))
else if (!$bCountTwoInited && 2 === count($aList)) else if (!$bCountTwoInited && 2 === \count($aList))
// else if (isset($aList[1]) && !isset($aList[2])) // fast 2 === count($aList) // else if (isset($aList[1]) && !isset($aList[2])) // fast 2 === \count($aList)
{ {
$bCountTwoInited = true; $bCountTwoInited = true;
@ -2244,19 +2243,19 @@ class ImapClient extends \MailSo\Net\NetClient
private function partialResponseLiteralCallbackCallable($sParent, $sLiteralAtomUpperCase, $rImapStream, $iLiteralLen) private function partialResponseLiteralCallbackCallable($sParent, $sLiteralAtomUpperCase, $rImapStream, $iLiteralLen)
{ {
$sLiteralAtomUpperCasePeek = ''; $sLiteralAtomUpperCasePeek = '';
if (0 === strpos($sLiteralAtomUpperCase, 'BODY')) if (0 === \strpos($sLiteralAtomUpperCase, 'BODY'))
{ {
$sLiteralAtomUpperCasePeek = str_replace('BODY', 'BODY.PEEK', $sLiteralAtomUpperCase); $sLiteralAtomUpperCasePeek = \str_replace('BODY', 'BODY.PEEK', $sLiteralAtomUpperCase);
} }
$sFetchKey = ''; $sFetchKey = '';
if (is_array($this->aFetchCallbacks)) if (\is_array($this->aFetchCallbacks))
{ {
if (0 < strlen($sLiteralAtomUpperCasePeek) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCasePeek])) if (0 < \strlen($sLiteralAtomUpperCasePeek) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCasePeek]))
{ {
$sFetchKey = $sLiteralAtomUpperCasePeek; $sFetchKey = $sLiteralAtomUpperCasePeek;
} }
else if (0 < strlen($sLiteralAtomUpperCase) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCase])) else if (0 < \strlen($sLiteralAtomUpperCase) && isset($this->aFetchCallbacks[$sLiteralAtomUpperCase]))
{ {
$sFetchKey = $sLiteralAtomUpperCase; $sFetchKey = $sLiteralAtomUpperCase;
} }
@ -2270,7 +2269,7 @@ class ImapClient extends \MailSo\Net\NetClient
\MailSo\Base\StreamWrappers\Literal::CreateStream($rImapStream, $iLiteralLen); \MailSo\Base\StreamWrappers\Literal::CreateStream($rImapStream, $iLiteralLen);
$bResult = true; $bResult = true;
$this->writeLog('Callback for '.$sParent.' / '.$sLiteralAtomUpperCase. $this->writeLog('Start Callback for '.$sParent.' / '.$sLiteralAtomUpperCase.
' - try to read '.$iLiteralLen.' bytes.', \MailSo\Log\Enumerations\Type::NOTE); ' - try to read '.$iLiteralLen.' bytes.', \MailSo\Log\Enumerations\Type::NOTE);
try try
@ -2284,31 +2283,53 @@ class ImapClient extends \MailSo\Net\NetClient
$this->writeLogException($oException); $this->writeLogException($oException);
} }
$iNotReadLiteralLen = 0; if (\is_resource($rImapLiteralStream))
while (!\feof($rImapLiteralStream))
{ {
$sBuf = \fread($rImapLiteralStream, 8192); $iNotReadLiteralLen = 0;
if (false !== $sBuf)
{ $bFeof = \feof($rImapLiteralStream);
\MailSo\Base\Utils::ResetTimeLimit(); $this->writeLog('End Callback for '.$sParent.' / '.$sLiteralAtomUpperCase.
$iNotReadLiteralLen += \strlen($sBuf); ' - feof = '.($bFeof ? 'good' : 'BAD'), $bFeof ?
continue; \MailSo\Log\Enumerations\Type::NOTE : \MailSo\Log\Enumerations\Type::WARNING);
}
break;
}
if ($iNotReadLiteralLen > 0) if (!$bFeof)
{
while (!@\feof($rImapLiteralStream))
{
$sBuf = @\fread($rImapLiteralStream, 1024 * 1024);
if (false === $sBuf || 0 === \strlen($sBuf) || null === $sBuf)
{
break;
}
\MailSo\Base\Utils::ResetTimeLimit();
$iNotReadLiteralLen += \strlen($sBuf);
}
if (\is_resource($rImapLiteralStream) && !@\feof($rImapLiteralStream))
{
@\stream_get_contents($rImapLiteralStream);
}
}
if (\is_resource($rImapLiteralStream))
{
@\fclose($rImapLiteralStream);
}
if ($iNotReadLiteralLen > 0)
{
$this->writeLog('Not read literal size is '.$iNotReadLiteralLen.' bytes.',
\MailSo\Log\Enumerations\Type::WARNING);
}
}
else
{ {
$this->writeLog('Not read literal size '.$iNotReadLiteralLen.' bytes.', $this->writeLog('Literal stream is not resource after callback.',
\MailSo\Log\Enumerations\Type::WARNING); \MailSo\Log\Enumerations\Type::WARNING);
} }
\MailSo\Base\Loader::IncStatistic('NetRead', $iLiteralLen); \MailSo\Base\Loader::IncStatistic('NetRead', $iLiteralLen);
if (\is_resource($rImapLiteralStream))
{
\fclose($rImapLiteralStream);
}
} }
return $bResult; return $bResult;
@ -2363,7 +2384,7 @@ class ImapClient extends \MailSo\Net\NetClient
*/ */
public function EscapeString($sStringForEscape) public function EscapeString($sStringForEscape)
{ {
return '"'.str_replace(array('\\', '"'), array('\\\\', '\\"'), $sStringForEscape).'"'; return '"'.\str_replace(array('\\', '"'), array('\\\\', '\\"'), $sStringForEscape).'"';
} }
/** /**

View file

@ -23,6 +23,11 @@ abstract class Driver
*/ */
protected $aPrefixes; protected $aPrefixes;
/**
* @var bool
*/
protected $bGuidPrefix;
/** /**
* @var bool * @var bool
*/ */
@ -62,6 +67,7 @@ abstract class Driver
$this->sName = 'INFO'; $this->sName = 'INFO';
$this->bTimePrefix = true; $this->bTimePrefix = true;
$this->bTypedPrefix = true; $this->bTypedPrefix = true;
$this->bGuidPrefix = true;
$this->iWriteOnTimeoutOnly = 0; $this->iWriteOnTimeoutOnly = 0;
$this->bWriteOnErrorOnly = false; $this->bWriteOnErrorOnly = false;
@ -80,6 +86,15 @@ abstract class Driver
); );
} }
/**
* @return \MailSo\Log\Driver
*/
public function DisableGuidPrefix()
{
$this->bGuidPrefix = false;
return $this;
}
/** /**
* @return \MailSo\Log\Driver * @return \MailSo\Log\Driver
*/ */
@ -150,9 +165,11 @@ abstract class Driver
protected function loggerLineImplementation($sTimePrefix, $sDesc, protected function loggerLineImplementation($sTimePrefix, $sDesc,
$iType = \MailSo\Log\Enumerations\Type::INFO, $sName = '') $iType = \MailSo\Log\Enumerations\Type::INFO, $sName = '')
{ {
return ($this->bTimePrefix ? '['.$sTimePrefix.'] ' : ''). return \ltrim(
($this->bTypedPrefix ? $this->getTypedPrefix($iType, $sName) : ''). ($this->bTimePrefix ? '['.$sTimePrefix.']' : '').
$sDesc; ($this->bGuidPrefix ? '['.\MailSo\Log\Logger::Guid().']' : '').
($this->bTypedPrefix ? ' '.$this->getTypedPrefix($iType, $sName) : '')
).$sDesc;
} }
/** /**
@ -215,6 +232,7 @@ abstract class Driver
array_unshift($this->aCache, $sFlush); array_unshift($this->aCache, $sFlush);
} }
$this->aCache[] = '--- FlushLogCache: Trigger';
$this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), $sDesc, $iType, $sName); $this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), $sDesc, $iType, $sName);
$this->bFlushCache = true; $this->bFlushCache = true;
@ -234,6 +252,7 @@ abstract class Driver
array_unshift($this->aCache, $sFlush); array_unshift($this->aCache, $sFlush);
} }
$this->aCache[] = '--- FlushLogCache: Trigger';
$this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), $sDesc, $iType, $sName); $this->aCache[] = $this->loggerLineImplementation($this->getTimeWithMicroSec(), $sDesc, $iType, $sName);
$this->bFlushCache = true; $this->bFlushCache = true;

View file

@ -61,6 +61,22 @@ class Logger extends \MailSo\Base\Collection
return $oInstance; return $oInstance;
} }
/**
* @staticvar string $sCache;
*
* @return string
*/
public static function Guid()
{
static $sCache = null;
if (null === $sCache)
{
$sCache = \substr(\md5(\microtime(true).\rand(10000, 99999)), -8);
}
return $sCache;
}
/** /**
* @return bool * @return bool
*/ */

View file

@ -792,12 +792,13 @@ class Actions
$this->oLogger->WriteEmptyLine(); $this->oLogger->WriteEmptyLine();
$oHttp = $this->Http(); $oHttp = $this->Http();
$this->oLogger->Write( $this->oLogger->Write('[DATE:'.\gmdate('d.m.y').'][RL:'.APP_VERSION.'][PHP:'.PHP_VERSION.'][IP:'.
$oHttp->GetMethod().': '.$oHttp->GetHost(false, false).$oHttp->GetServer('REQUEST_URI', ''), $oHttp->GetClientIp().'][PID:'.(\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? \getmypid() : 'unknown').
\MailSo\Log\Enumerations\Type::NOTE, 'REQUEST'); '][GUID:'.\MailSo\Log\Logger::Guid().']');
$this->oLogger->Write('[PHP:'.PHP_VERSION.'][RL:'.APP_VERSION.'][DATE:'.\gmdate('d.m.y').'][IP:'. $this->oLogger->Write(
$oHttp->GetClientIp().'][PID:'.(\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? \getmypid() : 'unknown').']'); ' ['.$oHttp->GetMethod().'] '.$oHttp->GetScheme().'://'.$oHttp->GetHost(false, false).$oHttp->GetServer('REQUEST_URI', ''),
\MailSo\Log\Enumerations\Type::NOTE, 'REQUEST');
} }
} }
@ -7287,7 +7288,7 @@ class Actions
} }
else else
{ {
$mResult = '['.\get_class($mResponse).']'; $mResult = '["'.\get_class($mResponse).'"]';
$bHook = false; $bHook = false;
} }

View file

@ -147,7 +147,8 @@ class ServiceActions
break; break;
} }
$this->Logger()->Write(\MailSo\Base\Utils::Php2js($aPost), \MailSo\Log\Enumerations\Type::INFO, 'POST', true); $this->Logger()->Write(\MailSo\Base\Utils::Php2js($aPost, $this->Logger()),
\MailSo\Log\Enumerations\Type::INFO, 'POST', true);
} }
else if (3 < \count($this->aPaths) && $this->oHttp->IsGet()) else if (3 < \count($this->aPaths) && $this->oHttp->IsGet())
{ {
@ -195,7 +196,7 @@ class ServiceActions
$this->Plugins()->RunHook('filter.ajax-response', array($sAction, &$aResponseItem)); $this->Plugins()->RunHook('filter.ajax-response', array($sAction, &$aResponseItem));
@\header('Content-Type: application/json; charset=utf-8'); @\header('Content-Type: application/json; charset=utf-8');
$sResult = \MailSo\Base\Utils::Php2js($aResponseItem); $sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger());
$sObResult = @\ob_get_clean(); $sObResult = @\ob_get_clean();
@ -299,7 +300,7 @@ class ServiceActions
} }
$this->Plugins()->RunHook('filter.upload-response', array(&$aResponseItem)); $this->Plugins()->RunHook('filter.upload-response', array(&$aResponseItem));
$sResult = \MailSo\Base\Utils::Php2js($aResponseItem); $sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger());
$sObResult = @\ob_get_clean(); $sObResult = @\ob_get_clean();
if (0 < \strlen($sObResult)) if (0 < \strlen($sObResult))
@ -620,7 +621,7 @@ class ServiceActions
} }
} }
return $bJson ? \MailSo\Base\Utils::Php2js(array($sTheme, $sResult)) : $sResult; return $bJson ? \MailSo\Base\Utils::Php2js(array($sTheme, $sResult), $this->Logger()) : $sResult;
} }
/** /**
@ -886,7 +887,7 @@ class ServiceActions
} }
} }
return \MailSo\Base\Utils::Php2js($aResult); return \MailSo\Base\Utils::Php2js($aResult, $this->Logger());
case 'redirect': case 'redirect':
default: default:
@ -925,7 +926,7 @@ class ServiceActions
return \MailSo\Base\Utils::Php2js(array( return \MailSo\Base\Utils::Php2js(array(
'Action' => 'ExternalSso', 'Action' => 'ExternalSso',
'Result' => $sResult 'Result' => $sResult
)); ), $this->Logger());
} }
} }
@ -1038,7 +1039,7 @@ class ServiceActions
\RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH.'app/templates/Views/Common', $this->oActions). \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH.'app/templates/Views/Common', $this->oActions).
$this->oActions->Plugins()->CompileTemplate($bAdmin); $this->oActions->Plugins()->CompileTemplate($bAdmin);
return 'window.rainloopTEMPLATES='.\MailSo\Base\Utils::Php2js(array($sHtml)).';'; return 'window.rainloopTEMPLATES='.\MailSo\Base\Utils::Php2js(array($sHtml), $this->Logger()).';';
} }
/** /**

View file

@ -637,7 +637,7 @@
border-radius: 8px; border-radius: 8px;
} }
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */ /*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
/* ============================================================================= /* =============================================================================
@ -1142,7 +1142,7 @@ table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
} }
@charset "UTF-8"; @charset "UTF-8";
@font-face { @font-face {
@ -1513,7 +1513,7 @@ table {
.icon-resize-out:before { .icon-resize-out:before {
content: "\e06d"; content: "\e06d";
} }
/** initial setup **/ /** initial setup **/
.nano { .nano {
/* /*
@ -1630,7 +1630,7 @@ table {
.nano > .pane2:hover > .slider2, .nano > .pane2.active > .slider2 { .nano > .pane2:hover > .slider2, .nano > .pane2.active > .slider2 {
background-color: rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.4);
} }
/* Magnific Popup CSS */ /* Magnific Popup CSS */
.mfp-bg { .mfp-bg {
top: 0; top: 0;
@ -1995,7 +1995,7 @@ img.mfp-img {
right: 0; right: 0;
padding-top: 0; } padding-top: 0; }
/* overlay at start */ /* overlay at start */
.mfp-fade.mfp-bg { .mfp-fade.mfp-bg {
@ -2041,7 +2041,7 @@ img.mfp-img {
-moz-transform: translateX(50px); -moz-transform: translateX(50px);
transform: translateX(50px); transform: translateX(50px);
} }
.simple-pace { .simple-pace {
-webkit-pointer-events: none; -webkit-pointer-events: none;
pointer-events: none; pointer-events: none;
@ -2112,7 +2112,7 @@ img.mfp-img {
@keyframes simple-pace-stripe-animation { @keyframes simple-pace-stripe-animation {
0% { transform: none; transform: none; } 0% { transform: none; transform: none; }
100% { transform: translate(-32px, 0); transform: translate(-32px, 0); } 100% { transform: translate(-32px, 0); transform: translate(-32px, 0); }
} }
.inputosaurus-container { .inputosaurus-container {
background-color:#fff; background-color:#fff;
border:1px solid #bcbec0; border:1px solid #bcbec0;
@ -2180,7 +2180,7 @@ img.mfp-img {
box-shadow:none; box-shadow:none;
} }
.inputosaurus-input-hidden { display:none; } .inputosaurus-input-hidden { display:none; }
.flag-wrapper { .flag-wrapper {
width: 24px; width: 24px;
height: 16px; height: 16px;
@ -2224,7 +2224,7 @@ img.mfp-img {
.flag.flag-pt-br {background-position: -192px -11px} .flag.flag-pt-br {background-position: -192px -11px}
.flag.flag-cn, .flag.flag-zh-tw, .flag.flag-zh-cn, .flag.flag-zh-hk {background-position: -208px -22px} .flag.flag-cn, .flag.flag-zh-tw, .flag.flag-zh-cn, .flag.flag-zh-hk {background-position: -208px -22px}
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
.clearfix { .clearfix {
*zoom: 1; *zoom: 1;

View file

@ -1,5 +1,5 @@
/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ /*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, _) { (function (window, $, ko, crossroads, hasher, _) {
'use strict'; 'use strict';
@ -77,14 +77,14 @@ var
$document = $(window.document), $document = $(window.document),
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
; ;
/*jshint onevar: false*/ /*jshint onevar: false*/
/** /**
* @type {?AdminApp} * @type {?AdminApp}
*/ */
var RL = null; var RL = null;
/*jshint onevar: true*/ /*jshint onevar: true*/
/** /**
* @type {?} * @type {?}
*/ */
@ -238,7 +238,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
return oType && 'application/pdf' === oType.type; return oType && 'application/pdf' === oType.type;
}); });
} }
Consts.Defaults = {}; Consts.Defaults = {};
Consts.Values = {}; Consts.Values = {};
Consts.DataImages = {}; Consts.DataImages = {};
@ -356,7 +356,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
* @type {string} * @type {string}
*/ */
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII='; Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
/** /**
* @enum {string} * @enum {string}
*/ */
@ -774,7 +774,7 @@ Enums.Notification = {
'UnknownNotification': 999, 'UnknownNotification': 999,
'UnknownError': 999 'UnknownError': 999
}; };
Utils.trim = $.trim; Utils.trim = $.trim;
Utils.inArray = $.inArray; Utils.inArray = $.inArray;
Utils.isArray = _.isArray; Utils.isArray = _.isArray;
@ -2524,7 +2524,7 @@ Utils.detectDropdownVisibility = _.debounce(function () {
return oItem.hasClass('open'); return oItem.hasClass('open');
})); }));
}, 50); }, 50);
// Base64 encode / decode // Base64 encode / decode
// http://www.webtoolkit.info/ // http://www.webtoolkit.info/
@ -2687,7 +2687,7 @@ Base64 = {
} }
}; };
/*jslint bitwise: false*/ /*jslint bitwise: false*/
ko.bindingHandlers.tooltip = { ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) { 'init': function (oElement, fValueAccessor) {
if (!Globals.bMobileDevice) if (!Globals.bMobileDevice)
@ -3504,7 +3504,7 @@ ko.observable.fn.validateFunc = function (fFunc)
return this; return this;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -3826,7 +3826,7 @@ LinkBuilder.prototype.socialFacebook = function ()
{ {
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : ''); return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
}; };
/** /**
* @type {Object} * @type {Object}
*/ */
@ -3920,7 +3920,7 @@ Plugins.settingsGet = function (sPluginSection, sName)
}; };
/** /**
* @constructor * @constructor
*/ */
@ -3994,7 +3994,7 @@ CookieDriver.prototype.get = function (sKey)
return mResult; return mResult;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4065,7 +4065,7 @@ LocalStorageDriver.prototype.get = function (sKey)
return mResult; return mResult;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4108,7 +4108,7 @@ LocalStorage.prototype.get = function (iKey)
{ {
return this.oDriver ? this.oDriver.get('p' + iKey) : null; return this.oDriver ? this.oDriver.get('p' + iKey) : null;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4121,7 +4121,7 @@ KnoinAbstractBoot.prototype.bootstart = function ()
{ {
}; };
/** /**
* @param {string=} sPosition = '' * @param {string=} sPosition = ''
* @param {string=} sTemplate = '' * @param {string=} sTemplate = ''
@ -4214,7 +4214,7 @@ KnoinAbstractViewModel.prototype.registerPopupKeyDown = function ()
return true; return true;
}); });
}; };
/** /**
* @param {string} sScreenName * @param {string} sScreenName
* @param {?=} aViewModels = [] * @param {?=} aViewModels = []
@ -4290,7 +4290,7 @@ KnoinAbstractScreen.prototype.__start = function ()
this.oCross = oRoute; this.oCross = oRoute;
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -4695,7 +4695,7 @@ Knoin.prototype.bootstart = function ()
}; };
kn = new Knoin(); kn = new Knoin();
/** /**
* @param {string=} sEmail * @param {string=} sEmail
* @param {string=} sName * @param {string=} sName
@ -5059,7 +5059,7 @@ EmailModel.prototype.inputoTagLine = function ()
{ {
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email; return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
}; };
/** /**
* @constructor * @constructor
*/ */
@ -5103,7 +5103,7 @@ ContactTagModel.prototype.toLine = function (bEncodeHtml)
return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ? return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
Utils.encodeHtml(this.name()) : this.name(); Utils.encodeHtml(this.name()) : this.name();
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5398,7 +5398,7 @@ PopupsDomainViewModel.prototype.clearForm = function ()
this.smtpAuth(true); this.smtpAuth(true);
this.whiteList(''); this.whiteList('');
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5535,7 +5535,7 @@ PopupsPluginViewModel.prototype.onBuild = function ()
} }
}, this)); }, this));
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5651,7 +5651,7 @@ PopupsActivateViewModel.prototype.validateSubscriptionKey = function ()
{ {
var sValue = this.key(); var sValue = this.key();
return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue)); return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5711,7 +5711,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
RL.data().mainLanguage(sLang); RL.data().mainLanguage(sLang);
this.cancelCommand(); this.cancelCommand();
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5817,7 +5817,7 @@ PopupsAskViewModel.prototype.onBuild = function ()
}, this)); }, this));
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5904,7 +5904,7 @@ AdminLoginViewModel.prototype.onHide = function ()
{ {
this.loginFocus(false); this.loginFocus(false);
}; };
/** /**
* @param {?} oScreen * @param {?} oScreen
* *
@ -5928,7 +5928,7 @@ AdminMenuViewModel.prototype.link = function (sRoute)
{ {
return '#/' + sRoute; return '#/' + sRoute;
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractViewModel * @extends KnoinAbstractViewModel
@ -5952,7 +5952,7 @@ AdminPaneViewModel.prototype.logoutClick = function ()
RL.remote().adminLogout(function () { RL.remote().adminLogout(function () {
RL.loginAndLogoutReload(); RL.loginAndLogoutReload();
}); });
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6052,7 +6052,7 @@ AdminGeneral.prototype.selectLanguage = function ()
{ {
kn.showScreenPopup(PopupsLanguagesViewModel); kn.showScreenPopup(PopupsLanguagesViewModel);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6104,7 +6104,7 @@ AdminLogin.prototype.onBuild = function ()
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6173,7 +6173,7 @@ AdminBranding.prototype.onBuild = function ()
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6393,7 +6393,7 @@ AdminContacts.prototype.onBuild = function ()
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6482,7 +6482,7 @@ AdminDomains.prototype.onDomainListChangeRequest = function ()
{ {
RL.reloadDomainList(); RL.reloadDomainList();
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6587,7 +6587,7 @@ AdminSecurity.prototype.phpInfoLink = function ()
{ {
return RL.link().phpInfo(); return RL.link().phpInfo();
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6703,7 +6703,7 @@ AdminSocial.prototype.onBuild = function ()
}, 50); }, 50);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6800,7 +6800,7 @@ AdminPlugins.prototype.onPluginDisableRequest = function (sResult, oData)
RL.reloadPluginList(); RL.reloadPluginList();
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6898,7 +6898,7 @@ AdminPackages.prototype.installPackage = function (oPackage)
RL.remote().packageInstall(this.requestHelper(oPackage, true), oPackage); RL.remote().packageInstall(this.requestHelper(oPackage, true), oPackage);
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -6953,7 +6953,7 @@ AdminLicensing.prototype.licenseExpiredMomentValue = function ()
; ;
return iTime && 1898625600 === iTime ? 'Never' : (oDate.format('LL') + ' (' + oDate.from(moment()) + ')'); return iTime && 1898625600 === iTime ? 'Never' : (oDate.format('LL') + ' (' + oDate.from(moment()) + ')');
}; };
/** /**
* @constructor * @constructor
*/ */
@ -7028,7 +7028,7 @@ AdminAbout.prototype.updateCoreData = function ()
RL.updateCoreData(); RL.updateCoreData();
} }
}; };
/** /**
* @constructor * @constructor
*/ */
@ -7159,7 +7159,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed')); this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
}; };
/** /**
* @constructor * @constructor
* @extends AbstractData * @extends AbstractData
@ -7210,7 +7210,7 @@ _.extend(AdminDataStorage.prototype, AbstractData.prototype);
AdminDataStorage.prototype.populateDataOnStart = function() AdminDataStorage.prototype.populateDataOnStart = function()
{ {
AbstractData.prototype.populateDataOnStart.call(this); AbstractData.prototype.populateDataOnStart.call(this);
}; };
/** /**
* @constructor * @constructor
*/ */
@ -7484,7 +7484,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
'Version': sVersion 'Version': sVersion
}); });
}; };
/** /**
* @constructor * @constructor
* @extends AbstractAjaxRemoteStorage * @extends AbstractAjaxRemoteStorage
@ -7745,7 +7745,7 @@ AdminAjaxRemoteStorage.prototype.adminPing = function (fCallback)
{ {
this.defaultRequest(fCallback, 'AdminPing'); this.defaultRequest(fCallback, 'AdminPing');
}; };
/** /**
* @constructor * @constructor
*/ */
@ -7829,7 +7829,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{ {
this.oEmailsPicsHashes = oData; this.oEmailsPicsHashes = oData;
}; };
/** /**
* @constructor * @constructor
* @extends AbstractCacheStorage * @extends AbstractCacheStorage
@ -7840,7 +7840,7 @@ function AdminCacheStorage()
} }
_.extend(AdminCacheStorage.prototype, AbstractCacheStorage.prototype); _.extend(AdminCacheStorage.prototype, AbstractCacheStorage.prototype);
/** /**
* @param {Array} aViewModels * @param {Array} aViewModels
* @constructor * @constructor
@ -8020,7 +8020,7 @@ AbstractSettings.prototype.routes = function ()
['', oRules] ['', oRules]
]; ];
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractScreen * @extends KnoinAbstractScreen
@ -8035,7 +8035,7 @@ _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
AdminLoginScreen.prototype.onShow = function () AdminLoginScreen.prototype.onShow = function ()
{ {
RL.setTitle(''); RL.setTitle('');
}; };
/** /**
* @constructor * @constructor
* @extends AbstractSettings * @extends AbstractSettings
@ -8053,7 +8053,7 @@ _.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
AdminSettingsScreen.prototype.onShow = function () AdminSettingsScreen.prototype.onShow = function ()
{ {
RL.setTitle(''); RL.setTitle('');
}; };
/** /**
* @constructor * @constructor
* @extends KnoinAbstractBoot * @extends KnoinAbstractBoot
@ -8411,7 +8411,7 @@ AbstractApp.prototype.bootstart = function ()
ssm.ready(); ssm.ready();
}; };
/** /**
* @constructor * @constructor
* @extends AbstractApp * @extends AbstractApp
@ -8712,7 +8712,7 @@ AdminApp.prototype.bootstart = function ()
* @type {AdminApp} * @type {AdminApp}
*/ */
RL = new AdminApp(); RL = new AdminApp();
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile'); $html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS); $window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
@ -8763,9 +8763,9 @@ window['__RLBOOT'] = function (fCall) {
window['__RLBOOT'] = null; window['__RLBOOT'] = null;
}); });
}; };
if (window.SimplePace) { if (window.SimplePace) {
window.SimplePace.add(10); window.SimplePace.add(10);
} }
}(window, jQuery, ko, crossroads, hasher, _)); }(window, jQuery, ko, crossroads, hasher, _));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long