Many interface improvements, optimizations

This commit is contained in:
RainLoop Team 2014-05-07 20:04:32 +04:00
parent 40d2548a53
commit 53dc509d79
42 changed files with 686 additions and 461 deletions

View file

@ -827,34 +827,34 @@ class Utils
/**
* @staticvar bool $bValidateAction
*
* @param int &$iTimer
* @param int $iTimeToReset = 15
* @param int $iTimeToAdd = 120
*
* @return bool
*/
public static function ResetTimeLimit(&$iTimer, $iTimeToReset = 15, $iTimeToAdd = 120)
public static function ResetTimeLimit($iTimeToReset = 15, $iTimeToAdd = 120)
{
static $bValidateAction = null;
static $iResetTimer = null;
if (null === $bValidateAction)
{
$iResetTimer = 0;
$sSafeMode = \strtolower(\trim(@\ini_get('safe_mode')));
$bSafeMode = 'on' === $sSafeMode || '1' === $sSafeMode || 'true' === $sSafeMode;
$bValidateAction = !$bSafeMode && \MailSo\Base\Utils::FunctionExistsAndEnabled('set_time_limit');
}
if ($bValidateAction)
if ($bValidateAction && $iTimeToReset < \time() - $iResetTimer)
{
$iTime = \time();
if ($iTimeToReset < $iTime - $iTimer)
{
$iTimer = $iTime;
\set_time_limit($iTimeToAdd);
}
$iResetTimer = \time();
\set_time_limit($iTimeToAdd);
return true;
}
return $bValidateAction;
return false;
}
/**
@ -1347,7 +1347,6 @@ class Utils
*/
public static function FpassthruWithTimeLimitReset($fResource, $iBufferLen = 8192)
{
$iTimer = 0;
$bResult = false;
if (\is_resource($fResource))
{
@ -1357,7 +1356,7 @@ class Utils
if (false !== $sBuffer)
{
echo $sBuffer;
\MailSo\Base\Utils::ResetTimeLimit($iTimer);
\MailSo\Base\Utils::ResetTimeLimit();
continue;
}
@ -1382,7 +1381,6 @@ class Utils
*/
public static function MultipleStreamWriter($rRead, $aWrite, $iBufferLen = 8192, $bResetTimeLimit = true, $bFixCrLf = false, $bRewindOnComplete = false)
{
$iTimer = 0;
$mResult = false;
if ($rRead && \is_array($aWrite) && 0 < \count($aWrite))
{
@ -1420,7 +1418,7 @@ class Utils
if ($bResetTimeLimit)
{
\MailSo\Base\Utils::ResetTimeLimit($iTimer);
\MailSo\Base\Utils::ResetTimeLimit();
}
}
}

View file

@ -1788,7 +1788,7 @@ class ImapClient extends \MailSo\Net\NetClient
$bIsClosingBracketSquare = false;
$iLiteralLen = 0;
$iBufferEndIndex = 0;
$iTimer = 0;
$iDebugCount = 0;
$rImapLiteralStream = null;
@ -1810,6 +1810,12 @@ class ImapClient extends \MailSo\Net\NetClient
while (!$bIsEndOfList)
{
$iDebugCount++;
if (100000 === $iDebugCount)
{
$this->Logger()->Write('PartialParseOver: '.$iDebugCount, \MailSo\Log\Enumerations\Type::ERROR);
}
if ($this->bNeedNext)
{
$iPos = 0;
@ -1854,7 +1860,7 @@ class ImapClient extends \MailSo\Net\NetClient
$sLiteral .= $sAddRead;
$iRead -= \strlen($sAddRead);
\MailSo\Base\Utils::ResetTimeLimit($iTimer);
\MailSo\Base\Utils::ResetTimeLimit();
}
if (false !== $sLiteral)
@ -2203,6 +2209,11 @@ class ImapClient extends \MailSo\Net\NetClient
$this->iResponseBufParsedPos = 0;
}
if (100000 < $iDebugCount)
{
$this->Logger()->Write('PartialParseOverResult: '.$iDebugCount, \MailSo\Log\Enumerations\Type::ERROR);
}
return $bTreatAsAtom ? $sAtomBuilder : $aList;
}
@ -2249,14 +2260,13 @@ class ImapClient extends \MailSo\Net\NetClient
\call_user_func($this->aFetchCallbacks[$sFetchKey],
$sParent, $sLiteralAtomUpperCase, $rImapLiteralStream);
$iTimer = 0;
$iNotReadLiteralLen = 0;
while (!\feof($rImapLiteralStream))
{
$sBuf = \fread($rImapLiteralStream, 8192);
if (false !== $sBuf)
{
\MailSo\Base\Utils::ResetTimeLimit($iTimer);
\MailSo\Base\Utils::ResetTimeLimit();
$iNotReadLiteralLen += \strlen($sBuf);
continue;
}

View file

@ -403,7 +403,6 @@ class SmtpClient extends \MailSo\Net\NetClient
$this->writeLog('Message data.', \MailSo\Log\Enumerations\Type::NOTE);
$iTimer = 0;
while (!\feof($rDataStream))
{
$sBuffer = \fgets($rDataStream);
@ -416,7 +415,7 @@ class SmtpClient extends \MailSo\Net\NetClient
$this->sendRaw(\rtrim($sBuffer, "\r\n"), false);
\MailSo\Base\Utils::ResetTimeLimit($iTimer);
\MailSo\Base\Utils::ResetTimeLimit();
continue;
}
else if (!\feof($rDataStream))

View file

@ -14,11 +14,6 @@ abstract class PdoAbstract
*/
protected $bExplain = false;
/**
* @var int
*/
protected $iResetTimer = 0;
/**
* @var \MailSo\Log\Logger
*/

View file

@ -252,14 +252,12 @@ class AddressBook extends \RainLoop\Providers\AbstractProvider
public function ImportCsvArray($sEmail, $aCsvData)
{
$iCount = 0;
$iResetTimer = 0;
if ($this->IsActive() && \is_array($aCsvData) && 0 < \count($aCsvData))
{
$oContact = new \RainLoop\Providers\AddressBook\Classes\Contact();
foreach ($aCsvData as $aItem)
{
\MailSo\Base\Utils::ResetTimeLimit($iResetTimer);
\MailSo\Base\Utils::ResetTimeLimit();
foreach ($aItem as $sItemName => $sItemValue)
{
@ -309,8 +307,6 @@ class AddressBook extends \RainLoop\Providers\AbstractProvider
public function ImportVcfFile($sEmail, $sVcfData)
{
$iCount = 0;
$iResetTimer = 0;
if ($this->IsActive() && \is_string($sVcfData))
{
$sVcfData = \trim($sVcfData);
@ -339,7 +335,7 @@ class AddressBook extends \RainLoop\Providers\AbstractProvider
{
if ($oVCard instanceof \Sabre\VObject\Component\VCard)
{
\MailSo\Base\Utils::ResetTimeLimit($iResetTimer);
\MailSo\Base\Utils::ResetTimeLimit();
if (empty($oVCard->UID))
{

View file

@ -158,7 +158,7 @@ class PdoAddressBook
private function davClientRequest($oClient, $sCmd, $sUrl, $mData = null)
{
\MailSo\Base\Utils::ResetTimeLimit($this->iResetTimer);
\MailSo\Base\Utils::ResetTimeLimit();
$this->oLogger->Write($sCmd.' '.$sUrl.('PUT' === $sCmd && null !== $mData ? ' ('.\strlen($mData).')' : ''),
\MailSo\Log\Enumerations\Type::INFO, 'DAV');

View file

@ -320,7 +320,7 @@ class Utils
'facebook.com' => 'facebook.png',
'facebookmail.com' => 'facebook.png',
'cnet.online.com' => 'cnet.jpg',
'cnet.online.com' => 'cnet.jpg',
'github.com' => 'github.png',
'steampowered.com' => 'steam.png',
'myspace.com' => 'myspace.png',
@ -328,7 +328,6 @@ class Utils
'youtube.com' => 'youtube.gif',
'amazon.com' => 'amazon.png',
'ted.com' => 'ted.png',
'icloud.com' => 'icloud.jpg',
'google.com' => 'google.png',
'plus.google.com' => 'google-plus.png',

View file

@ -11,7 +11,8 @@
<div class="btn-group">&nbsp;</div>
<div class="btn-group dropdown colored-toggle" data-bind="registrateBootstrapDropdown: true, openDropdownTrigger: moveDropdownTrigger">
<a id="move-dropdown-id" href="#" tabindex="-1" class="btn btn-dark-disabled-border dropdown-toggle buttonMove" data-toggle="dropdown" data-tooltip-placement="bottom" data-bind="command: moveCommand, tooltip: 'MESSAGE_LIST/BUTTON_MOVE_TO'">
<i class="icon-folder"></i>
<i class="icon-copy visible-on-ctrl"></i>
<i class="icon-folder hidden-on-ctrl"></i>
&nbsp;&nbsp;
<span class="caret"></span>
</a>
@ -20,7 +21,7 @@
<li class="divider" role="presentation" data-bind="visible: seporator"></li>
<!-- /ko -->
<!-- ko if: !seporator -->
<li class="e-item" role="presentation" data-bind="css: { 'disabled': disabled }, click: function () { if (!disabled) $root.moveSelectedMessagesToFolder(id); }">
<li class="e-item" role="presentation" data-bind="css: { 'disabled': disabled }, click: function (mdata, oEvent) { if (!disabled) $root.moveSelectedMessagesToFolder(id, oEvent && !!oEvent.ctrlKey); }">
<a class="e-link menuitem" href="#" tabindex="-1" data-bind="text: name"></a>
</li>
<!-- /ko -->
@ -32,7 +33,10 @@
<i class="icon-archive"></i>
</a>
<a class="btn btn-dark-disabled-border button-spam" data-tooltip-placement="bottom" data-bind="visible: !isSpamFolder() && !isSpamDisabled() && !isDraftFolder() && !isSentFolder(), command: spamCommand, tooltip: 'MESSAGE_LIST/BUTTON_SPAM'">
<i class="icon-bug"></i>
<i class="icon-angry-smiley"></i>
</a>
<a class="btn btn-dark-disabled-border button-not-spam" data-tooltip-placement="bottom" data-bind="visible: isSpamFolder() && !isSpamDisabled() && !isDraftFolder() && !isSentFolder(), command: notSpamCommand, tooltip: 'MESSAGE_LIST/BUTTON_NOT_SPAM'">
<i class="icon-happy-smiley"></i>
</a>
<a class="btn btn-dark-disabled-border button-delete" data-tooltip-placement="bottom" data-bind="command: deleteCommand, tooltip: 'MESSAGE_LIST/BUTTON_DELETE'">
<i class="icon-trash"></i>

View file

@ -31,7 +31,10 @@
<i class="icon-archive"></i>
</a>
<a class="btn btn-dark-disabled-border button-spam" data-tooltip-placement="bottom" data-bind="visible: !isDraftFolder() && !isSentFolder() && !isSpamFolder() && !isSpamDisabled(), command: spamCommand, tooltip: 'MESSAGE/BUTTON_SPAM'">
<i class="icon-bug"></i>
<i class="icon-angry-smiley"></i>
</a>
<a class="btn btn-dark-disabled-border button-not-spam" data-tooltip-placement="bottom" data-bind="visible: !isDraftFolder() && !isSentFolder() && isSpamFolder() && !isSpamDisabled(), command: notSpamCommand, tooltip: 'MESSAGE/BUTTON_NOT_SPAM'">
<i class="icon-happy-smiley"></i>
</a>
<a class="btn btn-dark-disabled-border button-delete" data-tooltip-placement="bottom" data-bind="command: deleteCommand, tooltip: 'MESSAGE/BUTTON_DELETE'">
<i class="icon-trash"></i>
@ -67,11 +70,18 @@
</li>
<li class="e-item" role="presentation" data-bind="visible: usePreviewPane() && !isDraftFolder() && !isSentFolder() && !isSpamFolder() && !isSpamDisabled()">
<a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="command: spamCommand">
<i class="icon-bug"></i>
<i class="icon-angry-smiley"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="MESSAGE/BUTTON_SPAM"></span>
</a>
</li>
<li class="e-item" role="presentation" data-bind="visible: usePreviewPane() && !isDraftFolder() && !isSentFolder() && isSpamFolder() && !isSpamDisabled()">
<a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="command: notSpamCommand">
<i class="icon-happy-smiley"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="MESSAGE/BUTTON_NOT_SPAM"></span>
</a>
</li>
<li class="e-item" role="presentation" data-bind="visible: usePreviewPane()">
<a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="command: deleteCommand">
<i class="icon-trash"></i>
@ -126,7 +136,7 @@
<div class="b-content thm-message-view-background-color">
<div>
<div class="b-message-view-checked-helper" data-bind="visible: !message() && '' === messageError() && hasCheckedMessages()">
<span data-bind="text: messageListChecked().length"></span>
<span data-bind="text: printableCheckedMessageCount()"></span>
<i class="icon-mail"></i>
</div>
<div class="b-message-view-desc" data-bind="visible: !message() && '' === messageError() && !hasCheckedMessages()">