Code refactoring

This commit is contained in:
RainLoop Team 2014-08-26 19:24:47 +04:00
parent 4a95dd6195
commit 36329110e5
81 changed files with 3474 additions and 2124 deletions

View file

@ -195,15 +195,63 @@ class ImapClient extends \MailSo\Net\NetClient
try
{
if ($bUseAuthPlainIfSupported && $this->IsSupported('AUTH=PLAIN'))
// TODO
if (false && $this->IsSupported('AUTH=CRAM-MD5'))
{
$this->SendRequest('AUTHENTICATE', array('CRAM-MD5'));
$aResponse = $this->parseResponseWithValidation();
if ($aResponse && \is_array($aResponse) && 0 < \count($aResponse) &&
\MailSo\Imap\Enumerations\ResponseType::CONTINUATION === $aResponse[\count($aResponse) - 1]->ResponseType)
{
$oContinuationResponse = null;
foreach ($aResponse as $oResponse)
{
if ($oResponse && \MailSo\Imap\Enumerations\ResponseType::CONTINUATION === $oResponse->ResponseType)
{
$oContinuationResponse = $oResponse;
}
}
if ($oContinuationResponse)
{
$sToken = \base64_encode("\0".$sLogin."\0".$sPassword);
if ($this->oLogger)
{
$this->oLogger->AddSecret($sToken);
}
$this->Logger()->WriteDump($aResponse);
$this->sendRaw($sToken, true, '*******');
$this->parseResponseWithValidation();
}
else
{
// TODO
}
}
}
else if ($bUseAuthPlainIfSupported && $this->IsSupported('AUTH=PLAIN'))
{
$sToken = \base64_encode("\0".$sLogin."\0".$sPassword);
if ($this->oLogger)
{
$this->oLogger->AddSecret(\base64_encode("\0".$sLogin."\0".$sPassword));
$this->oLogger->AddSecret($sToken);
}
$this->SendRequestWithCheck('AUTHENTICATE',
array('PLAIN', \base64_encode("\0".$sLogin."\0".$sPassword)));
if ($this->IsSupported('AUTH=SASL-IR') && false)
{
$this->SendRequestWithCheck('AUTHENTICATE', array('PLAIN', $sToken));
}
else
{
$this->SendRequest('AUTHENTICATE', array('PLAIN'));
$this->parseResponseWithValidation();
$this->sendRaw($sToken, true, '*******');
$this->parseResponseWithValidation();
}
}
else
{

View file

@ -423,8 +423,17 @@ abstract class NetClient
$iReadedLen = \strlen($this->sResponseBuffer);
if (null === $mReadLen || $bForceLogin)
{
$this->writeLogWithCrlf('< '.$this->sResponseBuffer, //.' ['.$iReadedLen.']',
\MailSo\Log\Enumerations\Type::INFO);
$iLimit = 5000; // 5kb
if ($iLimit < $iReadedLen)
{
$this->writeLogWithCrlf('[cutted:'.$iReadedLen.'b] < '.\substr($this->sResponseBuffer.'...', 0, $iLimit),
\MailSo\Log\Enumerations\Type::INFO);
}
else
{
$this->writeLogWithCrlf('< '.$this->sResponseBuffer, //.' ['.$iReadedLen.']',
\MailSo\Log\Enumerations\Type::INFO);
}
}
else
{

View file

@ -12,8 +12,8 @@
<meta http-equiv="refresh" content="0; URL=./?/BadBrowser" />
<![endif]-->
<script type="text/javascript" data-cfasync="false">
if (!navigator || !navigator.cookieEnabled) {
document.location.replace('./?/NoCookie');
if (!window.navigator || !window.navigator.cookieEnabled) {
window.document.location.replace('./?/NoCookie');
}
</script>
<meta name="Author" content="RainLoop Team" />
@ -26,11 +26,11 @@
<link type="text/css" rel="stylesheet" id="rlThemeLink" />
<script type="text/javascript" data-cfasync="false" src="{{BaseAppBootScriptLink}}"></script>
<script type="text/javascript" data-cfasync="false">
__includeScr('{{BaseAppDataScriptLink}}' + (window.__rlah ? window.__rlah() || '0' : '0') + '/' + Math.random().toString().substr(2) + '/');
__includeScr('{{BaseAppDataScriptLink}}' + (window.__rlah ? window.__rlah() || '0' : '0') + '/' + window.Math.random().toString().substr(2) + '/');
</script>
<script type="text/javascript" data-cfasync="false">
if (window.rainloopAppData && window.rainloopAppData['NewThemeLink']) {
document.getElementById('rlThemeLink').href = window.rainloopAppData['NewThemeLink'];
window.document.getElementById('rlThemeLink').href = window.rainloopAppData['NewThemeLink'];
}
</script>
</head>
@ -45,7 +45,7 @@
</div>
</div>
<script type="text/javascript" data-cfasync="false">
var oE = document.getElementById('rl-loading');
var oE = window.document.getElementById('rl-loading');
if (oE && oE.style) {
oE.style.opacity = 0;
window.setTimeout(function () {