From d1a7dd9491233c1e471a5dda7aa9a78998a3f34a Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Fri, 14 Mar 2014 19:55:47 +0400 Subject: [PATCH] Small fixes --- .../0.0.0/app/libraries/MailSo/Base/Http.php | 4 +- .../Imap/Exceptions/ResponseException.php | 2 +- .../libraries/MailSo/Imap/FetchResponse.php | 2 +- .../app/libraries/MailSo/Imap/ImapClient.php | 2 +- .../app/libraries/MailSo/Smtp/SmtpClient.php | 56 ++++++++++--------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Base/Http.php b/rainloop/v/0.0.0/app/libraries/MailSo/Base/Http.php index f704ef30a..17693b8b6 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Base/Http.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Base/Http.php @@ -599,9 +599,7 @@ class Http */ public function GetPath() { - $sUrl = \trim(\substr($this->GetServer('REQUEST_URI', ''), 0, - \strrpos($this->GetServer('REQUEST_URI', ''), \basename($this->GetServer('SCRIPT_NAME', '')))), '/'); - + $sUrl = \ltrim(\substr($this->GetServer('SCRIPT_NAME', ''), 0, \strrpos($this->GetServer('SCRIPT_NAME', ''), '/')), '/'); return '' === $sUrl ? '/' : '/'.$sUrl.'/'; } diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Exceptions/ResponseException.php b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Exceptions/ResponseException.php index d5dc2b7a7..5b443813f 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Exceptions/ResponseException.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Exceptions/ResponseException.php @@ -39,7 +39,7 @@ class ResponseException extends \MailSo\Imap\Exceptions\Exception } /** - * @return \MailSo\Imap\Response | null + * @return \MailSo\Imap\Response|null */ public function GetLastResponse() { diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/FetchResponse.php b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/FetchResponse.php index c0b415ce6..1be2b5d96 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/FetchResponse.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/FetchResponse.php @@ -142,7 +142,7 @@ class FetchResponse { $mReturn = $this->oImapResponse->ResponseList[1]; } - else + else if (isset($this->oImapResponse->ResponseList[3]) && \is_array($this->oImapResponse->ResponseList[3])) { foreach ($this->oImapResponse->ResponseList[3] as $mItem) { diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php index 6c7112bf3..3a11c03d5 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php @@ -589,7 +589,7 @@ class ImapClient extends \MailSo\Net\NetClient 'STATUS' === $oImapResponse->StatusOrIndex && isset($oImapResponse->ResponseList[2]) && isset($oImapResponse->ResponseList[3]) && - is_array($oImapResponse->ResponseList[3])) + \is_array($oImapResponse->ResponseList[3])) { $sFolderNameRaw = $oImapResponse->ResponseList[2]; diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Smtp/SmtpClient.php b/rainloop/v/0.0.0/app/libraries/MailSo/Smtp/SmtpClient.php index a3933d85a..301e222b0 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Smtp/SmtpClient.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Smtp/SmtpClient.php @@ -183,20 +183,20 @@ class SmtpClient extends \MailSo\Net\NetClient { $this->writeLogException( new \MailSo\Smtp\Exceptions\LoginBadMethodException( - $oException->GetResponses(), '', 0, $oException), + $oException->GetResponses(), $oException->getMessage(), 0, $oException), \MailSo\Log\Enumerations\Type::NOTICE, true); } try { - $this->sendRequestWithCheck(base64_encode($sLogin), 334, ''); - $this->sendRequestWithCheck(base64_encode($sPassword), 235, '', true); + $this->sendRequestWithCheck(\base64_encode($sLogin), 334, ''); + $this->sendRequestWithCheck(\base64_encode($sPassword), 235, '', true); } catch (\MailSo\Smtp\Exceptions\NegativeResponseException $oException) { $this->writeLogException( new \MailSo\Smtp\Exceptions\LoginBadCredentialsException( - $oException->GetResponses(), '', 0, $oException), + $oException->GetResponses(), $oException->getMessage(), 0, $oException), \MailSo\Log\Enumerations\Type::NOTICE, true); } } @@ -212,7 +212,7 @@ class SmtpClient extends \MailSo\Net\NetClient { $this->writeLogException( new \MailSo\Smtp\Exceptions\LoginBadCredentialsException( - $oException->GetResponses(), '', 0, $oException), + $oException->GetResponses(), $oException->getMessage(), 0, $oException), \MailSo\Log\Enumerations\Type::NOTICE, true); } } @@ -226,7 +226,7 @@ class SmtpClient extends \MailSo\Net\NetClient { $this->writeLogException( new \MailSo\Smtp\Exceptions\LoginBadMethodException( - $oException->GetResponses(), '', 0, $oException), + $oException->GetResponses(), $oException->getMessage(), 0, $oException), \MailSo\Log\Enumerations\Type::NOTICE, true); } @@ -238,7 +238,7 @@ class SmtpClient extends \MailSo\Net\NetClient { $this->writeLogException( new \MailSo\Smtp\Exceptions\LoginBadCredentialsException( - $oException->GetResponses(), '', 0, $oException), + $oException->GetResponses(), $oException->getMessage(), 0, $oException), \MailSo\Log\Enumerations\Type::NOTICE, true); } } @@ -274,7 +274,7 @@ class SmtpClient extends \MailSo\Net\NetClient { $this->writeLogException( new \MailSo\Smtp\Exceptions\LoginBadCredentialsException( - $oException->GetResponses(), '', 0, $oException), + $oException->GetResponses(), $oException->getMessage(), 0, $oException), \MailSo\Log\Enumerations\Type::NOTICE, true); } } @@ -300,7 +300,9 @@ class SmtpClient extends \MailSo\Net\NetClient public function MailFrom($sFrom, $sSizeIfSupported = '') { $sCmd = 'FROM:<'.$sFrom.'>'; - if (0 < strlen($sSizeIfSupported) && $this->IsSupported('SIZE')) + + $sSizeIfSupported = (string) $sSizeIfSupported; + if (0 < \strlen($sSizeIfSupported) && \is_numeric($sSizeIfSupported) && $this->IsSupported('SIZE')) { $sCmd .= ' SIZE='.$sSizeIfSupported; } @@ -385,7 +387,7 @@ class SmtpClient extends \MailSo\Net\NetClient */ public function DataWithStream($rDataStream) { - if (!is_resource($rDataStream)) + if (!\is_resource($rDataStream)) { throw new \MailSo\Base\Exceptions\InvalidArgumentException(); } @@ -402,22 +404,22 @@ class SmtpClient extends \MailSo\Net\NetClient $this->writeLog('Message data.', \MailSo\Log\Enumerations\Type::NOTE); $iTimer = 0; - while (!feof($rDataStream)) + while (!\feof($rDataStream)) { - $sBuffer = fgets($rDataStream); + $sBuffer = \fgets($rDataStream); if (false !== $sBuffer) { - if (0 === strpos($sBuffer, '.')) + if (0 === \strpos($sBuffer, '.')) { $sBuffer = '.'.$sBuffer; } - $this->sendRaw(rtrim($sBuffer, "\r\n"), false); + $this->sendRaw(\rtrim($sBuffer, "\r\n"), false); \MailSo\Base\Utils::ResetTimeLimit($iTimer); continue; } - else if (!feof($rDataStream)) + else if (!\feof($rDataStream)) { $this->writeLogException( new Exceptions\RuntimeException('Cannot read input resource'), @@ -558,12 +560,12 @@ class SmtpClient extends \MailSo\Net\NetClient $this->IsConnected(true); - $sCommand = trim($sCommand); - $sRealCommand = $sCommand.(0 === strlen($sAddToCommand) ? '' : ' '.$sAddToCommand); + $sCommand = \trim($sCommand); + $sRealCommand = $sCommand.(0 === \strlen($sAddToCommand) ? '' : ' '.$sAddToCommand); $sFakeCommand = ($bSecureLog) ? '**********' : ''; - $this->iRequestTime = microtime(true); + $this->iRequestTime = \microtime(true); $this->sendRaw($sRealCommand, true, $sFakeCommand); return $this; @@ -682,13 +684,13 @@ class SmtpClient extends \MailSo\Net\NetClient */ private function validateResponse($mExpectCode) { - if (!is_array($mExpectCode)) + if (!\is_array($mExpectCode)) { $mExpectCode = array((int) $mExpectCode); } else { - $mExpectCode = array_map('intval', $mExpectCode); + $mExpectCode = \array_map('intval', $mExpectCode); } $aParts = array('', '', ''); @@ -696,23 +698,23 @@ class SmtpClient extends \MailSo\Net\NetClient do { $this->getNextBuffer(); - $aParts = preg_split('/([\s-]+)/', $this->sResponseBuffer, 2, PREG_SPLIT_DELIM_CAPTURE); + $aParts = \preg_split('/([\s-]+)/', $this->sResponseBuffer, 2, PREG_SPLIT_DELIM_CAPTURE); - if (is_array($aParts) && 3 === count($aParts) && is_numeric($aParts[0])) + if (\is_array($aParts) && 3 === \count($aParts) && \is_numeric($aParts[0])) { - if ('-' !== trim($aParts[1]) && !in_array((int) $aParts[0], $mExpectCode)) + if ('-' !== trim($aParts[1]) && !\in_array((int) $aParts[0], $mExpectCode)) { $this->writeLogException( - new Exceptions\NegativeResponseException($this->aResults, trim( - (0 < count($this->aResults) ? implode("\r\n", $this->aResults)."\r\n" : ''). + new Exceptions\NegativeResponseException($this->aResults, \trim( + (0 < \count($this->aResults) ? \implode("\r\n", $this->aResults)."\r\n" : ''). $this->sResponseBuffer)), \MailSo\Log\Enumerations\Type::ERROR, true); } } else { $this->writeLogException( - new Exceptions\ResponseException($this->aResults, trim( - (0 < count($this->aResults) ? implode("\r\n", $this->aResults)."\r\n" : ''). + new Exceptions\ResponseException($this->aResults, \trim( + (0 < \count($this->aResults) ? \implode("\r\n", $this->aResults)."\r\n" : ''). $this->sResponseBuffer)), \MailSo\Log\Enumerations\Type::ERROR, true); }