mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Small fixes
This commit is contained in:
parent
7d7c05737f
commit
d1a7dd9491
5 changed files with 33 additions and 33 deletions
|
|
@ -599,9 +599,7 @@ class Http
|
||||||
*/
|
*/
|
||||||
public function GetPath()
|
public function GetPath()
|
||||||
{
|
{
|
||||||
$sUrl = \trim(\substr($this->GetServer('REQUEST_URI', ''), 0,
|
$sUrl = \ltrim(\substr($this->GetServer('SCRIPT_NAME', ''), 0, \strrpos($this->GetServer('SCRIPT_NAME', ''), '/')), '/');
|
||||||
\strrpos($this->GetServer('REQUEST_URI', ''), \basename($this->GetServer('SCRIPT_NAME', '')))), '/');
|
|
||||||
|
|
||||||
return '' === $sUrl ? '/' : '/'.$sUrl.'/';
|
return '' === $sUrl ? '/' : '/'.$sUrl.'/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class ResponseException extends \MailSo\Imap\Exceptions\Exception
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \MailSo\Imap\Response | null
|
* @return \MailSo\Imap\Response|null
|
||||||
*/
|
*/
|
||||||
public function GetLastResponse()
|
public function GetLastResponse()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ class FetchResponse
|
||||||
{
|
{
|
||||||
$mReturn = $this->oImapResponse->ResponseList[1];
|
$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)
|
foreach ($this->oImapResponse->ResponseList[3] as $mItem)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -589,7 +589,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
'STATUS' === $oImapResponse->StatusOrIndex &&
|
'STATUS' === $oImapResponse->StatusOrIndex &&
|
||||||
isset($oImapResponse->ResponseList[2]) &&
|
isset($oImapResponse->ResponseList[2]) &&
|
||||||
isset($oImapResponse->ResponseList[3]) &&
|
isset($oImapResponse->ResponseList[3]) &&
|
||||||
is_array($oImapResponse->ResponseList[3]))
|
\is_array($oImapResponse->ResponseList[3]))
|
||||||
{
|
{
|
||||||
$sFolderNameRaw = $oImapResponse->ResponseList[2];
|
$sFolderNameRaw = $oImapResponse->ResponseList[2];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,20 +183,20 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Smtp\Exceptions\LoginBadMethodException(
|
new \MailSo\Smtp\Exceptions\LoginBadMethodException(
|
||||||
$oException->GetResponses(), '', 0, $oException),
|
$oException->GetResponses(), $oException->getMessage(), 0, $oException),
|
||||||
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->sendRequestWithCheck(base64_encode($sLogin), 334, '');
|
$this->sendRequestWithCheck(\base64_encode($sLogin), 334, '');
|
||||||
$this->sendRequestWithCheck(base64_encode($sPassword), 235, '', true);
|
$this->sendRequestWithCheck(\base64_encode($sPassword), 235, '', true);
|
||||||
}
|
}
|
||||||
catch (\MailSo\Smtp\Exceptions\NegativeResponseException $oException)
|
catch (\MailSo\Smtp\Exceptions\NegativeResponseException $oException)
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Smtp\Exceptions\LoginBadCredentialsException(
|
new \MailSo\Smtp\Exceptions\LoginBadCredentialsException(
|
||||||
$oException->GetResponses(), '', 0, $oException),
|
$oException->GetResponses(), $oException->getMessage(), 0, $oException),
|
||||||
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +212,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Smtp\Exceptions\LoginBadCredentialsException(
|
new \MailSo\Smtp\Exceptions\LoginBadCredentialsException(
|
||||||
$oException->GetResponses(), '', 0, $oException),
|
$oException->GetResponses(), $oException->getMessage(), 0, $oException),
|
||||||
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -226,7 +226,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Smtp\Exceptions\LoginBadMethodException(
|
new \MailSo\Smtp\Exceptions\LoginBadMethodException(
|
||||||
$oException->GetResponses(), '', 0, $oException),
|
$oException->GetResponses(), $oException->getMessage(), 0, $oException),
|
||||||
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -238,7 +238,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Smtp\Exceptions\LoginBadCredentialsException(
|
new \MailSo\Smtp\Exceptions\LoginBadCredentialsException(
|
||||||
$oException->GetResponses(), '', 0, $oException),
|
$oException->GetResponses(), $oException->getMessage(), 0, $oException),
|
||||||
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -274,7 +274,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new \MailSo\Smtp\Exceptions\LoginBadCredentialsException(
|
new \MailSo\Smtp\Exceptions\LoginBadCredentialsException(
|
||||||
$oException->GetResponses(), '', 0, $oException),
|
$oException->GetResponses(), $oException->getMessage(), 0, $oException),
|
||||||
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +300,9 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
public function MailFrom($sFrom, $sSizeIfSupported = '')
|
public function MailFrom($sFrom, $sSizeIfSupported = '')
|
||||||
{
|
{
|
||||||
$sCmd = 'FROM:<'.$sFrom.'>';
|
$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;
|
$sCmd .= ' SIZE='.$sSizeIfSupported;
|
||||||
}
|
}
|
||||||
|
|
@ -385,7 +387,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
public function DataWithStream($rDataStream)
|
public function DataWithStream($rDataStream)
|
||||||
{
|
{
|
||||||
if (!is_resource($rDataStream))
|
if (!\is_resource($rDataStream))
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
|
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);
|
$this->writeLog('Message data.', \MailSo\Log\Enumerations\Type::NOTE);
|
||||||
|
|
||||||
$iTimer = 0;
|
$iTimer = 0;
|
||||||
while (!feof($rDataStream))
|
while (!\feof($rDataStream))
|
||||||
{
|
{
|
||||||
$sBuffer = fgets($rDataStream);
|
$sBuffer = \fgets($rDataStream);
|
||||||
if (false !== $sBuffer)
|
if (false !== $sBuffer)
|
||||||
{
|
{
|
||||||
if (0 === strpos($sBuffer, '.'))
|
if (0 === \strpos($sBuffer, '.'))
|
||||||
{
|
{
|
||||||
$sBuffer = '.'.$sBuffer;
|
$sBuffer = '.'.$sBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sendRaw(rtrim($sBuffer, "\r\n"), false);
|
$this->sendRaw(\rtrim($sBuffer, "\r\n"), false);
|
||||||
|
|
||||||
\MailSo\Base\Utils::ResetTimeLimit($iTimer);
|
\MailSo\Base\Utils::ResetTimeLimit($iTimer);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!feof($rDataStream))
|
else if (!\feof($rDataStream))
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new Exceptions\RuntimeException('Cannot read input resource'),
|
new Exceptions\RuntimeException('Cannot read input resource'),
|
||||||
|
|
@ -558,12 +560,12 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
|
|
||||||
$this->IsConnected(true);
|
$this->IsConnected(true);
|
||||||
|
|
||||||
$sCommand = trim($sCommand);
|
$sCommand = \trim($sCommand);
|
||||||
$sRealCommand = $sCommand.(0 === strlen($sAddToCommand) ? '' : ' '.$sAddToCommand);
|
$sRealCommand = $sCommand.(0 === \strlen($sAddToCommand) ? '' : ' '.$sAddToCommand);
|
||||||
|
|
||||||
$sFakeCommand = ($bSecureLog) ? '**********' : '';
|
$sFakeCommand = ($bSecureLog) ? '**********' : '';
|
||||||
|
|
||||||
$this->iRequestTime = microtime(true);
|
$this->iRequestTime = \microtime(true);
|
||||||
$this->sendRaw($sRealCommand, true, $sFakeCommand);
|
$this->sendRaw($sRealCommand, true, $sFakeCommand);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
@ -682,13 +684,13 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
private function validateResponse($mExpectCode)
|
private function validateResponse($mExpectCode)
|
||||||
{
|
{
|
||||||
if (!is_array($mExpectCode))
|
if (!\is_array($mExpectCode))
|
||||||
{
|
{
|
||||||
$mExpectCode = array((int) $mExpectCode);
|
$mExpectCode = array((int) $mExpectCode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mExpectCode = array_map('intval', $mExpectCode);
|
$mExpectCode = \array_map('intval', $mExpectCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
$aParts = array('', '', '');
|
$aParts = array('', '', '');
|
||||||
|
|
@ -696,23 +698,23 @@ class SmtpClient extends \MailSo\Net\NetClient
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
$this->getNextBuffer();
|
$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(
|
$this->writeLogException(
|
||||||
new Exceptions\NegativeResponseException($this->aResults, trim(
|
new Exceptions\NegativeResponseException($this->aResults, \trim(
|
||||||
(0 < count($this->aResults) ? implode("\r\n", $this->aResults)."\r\n" : '').
|
(0 < \count($this->aResults) ? \implode("\r\n", $this->aResults)."\r\n" : '').
|
||||||
$this->sResponseBuffer)), \MailSo\Log\Enumerations\Type::ERROR, true);
|
$this->sResponseBuffer)), \MailSo\Log\Enumerations\Type::ERROR, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->writeLogException(
|
$this->writeLogException(
|
||||||
new Exceptions\ResponseException($this->aResults, trim(
|
new Exceptions\ResponseException($this->aResults, \trim(
|
||||||
(0 < count($this->aResults) ? implode("\r\n", $this->aResults)."\r\n" : '').
|
(0 < \count($this->aResults) ? \implode("\r\n", $this->aResults)."\r\n" : '').
|
||||||
$this->sResponseBuffer)), \MailSo\Log\Enumerations\Type::ERROR, true);
|
$this->sResponseBuffer)), \MailSo\Log\Enumerations\Type::ERROR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue