strlen() and count() are always 0 = false or more = true

This commit is contained in:
djmaze 2021-11-18 10:15:33 +01:00
parent 779e7c7685
commit 30bec04a75
50 changed files with 322 additions and 324 deletions

View file

@ -145,7 +145,7 @@ class Http
if ($bWithRemoteUserData) if ($bWithRemoteUserData)
{ {
$sUser = \trim($this->GetServer('REMOTE_USER', '')); $sUser = \trim($this->GetServer('REMOTE_USER', ''));
$sHost = (0 < \strlen($sUser) ? $sUser.'@' : '').$sHost; $sHost = (\strlen($sUser) ? $sUser.'@' : '').$sHost;
} }
if ($bWithoutPort) if ($bWithoutPort)
@ -189,15 +189,15 @@ class Http
CURLOPT_TIMEOUT => (int) $iTimeout CURLOPT_TIMEOUT => (int) $iTimeout
); );
if (0 < \strlen($sCustomUserAgent)) if (\strlen($sCustomUserAgent))
{ {
$aOptions[CURLOPT_USERAGENT] = $sCustomUserAgent; $aOptions[CURLOPT_USERAGENT] = $sCustomUserAgent;
} }
if (0 < \strlen($sProxy)) if (\strlen($sProxy))
{ {
$aOptions[CURLOPT_PROXY] = $sProxy; $aOptions[CURLOPT_PROXY] = $sProxy;
if (0 < \strlen($sProxyAuth)) if (\strlen($sProxyAuth))
{ {
$aOptions[CURLOPT_PROXYUSERPWD] = $sProxyAuth; $aOptions[CURLOPT_PROXYUSERPWD] = $sProxyAuth;
} }
@ -238,7 +238,7 @@ class Http
$sNewUrl = null; $sNewUrl = null;
$sUrl = isset($aOptions[CURLOPT_URL]) ? $aOptions[CURLOPT_URL] : $sUrl; $sUrl = isset($aOptions[CURLOPT_URL]) ? $aOptions[CURLOPT_URL] : $sUrl;
if (isset($aOptions[CURLOPT_FOLLOWLOCATION]) && $aOptions[CURLOPT_FOLLOWLOCATION] && 0 < \strlen($sUrl) && if (isset($aOptions[CURLOPT_FOLLOWLOCATION]) && $aOptions[CURLOPT_FOLLOWLOCATION] && \strlen($sUrl) &&
\ini_get('open_basedir') !== '') \ini_get('open_basedir') !== '')
{ {
$aOptions[CURLOPT_FOLLOWLOCATION] = false; $aOptions[CURLOPT_FOLLOWLOCATION] = false;
@ -264,7 +264,7 @@ class Http
CURLOPT_TIMEOUT => 5 CURLOPT_TIMEOUT => 5
); );
if (isset($aOptions[CURLOPT_HTTPHEADER]) && \is_array($aOptions[CURLOPT_HTTPHEADER]) && 0 < \count($aOptions[CURLOPT_HTTPHEADER])) if (isset($aOptions[CURLOPT_HTTPHEADER]) && \is_array($aOptions[CURLOPT_HTTPHEADER]) && \count($aOptions[CURLOPT_HTTPHEADER]))
{ {
$aAddOptions[CURLOPT_HTTPHEADER] = $aOptions[CURLOPT_HTTPHEADER]; $aAddOptions[CURLOPT_HTTPHEADER] = $aOptions[CURLOPT_HTTPHEADER];
} }
@ -303,7 +303,7 @@ class Http
} while ($iCode && --$iRedirectLimit); } while ($iCode && --$iRedirectLimit);
\curl_close($oCurl); \curl_close($oCurl);
if ($iRedirectLimit > 0 && 0 < \strlen($sNewUrl)) if ($iRedirectLimit > 0 && \strlen($sNewUrl))
{ {
$aOptions[CURLOPT_URL] = $sNewUrl; $aOptions[CURLOPT_URL] = $sNewUrl;
} }
@ -352,21 +352,21 @@ class Http
CURLOPT_TIMEOUT => (int) $iTimeout CURLOPT_TIMEOUT => (int) $iTimeout
); );
if (0 < \strlen($sCustomUserAgent)) if (\strlen($sCustomUserAgent))
{ {
$aOptions[CURLOPT_USERAGENT] = $sCustomUserAgent; $aOptions[CURLOPT_USERAGENT] = $sCustomUserAgent;
} }
if (0 < \strlen($sProxy)) if (\strlen($sProxy))
{ {
$aOptions[CURLOPT_PROXY] = $sProxy; $aOptions[CURLOPT_PROXY] = $sProxy;
if (0 < \strlen($sProxyAuth)) if (\strlen($sProxyAuth))
{ {
$aOptions[CURLOPT_PROXYUSERPWD] = $sProxyAuth; $aOptions[CURLOPT_PROXYUSERPWD] = $sProxyAuth;
} }
} }
if (0 < \count($aHttpHeaders)) if (\count($aHttpHeaders))
{ {
$aOptions[CURLOPT_HTTPHEADER] = $aHttpHeaders; $aOptions[CURLOPT_HTTPHEADER] = $aHttpHeaders;
} }
@ -374,7 +374,7 @@ class Http
if ($oLogger) if ($oLogger)
{ {
$oLogger->Write('cUrl: URL: '.$sUrl); $oLogger->Write('cUrl: URL: '.$sUrl);
// if (isset($aOptions[CURLOPT_HTTPHEADER]) && \is_array($aOptions[CURLOPT_HTTPHEADER]) && 0 < \count($aOptions[CURLOPT_HTTPHEADER])) // if (isset($aOptions[CURLOPT_HTTPHEADER]) && \is_array($aOptions[CURLOPT_HTTPHEADER]) && \count($aOptions[CURLOPT_HTTPHEADER]))
// { // {
// $oLogger->Write('cUrl: Headers: '.\print_r($aOptions[CURLOPT_HTTPHEADER], true)); // $oLogger->Write('cUrl: Headers: '.\print_r($aOptions[CURLOPT_HTTPHEADER], true));
// } // }
@ -436,7 +436,7 @@ class Http
\header('Last-Modified: '.\gmdate('D, d M Y H:i:s', $iUtcTimeStamp - $iExpireTime).' UTC'); \header('Last-Modified: '.\gmdate('D, d M Y H:i:s', $iUtcTimeStamp - $iExpireTime).' UTC');
\header('Expires: '.\gmdate('D, j M Y H:i:s', $iUtcTimeStamp + $iExpireTime).' UTC'); \header('Expires: '.\gmdate('D, j M Y H:i:s', $iUtcTimeStamp + $iExpireTime).' UTC');
if (0 < strlen($sEtag)) if (\strlen($sEtag))
{ {
\header('Etag: '.$sEtag); \header('Etag: '.$sEtag);
} }

View file

@ -84,7 +84,7 @@ class Binary
public static function GetInlineDecodeOrEncodeFunctionName(string $sContentTransferEncoding, bool $bDecode = true) : string public static function GetInlineDecodeOrEncodeFunctionName(string $sContentTransferEncoding, bool $bDecode = true) : string
{ {
switch (strtolower($sContentTransferEncoding)) switch (\strtolower($sContentTransferEncoding))
{ {
case \MailSo\Base\Enumerations\Encoding::BASE64_LOWER: case \MailSo\Base\Enumerations\Encoding::BASE64_LOWER:
return $bDecode ? 'convert.base64-decode' : 'convert.base64-encode'; return $bDecode ? 'convert.base64-decode' : 'convert.base64-encode';
@ -104,12 +104,12 @@ class Binary
public static function InlineConvertDecode(string $sEncodedString, string &$sEndBuffer, string $sFromEncoding, string $sToEncoding) : string public static function InlineConvertDecode(string $sEncodedString, string &$sEndBuffer, string $sFromEncoding, string $sToEncoding) : string
{ {
$sEndBuffer = ''; $sEndBuffer = '';
$sQuotedPrintableLen = strlen($sEncodedString); $iQuotedPrintableLen = \strlen($sEncodedString);
$iLastSpace = strrpos($sEncodedString, ' '); $iLastSpace = \strrpos($sEncodedString, ' ');
if (false !== $iLastSpace && $iLastSpace + 1 < $sQuotedPrintableLen) if (false !== $iLastSpace && $iLastSpace + 1 < $iQuotedPrintableLen)
{ {
$sEndBuffer = substr($sEncodedString, $iLastSpace + 1); $sEndBuffer = \substr($sEncodedString, $iLastSpace + 1);
$sEncodedString = substr($sEncodedString, 0, $iLastSpace + 1); $sEncodedString = \substr($sEncodedString, 0, $iLastSpace + 1);
} }
return \MailSo\Base\Utils::ConvertEncoding($sEncodedString, $sFromEncoding, $sToEncoding); return \MailSo\Base\Utils::ConvertEncoding($sEncodedString, $sFromEncoding, $sToEncoding);
} }
@ -149,17 +149,17 @@ class Binary
public static function CreateStream($rStream, public static function CreateStream($rStream,
string $sUtilsDecodeOrEncodeFunctionName = null, string $sFromEncoding = null, string $sToEncoding = null) string $sUtilsDecodeOrEncodeFunctionName = null, string $sFromEncoding = null, string $sToEncoding = null)
{ {
if (!in_array(self::STREAM_NAME, stream_get_wrappers())) if (!\in_array(self::STREAM_NAME, \stream_get_wrappers()))
{ {
stream_wrapper_register(self::STREAM_NAME, '\MailSo\Base\StreamWrappers\Binary'); \stream_wrapper_register(self::STREAM_NAME, '\MailSo\Base\StreamWrappers\Binary');
} }
if (null === $sUtilsDecodeOrEncodeFunctionName || 0 === strlen($sUtilsDecodeOrEncodeFunctionName)) if (null === $sUtilsDecodeOrEncodeFunctionName || !\strlen($sUtilsDecodeOrEncodeFunctionName))
{ {
$sUtilsDecodeOrEncodeFunctionName = 'InlineNullDecode'; $sUtilsDecodeOrEncodeFunctionName = 'InlineNullDecode';
} }
$sHashName = md5(microtime(true).rand(1000, 9999)); $sHashName = \md5(\microtime(true).\rand(1000, 9999));
if (null !== $sFromEncoding && null !== $sToEncoding && $sFromEncoding !== $sToEncoding) if (null !== $sFromEncoding && null !== $sToEncoding && $sFromEncoding !== $sToEncoding)
{ {
@ -167,7 +167,7 @@ class Binary
$sUtilsDecodeOrEncodeFunctionName = 'InlineConvertDecode'; $sUtilsDecodeOrEncodeFunctionName = 'InlineConvertDecode';
} }
if (in_array($sUtilsDecodeOrEncodeFunctionName, array( if (\in_array($sUtilsDecodeOrEncodeFunctionName, array(
'convert.base64-decode', 'convert.base64-encode', 'convert.base64-decode', 'convert.base64-encode',
'convert.quoted-printable-decode', 'convert.quoted-printable-encode' 'convert.quoted-printable-decode', 'convert.quoted-printable-encode'
))) )))
@ -203,17 +203,16 @@ class Binary
$this->sToEncoding = null; $this->sToEncoding = null;
$this->sFunctionName = null; $this->sFunctionName = null;
$bResult = false; $aPath = \parse_url($sPath);
$aPath = parse_url($sPath);
if (isset($aPath['host']) && isset($aPath['scheme']) && if (isset($aPath['host']) && isset($aPath['scheme']) &&
0 < strlen($aPath['host']) && 0 < strlen($aPath['scheme']) && \strlen($aPath['host']) && \strlen($aPath['scheme']) &&
self::STREAM_NAME === $aPath['scheme']) self::STREAM_NAME === $aPath['scheme'])
{ {
$sHashName = $aPath['host']; $sHashName = $aPath['host'];
if (isset(self::$aStreams[$sHashName]) && if (isset(self::$aStreams[$sHashName]) &&
is_array(self::$aStreams[$sHashName]) && \is_array(self::$aStreams[$sHashName]) &&
4 === count(self::$aStreams[$sHashName])) 4 === \count(self::$aStreams[$sHashName]))
{ {
$this->rStream = self::$aStreams[$sHashName][0]; $this->rStream = self::$aStreams[$sHashName][0];
$this->sFunctionName = self::$aStreams[$sHashName][1]; $this->sFunctionName = self::$aStreams[$sHashName][1];
@ -221,10 +220,10 @@ class Binary
$this->sToEncoding = self::$aStreams[$sHashName][3]; $this->sToEncoding = self::$aStreams[$sHashName][3];
} }
$bResult = is_resource($this->rStream); return \is_resource($this->rStream);
} }
return $bResult; return false;
} }
public function stream_read(int $iCount) : string public function stream_read(int $iCount) : string
@ -234,29 +233,29 @@ class Binary
if ($iCount > 0) if ($iCount > 0)
{ {
if ($iCount < strlen($this->sBuffer)) if ($iCount < \strlen($this->sBuffer))
{ {
$sReturn = substr($this->sBuffer, 0, $iCount); $sReturn = \substr($this->sBuffer, 0, $iCount);
$this->sBuffer = substr($this->sBuffer, $iCount); $this->sBuffer = \substr($this->sBuffer, $iCount);
} }
else else
{ {
$sReturn = $this->sBuffer; $sReturn = $this->sBuffer;
while ($iCount > 0) while ($iCount > 0)
{ {
if (feof($this->rStream)) if (\feof($this->rStream))
{ {
if (0 === strlen($this->sBuffer.$sReturn)) if (!\strlen($this->sBuffer.$sReturn))
{ {
return false; return false;
} }
if (0 < strlen($this->sReadEndBuffer)) if (\strlen($this->sReadEndBuffer))
{ {
$sReturn .= self::$sFunctionName($this->sReadEndBuffer, $sReturn .= self::$sFunctionName($this->sReadEndBuffer,
$this->sReadEndBuffer, $this->sFromEncoding, $this->sToEncoding); $this->sReadEndBuffer, $this->sFromEncoding, $this->sToEncoding);
$iDecodeLen = strlen($sReturn); $iDecodeLen = \strlen($sReturn);
} }
$iCount = 0; $iCount = 0;
@ -264,7 +263,7 @@ class Binary
} }
else else
{ {
$sReadResult = fread($this->rStream, 8192); $sReadResult = \fread($this->rStream, 8192);
if (false === $sReadResult) if (false === $sReadResult)
{ {
return false; return false;
@ -273,11 +272,11 @@ class Binary
$sReturn .= self::$sFunctionName($this->sReadEndBuffer.$sReadResult, $sReturn .= self::$sFunctionName($this->sReadEndBuffer.$sReadResult,
$this->sReadEndBuffer, $this->sFromEncoding, $this->sToEncoding); $this->sReadEndBuffer, $this->sFromEncoding, $this->sToEncoding);
$iDecodeLen = strlen($sReturn); $iDecodeLen = \strlen($sReturn);
if ($iCount < $iDecodeLen) if ($iCount < $iDecodeLen)
{ {
$this->sBuffer = substr($sReturn, $iCount); $this->sBuffer = \substr($sReturn, $iCount);
$sReturn = substr($sReturn, 0, $iCount); $sReturn = \substr($sReturn, 0, $iCount);
$iCount = 0; $iCount = 0;
} }
else else
@ -288,7 +287,7 @@ class Binary
} }
} }
$this->iPos += strlen($sReturn); $this->iPos += \strlen($sReturn);
return $sReturn; return $sReturn;
} }
@ -307,7 +306,7 @@ class Binary
public function stream_eof() : bool public function stream_eof() : bool
{ {
return 0 === strlen($this->sBuffer) && feof($this->rStream); return !\strlen($this->sBuffer) && \feof($this->rStream);
} }
public function stream_stat() : array public function stream_stat() : array

View file

@ -50,16 +50,16 @@ class Literal
*/ */
public static function CreateStream($rStream, int $iLiteralLen) public static function CreateStream($rStream, int $iLiteralLen)
{ {
if (!in_array(self::STREAM_NAME, stream_get_wrappers())) if (!\in_array(self::STREAM_NAME, stream_get_wrappers()))
{ {
stream_wrapper_register(self::STREAM_NAME, '\MailSo\Base\StreamWrappers\Literal'); \stream_wrapper_register(self::STREAM_NAME, '\MailSo\Base\StreamWrappers\Literal');
} }
$sHashName = md5(microtime(true).rand(1000, 9999)); $sHashName = \md5(\microtime(true).\rand(1000, 9999));
self::$aStreams[$sHashName] = array($rStream, $iLiteralLen); self::$aStreams[$sHashName] = array($rStream, $iLiteralLen);
return fopen(self::STREAM_NAME.'://'.$sHashName, 'rb'); return \fopen(self::STREAM_NAME.'://'.$sHashName, 'rb');
} }
public function stream_open(string $sPath) : bool public function stream_open(string $sPath) : bool
@ -68,26 +68,25 @@ class Literal
$this->iSize = 0; $this->iSize = 0;
$this->rStream = false; $this->rStream = false;
$bResult = false; $aPath = \parse_url($sPath);
$aPath = parse_url($sPath);
if (isset($aPath['host']) && isset($aPath['scheme']) && if (isset($aPath['host']) && isset($aPath['scheme']) &&
0 < strlen($aPath['host']) && 0 < strlen($aPath['scheme']) && \strlen($aPath['host']) && \strlen($aPath['scheme']) &&
self::STREAM_NAME === $aPath['scheme']) self::STREAM_NAME === $aPath['scheme'])
{ {
$sHashName = $aPath['host']; $sHashName = $aPath['host'];
if (isset(self::$aStreams[$sHashName]) && if (isset(self::$aStreams[$sHashName]) &&
is_array(self::$aStreams[$sHashName]) && \is_array(self::$aStreams[$sHashName]) &&
2 === count(self::$aStreams[$sHashName])) 2 === \count(self::$aStreams[$sHashName]))
{ {
$this->rStream = self::$aStreams[$sHashName][0]; $this->rStream = self::$aStreams[$sHashName][0];
$this->iSize = self::$aStreams[$sHashName][1]; $this->iSize = self::$aStreams[$sHashName][1];
} }
$bResult = is_resource($this->rStream); return \is_resource($this->rStream);
} }
return $bResult; return false;
} }
public function stream_read(int $iCount) : string public function stream_read(int $iCount) : string
@ -104,7 +103,7 @@ class Literal
$iRead = $iCount; $iRead = $iCount;
while (0 < $iRead) while (0 < $iRead)
{ {
$sAddRead = fread($this->rStream, $iRead); $sAddRead = \fread($this->rStream, $iRead);
if (false === $sAddRead) if (false === $sAddRead)
{ {
$sReadResult = false; $sReadResult = false;
@ -112,8 +111,8 @@ class Literal
} }
$sReadResult .= $sAddRead; $sReadResult .= $sAddRead;
$iRead -= strlen($sAddRead); $iRead -= \strlen($sAddRead);
$this->iPos += strlen($sAddRead); $this->iPos += \strlen($sAddRead);
} }
if (false !== $sReadResult) if (false !== $sReadResult)

View file

@ -95,13 +95,13 @@ class SubStreams
$aPath = \parse_url($sPath); $aPath = \parse_url($sPath);
if (isset($aPath['host'], $aPath['scheme']) && if (isset($aPath['host'], $aPath['scheme']) &&
0 < \strlen($aPath['host']) && 0 < \strlen($aPath['scheme']) && \strlen($aPath['host']) && \strlen($aPath['scheme']) &&
self::STREAM_NAME === $aPath['scheme']) self::STREAM_NAME === $aPath['scheme'])
{ {
$sHashName = $aPath['host']; $sHashName = $aPath['host'];
if (isset(self::$aStreams[$sHashName]) && if (isset(self::$aStreams[$sHashName]) &&
\is_array(self::$aStreams[$sHashName]) && \is_array(self::$aStreams[$sHashName]) &&
0 < \count(self::$aStreams[$sHashName])) \count(self::$aStreams[$sHashName]))
{ {
$this->iIndex = 0; $this->iIndex = 0;
$this->iPos = 0; $this->iPos = 0;
@ -110,7 +110,7 @@ class SubStreams
$this->aSubStreams = self::$aStreams[$sHashName]; $this->aSubStreams = self::$aStreams[$sHashName];
} }
$bResult = 0 < \count($this->aSubStreams); $bResult = \count($this->aSubStreams);
} }
return $bResult; return $bResult;

View file

@ -58,7 +58,7 @@ class TempFile
$aPath = parse_url($sPath); $aPath = parse_url($sPath);
if (isset($aPath['host']) && isset($aPath['scheme']) && if (isset($aPath['host']) && isset($aPath['scheme']) &&
0 < strlen($aPath['host']) && 0 < strlen($aPath['scheme']) && \strlen($aPath['host']) && \strlen($aPath['scheme']) &&
self::STREAM_NAME === $aPath['scheme']) self::STREAM_NAME === $aPath['scheme'])
{ {
$sHashName = $aPath['host']; $sHashName = $aPath['host'];

View file

@ -39,34 +39,34 @@ class Test
*/ */
public static function CreateStream(string $sRawResponse) public static function CreateStream(string $sRawResponse)
{ {
if (!in_array(self::STREAM_NAME, stream_get_wrappers())) if (!\in_array(self::STREAM_NAME, \stream_get_wrappers()))
{ {
stream_wrapper_register(self::STREAM_NAME, '\MailSo\Base\StreamWrappers\Test'); \stream_wrapper_register(self::STREAM_NAME, '\MailSo\Base\StreamWrappers\Test');
} }
$sHashName = md5(microtime(true).rand(1000, 9999)); $sHashName = \md5(\microtime(true).\rand(1000, 9999));
$rConnect = fopen('php://memory', 'r+b'); $rConnect = \fopen('php://memory', 'r+b');
fwrite($rConnect, $sRawResponse); \fwrite($rConnect, $sRawResponse);
fseek($rConnect, 0); \fseek($rConnect, 0);
self::$aStreams[$sHashName] = $rConnect; self::$aStreams[$sHashName] = $rConnect;
return fopen(self::STREAM_NAME.'://'.$sHashName, 'r+b'); return \fopen(self::STREAM_NAME.'://'.$sHashName, 'r+b');
} }
public function stream_open(string $sPath) : bool public function stream_open(string $sPath) : bool
{ {
$bResult = false; $bResult = false;
$aPath = parse_url($sPath); $aPath = \parse_url($sPath);
if (isset($aPath['host']) && isset($aPath['scheme']) && if (isset($aPath['host']) && isset($aPath['scheme']) &&
0 < strlen($aPath['host']) && 0 < strlen($aPath['scheme']) && \strlen($aPath['host']) && \strlen($aPath['scheme']) &&
self::STREAM_NAME === $aPath['scheme']) self::STREAM_NAME === $aPath['scheme'])
{ {
$sHashName = $aPath['host']; $sHashName = $aPath['host'];
if (isset(self::$aStreams[$sHashName]) && if (isset(self::$aStreams[$sHashName]) &&
is_resource(self::$aStreams[$sHashName])) \is_resource(self::$aStreams[$sHashName]))
{ {
$this->rReadSream = self::$aStreams[$sHashName]; $this->rReadSream = self::$aStreams[$sHashName];
$bResult = true; $bResult = true;
@ -78,27 +78,27 @@ class Test
public function stream_read(int $iCount) : string public function stream_read(int $iCount) : string
{ {
return fread($this->rReadSream, $iCount); return \fread($this->rReadSream, $iCount);
} }
public function stream_write(string $sInputString) : int public function stream_write(string $sInputString) : int
{ {
return strlen($sInputString); return \strlen($sInputString);
} }
public function stream_tell() : int public function stream_tell() : int
{ {
return ftell($this->rReadSream); return \ftell($this->rReadSream);
} }
public function stream_eof() : bool public function stream_eof() : bool
{ {
return feof($this->rReadSream); return \feof($this->rReadSream);
} }
public function stream_stat() : array public function stream_stat() : array
{ {
return fstat($this->rReadSream); return \fstat($this->rReadSream);
} }
public function stream_seek() : bool public function stream_seek() : bool

View file

@ -152,7 +152,7 @@ END;
$aSupportedEncodings = \array_map('strtoupper', \array_unique( $aSupportedEncodings = \array_map('strtoupper', \array_unique(
\array_merge( \array_merge(
$aSupportedEncodings, $aSupportedEncodings,
array_merge( \array_merge(
...\array_map( ...\array_map(
'mb_encoding_aliases', 'mb_encoding_aliases',
$aSupportedEncodings $aSupportedEncodings
@ -1005,7 +1005,7 @@ END;
$iNow = $iNow ?: \time(); $iNow = $iNow ?: \time();
$iFileCount = 0; $iFileCount = 0;
$sTempPath = rtrim($sTempPath, '\\/'); $sTempPath = \rtrim($sTempPath, '\\/');
if (\is_dir($sTempPath)) if (\is_dir($sTempPath))
{ {
$rDirH = \opendir($sTempPath); $rDirH = \opendir($sTempPath);
@ -1055,7 +1055,7 @@ END;
{ {
$bResult = true; $bResult = true;
$sTempPath = rtrim($sTempPath, '\\/'); $sTempPath = \rtrim($sTempPath, '\\/');
if (\is_dir($sTempPath)) if (\is_dir($sTempPath))
{ {
$rDirH = \opendir($sTempPath); $rDirH = \opendir($sTempPath);
@ -1105,7 +1105,7 @@ END;
public static function Utf8Clear(?string $sUtfString, string $sReplaceOn = '') : string public static function Utf8Clear(?string $sUtfString, string $sReplaceOn = '') : string
{ {
if (!strlen($sUtfString)) if (!\strlen($sUtfString))
{ {
return ''; return '';
} }

View file

@ -79,7 +79,7 @@ class CacheClient
{ {
$iTimer = 0; $iTimer = 0;
$sValue = $this->Get($sKey.'/TIMER'); $sValue = $this->Get($sKey.'/TIMER');
if (0 < strlen($sValue) && is_numeric($sValue)) if (\strlen($sValue) && is_numeric($sValue))
{ {
$iTimer = (int) $sValue; $iTimer = (int) $sValue;
} }
@ -116,7 +116,7 @@ class CacheClient
public function SetCacheIndex(string $sCacheIndex) : self public function SetCacheIndex(string $sCacheIndex) : self
{ {
$this->sCacheIndex = 0 < \strlen($sCacheIndex) ? "\x0".$sCacheIndex : ''; $this->sCacheIndex = \strlen($sCacheIndex) ? "\x0".$sCacheIndex : '';
return $this; return $this;
} }

View file

@ -196,7 +196,7 @@ abstract class Driver
protected function getTypedPrefix(int $iType, string $sName = '') : string protected function getTypedPrefix(int $iType, string $sName = '') : string
{ {
$sName = 0 < \strlen($sName) ? $sName : $this->sName; $sName = \strlen($sName) ? $sName : $this->sName;
return isset($this->aPrefixes[$iType]) ? $sName.$this->aPrefixes[$iType].': ' : ''; return isset($this->aPrefixes[$iType]) ? $sName.$this->aPrefixes[$iType].': ' : '';
} }

View file

@ -93,7 +93,7 @@ class Logger extends \MailSo\Base\Collection
public function AddSecret(string $sWord) : void public function AddSecret(string $sWord) : void
{ {
if (0 < \strlen(\trim($sWord))) if (\strlen(\trim($sWord)))
{ {
$this->aSecretWords[] = $sWord; $this->aSecretWords[] = $sWord;
$this->aSecretWords = \array_unique($this->aSecretWords); $this->aSecretWords = \array_unique($this->aSecretWords);
@ -181,7 +181,7 @@ class Logger extends \MailSo\Base\Collection
$aLoggers = array(); $aLoggers = array();
$iResult = 1; $iResult = 1;
if ($bSearchSecretWords && !$this->bShowSecter && 0 < \count($this->aSecretWords)) if ($bSearchSecretWords && !$this->bShowSecter && \count($this->aSecretWords))
{ {
$sDesc = \str_replace($this->aSecretWords, '*******', $sDesc); $sDesc = \str_replace($this->aSecretWords, '*******', $sDesc);
} }

View file

@ -78,7 +78,7 @@ class Attachment implements \JsonSerializable
{ {
$sFileName = 'calendar'.$this->MimeIndex().'.ics'; $sFileName = 'calendar'.$this->MimeIndex().'.ics';
} }
else if (0 < \strlen($sMimeType)) else if (\strlen($sMimeType))
{ {
$sFileName = \str_replace('/', $this->MimeIndex().'.', $sMimeType); $sFileName = \str_replace('/', $this->MimeIndex().'.', $sMimeType);
} }

View file

@ -329,13 +329,13 @@ class Message implements \JsonSerializable
\MailSo\Mime\Enumerations\Parameter::CHARSET \MailSo\Mime\Enumerations\Parameter::CHARSET
); );
if (0 < \strlen($sContentTypeCharset)) if (\strlen($sContentTypeCharset))
{ {
$sCharset = $sContentTypeCharset; $sCharset = $sContentTypeCharset;
$sCharset = \MailSo\Base\Utils::NormalizeCharset($sCharset); $sCharset = \MailSo\Base\Utils::NormalizeCharset($sCharset);
} }
if (0 < \strlen($sCharset)) if (\strlen($sCharset))
{ {
$oHeaders->SetParentCharset($sCharset); $oHeaders->SetParentCharset($sCharset);
} }
@ -394,7 +394,7 @@ class Message implements \JsonSerializable
{ {
$sPriority = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_PRIORITY); $sPriority = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_PRIORITY);
} }
if (0 < \strlen($sPriority)) if (\strlen($sPriority))
{ {
switch (\str_replace(' ', '', \strtolower($sPriority))) switch (\str_replace(' ', '', \strtolower($sPriority)))
{ {
@ -485,7 +485,7 @@ class Message implements \JsonSerializable
} }
$sDraftInfo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_DRAFT_INFO); $sDraftInfo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_DRAFT_INFO);
if (0 < \strlen($sDraftInfo)) { if (\strlen($sDraftInfo)) {
$sType = ''; $sType = '';
$sFolder = ''; $sFolder = '';
$iUid = 0; $iUid = 0;
@ -506,7 +506,7 @@ class Message implements \JsonSerializable
} }
} }
if (0 < \strlen($sType) && 0 < \strlen($sFolder) && $iUid) { if (\strlen($sType) && \strlen($sFolder) && $iUid) {
$this->aDraftInfo = array($sType, $iUid, $sFolder); $this->aDraftInfo = array($sType, $iUid, $sFolder);
} }
} }
@ -544,7 +544,7 @@ class Message implements \JsonSerializable
$aPgpSignatureParts = $oBodyStructure ? $oBodyStructure->SearchByContentType('application/pgp-signature') : null; $aPgpSignatureParts = $oBodyStructure ? $oBodyStructure->SearchByContentType('application/pgp-signature') : null;
if ($this->bPgpSigned = !empty($aPgpSignatureParts)) { if ($this->bPgpSigned = !empty($aPgpSignatureParts)) {
$sPgpSignatureText = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::BODY.'['.$aPgpSignatureParts[0]->PartID().']'); $sPgpSignatureText = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::BODY.'['.$aPgpSignatureParts[0]->PartID().']');
if (\is_string($sPgpSignatureText) && 0 < \strlen($sPgpSignatureText) && 0 < \strpos($sPgpSignatureText, 'BEGIN PGP SIGNATURE')) { if (\is_string($sPgpSignatureText) && \strlen($sPgpSignatureText) && 0 < \strpos($sPgpSignatureText, 'BEGIN PGP SIGNATURE')) {
$this->sPgpSignature = \trim($sPgpSignatureText); $this->sPgpSignature = \trim($sPgpSignatureText);
$this->sPgpSignatureMicAlg = (string) $oHeaders->ParameterValue(\MailSo\Mime\Enumerations\Header::CONTENT_TYPE, 'micalg'); $this->sPgpSignatureMicAlg = (string) $oHeaders->ParameterValue(\MailSo\Mime\Enumerations\Header::CONTENT_TYPE, 'micalg');
} }
@ -572,13 +572,13 @@ class Message implements \JsonSerializable
if (null === $sText) if (null === $sText)
{ {
$sText = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::BODY.'['.$oPart->PartID().']<0>'); $sText = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::BODY.'['.$oPart->PartID().']<0>');
if (\is_string($sText) && 0 < \strlen($sText)) if (\is_string($sText) && \strlen($sText))
{ {
$this->bTextPartIsTrimmed = true; $this->bTextPartIsTrimmed = true;
} }
} }
if (\is_string($sText) && 0 < \strlen($sText)) if (\is_string($sText) && \strlen($sText))
{ {
$sTextCharset = $oPart->Charset(); $sTextCharset = $oPart->Charset();
if (empty($sTextCharset)) if (empty($sTextCharset))
@ -608,7 +608,7 @@ class Message implements \JsonSerializable
} }
} }
if (0 < \count($aHtmlParts)) if (\count($aHtmlParts))
{ {
$this->sHtml = \implode('<br />', $aHtmlParts); $this->sHtml = \implode('<br />', $aHtmlParts);
} }
@ -632,7 +632,7 @@ class Message implements \JsonSerializable
if ($oBodyStructure) if ($oBodyStructure)
{ {
$aAttachmentsParts = $oBodyStructure->SearchAttachmentsParts(); $aAttachmentsParts = $oBodyStructure->SearchAttachmentsParts();
if ($aAttachmentsParts && 0 < count($aAttachmentsParts)) if ($aAttachmentsParts && \count($aAttachmentsParts))
{ {
$this->oAttachments = new AttachmentCollection; $this->oAttachments = new AttachmentCollection;
foreach ($aAttachmentsParts as /* @var $oAttachmentItem \MailSo\Imap\BodyStructure */ $oAttachmentItem) foreach ($aAttachmentsParts as /* @var $oAttachmentItem \MailSo\Imap\BodyStructure */ $oAttachmentItem)

View file

@ -138,6 +138,6 @@ class Attachment
public function IsLinked() : bool public function IsLinked() : bool
{ {
return $this->bIsLinked && 0 < \strlen($this->sCID); return $this->bIsLinked && \strlen($this->sCID);
} }
} }

View file

@ -42,7 +42,7 @@ class Email implements \JsonSerializable
*/ */
function __construct(string $sEmail, string $sDisplayName = '') function __construct(string $sEmail, string $sDisplayName = '')
{ {
if (!strlen(\trim($sEmail))) if (!\strlen(\trim($sEmail)))
{ {
throw new \MailSo\Base\Exceptions\InvalidArgumentException; throw new \MailSo\Base\Exceptions\InvalidArgumentException;
} }
@ -62,7 +62,7 @@ class Email implements \JsonSerializable
public static function Parse(string $sEmailAddress) : self public static function Parse(string $sEmailAddress) : self
{ {
$sEmailAddress = \MailSo\Base\Utils::Trim($sEmailAddress); $sEmailAddress = \MailSo\Base\Utils::Trim($sEmailAddress);
if (!strlen(\trim($sEmailAddress))) if (!\strlen(\trim($sEmailAddress)))
{ {
throw new \MailSo\Base\Exceptions\InvalidArgumentException; throw new \MailSo\Base\Exceptions\InvalidArgumentException;
} }
@ -242,10 +242,10 @@ class Email implements \JsonSerializable
} }
$sDisplayName = 0 === \strlen($sDisplayName) ? '' : '"'.$sDisplayName.'"'; $sDisplayName = 0 === \strlen($sDisplayName) ? '' : '"'.$sDisplayName.'"';
if (0 < \strlen($this->sEmail)) if (\strlen($this->sEmail))
{ {
$sReturn = $this->GetEmail($bIdn); $sReturn = $this->GetEmail($bIdn);
if (0 < \strlen($sDisplayName)) if (\strlen($sDisplayName))
{ {
$sReturn = $sDisplayName.' <'.$sReturn.'>'; $sReturn = $sDisplayName.' <'.$sReturn.'>';
} }

View file

@ -61,12 +61,12 @@ class Header
$this->sEncodedValueForReparse = ''; $this->sEncodedValueForReparse = '';
$this->oParameters = null; $this->oParameters = null;
if (0 < \strlen($sEncodedValueForReparse) && $this->IsReparsed()) if (\strlen($sEncodedValueForReparse) && $this->IsReparsed())
{ {
$this->sEncodedValueForReparse = \trim($sEncodedValueForReparse); $this->sEncodedValueForReparse = \trim($sEncodedValueForReparse);
} }
if (0 < \strlen($this->sFullValue) && $this->IsParameterized()) if (\strlen($this->sFullValue) && $this->IsParameterized())
{ {
$aRawExplode = \explode(';', $this->sFullValue, 2); $aRawExplode = \explode(';', $this->sFullValue, 2);
if (2 === \count($aRawExplode)) if (2 === \count($aRawExplode))
@ -93,7 +93,7 @@ class Header
} }
$aParts = \explode(':', \str_replace("\r", '', $sEncodedLines), 2); $aParts = \explode(':', \str_replace("\r", '', $sEncodedLines), 2);
if (isset($aParts[0]) && isset($aParts[1]) && 0 < \strlen($aParts[0]) && 0 < \strlen($aParts[1])) if (isset($aParts[0]) && isset($aParts[1]) && \strlen($aParts[0]) && \strlen($aParts[1]))
{ {
return new self( return new self(
\trim($aParts[0]), \trim($aParts[0]),
@ -128,7 +128,7 @@ class Header
public function SetParentCharset(string $sParentCharset) : Header public function SetParentCharset(string $sParentCharset) : Header
{ {
if ($this->sParentCharset !== $sParentCharset && $this->IsReparsed() && 0 < \strlen($this->sEncodedValueForReparse)) if ($this->sParentCharset !== $sParentCharset && $this->IsReparsed() && \strlen($this->sEncodedValueForReparse))
{ {
$this->initInputData( $this->initInputData(
$this->sName, $this->sName,
@ -221,11 +221,11 @@ class Header
{ {
$sValue = $this->Value(); $sValue = $this->Value();
if (!\MailSo\Base\Utils::IsAscii($sValue) && if (!\MailSo\Base\Utils::IsAscii($sValue) &&
0 < \strlen($this->sEncodedValueForReparse) && \strlen($this->sEncodedValueForReparse) &&
!\MailSo\Base\Utils::IsAscii($this->sEncodedValueForReparse)) !\MailSo\Base\Utils::IsAscii($this->sEncodedValueForReparse))
{ {
$sValueCharset = \MailSo\Base\Utils::CharsetDetect($this->sEncodedValueForReparse); $sValueCharset = \MailSo\Base\Utils::CharsetDetect($this->sEncodedValueForReparse);
if (0 < \strlen($sValueCharset)) if (\strlen($sValueCharset))
{ {
$this->SetParentCharset($sValueCharset); $this->SetParentCharset($sValueCharset);
$sValue = $this->Value(); $sValue = $this->Value();

View file

@ -81,7 +81,7 @@ class HeaderCollection extends \MailSo\Base\Collection
{ {
$oResult = null; $oResult = null;
$sValue = $this->ValueByName($sHeaderName, $bCharsetAutoDetect); $sValue = $this->ValueByName($sHeaderName, $bCharsetAutoDetect);
if (0 < \strlen($sValue)) { if (\strlen($sValue)) {
$oResult = new EmailCollection($sValue); $oResult = new EmailCollection($sValue);
} }
return $oResult && 0 < $oResult->Count() ? $oResult : null; return $oResult && 0 < $oResult->Count() ? $oResult : null;
@ -144,7 +144,7 @@ class HeaderCollection extends \MailSo\Base\Collection
$sName = null; $sName = null;
$sValue = null; $sValue = null;
foreach ($aHeaders as $sHeadersValue) { foreach ($aHeaders as $sHeadersValue) {
if (0 === strlen($sHeadersValue)) { if (!\strlen($sHeadersValue)) {
continue; continue;
} }
@ -218,7 +218,7 @@ class HeaderCollection extends \MailSo\Base\Collection
$aResult = array(); $aResult = array();
$aHeaders = $this->ValuesByName(Enumerations\Header::AUTHENTICATION_RESULTS); $aHeaders = $this->ValuesByName(Enumerations\Header::AUTHENTICATION_RESULTS);
if (0 < \count($aHeaders)) if (\count($aHeaders))
{ {
foreach ($aHeaders as $sHeaderValue) foreach ($aHeaders as $sHeaderValue)
{ {

View file

@ -161,7 +161,7 @@ class Message
public function SetCustomHeader(string $sHeaderName, string $sValue) : self public function SetCustomHeader(string $sHeaderName, string $sValue) : self
{ {
$sHeaderName = \trim($sHeaderName); $sHeaderName = \trim($sHeaderName);
if (0 < \strlen($sHeaderName)) if (\strlen($sHeaderName))
{ {
$this->aHeadersValue[$sHeaderName] = $sValue; $this->aHeadersValue[$sHeaderName] = $sValue;
} }
@ -220,7 +220,7 @@ class Message
break; break;
} }
if (0 < \strlen($sResult)) if (\strlen($sResult))
{ {
$this->aHeadersValue[Enumerations\Header::X_PRIORITY] = $sResult; $this->aHeadersValue[Enumerations\Header::X_PRIORITY] = $sResult;
} }
@ -244,7 +244,7 @@ class Message
break; break;
} }
if (0 < \strlen($sResult)) if (\strlen($sResult))
{ {
$this->aHeadersValue[Enumerations\Header::SENSITIVITY] = $sResult; $this->aHeadersValue[Enumerations\Header::SENSITIVITY] = $sResult;
} }
@ -275,7 +275,7 @@ class Message
public function SetDate(int $iDateTime) : self public function SetDate(int $iDateTime) : self
{ {
$this->aHeadersValue[Enumerations\Header::DATE] = gmdate('r', $iDateTime); $this->aHeadersValue[Enumerations\Header::DATE] = \gmdate('r', $iDateTime);
return $this; return $this;
} }
@ -348,7 +348,7 @@ class Message
private function generateNewBoundary() : string private function generateNewBoundary() : string
{ {
return '--='.\MailSo\Config::$BoundaryPrefix. return '--='.\MailSo\Config::$BoundaryPrefix.
\rand(100, 999).'_'.rand(100000000, 999999999).'.'.\time(); \rand(100, 999).'_'.\rand(100000000, 999999999).'.'.\time();
} }
private function generateNewMessageId(string $sHostName = '') : string private function generateNewMessageId(string $sHostName = '') : string
@ -384,7 +384,7 @@ class Message
$oContentTypeParameters = null; $oContentTypeParameters = null;
$oContentDispositionParameters = null; $oContentDispositionParameters = null;
if (0 < strlen(trim($sFileName))) if (\strlen(\trim($sFileName)))
{ {
$oContentTypeParameters = $oContentTypeParameters =
(new ParameterCollection)->Add(new Parameter( (new ParameterCollection)->Add(new Parameter(
@ -409,14 +409,14 @@ class Message
) )
); );
if (0 < strlen($sCID)) if (\strlen($sCID))
{ {
$oAttachmentPart->Headers->append( $oAttachmentPart->Headers->append(
new Header(Enumerations\Header::CONTENT_ID, $sCID) new Header(Enumerations\Header::CONTENT_ID, $sCID)
); );
} }
if (0 < strlen($sContentLocation)) if (\strlen($sContentLocation))
{ {
$oAttachmentPart->Headers->append( $oAttachmentPart->Headers->append(
new Header(Enumerations\Header::CONTENT_LOCATION, $sContentLocation) new Header(Enumerations\Header::CONTENT_LOCATION, $sContentLocation)
@ -425,7 +425,7 @@ class Message
$oAttachmentPart->Body = $oAttachment->Resource(); $oAttachmentPart->Body = $oAttachment->Resource();
if ('message/rfc822' !== strtolower($oAttachment->ContentType())) if ('message/rfc822' !== \strtolower($oAttachment->ContentType()))
{ {
$oAttachmentPart->Headers->append( $oAttachmentPart->Headers->append(
new Header( new Header(
@ -434,7 +434,7 @@ class Message
) )
); );
if (is_resource($oAttachmentPart->Body)) if (\is_resource($oAttachmentPart->Body))
{ {
if (!\MailSo\Base\StreamWrappers\Binary::IsStreamRemembed($oAttachmentPart->Body)) if (!\MailSo\Base\StreamWrappers\Binary::IsStreamRemembed($oAttachmentPart->Body))
{ {
@ -465,7 +465,7 @@ class Message
\MailSo\Base\Enumerations\Charset::UTF_8) \MailSo\Base\Enumerations\Charset::UTF_8)
); );
if (isset($aAlternativeData[3]) && \is_array($aAlternativeData[3]) && 0 < \count($aAlternativeData[3])) if (isset($aAlternativeData[3]) && \is_array($aAlternativeData[3]) && \count($aAlternativeData[3]))
{ {
foreach ($aAlternativeData[3] as $sName => $sValue) foreach ($aAlternativeData[3] as $sName => $sValue)
{ {
@ -481,18 +481,18 @@ class Message
$oAlternativePart->Body = null; $oAlternativePart->Body = null;
if (isset($aAlternativeData[1])) if (isset($aAlternativeData[1]))
{ {
if (is_resource($aAlternativeData[1])) if (\is_resource($aAlternativeData[1]))
{ {
$oAlternativePart->Body = $aAlternativeData[1]; $oAlternativePart->Body = $aAlternativeData[1];
} }
else if (is_string($aAlternativeData[1]) && 0 < strlen($aAlternativeData[1])) else if (\is_string($aAlternativeData[1]) && \strlen($aAlternativeData[1]))
{ {
$oAlternativePart->Body = $oAlternativePart->Body =
\MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString($aAlternativeData[1]); \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString($aAlternativeData[1]);
} }
} }
if (isset($aAlternativeData[2]) && 0 < strlen($aAlternativeData[2])) if (isset($aAlternativeData[2]) && \strlen($aAlternativeData[2]))
{ {
$oAlternativePart->Headers->append( $oAlternativePart->Headers->append(
new Header(Enumerations\Header::CONTENT_TRANSFER_ENCODING, new Header(Enumerations\Header::CONTENT_TRANSFER_ENCODING,
@ -500,7 +500,7 @@ class Message
) )
); );
if (is_resource($oAlternativePart->Body)) if (\is_resource($oAlternativePart->Body))
{ {
if (!\MailSo\Base\StreamWrappers\Binary::IsStreamRemembed($oAlternativePart->Body)) if (!\MailSo\Base\StreamWrappers\Binary::IsStreamRemembed($oAlternativePart->Body))
{ {
@ -514,7 +514,7 @@ class Message
} }
} }
if (!is_resource($oAlternativePart->Body)) if (!\is_resource($oAlternativePart->Body))
{ {
$oAlternativePart->Body = $oAlternativePart->Body =
\MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(''); \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString('');
@ -554,7 +554,7 @@ class Message
} }
} }
else if (1 === count($this->aAlternativeParts)) else if (1 === \count($this->aAlternativeParts))
{ {
$oAlternativePart = $this->createNewMessageAlternativePartBody($this->aAlternativeParts[0]); $oAlternativePart = $this->createNewMessageAlternativePartBody($this->aAlternativeParts[0]);
if ($oAlternativePart) if ($oAlternativePart)
@ -574,7 +574,7 @@ class Message
else else
{ {
$aAttachments = $this->oAttachmentCollection->getArrayCopy(); $aAttachments = $this->oAttachmentCollection->getArrayCopy();
if (1 === count($aAttachments) && isset($aAttachments[0])) if (1 === \count($aAttachments) && isset($aAttachments[0]))
{ {
$this->oAttachmentCollection->Clear(); $this->oAttachmentCollection->Clear();
@ -594,7 +594,7 @@ class Message
$oResultPart = null; $oResultPart = null;
$aAttachments = $this->oAttachmentCollection->LinkedAttachments(); $aAttachments = $this->oAttachmentCollection->LinkedAttachments();
if (0 < count($aAttachments)) if (\count($aAttachments))
{ {
$oResultPart = new Part; $oResultPart = new Part;
@ -629,7 +629,7 @@ class Message
$oResultPart = null; $oResultPart = null;
$aAttachments = $this->oAttachmentCollection->UnlinkedAttachments(); $aAttachments = $this->oAttachmentCollection->UnlinkedAttachments();
if (0 < count($aAttachments)) if (\count($aAttachments))
{ {
$oResultPart = new Part; $oResultPart = new Part;

View file

@ -75,7 +75,7 @@ class Parameter
public function ToString(bool $bConvertSpecialsName = false) : string public function ToString(bool $bConvertSpecialsName = false) : string
{ {
$sResult = ''; $sResult = '';
if (0 < strlen($this->sName)) if (\strlen($this->sName))
{ {
$sResult = $this->sName.'='; $sResult = $this->sName.'=';
if ($bConvertSpecialsName && in_array(strtolower($this->sName), array( if ($bConvertSpecialsName && in_array(strtolower($this->sName), array(

View file

@ -21,7 +21,7 @@ class ParameterCollection extends \MailSo\Base\Collection
{ {
parent::__construct(); parent::__construct();
if (0 < \strlen($sRawParams)) if (\strlen($sRawParams))
{ {
$this->Parse($sRawParams); $this->Parse($sRawParams);
} }
@ -70,13 +70,13 @@ class ParameterCollection extends \MailSo\Base\Collection
foreach ($this as $oParam) foreach ($this as $oParam)
{ {
$sLine = $oParam->ToString($bConvertSpecialsName); $sLine = $oParam->ToString($bConvertSpecialsName);
if (0 < \strlen($sLine)) if (\strlen($sLine))
{ {
$aResult[] = $sLine; $aResult[] = $sLine;
} }
} }
return 0 < \count($aResult) ? \implode('; ', $aResult) : ''; return \count($aResult) ? \implode('; ', $aResult) : '';
} }
private function reParseParameters() : void private function reParseParameters() : void
@ -93,7 +93,7 @@ class ParameterCollection extends \MailSo\Base\Collection
$sParamName = $oParam->Name(); $sParamName = $oParam->Name();
if (\preg_match('/([^\*]+)\*([\d]{1,2})\*/', $sParamName, $aMatch) && isset($aMatch[1], $aMatch[2]) if (\preg_match('/([^\*]+)\*([\d]{1,2})\*/', $sParamName, $aMatch) && isset($aMatch[1], $aMatch[2])
&& 0 < \strlen($aMatch[1]) && \is_numeric($aMatch[2])) && \strlen($aMatch[1]) && \is_numeric($aMatch[2]))
{ {
if (!isset($aPreParams[$aMatch[1]])) if (!isset($aPreParams[$aMatch[1]]))
{ {
@ -105,7 +105,7 @@ class ParameterCollection extends \MailSo\Base\Collection
if (false !== \strpos($sValue, "''")) if (false !== \strpos($sValue, "''"))
{ {
$aValueParts = \explode("''", $sValue, 2); $aValueParts = \explode("''", $sValue, 2);
if (\is_array($aValueParts) && 2 === \count($aValueParts) && 0 < \strlen($aValueParts[1])) if (\is_array($aValueParts) && 2 === \count($aValueParts) && \strlen($aValueParts[1]))
{ {
$sCharset = $aValueParts[0]; $sCharset = $aValueParts[0];
$sValue = $aValueParts[1]; $sValue = $aValueParts[1];
@ -125,7 +125,7 @@ class ParameterCollection extends \MailSo\Base\Collection
if (false !== \strpos($sValue, "''")) if (false !== \strpos($sValue, "''"))
{ {
$aValueParts = \explode("''", $sValue, 2); $aValueParts = \explode("''", $sValue, 2);
if (\is_array($aValueParts) && 2 === \count($aValueParts) && 0 < \strlen($aValueParts[1])) if (\is_array($aValueParts) && 2 === \count($aValueParts) && \strlen($aValueParts[1]))
{ {
$sCharset = $aValueParts[0]; $sCharset = $aValueParts[0];
$sValue = $aValueParts[1]; $sValue = $aValueParts[1];
@ -146,7 +146,7 @@ class ParameterCollection extends \MailSo\Base\Collection
$sResult = \implode(\array_values($aValues)); $sResult = \implode(\array_values($aValues));
$sResult = \urldecode($sResult); $sResult = \urldecode($sResult);
if (0 < \strlen($sCharset)) if (\strlen($sCharset))
{ {
$sResult = \MailSo\Base\Utils::ConvertEncoding($sResult, $sResult = \MailSo\Base\Utils::ConvertEncoding($sResult,
$sCharset, \MailSo\Base\Enumerations\Charset::UTF_8); $sCharset, \MailSo\Base\Enumerations\Charset::UTF_8);

View file

@ -96,7 +96,7 @@ class Part
public function ParentCharset() : string public function ParentCharset() : string
{ {
return (0 < \strlen($this->sCharset)) ? $this->sParentCharset : self::$DefaultCharset; return (\strlen($this->sCharset)) ? $this->sParentCharset : self::$DefaultCharset;
} }
public function SetParentCharset(string $sParentCharset) : self public function SetParentCharset(string $sParentCharset) : self
@ -122,14 +122,14 @@ class Part
public function HeaderCharset() : string public function HeaderCharset() : string
{ {
return ($this->Headers) ? trim(strtolower($this->Headers->ParameterValue( return ($this->Headers) ? \trim(\strtolower($this->Headers->ParameterValue(
Enumerations\Header::CONTENT_TYPE, Enumerations\Header::CONTENT_TYPE,
Enumerations\Parameter::CHARSET))) : ''; Enumerations\Parameter::CHARSET))) : '';
} }
public function HeaderBoundary() : string public function HeaderBoundary() : string
{ {
return ($this->Headers) ? trim($this->Headers->ParameterValue( return ($this->Headers) ? \trim($this->Headers->ParameterValue(
Enumerations\Header::CONTENT_TYPE, Enumerations\Header::CONTENT_TYPE,
Enumerations\Parameter::BOUNDARY)) : ''; Enumerations\Parameter::BOUNDARY)) : '';
} }
@ -137,26 +137,26 @@ class Part
public function ContentType() : string public function ContentType() : string
{ {
return ($this->Headers) ? return ($this->Headers) ?
trim(strtolower($this->Headers->ValueByName( \trim(\strtolower($this->Headers->ValueByName(
Enumerations\Header::CONTENT_TYPE))) : ''; Enumerations\Header::CONTENT_TYPE))) : '';
} }
public function ContentTransferEncoding() : string public function ContentTransferEncoding() : string
{ {
return ($this->Headers) ? return ($this->Headers) ?
trim(strtolower($this->Headers->ValueByName( \trim(\strtolower($this->Headers->ValueByName(
Enumerations\Header::CONTENT_TRANSFER_ENCODING))) : ''; Enumerations\Header::CONTENT_TRANSFER_ENCODING))) : '';
} }
public function ContentID() : string public function ContentID() : string
{ {
return ($this->Headers) ? trim($this->Headers->ValueByName( return ($this->Headers) ? \trim($this->Headers->ValueByName(
Enumerations\Header::CONTENT_ID)) : ''; Enumerations\Header::CONTENT_ID)) : '';
} }
public function ContentLocation() : string public function ContentLocation() : string
{ {
return ($this->Headers) ? trim($this->Headers->ValueByName( return ($this->Headers) ? \trim($this->Headers->ValueByName(
Enumerations\Header::CONTENT_LOCATION)) : ''; Enumerations\Header::CONTENT_LOCATION)) : '';
} }
@ -183,13 +183,13 @@ class Part
$sResult = ''; $sResult = '';
if ($this->Headers) if ($this->Headers)
{ {
$sResult = trim($this->Headers->ParameterValue( $sResult = \trim($this->Headers->ParameterValue(
Enumerations\Header::CONTENT_DISPOSITION, Enumerations\Header::CONTENT_DISPOSITION,
Enumerations\Parameter::FILENAME)); Enumerations\Parameter::FILENAME));
if (0 === strlen($sResult)) if (!\strlen($sResult))
{ {
$sResult = trim($this->Headers->ParameterValue( $sResult = \trim($this->Headers->ParameterValue(
Enumerations\Header::CONTENT_TYPE, Enumerations\Header::CONTENT_TYPE,
Enumerations\Parameter::NAME)); Enumerations\Parameter::NAME));
} }
@ -200,14 +200,14 @@ class Part
public function ParseFromFile(string $sFileName) : self public function ParseFromFile(string $sFileName) : self
{ {
$rStreamHandle = (file_exists($sFileName)) ? fopen($sFileName, 'rb') : false; $rStreamHandle = \file_exists($sFileName) ? \fopen($sFileName, 'rb') : false;
if (is_resource($rStreamHandle)) if (\is_resource($rStreamHandle))
{ {
$this->ParseFromStream($rStreamHandle); $this->ParseFromStream($rStreamHandle);
if (is_resource($rStreamHandle)) if (\is_resource($rStreamHandle))
{ {
fclose($rStreamHandle); \fclose($rStreamHandle);
} }
} }
@ -216,14 +216,14 @@ class Part
public function ParseFromString(string $sRawMessage) : self public function ParseFromString(string $sRawMessage) : self
{ {
$rStreamHandle = (0 < strlen($sRawMessage)) ? $rStreamHandle = \strlen($sRawMessage) ?
\MailSo\Base\ResourceRegistry::CreateMemoryResource() : false; \MailSo\Base\ResourceRegistry::CreateMemoryResource() : false;
if (is_resource($rStreamHandle)) if (\is_resource($rStreamHandle))
{ {
fwrite($rStreamHandle, $sRawMessage); \fwrite($rStreamHandle, $sRawMessage);
unset($sRawMessage); unset($sRawMessage);
fseek($rStreamHandle, 0); \fseek($rStreamHandle, 0);
$this->ParseFromStream($rStreamHandle); $this->ParseFromStream($rStreamHandle);
@ -260,7 +260,7 @@ class Part
foreach ($this->LineParts as /* @var $oMimePart Part */ $oMimePart) foreach ($this->LineParts as /* @var $oMimePart Part */ $oMimePart)
{ {
$sCharset = $oMimePart->HeaderCharset(); $sCharset = $oMimePart->HeaderCharset();
if (0 < strlen($sCharset)) if (\strlen($sCharset))
{ {
$sFirstNotNullCharset = $sCharset; $sFirstNotNullCharset = $sCharset;
break; break;
@ -268,7 +268,7 @@ class Part
} }
$sForceCharset = self::$ForceCharset; $sForceCharset = self::$ForceCharset;
if (0 < strlen($sForceCharset)) if (\strlen($sForceCharset))
{ {
foreach ($this->LineParts as /* @var $oMimePart Part */ $oMimePart) foreach ($this->LineParts as /* @var $oMimePart Part */ $oMimePart)
{ {
@ -284,7 +284,7 @@ class Part
foreach ($this->LineParts as /* @var $oMimePart Part */ $oMimePart) foreach ($this->LineParts as /* @var $oMimePart Part */ $oMimePart)
{ {
$sHeaderCharset = $oMimePart->HeaderCharset(); $sHeaderCharset = $oMimePart->HeaderCharset();
$oMimePart->SetParentCharset((0 < strlen($sHeaderCharset)) ? $sHeaderCharset : $sFirstNotNullCharset); $oMimePart->SetParentCharset((\strlen($sHeaderCharset)) ? $sHeaderCharset : $sFirstNotNullCharset);
$oMimePart->Headers->SetParentCharset($sHeaderCharset); $oMimePart->Headers->SetParentCharset($sHeaderCharset);
} }
} }
@ -315,11 +315,11 @@ class Part
$sBuffer = ''; $sBuffer = '';
} }
if (!$bIsOef && !feof($rStreamHandle)) if (!$bIsOef && !\feof($rStreamHandle))
{ {
if (!$bNotFirstRead) if (!$bNotFirstRead)
{ {
$sBuffer = fread($rStreamHandle, $this->iParseBuffer); $sBuffer = \fread($rStreamHandle, $this->iParseBuffer);
if (false === $sBuffer) if (false === $sBuffer)
{ {
break; break;
@ -332,7 +332,7 @@ class Part
$bNotFirstRead = false; $bNotFirstRead = false;
} }
} }
else if ($bIsOef && 0 === strlen($sBuffer)) else if ($bIsOef && !\strlen($sBuffer))
{ {
break; break;
} }
@ -347,28 +347,28 @@ class Part
if (self::POS_HEADERS === $iParsePosition) if (self::POS_HEADERS === $iParsePosition)
{ {
$iEndLen = 4; $iEndLen = 4;
$iPos = strpos($sCurrentLine, "\r\n\r\n", $iOffset); $iPos = \strpos($sCurrentLine, "\r\n\r\n", $iOffset);
if (false === $iPos) if (false === $iPos)
{ {
$iEndLen = 2; $iEndLen = 2;
$iPos = strpos($sCurrentLine, "\n\n", $iOffset); $iPos = \strpos($sCurrentLine, "\n\n", $iOffset);
} }
if (false !== $iPos) if (false !== $iPos)
{ {
$aHeadersLines[] = substr($sCurrentLine, $iOffset, $iPos + $iEndLen - $iOffset); $aHeadersLines[] = \substr($sCurrentLine, $iOffset, $iPos + $iEndLen - $iOffset);
$this->Headers->Parse(implode($aHeadersLines))->SetParentCharset($this->HeaderCharset()); $this->Headers->Parse(\implode($aHeadersLines))->SetParentCharset($this->HeaderCharset());
$aHeadersLines = array(); $aHeadersLines = array();
$oCallbackClass->InitMimePartHeader(); $oCallbackClass->InitMimePartHeader();
$sBoundary = $this->HeaderBoundary(); $sBoundary = $this->HeaderBoundary();
if (0 < strlen($sBoundary)) if (\strlen($sBoundary))
{ {
$sBoundary = '--'.$sBoundary; $sBoundary = '--'.$sBoundary;
$sCurrentBoundary = $sBoundary; $sCurrentBoundary = $sBoundary;
array_unshift($aBoundaryStack, $sBoundary); \array_unshift($aBoundaryStack, $sBoundary);
} }
$iOffset = $iPos + $iEndLen; $iOffset = $iPos + $iEndLen;
@ -377,10 +377,10 @@ class Part
} }
else else
{ {
$iBufferLen = strlen($sPrevBuffer); $iBufferLen = \strlen($sPrevBuffer);
if ($iBufferLen > $iOffset) if ($iBufferLen > $iOffset)
{ {
$aHeadersLines[] = substr($sPrevBuffer, $iOffset); $aHeadersLines[] = \substr($sPrevBuffer, $iOffset);
$iOffset = 0; $iOffset = 0;
} }
else else
@ -396,19 +396,19 @@ class Part
$sBoundaryLen = 0; $sBoundaryLen = 0;
$bIsBoundaryEnd = false; $bIsBoundaryEnd = false;
$bCurrentPartBody = false; $bCurrentPartBody = false;
$bIsBoundaryCheck = 0 < count($aBoundaryStack); $bIsBoundaryCheck = \count($aBoundaryStack);
foreach ($aBoundaryStack as $sKey => $sBoundary) foreach ($aBoundaryStack as $sKey => $sBoundary)
{ {
if (false !== ($iPos = strpos($sCurrentLine, $sBoundary, $iOffset))) if (false !== ($iPos = \strpos($sCurrentLine, $sBoundary, $iOffset)))
{ {
if ($sCurrentBoundary === $sBoundary) if ($sCurrentBoundary === $sBoundary)
{ {
$bCurrentPartBody = true; $bCurrentPartBody = true;
} }
$sBoundaryLen = strlen($sBoundary); $sBoundaryLen = \strlen($sBoundary);
if ('--' === substr($sCurrentLine, $iPos + $sBoundaryLen, 2)) if ('--' === \substr($sCurrentLine, $iPos + $sBoundaryLen, 2))
{ {
$sBoundaryLen += 2; $sBoundaryLen += 2;
$bIsBoundaryEnd = true; $bIsBoundaryEnd = true;
@ -423,7 +423,7 @@ class Part
if (false !== $iPos) if (false !== $iPos)
{ {
$oCallbackClass->WriteBody(substr($sCurrentLine, $iOffset, $iPos - $iOffset)); $oCallbackClass->WriteBody(\substr($sCurrentLine, $iOffset, $iPos - $iOffset));
$iOffset = $iPos; $iOffset = $iPos;
if ($bCurrentPartBody) if ($bCurrentPartBody)
@ -437,10 +437,10 @@ class Part
} }
else else
{ {
$iBufferLen = strlen($sPrevBuffer); $iBufferLen = \strlen($sPrevBuffer);
if ($iBufferLen > $iOffset) if ($iBufferLen > $iOffset)
{ {
$oCallbackClass->WriteBody(substr($sPrevBuffer, $iOffset)); $oCallbackClass->WriteBody(\substr($sPrevBuffer, $iOffset));
$iOffset = 0; $iOffset = 0;
} }
else else
@ -453,24 +453,24 @@ class Part
else if (self::POS_SUBPARTS === $iParsePosition) else if (self::POS_SUBPARTS === $iParsePosition)
{ {
$iPos = false; $iPos = false;
$sBoundaryLen = 0; $iBoundaryLen = 0;
$bIsBoundaryEnd = false; $bIsBoundaryEnd = false;
$bCurrentPartBody = false; $bCurrentPartBody = false;
$bIsBoundaryCheck = 0 < count($aBoundaryStack); $bIsBoundaryCheck = \count($aBoundaryStack);
foreach ($aBoundaryStack as $sKey => $sBoundary) foreach ($aBoundaryStack as $sKey => $sBoundary)
{ {
if (false !== ($iPos = strpos($sCurrentLine, $sBoundary, $iOffset))) if (false !== ($iPos = \strpos($sCurrentLine, $sBoundary, $iOffset)))
{ {
if ($sCurrentBoundary === $sBoundary) if ($sCurrentBoundary === $sBoundary)
{ {
$bCurrentPartBody = true; $bCurrentPartBody = true;
} }
$sBoundaryLen = strlen($sBoundary); $iBoundaryLen = \strlen($sBoundary);
if ('--' === substr($sCurrentLine, $iPos + $sBoundaryLen, 2)) if ('--' === \substr($sCurrentLine, $iPos + $iBoundaryLen, 2))
{ {
$sBoundaryLen += 2; $iBoundaryLen += 2;
$bIsBoundaryEnd = true; $bIsBoundaryEnd = true;
unset($aBoundaryStack[$sKey]); unset($aBoundaryStack[$sKey]);
$sCurrentBoundary = (isset($aBoundaryStack[$sKey + 1])) $sCurrentBoundary = (isset($aBoundaryStack[$sKey + 1]))
@ -482,7 +482,7 @@ class Part
if (false !== $iPos && $bCurrentPartBody) if (false !== $iPos && $bCurrentPartBody)
{ {
$iOffset = $iPos + $sBoundaryLen; $iOffset = $iPos + $iBoundaryLen;
$oSubPart = new self; $oSubPart = new self;
@ -505,15 +505,15 @@ class Part
} }
} }
if (0 < strlen($sPrevBuffer)) if (\strlen($sPrevBuffer))
{ {
if (self::POS_HEADERS === $iParsePosition) if (self::POS_HEADERS === $iParsePosition)
{ {
$aHeadersLines[] = ($iOffset < strlen($sPrevBuffer)) $aHeadersLines[] = ($iOffset < \strlen($sPrevBuffer))
? substr($sPrevBuffer, $iOffset) ? \substr($sPrevBuffer, $iOffset)
: $sPrevBuffer; : $sPrevBuffer;
$this->Headers->Parse(implode($aHeadersLines))->SetParentCharset($this->HeaderCharset()); $this->Headers->Parse(\implode($aHeadersLines))->SetParentCharset($this->HeaderCharset());
$aHeadersLines = array(); $aHeadersLines = array();
$oCallbackClass->InitMimePartHeader(); $oCallbackClass->InitMimePartHeader();
@ -522,16 +522,16 @@ class Part
{ {
if (!$bIsBoundaryCheck) if (!$bIsBoundaryCheck)
{ {
$oCallbackClass->WriteBody(($iOffset < strlen($sPrevBuffer)) $oCallbackClass->WriteBody(($iOffset < \strlen($sPrevBuffer))
? substr($sPrevBuffer, $iOffset) : $sPrevBuffer); ? \substr($sPrevBuffer, $iOffset) : $sPrevBuffer);
} }
} }
} }
else else
{ {
if (self::POS_HEADERS === $iParsePosition && 0 < count($aHeadersLines)) if (self::POS_HEADERS === $iParsePosition && \count($aHeadersLines))
{ {
$this->Headers->Parse(implode($aHeadersLines))->SetParentCharset($this->HeaderCharset()); $this->Headers->Parse(\implode($aHeadersLines))->SetParentCharset($this->HeaderCharset());
$aHeadersLines = array(); $aHeadersLines = array();
$oCallbackClass->InitMimePartHeader(); $oCallbackClass->InitMimePartHeader();
@ -579,12 +579,12 @@ class Part
if (0 < $this->SubParts->Count()) if (0 < $this->SubParts->Count())
{ {
$sBoundary = $this->HeaderBoundary(); $sBoundary = $this->HeaderBoundary();
if (0 < strlen($sBoundary)) if (\strlen($sBoundary))
{ {
$aSubStreams[] = '--'.$sBoundary.Enumerations\Constants::CRLF; $aSubStreams[] = '--'.$sBoundary.Enumerations\Constants::CRLF;
$rSubPartsStream = $this->SubParts->ToStream($sBoundary); $rSubPartsStream = $this->SubParts->ToStream($sBoundary);
if (is_resource($rSubPartsStream)) if (\is_resource($rSubPartsStream))
{ {
$aSubStreams[] = $rSubPartsStream; $aSubStreams[] = $rSubPartsStream;
} }

View file

@ -28,13 +28,13 @@ class PartCollection extends \MailSo\Base\Collection
*/ */
public function ToStream(string $sBoundary) public function ToStream(string $sBoundary)
{ {
if (0 < \strlen($sBoundary)) if (\strlen($sBoundary))
{ {
$aResult = array(); $aResult = array();
foreach ($this as $oPart) foreach ($this as $oPart)
{ {
if (0 < count($aResult)) if (\count($aResult))
{ {
$aResult[] = Enumerations\Constants::CRLF. $aResult[] = Enumerations\Constants::CRLF.
'--'.$sBoundary.Enumerations\Constants::CRLF; '--'.$sBoundary.Enumerations\Constants::CRLF;

View file

@ -326,7 +326,7 @@ abstract class NetClient
\MailSo\Log\Enumerations\Type::ERROR, true); \MailSo\Log\Enumerations\Type::ERROR, true);
} }
$bFake = 0 < \strlen($sFakeRaw); $bFake = \strlen($sFakeRaw);
$sRaw .= "\r\n"; $sRaw .= "\r\n";
if ($this->oLogger && $this->oLogger->IsShowSecter()) if ($this->oLogger && $this->oLogger->IsShowSecter())

View file

@ -223,7 +223,7 @@ class SmtpClient extends \MailSo\Net\NetClient
$sCmd = 'FROM:<'.$sFrom.'>'; $sCmd = 'FROM:<'.$sFrom.'>';
if (0 < \strlen($sSizeIfSupported) && \is_numeric($sSizeIfSupported) && $this->IsSupported('SIZE')) if (\strlen($sSizeIfSupported) && \is_numeric($sSizeIfSupported) && $this->IsSupported('SIZE'))
{ {
$sCmd .= ' SIZE='.$sSizeIfSupported; $sCmd .= ' SIZE='.$sSizeIfSupported;
} }
@ -515,7 +515,7 @@ class SmtpClient extends \MailSo\Net\NetClient
foreach ($this->aResults as $sLine) foreach ($this->aResults as $sLine)
{ {
$aMatch = array(); $aMatch = array();
if (\preg_match('/[\d]+[ \-](.+)$/', $sLine, $aMatch) && isset($aMatch[1]) && 0 < \strlen($aMatch[1])) if (\preg_match('/[\d]+[ \-](.+)$/', $sLine, $aMatch) && isset($aMatch[1]) && \strlen($aMatch[1]))
{ {
$sLine = \trim($aMatch[1]); $sLine = \trim($aMatch[1]);
$aLine = \preg_split('/[ =]/', $sLine, 2); $aLine = \preg_split('/[ =]/', $sLine, 2);
@ -525,7 +525,7 @@ class SmtpClient extends \MailSo\Net\NetClient
if (('AUTH' === $sCapa || 'SIZE' === $sCapa) && !empty($aLine[1])) if (('AUTH' === $sCapa || 'SIZE' === $sCapa) && !empty($aLine[1]))
{ {
$sSubLine = \trim(\strtoupper($aLine[1])); $sSubLine = \trim(\strtoupper($aLine[1]));
if (0 < \strlen($sSubLine)) if (\strlen($sSubLine))
{ {
if ('AUTH' === $sCapa) if ('AUTH' === $sCapa)
{ {

View file

@ -498,7 +498,7 @@ trait Admin
if ($sRep) if ($sRep)
{ {
$aRep = \json_decode($sRep); $aRep = \json_decode($sRep);
$bReal = \is_array($aRep) && 0 < \count($aRep); $bReal = \is_array($aRep) && \count($aRep);
if ($bReal) if ($bReal)
{ {
@ -514,7 +514,7 @@ trait Admin
else if ('' !== $sRep) else if ('' !== $sRep)
{ {
$aRep = \json_decode($sRep, false, 10); $aRep = \json_decode($sRep, false, 10);
$bReal = \is_array($aRep) && 0 < \count($aRep); $bReal = \is_array($aRep) && \count($aRep);
} }
return \is_array($aRep) ? $aRep : []; return \is_array($aRep) ? $aRep : [];

View file

@ -101,7 +101,7 @@ trait Contacts
$aFilteredUids = \array_filter(\array_map('intval', $aUids)); $aFilteredUids = \array_filter(\array_map('intval', $aUids));
$bResult = false; $bResult = false;
if (0 < \count($aFilteredUids) && $this->AddressBookProvider($oAccount)->IsActive()) if (\count($aFilteredUids) && $this->AddressBookProvider($oAccount)->IsActive())
{ {
$bResult = $this->AddressBookProvider($oAccount)->DeleteContacts($this->GetMainEmail($oAccount), $aFilteredUids); $bResult = $this->AddressBookProvider($oAccount)->DeleteContacts($this->GetMainEmail($oAccount), $aFilteredUids);
} }
@ -117,12 +117,12 @@ trait Contacts
$oAddressBookProvider = $this->AddressBookProvider($oAccount); $oAddressBookProvider = $this->AddressBookProvider($oAccount);
$sRequestUid = \trim($this->GetActionParam('RequestUid', '')); $sRequestUid = \trim($this->GetActionParam('RequestUid', ''));
if ($oAddressBookProvider && $oAddressBookProvider->IsActive() && 0 < \strlen($sRequestUid)) if ($oAddressBookProvider && $oAddressBookProvider->IsActive() && \strlen($sRequestUid))
{ {
$sUid = \trim($this->GetActionParam('Uid', '')); $sUid = \trim($this->GetActionParam('Uid', ''));
$oContact = null; $oContact = null;
if (0 < \strlen($sUid)) if (\strlen($sUid))
{ {
$oContact = $oAddressBookProvider->GetContactByID($this->GetMainEmail($oAccount), $sUid); $oContact = $oAddressBookProvider->GetContactByID($this->GetMainEmail($oAccount), $sUid);
} }
@ -130,7 +130,7 @@ trait Contacts
if (!$oContact) if (!$oContact)
{ {
$oContact = new \RainLoop\Providers\AddressBook\Classes\Contact(); $oContact = new \RainLoop\Providers\AddressBook\Classes\Contact();
if (0 < \strlen($sUid)) if (\strlen($sUid))
{ {
$oContact->IdContact = $sUid; $oContact->IdContact = $sUid;
} }

View file

@ -114,21 +114,21 @@ trait Folders
{ {
$mNewParent = \substr($mFolderNameToCreate, 0, $iPos); $mNewParent = \substr($mFolderNameToCreate, 0, $iPos);
$mNewFolderNameToCreate = \substr($mFolderNameToCreate, $iPos + 1); $mNewFolderNameToCreate = \substr($mFolderNameToCreate, $iPos + 1);
if (0 < \strlen($mNewFolderNameToCreate)) if (\strlen($mNewFolderNameToCreate))
{ {
$mFolderNameToCreate = $mNewFolderNameToCreate; $mFolderNameToCreate = $mNewFolderNameToCreate;
} }
if (0 < \strlen($mNewParent)) if (\strlen($mNewParent))
{ {
$sParent = 0 < \strlen($sParent) ? $sParent.$sDelimiter.$mNewParent : $mNewParent; $sParent = \strlen($sParent) ? $sParent.$sDelimiter.$mNewParent : $mNewParent;
} }
} }
$sFullNameToCheck = \MailSo\Base\Utils::ConvertEncoding($mFolderNameToCreate, $sFullNameToCheck = \MailSo\Base\Utils::ConvertEncoding($mFolderNameToCreate,
\MailSo\Base\Enumerations\Charset::UTF_8, \MailSo\Base\Enumerations\Charset::UTF_7_IMAP); \MailSo\Base\Enumerations\Charset::UTF_8, \MailSo\Base\Enumerations\Charset::UTF_7_IMAP);
if (0 < \strlen(\trim($sParent))) if (\strlen(\trim($sParent)))
{ {
$sFullNameToCheck = $sParent.$sDelimiter.$sFullNameToCheck; $sFullNameToCheck = $sParent.$sDelimiter.$sFullNameToCheck;
} }

View file

@ -301,7 +301,7 @@ trait Messages
} }
} }
if (0 < \count($aArrayToFrec)) if (\count($aArrayToFrec))
{ {
$oSettings = $this->SettingsProvider()->Load($oAccount); $oSettings = $this->SettingsProvider()->Load($oAccount);
@ -616,7 +616,7 @@ trait Messages
try try
{ {
$aAttachments = $this->GetActionParam('Attachments', array()); $aAttachments = $this->GetActionParam('Attachments', array());
if (\is_array($aAttachments) && 0 < \count($aAttachments)) if (\is_array($aAttachments) && \count($aAttachments))
{ {
$mResult = array(); $mResult = array();
foreach ($aAttachments as $sAttachment) foreach ($aAttachments as $sAttachment)
@ -758,7 +758,7 @@ trait Messages
$oSmtpClient->Rcpt($oEmail->GetEmail(), $bDsn); $oSmtpClient->Rcpt($oEmail->GetEmail(), $bDsn);
} }
if ($bAddHiddenRcpt && \is_array($aHiddenRcpt) && 0 < \count($aHiddenRcpt)) if ($bAddHiddenRcpt && \is_array($aHiddenRcpt) && \count($aHiddenRcpt))
{ {
foreach ($aHiddenRcpt as $sEmail) foreach ($aHiddenRcpt as $sEmail)
{ {
@ -1058,7 +1058,7 @@ trait Messages
} }
} }
if ($mFoundDataURL && \is_array($mFoundDataURL) && 0 < \count($mFoundDataURL)) if ($mFoundDataURL && \is_array($mFoundDataURL) && \count($mFoundDataURL))
{ {
foreach ($mFoundDataURL as $sCidHash => $sDataUrlString) foreach ($mFoundDataURL as $sCidHash => $sDataUrlString)
{ {

View file

@ -278,7 +278,7 @@ trait Raw
if ($sLoadedData) if ($sLoadedData)
{ {
if ($bIsRangeRequest && (0 < \strlen($sRangeStart) || 0 < \strlen($sRangeEnd))) if ($bIsRangeRequest && (\strlen($sRangeStart) || \strlen($sRangeEnd)))
{ {
$iFullContentLength = \strlen($sLoadedData); $iFullContentLength = \strlen($sLoadedData);

View file

@ -267,7 +267,7 @@ trait Response
if ($oAttachment) if ($oAttachment)
{ {
$sContentLocation = $oAttachment->ContentLocation(); $sContentLocation = $oAttachment->ContentLocation();
if ($sContentLocation && 0 < \strlen($sContentLocation)) if ($sContentLocation && \strlen($sContentLocation))
{ {
$aContentLocationUrls[] = $oAttachment->ContentLocation(); $aContentLocationUrls[] = $oAttachment->ContentLocation();
} }
@ -324,8 +324,8 @@ trait Response
unset($sHtml, $sPlain); unset($sHtml, $sPlain);
$mResult['HasExternals'] = $bHasExternals; $mResult['HasExternals'] = $bHasExternals;
$mResult['HasInternals'] = (\is_array($mFoundedCIDs) && 0 < \count($mFoundedCIDs)) || $mResult['HasInternals'] = (\is_array($mFoundedCIDs) && \count($mFoundedCIDs)) ||
(\is_array($mFoundedContentLocationUrls) && 0 < \count($mFoundedContentLocationUrls)); (\is_array($mFoundedContentLocationUrls) && \count($mFoundedContentLocationUrls));
$mResult['FoundedCIDs'] = $mFoundedCIDs; $mResult['FoundedCIDs'] = $mFoundedCIDs;
$mResult['Attachments'] = $this->responseObject($oAttachments, $sParent, \array_merge($aParameters, array( $mResult['Attachments'] = $this->responseObject($oAttachments, $sParent, \array_merge($aParameters, array(
'FoundedCIDs' => $mFoundedCIDs, 'FoundedCIDs' => $mFoundedCIDs,
@ -333,9 +333,9 @@ trait Response
))); )));
$mResult['ReadReceipt'] = $mResponse->ReadReceipt(); $mResult['ReadReceipt'] = $mResponse->ReadReceipt();
if (0 < \strlen($mResult['ReadReceipt']) && !$mResult['IsReadReceipt']) if (\strlen($mResult['ReadReceipt']) && !$mResult['IsReadReceipt'])
{ {
if (0 < \strlen($mResult['ReadReceipt'])) if (\strlen($mResult['ReadReceipt']))
{ {
try try
{ {
@ -348,7 +348,7 @@ trait Response
catch (\Throwable $oException) { unset($oException); } catch (\Throwable $oException) { unset($oException); }
} }
if (0 < \strlen($mResult['ReadReceipt']) && '1' === $this->Cacher($oAccount)->Get( if (\strlen($mResult['ReadReceipt']) && '1' === $this->Cacher($oAccount)->Get(
\RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $mResult['Folder'], $mResult['Uid']), '0')) \RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $mResult['Folder'], $mResult['Uid']), '0'))
{ {
$mResult['ReadReceipt'] = ''; $mResult['ReadReceipt'] = '';
@ -367,12 +367,12 @@ trait Response
} }
$mFoundedCIDs = isset($aParameters['FoundedCIDs']) && \is_array($aParameters['FoundedCIDs']) && $mFoundedCIDs = isset($aParameters['FoundedCIDs']) && \is_array($aParameters['FoundedCIDs']) &&
0 < \count($aParameters['FoundedCIDs']) ? \count($aParameters['FoundedCIDs']) ?
$aParameters['FoundedCIDs'] : null; $aParameters['FoundedCIDs'] : null;
$mFoundedContentLocationUrls = isset($aParameters['FoundedContentLocationUrls']) && $mFoundedContentLocationUrls = isset($aParameters['FoundedContentLocationUrls']) &&
\is_array($aParameters['FoundedContentLocationUrls']) && \is_array($aParameters['FoundedContentLocationUrls']) &&
0 < \count($aParameters['FoundedContentLocationUrls']) ? \count($aParameters['FoundedContentLocationUrls']) ?
$aParameters['FoundedContentLocationUrls'] : null; $aParameters['FoundedContentLocationUrls'] : null;
if ($mFoundedCIDs || $mFoundedContentLocationUrls) if ($mFoundedCIDs || $mFoundedContentLocationUrls)
@ -380,7 +380,7 @@ trait Response
$mFoundedCIDs = \array_merge($mFoundedCIDs ? $mFoundedCIDs : array(), $mFoundedCIDs = \array_merge($mFoundedCIDs ? $mFoundedCIDs : array(),
$mFoundedContentLocationUrls ? $mFoundedContentLocationUrls : array()); $mFoundedContentLocationUrls ? $mFoundedContentLocationUrls : array());
$mFoundedCIDs = 0 < \count($mFoundedCIDs) ? $mFoundedCIDs : null; $mFoundedCIDs = \count($mFoundedCIDs) ? $mFoundedCIDs : null;
} }
$mResult['IsLinked'] = ($mFoundedCIDs && \in_array(\trim(\trim($mResponse->Cid()), '<>'), $mFoundedCIDs)) $mResult['IsLinked'] = ($mFoundedCIDs && \in_array(\trim(\trim($mResponse->Cid()), '<>'), $mFoundedCIDs))

View file

@ -419,7 +419,7 @@ rl_email text NOT NULL DEFAULT \'\'
break; break;
} }
if (0 < \count($aQ)) if (\count($aQ))
{ {
try try
{ {

View file

@ -35,7 +35,7 @@ abstract class AbstractConfig
$sAdditionalFileName = \trim($sAdditionalFileName); $sAdditionalFileName = \trim($sAdditionalFileName);
$this->sAdditionalFile = \APP_PRIVATE_DATA.'configs/'.$sAdditionalFileName; $this->sAdditionalFile = \APP_PRIVATE_DATA.'configs/'.$sAdditionalFileName;
$this->sAdditionalFile = 0 < \strlen($sAdditionalFileName) && $this->sAdditionalFile = \strlen($sAdditionalFileName) &&
\file_exists($this->sAdditionalFile) ? $this->sAdditionalFile : ''; \file_exists($this->sAdditionalFile) ? $this->sAdditionalFile : '';
$this->sFileHeader = $sFileHeader; $this->sFileHeader = $sFileHeader;
@ -49,7 +49,7 @@ abstract class AbstractConfig
public function IsInited() : bool public function IsInited() : bool
{ {
return \is_array($this->aData) && 0 < \count($this->aData); return \is_array($this->aData) && \count($this->aData);
} }
/** /**
@ -186,7 +186,7 @@ abstract class AbstractConfig
} }
$aData = \RainLoop\Utils::CustomParseIniFile($this->sFile, true); $aData = \RainLoop\Utils::CustomParseIniFile($this->sFile, true);
if (0 < \count($aData)) if (\count($aData))
{ {
foreach ($aData as $sSectionKey => $aSectionValue) foreach ($aData as $sSectionKey => $aSectionValue)
{ {
@ -204,7 +204,7 @@ abstract class AbstractConfig
if (\file_exists($this->sAdditionalFile) && \is_readable($this->sAdditionalFile)) if (\file_exists($this->sAdditionalFile) && \is_readable($this->sAdditionalFile))
{ {
$aSubData = \RainLoop\Utils::CustomParseIniFile($this->sAdditionalFile, true); $aSubData = \RainLoop\Utils::CustomParseIniFile($this->sAdditionalFile, true);
if (\is_array($aSubData) && 0 < \count($aSubData)) if (\is_array($aSubData) && \count($aSubData))
{ {
foreach ($aSubData as $sSectionKey => $aSectionValue) foreach ($aSubData as $sSectionKey => $aSectionValue)
{ {
@ -295,7 +295,7 @@ abstract class AbstractConfig
$this->clearCache(); $this->clearCache();
return false !== \file_put_contents($this->sFile, return false !== \file_put_contents($this->sFile,
(0 < \strlen($this->sFileHeader) ? $this->sFileHeader : ''). (\strlen($this->sFileHeader) ? $this->sFileHeader : '').
$sNewLine.\implode($sNewLine, $aResultLines)); $sNewLine.\implode($sNewLine, $aResultLines));
} }
} }

View file

@ -19,11 +19,11 @@ class Application extends \RainLoop\Config\AbstractConfig
$bResult = parent::Load(); $bResult = parent::Load();
$this->aReplaceEnv = null; $this->aReplaceEnv = null;
if ((isset($_ENV) && \is_array($_ENV) && 0 < \count($_ENV)) || if ((isset($_ENV) && \is_array($_ENV) && \count($_ENV)) ||
(isset($_SERVER) && \is_array($_SERVER) && 0 < \count($_SERVER))) (isset($_SERVER) && \is_array($_SERVER) && \count($_SERVER)))
{ {
$sEnvNames = $this->Get('labs', 'replace_env_in_configuration', ''); $sEnvNames = $this->Get('labs', 'replace_env_in_configuration', '');
if (0 < \strlen($sEnvNames)) if (\strlen($sEnvNames))
{ {
$this->aReplaceEnv = \explode(',', $sEnvNames); $this->aReplaceEnv = \explode(',', $sEnvNames);
if (\is_array($this->aReplaceEnv)) if (\is_array($this->aReplaceEnv))
@ -93,7 +93,7 @@ class Application extends \RainLoop\Config\AbstractConfig
$this->SetPassword($sPassword); $this->SetPassword($sPassword);
return true; return true;
} }
return 0 < \strlen($sPassword) && \password_verify($sPassword, $sConfigPassword); return \strlen($sPassword) && \password_verify($sPassword, $sConfigPassword);
} }
public function Save() : bool public function Save() : bool

View file

@ -18,7 +18,7 @@ class Plugin extends \RainLoop\Config\AbstractConfig
private function convertConfigMap(array $aMap) : array private function convertConfigMap(array $aMap) : array
{ {
if (0 < \count($aMap)) if (\count($aMap))
{ {
$aResultMap = array(); $aResultMap = array();
foreach ($aMap as /* @var $oProperty \RainLoop\Plugins\Property */ $oProperty) foreach ($aMap as /* @var $oProperty \RainLoop\Plugins\Property */ $oProperty)
@ -31,7 +31,7 @@ class Plugin extends \RainLoop\Config\AbstractConfig
} }
} }
if (0 < \count($aResultMap)) if (\count($aResultMap))
{ {
return array( return array(
'plugin' => $aResultMap 'plugin' => $aResultMap

View file

@ -132,7 +132,7 @@ class Domain implements \JsonSerializable
{ {
$oDomain = null; $oDomain = null;
if (0 < \strlen($sName) && 0 < \strlen($aDomain['imap_host']) && 0 < \strlen($aDomain['imap_port'])) if (\strlen($sName) && \strlen($aDomain['imap_host']) && \strlen($aDomain['imap_port']))
{ {
$sIncHost = (string) $aDomain['imap_host']; $sIncHost = (string) $aDomain['imap_host'];
$iIncPort = (int) $aDomain['imap_port']; $iIncPort = (int) $aDomain['imap_port'];
@ -381,7 +381,7 @@ class Domain implements \JsonSerializable
public function ValidateWhiteList(string $sEmail, string $sLogin = '') : bool public function ValidateWhiteList(string $sEmail, string $sLogin = '') : bool
{ {
$sW = \trim($this->sWhiteList); $sW = \trim($this->sWhiteList);
if (0 < strlen($sW)) if (\strlen($sW))
{ {
$sEmail = \MailSo\Base\Utils::IdnToUtf8($sEmail, true); $sEmail = \MailSo\Base\Utils::IdnToUtf8($sEmail, true);
$sLogin = \MailSo\Base\Utils::IdnToUtf8($sLogin, true); $sLogin = \MailSo\Base\Utils::IdnToUtf8($sLogin, true);
@ -389,7 +389,7 @@ class Domain implements \JsonSerializable
$sW = \preg_replace('/([^\s]+)@[^\s]*/', '$1', $sW); $sW = \preg_replace('/([^\s]+)@[^\s]*/', '$1', $sW);
$sW = ' '.\trim(\preg_replace('/[\s;,\r\n\t]+/', ' ', $sW)).' '; $sW = ' '.\trim(\preg_replace('/[\s;,\r\n\t]+/', ' ', $sW)).' ';
$sUserPart = \MailSo\Base\Utils::GetAccountNameFromEmail(0 < \strlen($sLogin) ? $sLogin : $sEmail); $sUserPart = \MailSo\Base\Utils::GetAccountNameFromEmail(\strlen($sLogin) ? $sLogin : $sEmail);
return false !== \stripos($sW, ' '.$sUserPart.' '); return false !== \stripos($sW, ' '.$sUserPart.' ');
} }

View file

@ -127,7 +127,7 @@ abstract class AbstractPlugin
public function SetVersion(string $sVersion) : self public function SetVersion(string $sVersion) : self
{ {
if (0 < \strlen($sVersion)) if (\strlen($sVersion))
{ {
$this->sVersion = $sVersion; $this->sVersion = $sVersion;
} }

View file

@ -173,7 +173,7 @@ class AddressBook extends \RainLoop\Providers\AbstractProvider
public function ImportCsvArray(string $sEmail, array $aCsvData) : int public function ImportCsvArray(string $sEmail, array $aCsvData) : int
{ {
$iCount = 0; $iCount = 0;
if ($this->IsActive() && 0 < \count($aCsvData)) if ($this->IsActive() && \count($aCsvData))
{ {
$oContact = new \RainLoop\Providers\AddressBook\Classes\Contact(); $oContact = new \RainLoop\Providers\AddressBook\Classes\Contact();
foreach ($aCsvData as $aItem) foreach ($aCsvData as $aItem)
@ -202,7 +202,7 @@ class AddressBook extends \RainLoop\Providers\AbstractProvider
} }
} }
if ($oContact && 0 < \count($oContact->Properties)) if ($oContact && \count($oContact->Properties))
{ {
if ($this->ContactSave($sEmail, $oContact)) if ($this->ContactSave($sEmail, $oContact))
{ {
@ -255,7 +255,7 @@ class AddressBook extends \RainLoop\Providers\AbstractProvider
$oContact->PopulateByVCard($oVCard); $oContact->PopulateByVCard($oVCard);
if (0 < \count($oContact->Properties)) if (\count($oContact->Properties))
{ {
if ($this->ContactSave($sEmail, $oContact)) if ($this->ContactSave($sEmail, $oContact))
{ {

View file

@ -87,7 +87,7 @@ class Contact implements \JsonSerializable
$oFullNameProperty =& $oProperty; $oFullNameProperty =& $oProperty;
} }
if (0 < \strlen($oProperty->Value)) if (\strlen($oProperty->Value))
{ {
if ('' === $sEmail && $oProperty->IsEmail()) if ('' === $sEmail && $oProperty->IsEmail())
{ {
@ -117,7 +117,7 @@ class Contact implements \JsonSerializable
$sDisplay = $bForceFullNameReplace ? '' : \trim($sFullName); $sDisplay = $bForceFullNameReplace ? '' : \trim($sFullName);
if ('' === $sDisplay && (0 < \strlen($sLastName) || 0 < \strlen($sFirstName))) if ('' === $sDisplay && (\strlen($sLastName) || \strlen($sFirstName)))
{ {
$sDisplay = \trim($sFirstName.' '.$sLastName); $sDisplay = \trim($sFirstName.' '.$sLastName);
} }
@ -190,7 +190,7 @@ class Contact implements \JsonSerializable
} }
$oVCard = null; $oVCard = null;
if (0 < \strlen($sPreVCard)) if (\strlen($sPreVCard))
{ {
try try
{ {
@ -273,7 +273,7 @@ class Contact implements \JsonSerializable
} }
$aTypes = $oProperty->TypesAsArray(); $aTypes = $oProperty->TypesAsArray();
$oVCard->add($sAddKey, $oProperty->Value, \is_array($aTypes) && 0 < \count($aTypes) ? array('TYPE' => $aTypes) : null); $oVCard->add($sAddKey, $oProperty->Value, \is_array($aTypes) && \count($aTypes) ? array('TYPE' => $aTypes) : null);
break; break;
} }
} }
@ -450,7 +450,7 @@ class Contact implements \JsonSerializable
$sValue = \trim($oProp); $sValue = \trim($oProp);
if ($bOldVersion && !isset($oProp->parameters['CHARSET'])) if ($bOldVersion && !isset($oProp->parameters['CHARSET']))
{ {
if (0 < \strlen($sValue)) if (\strlen($sValue))
{ {
$sEncValue = \utf8_encode($sValue); $sEncValue = \utf8_encode($sValue);
if (0 === \strlen($sEncValue)) if (0 === \strlen($sEncValue))
@ -476,7 +476,7 @@ class Contact implements \JsonSerializable
$aTypes = $oTypes ? $oTypes->getParts() : array(); $aTypes = $oTypes ? $oTypes->getParts() : array();
$sValue = $oProp ? \trim($oProp->getValue()) : ''; $sValue = $oProp ? \trim($oProp->getValue()) : '';
if (0 < \strlen($sValue)) if (\strlen($sValue))
{ {
if (!$oTypes || $oTypes->has('PREF')) if (!$oTypes || $oTypes->has('PREF'))
{ {
@ -530,7 +530,7 @@ class Contact implements \JsonSerializable
$sValue = \trim($sValue); $sValue = \trim($sValue);
if ($bOldVersion && !isset($oVCard->N->parameters['CHARSET'])) if ($bOldVersion && !isset($oVCard->N->parameters['CHARSET']))
{ {
if (0 < \strlen($sValue)) if (\strlen($sValue))
{ {
$sEncValue = \utf8_encode($sValue); $sEncValue = \utf8_encode($sValue);
if (0 === \strlen($sEncValue)) if (0 === \strlen($sEncValue))

View file

@ -115,7 +115,7 @@ class Property implements \JsonSerializable
$this->TypeStr = \trim($this->TypeStr); $this->TypeStr = \trim($this->TypeStr);
$this->ValueLower = ''; $this->ValueLower = '';
if (0 < \strlen($this->Value)) if (\strlen($this->Value))
{ {
// lower // lower
if ($this->IsEmail()) if ($this->IsEmail())

View file

@ -80,7 +80,7 @@ class PdoAddressBook
if ($oStmt) if ($oStmt)
{ {
$aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC); $aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetch) && 0 < \count($aFetch)) if (\is_array($aFetch) && \count($aFetch))
{ {
foreach ($aFetch as $aItem) foreach ($aFetch as $aItem)
{ {
@ -156,7 +156,7 @@ class PdoAddressBook
} }
} }
if (0 < \count($aIdsForDeletedion)) if (\count($aIdsForDeletedion))
{ {
$this->DeleteContacts($sEmail, $aIdsForDeletedion, false); $this->DeleteContacts($sEmail, $aIdsForDeletedion, false);
} }
@ -182,7 +182,7 @@ class PdoAddressBook
{ {
$sExsistensBody = ''; $sExsistensBody = '';
$mExsistenRemoteID = isset($aRemoteSyncData[$sKey]['vcf']) && !empty($aData['etag']) ? $aRemoteSyncData[$sKey]['vcf'] : ''; $mExsistenRemoteID = isset($aRemoteSyncData[$sKey]['vcf']) && !empty($aData['etag']) ? $aRemoteSyncData[$sKey]['vcf'] : '';
if (0 < \strlen($mExsistenRemoteID)) if (\strlen($mExsistenRemoteID))
{ {
$oResponse = $this->davClientRequest($oClient, 'GET', $sPath.$mExsistenRemoteID); $oResponse = $this->davClientRequest($oClient, 'GET', $sPath.$mExsistenRemoteID);
if ($oResponse) if ($oResponse)
@ -194,7 +194,7 @@ class PdoAddressBook
} }
$oResponse = $this->davClientRequest($oClient, 'PUT', $oResponse = $this->davClientRequest($oClient, 'PUT',
$sPath.(0 < \strlen($mExsistenRemoteID) ? $mExsistenRemoteID : $oContact->CardDavNameUri()), $sPath.(\strlen($mExsistenRemoteID) ? $mExsistenRemoteID : $oContact->CardDavNameUri()),
$oContact->ToVCard($sExsistensBody, $this->oLogger)."\r\n\r\n"); $oContact->ToVCard($sExsistensBody, $this->oLogger)."\r\n\r\n");
if ($oResponse) if ($oResponse)
{ {
@ -298,7 +298,7 @@ class PdoAddressBook
$bCsvHeader = true; $bCsvHeader = true;
$aDatabaseSyncData = $this->prepearDatabaseSyncData($iUserID); $aDatabaseSyncData = $this->prepearDatabaseSyncData($iUserID);
if (\is_array($aDatabaseSyncData) && 0 < \count($aDatabaseSyncData)) if (\is_array($aDatabaseSyncData) && \count($aDatabaseSyncData))
{ {
foreach ($aDatabaseSyncData as $mData) foreach ($aDatabaseSyncData as $mData)
{ {
@ -333,7 +333,7 @@ class PdoAddressBook
$iUserID = $this->getUserId($sEmail); $iUserID = $this->getUserId($sEmail);
$iIdContact = 0 < \strlen($oContact->IdContact) && \is_numeric($oContact->IdContact) ? (int) $oContact->IdContact : 0; $iIdContact = \strlen($oContact->IdContact) && \is_numeric($oContact->IdContact) ? (int) $oContact->IdContact : 0;
$bUpdate = 0 < $iIdContact; $bUpdate = 0 < $iIdContact;
@ -418,7 +418,7 @@ class PdoAddressBook
); );
} }
if (0 < \count($aParams)) if (\count($aParams))
{ {
$sSql = 'INSERT INTO rainloop_ab_properties '. $sSql = 'INSERT INTO rainloop_ab_properties '.
'( id_contact, id_user, prop_type, prop_type_str, prop_value, prop_value_lower, prop_value_custom, prop_frec)'. '( id_contact, id_user, prop_type, prop_type_str, prop_value, prop_value_lower, prop_value_custom, prop_frec)'.
@ -500,7 +500,7 @@ class PdoAddressBook
$aSearchIds = array(); $aSearchIds = array();
$aPropertyFromSearchIds = array(); $aPropertyFromSearchIds = array();
if (0 < \strlen($sSearch)) if (\strlen($sSearch))
{ {
$sCustomSearch = $this->specialConvertSearchValueCustomPhone($sSearch); $sCustomSearch = $this->specialConvertSearchValueCustomPhone($sSearch);
$sLowerSearch = $this->specialConvertSearchValueLower($sSearch, '='); $sLowerSearch = $this->specialConvertSearchValueLower($sSearch, '=');
@ -513,8 +513,8 @@ class PdoAddressBook
$sSql = 'SELECT id_user, id_prop, id_contact FROM rainloop_ab_properties '. $sSql = 'SELECT id_user, id_prop, id_contact FROM rainloop_ab_properties '.
'WHERE (id_user = :id_user) AND prop_type IN ('.$sSearchTypes.') AND ('. 'WHERE (id_user = :id_user) AND prop_type IN ('.$sSearchTypes.') AND ('.
'prop_value LIKE :search ESCAPE \'=\''. 'prop_value LIKE :search ESCAPE \'=\''.
(0 < \strlen($sLowerSearch) ? ' OR (prop_value_lower <> \'\' AND prop_value_lower LIKE :search_lower ESCAPE \'=\')' : ''). (\strlen($sLowerSearch) ? ' OR (prop_value_lower <> \'\' AND prop_value_lower LIKE :search_lower ESCAPE \'=\')' : '').
(0 < \strlen($sCustomSearch) ? ' OR (prop_type = '.PropertyType::PHONE.' AND prop_value_custom <> \'\' AND prop_value_custom LIKE :search_custom_phone)' : ''). (\strlen($sCustomSearch) ? ' OR (prop_type = '.PropertyType::PHONE.' AND prop_value_custom <> \'\' AND prop_value_custom LIKE :search_custom_phone)' : '').
') GROUP BY id_contact, id_prop'; ') GROUP BY id_contact, id_prop';
$aParams = array( $aParams = array(
@ -522,12 +522,12 @@ class PdoAddressBook
':search' => array($this->specialConvertSearchValue($sSearch, '='), \PDO::PARAM_STR) ':search' => array($this->specialConvertSearchValue($sSearch, '='), \PDO::PARAM_STR)
); );
if (0 < \strlen($sLowerSearch)) if (\strlen($sLowerSearch))
{ {
$aParams[':search_lower'] = array($sLowerSearch, \PDO::PARAM_STR); $aParams[':search_lower'] = array($sLowerSearch, \PDO::PARAM_STR);
} }
if (0 < \strlen($sCustomSearch)) if (\strlen($sCustomSearch))
{ {
$aParams[':search_custom_phone'] = array($sCustomSearch, \PDO::PARAM_STR); $aParams[':search_custom_phone'] = array($sCustomSearch, \PDO::PARAM_STR);
} }
@ -536,7 +536,7 @@ class PdoAddressBook
if ($oStmt) if ($oStmt)
{ {
$aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC); $aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetch) && 0 < \count($aFetch)) if (\is_array($aFetch) && \count($aFetch))
{ {
foreach ($aFetch as $aItem) foreach ($aFetch as $aItem)
{ {
@ -584,7 +584,7 @@ class PdoAddressBook
':id_user' => array($iUserID, \PDO::PARAM_INT) ':id_user' => array($iUserID, \PDO::PARAM_INT)
); );
if (0 < \count($aSearchIds)) if (\count($aSearchIds))
{ {
$sSql .= ' AND id_contact IN ('.implode(',', $aSearchIds).')'; $sSql .= ' AND id_contact IN ('.implode(',', $aSearchIds).')';
} }
@ -600,7 +600,7 @@ class PdoAddressBook
$aContacts = array(); $aContacts = array();
$aIdContacts = array(); $aIdContacts = array();
if (\is_array($aFetch) && 0 < \count($aFetch)) if (\is_array($aFetch) && \count($aFetch))
{ {
foreach ($aFetch as $aItem) foreach ($aFetch as $aItem)
{ {
@ -626,7 +626,7 @@ class PdoAddressBook
unset($aFetch); unset($aFetch);
if (0 < count($aIdContacts)) if (\count($aIdContacts))
{ {
$oStmt->closeCursor(); $oStmt->closeCursor();
@ -636,7 +636,7 @@ class PdoAddressBook
if ($oStmt) if ($oStmt)
{ {
$aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC); $aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetch) && 0 < \count($aFetch)) if (\is_array($aFetch) && \count($aFetch))
{ {
foreach ($aFetch as $aItem) foreach ($aFetch as $aItem)
{ {
@ -712,7 +712,7 @@ class PdoAddressBook
{ {
$aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC); $aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetch) && 0 < \count($aFetch)) if (\is_array($aFetch) && \count($aFetch))
{ {
foreach ($aFetch as $aItem) foreach ($aFetch as $aItem)
{ {
@ -743,7 +743,7 @@ class PdoAddressBook
if ($oStmt) if ($oStmt)
{ {
$aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC); $aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetch) && 0 < \count($aFetch)) if (\is_array($aFetch) && \count($aFetch))
{ {
foreach ($aFetch as $aItem) foreach ($aFetch as $aItem)
{ {
@ -800,7 +800,7 @@ class PdoAddressBook
$sSql = 'SELECT id_contact, id_prop, prop_type, prop_value FROM rainloop_ab_properties '. $sSql = 'SELECT id_contact, id_prop, prop_type, prop_value FROM rainloop_ab_properties '.
'WHERE (id_user = :id_user) AND prop_type IN ('.$sTypes.') AND ('. 'WHERE (id_user = :id_user) AND prop_type IN ('.$sTypes.') AND ('.
'prop_value LIKE :search ESCAPE \'=\''. 'prop_value LIKE :search ESCAPE \'=\''.
(0 < \strlen($sLowerSearch) ? ' OR (prop_value_lower <> \'\' AND prop_value_lower LIKE :search_lower ESCAPE \'=\')' : ''). (\strlen($sLowerSearch) ? ' OR (prop_value_lower <> \'\' AND prop_value_lower LIKE :search_lower ESCAPE \'=\')' : '').
')' ')'
; ;
@ -810,7 +810,7 @@ class PdoAddressBook
':search' => array($this->specialConvertSearchValue($sSearch, '='), \PDO::PARAM_STR) ':search' => array($this->specialConvertSearchValue($sSearch, '='), \PDO::PARAM_STR)
); );
if (0 < \strlen($sLowerSearch)) if (\strlen($sLowerSearch))
{ {
$aParams[':search_lower'] = array($sLowerSearch, \PDO::PARAM_STR); $aParams[':search_lower'] = array($sLowerSearch, \PDO::PARAM_STR);
} }
@ -828,7 +828,7 @@ class PdoAddressBook
$aContactAllAccess = array(); $aContactAllAccess = array();
$aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC); $aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetch) && 0 < \count($aFetch)) if (\is_array($aFetch) && \count($aFetch))
{ {
foreach ($aFetch as $aItem) foreach ($aFetch as $aItem)
{ {
@ -857,7 +857,7 @@ class PdoAddressBook
unset($aFetch); unset($aFetch);
$aIdContacts = \array_values($aIdContacts); $aIdContacts = \array_values($aIdContacts);
if (0 < count($aIdContacts)) if (\count($aIdContacts))
{ {
$oStmt->closeCursor(); $oStmt->closeCursor();
@ -872,7 +872,7 @@ class PdoAddressBook
if ($oStmt) if ($oStmt)
{ {
$aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC); $aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetch) && 0 < \count($aFetch)) if (\is_array($aFetch) && \count($aFetch))
{ {
$aNames = array(); $aNames = array();
$aEmails = array(); $aEmails = array();
@ -1014,7 +1014,7 @@ class PdoAddressBook
if ($oStmt) if ($oStmt)
{ {
$aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC); $aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetch) && 0 < \count($aFetch)) if (\is_array($aFetch) && \count($aFetch))
{ {
foreach ($aFetch as $aItem) foreach ($aFetch as $aItem)
{ {
@ -1030,7 +1030,7 @@ class PdoAddressBook
if ($oItem) if ($oItem)
{ {
$sEmail = \trim($oItem->GetEmail(true)); $sEmail = \trim($oItem->GetEmail(true));
if (0 < \strlen($sEmail)) if (\strlen($sEmail))
{ {
$aEmailsToUpdate[] = $sEmail; $aEmailsToUpdate[] = $sEmail;
return !\in_array($sEmail, $aExists); return !\in_array($sEmail, $aExists);
@ -1047,7 +1047,7 @@ class PdoAddressBook
if ($oItem) if ($oItem)
{ {
$sEmailUpdate = \trim($oItem->GetEmail(true)); $sEmailUpdate = \trim($oItem->GetEmail(true));
if (0 < \strlen($sEmailUpdate)) if (\strlen($sEmailUpdate))
{ {
$aEmailsToUpdate[] = $sEmailUpdate; $aEmailsToUpdate[] = $sEmailUpdate;
} }
@ -1057,7 +1057,7 @@ class PdoAddressBook
unset($aEmails, $aEmailsObjects); unset($aEmails, $aEmailsObjects);
if (0 < \count($aEmailsToCreate)) if (\count($aEmailsToCreate))
{ {
$oContact = new Classes\Contact(); $oContact = new Classes\Contact();
foreach ($aEmailsToCreate as $oEmail) foreach ($aEmailsToCreate as $oEmail)
@ -1086,7 +1086,7 @@ class PdoAddressBook
$sFirst = $sFullName; $sFirst = $sFullName;
} }
if (0 < \strlen($sFirst)) if (\strlen($sFirst))
{ {
$oPropName = new Classes\Property(); $oPropName = new Classes\Property();
$oPropName->Type = Enumerations\PropertyType::FIRST_NAME; $oPropName->Type = Enumerations\PropertyType::FIRST_NAME;
@ -1095,7 +1095,7 @@ class PdoAddressBook
$oContact->Properties[] = $oPropName; $oContact->Properties[] = $oPropName;
} }
if (0 < \strlen($sLast)) if (\strlen($sLast))
{ {
$oPropName = new Classes\Property(); $oPropName = new Classes\Property();
$oPropName->Type = Enumerations\PropertyType::LAST_NAME; $oPropName->Type = Enumerations\PropertyType::LAST_NAME;
@ -1105,7 +1105,7 @@ class PdoAddressBook
} }
} }
if (0 < \count($oContact->Properties)) if (\count($oContact->Properties))
{ {
$this->ContactSave($sEmail, $oContact); $this->ContactSave($sEmail, $oContact);
} }
@ -1272,13 +1272,13 @@ SQLITEINITIAL;
} }
$aResult = array(); $aResult = array();
if (0 < \strlen($sInitial)) if (\strlen($sInitial))
{ {
$aList = \explode(';', \trim($sInitial)); $aList = \explode(';', \trim($sInitial));
foreach ($aList as $sV) foreach ($aList as $sV)
{ {
$sV = \trim($sV); $sV = \trim($sV);
if (0 < \strlen($sV)) if (\strlen($sV))
{ {
$aResult[] = $sV; $aResult[] = $sV;
} }

View file

@ -53,7 +53,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
if ($this->oCacher) if ($this->oCacher)
{ {
$sResult = $this->oCacher->Get($this->wildcardDomainsCacheKey()); $sResult = $this->oCacher->Get($this->wildcardDomainsCacheKey());
if (0 < \strlen($sResult)) if (\strlen($sResult))
{ {
return $sResult; return $sResult;
} }
@ -72,7 +72,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
} }
} }
if (0 < \count($aNames)) if (\count($aNames))
{ {
\rsort($aNames, SORT_STRING); \rsort($aNames, SORT_STRING);
$sResult = \implode(' ', $aNames); $sResult = \implode(' ', $aNames);
@ -134,10 +134,10 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
else if ($bFindWithWildCard) else if ($bFindWithWildCard)
{ {
$sNames = $this->getWildcardDomainsLine(); $sNames = $this->getWildcardDomainsLine();
if (0 < \strlen($sNames)) if (\strlen($sNames))
{ {
if (\RainLoop\Plugins\Helper::ValidateWildcardValues( if (\RainLoop\Plugins\Helper::ValidateWildcardValues(
\MailSo\Base\Utils::IdnToUtf8($sName, true), $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue)) \MailSo\Base\Utils::IdnToUtf8($sName, true), $sNames, $sFoundedValue) && \strlen($sFoundedValue))
{ {
if (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(','.$sDisabled.',', ','.$sFoundedValue.',')) if (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(','.$sDisabled.',', ','.$sFoundedValue.','))
{ {
@ -213,7 +213,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
$bResult = true; $bResult = true;
$sRealFileName = $this->codeFileName($sName); $sRealFileName = $this->codeFileName($sName);
if (0 < \strlen($sName)) if (\strlen($sName))
{ {
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini')) if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini'))
{ {
@ -286,10 +286,10 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
$aResult = \array_slice($aResult, $iOffset, $iLimit); $aResult = \array_slice($aResult, $iOffset, $iLimit);
$aDisabledNames = array(); $aDisabledNames = array();
if (0 < \count($aResult) && \file_exists($this->sDomainPath.'/disabled')) if (\count($aResult) && \file_exists($this->sDomainPath.'/disabled'))
{ {
$sDisabled = \file_get_contents($this->sDomainPath.'/disabled'); $sDisabled = \file_get_contents($this->sDomainPath.'/disabled');
if (false !== $sDisabled && 0 < strlen($sDisabled)) if (false !== $sDisabled && \strlen($sDisabled))
{ {
$aDisabledNames = \explode(',', $sDisabled); $aDisabledNames = \explode(',', $sDisabled);
$aDisabledNames = \array_unique($aDisabledNames); $aDisabledNames = \array_unique($aDisabledNames);

View file

@ -117,7 +117,7 @@ class FileStorage implements \RainLoop\Providers\Files\IFiles
public function CloseAllOpenedFiles() : bool public function CloseAllOpenedFiles() : bool
{ {
if (\is_array($this->aResources) && 0 < \count($this->aResources)) if (\is_array($this->aResources) && \count($this->aResources))
{ {
foreach ($this->aResources as $sFileName => $rFile) foreach ($this->aResources as $sFileName => $rFile)
{ {

View file

@ -62,7 +62,7 @@ class FilterCondition implements \JsonSerializable
$aResult = array(); $aResult = array();
foreach ($aCollection as $aItem) foreach ($aCollection as $aItem)
{ {
if (\is_array($aItem) && 0 < \count($aItem)) if (\is_array($aItem) && \count($aItem))
{ {
$oItem = new \RainLoop\Providers\Filters\Classes\FilterCondition(); $oItem = new \RainLoop\Providers\Filters\Classes\FilterCondition();
if ($oItem->FromJSON($aItem)) if ($oItem->FromJSON($aItem))

View file

@ -83,8 +83,8 @@ class Sieve
$sValue = \trim($oCondition->Value()); $sValue = \trim($oCondition->Value());
$sValueSecond = \trim($oCondition->ValueSecond()); $sValueSecond = \trim($oCondition->ValueSecond());
if (0 < \strlen($sValue) || if (\strlen($sValue) ||
(0 < \strlen($sValue) && 0 < \strlen($sValueSecond) && (\strlen($sValue) && \strlen($sValueSecond) &&
Enumerations\ConditionField::HEADER === $oCondition->Field())) Enumerations\ConditionField::HEADER === $oCondition->Field()))
{ {
switch ($oCondition->Type()) switch ($oCondition->Type())
@ -271,33 +271,33 @@ class Sieve
$sValueSecond = \trim($oFilter->ActionValueSecond()); $sValueSecond = \trim($oFilter->ActionValueSecond());
$sValueThird = \trim($oFilter->ActionValueThird()); $sValueThird = \trim($oFilter->ActionValueThird());
$sValueFourth = \trim($oFilter->ActionValueFourth()); $sValueFourth = \trim($oFilter->ActionValueFourth());
if (0 < \strlen($sValue)) if (\strlen($sValue))
{ {
$aCapa['vacation'] = true; $aCapa['vacation'] = true;
$iDays = 1; $iDays = 1;
$sSubject = ''; $sSubject = '';
if (0 < \strlen($sValueSecond)) if (\strlen($sValueSecond))
{ {
$sSubject = ':subject "'. $sSubject = ':subject "'.
static::quote(\MailSo\Base\Utils::StripSpaces($sValueSecond)).'" '; static::quote(\MailSo\Base\Utils::StripSpaces($sValueSecond)).'" ';
} }
if (0 < \strlen($sValueThird) && \is_numeric($sValueThird) && 1 < (int) $sValueThird) if (\strlen($sValueThird) && \is_numeric($sValueThird) && 1 < (int) $sValueThird)
{ {
$iDays = (int) $sValueThird; $iDays = (int) $sValueThird;
} }
$sAddresses = ''; $sAddresses = '';
if (0 < \strlen($sValueFourth)) if (\strlen($sValueFourth))
{ {
$aAddresses = \explode(',', $sValueFourth); $aAddresses = \explode(',', $sValueFourth);
$aAddresses = \array_filter(\array_map(function ($sEmail) use ($self) { $aAddresses = \array_filter(\array_map(function ($sEmail) use ($self) {
$sEmail = \trim($sEmail); $sEmail = \trim($sEmail);
return 0 < \strlen($sEmail) ? '"'.static::quote($sEmail).'"' : ''; return \strlen($sEmail) ? '"'.static::quote($sEmail).'"' : '';
}, $aAddresses), 'strlen'); }, $aAddresses), 'strlen');
if (0 < \count($aAddresses)) if (\count($aAddresses))
{ {
$sAddresses = ':addresses ['.\implode(', ', $aAddresses).'] '; $sAddresses = ':addresses ['.\implode(', ', $aAddresses).'] ';
} }
@ -316,7 +316,7 @@ class Sieve
break; break;
case Enumerations\ActionType::REJECT: case Enumerations\ActionType::REJECT:
$sValue = \trim($oFilter->ActionValue()); $sValue = \trim($oFilter->ActionValue());
if (0 < \strlen($sValue)) if (\strlen($sValue))
{ {
$aCapa['reject'] = true; $aCapa['reject'] = true;
@ -333,7 +333,7 @@ class Sieve
break; break;
case Enumerations\ActionType::FORWARD: case Enumerations\ActionType::FORWARD:
$sValue = $oFilter->ActionValue(); $sValue = $oFilter->ActionValue();
if (0 < \strlen($sValue)) if (\strlen($sValue))
{ {
if ($oFilter->Keep()) if ($oFilter->Keep())
{ {
@ -354,7 +354,7 @@ class Sieve
break; break;
case Enumerations\ActionType::MOVE_TO: case Enumerations\ActionType::MOVE_TO:
$sValue = $oFilter->ActionValue(); $sValue = $oFilter->ActionValue();
if (0 < \strlen($sValue)) if (\strlen($sValue))
{ {
$sFolderName = $sValue; // utf7-imap $sFolderName = $sValue; // utf7-imap
if (static::$bUtf8FolderName) // to utf-8 if (static::$bUtf8FolderName) // to utf-8

View file

@ -21,13 +21,13 @@ class Suggestions extends \RainLoop\Providers\AbstractProvider
}); });
} }
$this->aDrivers = \is_array($aDriver) && 0 < \count($aDriver) ? $aDriver : null; $this->aDrivers = \is_array($aDriver) && \count($aDriver) ? $aDriver : null;
} }
public function Process(\RainLoop\Model\Account $oAccount, string $sQuery, int $iLimit = 20) : array public function Process(\RainLoop\Model\Account $oAccount, string $sQuery, int $iLimit = 20) : array
{ {
$aSuggestions = array(); $aSuggestions = array();
if ($this->IsActive() && \is_array($this->aDrivers) && 0 < \strlen($sQuery)) if ($this->IsActive() && \is_array($this->aDrivers) && \strlen($sQuery))
{ {
foreach ($this->aDrivers as $oDriver) foreach ($this->aDrivers as $oDriver)
{ {
@ -35,7 +35,7 @@ class Suggestions extends \RainLoop\Providers\AbstractProvider
if ($oDriver) if ($oDriver)
{ {
$aSubs = $oDriver->Process($oAccount, $sQuery, $iLimit); $aSubs = $oDriver->Process($oAccount, $sQuery, $iLimit);
if (\is_array($aSubs) && 0 < \count($aSubs)) if (\is_array($aSubs) && \count($aSubs))
{ {
$aSuggestions = \array_merge($aSuggestions, $aSubs); $aSuggestions = \array_merge($aSuggestions, $aSubs);
} }
@ -55,6 +55,6 @@ class Suggestions extends \RainLoop\Providers\AbstractProvider
public function IsActive() : bool public function IsActive() : bool
{ {
return \is_array($this->aDrivers) && 0 < \count($this->aDrivers); return \is_array($this->aDrivers) && \count($this->aDrivers);
} }
} }

View file

@ -160,7 +160,7 @@ class Utils
$_COOKIE[$sName] = $sValue; $_COOKIE[$sName] = $sValue;
\setcookie($sName, $sValue, array( \setcookie($sName, $sValue, array(
'expires' => $iExpire, 'expires' => $iExpire,
'path' => $sPath && 0 < \strlen($sPath) ? $sPath : '/', 'path' => $sPath && \strlen($sPath) ? $sPath : '/',
// 'domain' => $sDomain, // 'domain' => $sDomain,
'secure' => isset($_SERVER['HTTPS']) || static::$CookieDefaultSecure, 'secure' => isset($_SERVER['HTTPS']) || static::$CookieDefaultSecure,
'httponly' => $bHttpOnly, 'httponly' => $bHttpOnly,
@ -185,7 +185,7 @@ class Utils
unset($_COOKIE[$sName]); unset($_COOKIE[$sName]);
\setcookie($sName, '', array( \setcookie($sName, '', array(
'expires' => \time() - 3600 * 24 * 30, 'expires' => \time() - 3600 * 24 * 30,
'path' => $sPath && 0 < \strlen($sPath) ? $sPath : '/', 'path' => $sPath && \strlen($sPath) ? $sPath : '/',
// 'domain' => null, // 'domain' => null,
'secure' => isset($_SERVER['HTTPS']) || static::$CookieDefaultSecure, 'secure' => isset($_SERVER['HTTPS']) || static::$CookieDefaultSecure,
'httponly' => true, 'httponly' => true,

View file

@ -134,13 +134,13 @@
<i class="icon-file-text"></i> <i class="icon-file-text"></i>
</button> </button>
<button type="button" class="btn" data-bind="click: function () { attachmentsPlace(true); }, <button type="button" class="btn" data-bind="click: function () { attachmentsPlace(true); },
css: { 'btn-danger': 0 < attachmentsInErrorCount(), 'active': attachmentsPlace() }, css: { 'btn-danger': attachmentsInErrorCount(), 'active': attachmentsPlace() },
tooltipErrorTip: attachmentsErrorTooltip"> tooltipErrorTip: attachmentsErrorTooltip">
<span data-bind="visible: 0 < attachmentsCount()"> <span data-bind="visible: attachmentsCount()">
<b data-bind="text: attachmentsCount"></b> <b data-bind="text: attachmentsCount"></b>
&nbsp;&nbsp; &nbsp;&nbsp;
</span> </span>
<i data-bind="css: { 'icon-attachment': 0 === attachmentsInProcessCount(), 'icon-spinner': 0 < attachmentsInProcessCount()}"></i> <i data-bind="css: { 'icon-attachment': !attachmentsInProcessCount(), 'icon-spinner': attachmentsInProcessCount()}"></i>
</button> </button>
</div> </div>
<div class="btn-group"> <div class="btn-group">

View file

@ -66,10 +66,10 @@
autocomplete="current-password" autocorrect="off" autocapitalize="off" spellcheck="false" autocomplete="current-password" autocorrect="off" autocapitalize="off" spellcheck="false"
data-i18n="[placeholder]GLOBAL/PASSWORD" data-i18n="[placeholder]GLOBAL/PASSWORD"
data-bind="textInput: password, onEnter: doCommand" /> data-bind="textInput: password, onEnter: doCommand" />
<select class="input-block-level" data-bind="visible: 0 < privateKeysOptions().length, options: privateKeysOptions, value: selectedPrivateKey, <select class="input-block-level" data-bind="visible: privateKeysOptions().length, options: privateKeysOptions, value: selectedPrivateKey,
optionsCaption: privateKeysOptionsCaption, optionsText: 'name', optionsValue: 'id'"></select> optionsCaption: privateKeysOptionsCaption, optionsText: 'name', optionsValue: 'id'"></select>
</div> </div>
<select class="input-block-level" data-bind="visible: encrypt() && 0 < publicKeysOptions().length, options: publicKeysOptions, value: selectedPublicKey, <select class="input-block-level" data-bind="visible: encrypt() && publicKeysOptions().length, options: publicKeysOptions, value: selectedPublicKey,
optionsCaption: publicKeysOptionsCaption, optionsText: 'name', optionsValue: 'id'"></select> optionsCaption: publicKeysOptionsCaption, optionsText: 'name', optionsValue: 'id'"></select>
</div> </div>
</div> </div>

View file

@ -62,7 +62,7 @@
</div> </div>
<div class="listEmptySearchList" data-bind="visible: 0 === contacts().length && '' !== search() && !contacts.loading()" <div class="listEmptySearchList" data-bind="visible: 0 === contacts().length && '' !== search() && !contacts.loading()"
data-i18n="CONTACTS/EMPTY_SEARCH"></div> data-i18n="CONTACTS/EMPTY_SEARCH"></div>
<div class="e-contact-foreach g-ui-user-select-none" data-bind="foreach: contacts, visible: 0 < contacts().length"> <div class="e-contact-foreach g-ui-user-select-none" data-bind="foreach: contacts, visible: contacts().length">
<div class="e-contact-item g-ui-user-select-none" data-bind="css: lineAsCss()"> <div class="e-contact-item g-ui-user-select-none" data-bind="css: lineAsCss()">
<div class="checkboxItem fontastic" data-bind="text: checked() ? '☑' : '☐'"></div> <div class="checkboxItem fontastic" data-bind="text: checked() ? '☑' : '☐'"></div>
<div class="nameParent actionHandle" data-bind="text: display"></div> <div class="nameParent actionHandle" data-bind="text: display"></div>
@ -138,7 +138,7 @@
data-bind="value: value, hasfocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}" /> data-bind="value: value, hasfocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}" />
</div> </div>
</div> </div>
<div data-bind="visible: 0 < viewPropertiesOther().length, foreach: viewPropertiesOther"> <div data-bind="visible: viewPropertiesOther().length, foreach: viewPropertiesOther">
<div class="property-line"> <div class="property-line">
<!-- ko if: !largeValue() --> <!-- ko if: !largeValue() -->
<span data-bind="text: value"></span> <span data-bind="text: value"></span>
@ -156,7 +156,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="control-group" data-bind="visible: !viewReadOnly() || 0 < viewPropertiesEmails().length"> <div class="control-group" data-bind="visible: !viewReadOnly() || viewPropertiesEmails().length">
<label class="fontastic iconsize24" data-i18n="[title]GLOBAL/EMAIL">@</label> <label class="fontastic iconsize24" data-i18n="[title]GLOBAL/EMAIL">@</label>
<div> <div>
<div data-bind="foreach: viewPropertiesEmails"> <div data-bind="foreach: viewPropertiesEmails">
@ -170,7 +170,7 @@
<a href="#" class="g-ui-link add-link" data-bind="visible: !viewReadOnly(), click: addNewEmail" data-i18n="CONTACTS/LINK_ADD_EMAIL"></a> <a href="#" class="g-ui-link add-link" data-bind="visible: !viewReadOnly(), click: addNewEmail" data-i18n="CONTACTS/LINK_ADD_EMAIL"></a>
</div> </div>
</div> </div>
<div class="control-group" data-bind="visible: 0 < viewPropertiesPhones().length"> <div class="control-group" data-bind="visible: viewPropertiesPhones().length">
<label class="fontastic iconsize24" data-i18n="[title]CONTACTS/LABEL_PHONE">📞</label> <label class="fontastic iconsize24" data-i18n="[title]CONTACTS/LABEL_PHONE">📞</label>
<div> <div>
<div data-bind="foreach: viewPropertiesPhones"> <div data-bind="foreach: viewPropertiesPhones">
@ -183,7 +183,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="control-group" data-bind="visible: 0 < viewPropertiesWeb().length"> <div class="control-group" data-bind="visible: viewPropertiesWeb().length">
<label class="fontastic iconsize24" data-i18n="[title]CONTACTS/LABEL_WEB">🌍</label> <label class="fontastic iconsize24" data-i18n="[title]CONTACTS/LABEL_WEB">🌍</label>
<div> <div>
<div data-bind="foreach: viewPropertiesWeb"> <div data-bind="foreach: viewPropertiesWeb">

View file

@ -26,7 +26,7 @@
data-i18n="POPUPS_FILTER/SELECT_MATCH_ALL"></option> data-i18n="POPUPS_FILTER/SELECT_MATCH_ALL"></option>
</select> </select>
</div> </div>
<div data-bind="visible: 0 < conditions().length, foreach: conditions"> <div data-bind="visible: conditions().length, foreach: conditions">
<div class="control-group" data-bind="css: {'error': valueError}" style="display:flex"> <div class="control-group" data-bind="css: {'error': valueError}" style="display:flex">
<div style="flex-grow:1" data-bind="css: {'error': valueError}, template: {'name': template(), 'data': $data}"></div> <div style="flex-grow:1" data-bind="css: {'error': valueError}, template: {'name': template(), 'data': $data}"></div>
<span class="delete-action button-delete fontastic" style="margin-top: 5px;" <span class="delete-action button-delete fontastic" style="margin-top: 5px;"

View file

@ -9,7 +9,7 @@
<a id="top-system-dropdown-id" href="#" tabindex="-1" class="btn single btn-block dropdown-toggle"> <a id="top-system-dropdown-id" href="#" tabindex="-1" class="btn single btn-block dropdown-toggle">
<i class="fontastic" data-bind="css: {'icon-spinner': accountsLoading()}">👤</i> <i class="fontastic" data-bind="css: {'icon-spinner': accountsLoading()}">👤</i>
<!-- <!--
<b data-bind="text: accountsUnreadCount, visible: 100 > accountsUnreadCount() && 0 < accountsUnreadCount()"></b> <b data-bind="text: accountsUnreadCount, visible: 100 > accountsUnreadCount() && accountsUnreadCount()"></b>
<b data-bind="visible: 99 < accountsUnreadCount()">99+</b> <b data-bind="visible: 99 < accountsUnreadCount()">99+</b>
&nbsp; &nbsp;
--> -->
@ -21,7 +21,7 @@
<!-- ko foreach: accounts --> <!-- ko foreach: accounts -->
<li role="presentation"> <li role="presentation">
<a class="account-item" href="#" data-bind="click: $root.accountClick, css: {'current': $root.accountEmail() === email}"> <a class="account-item" href="#" data-bind="click: $root.accountClick, css: {'current': $root.accountEmail() === email}">
<!-- <b class="pull-right counter" data-bind="visible: 0 < count()"> <!-- <b class="pull-right counter" data-bind="visible: count()">
<span data-bind="text: count, visible: 100 > count()"></span> <span data-bind="text: count, visible: 100 > count()"></span>
<span data-bind="visible: 99 < count()">99+</span> <span data-bind="visible: 99 < count()">99+</span>
</b>--> </b>-->