Don't suppress functions

This commit is contained in:
djmaze 2020-03-20 15:29:52 +01:00
parent 1009398d0c
commit 559ebe0f28
28 changed files with 244 additions and 265 deletions

View file

@ -64,7 +64,7 @@ abstract class HtmlUtils
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('libxml_clear_errors')) if (\MailSo\Base\Utils::FunctionExistsAndEnabled('libxml_clear_errors'))
{ {
@\libxml_clear_errors(); \libxml_clear_errors();
} }
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('libxml_use_internal_errors')) if (\MailSo\Base\Utils::FunctionExistsAndEnabled('libxml_use_internal_errors'))

View file

@ -17,19 +17,6 @@ namespace MailSo\Base;
*/ */
class Http class Http
{ {
/**
* @var bool
*/
private $bIsMagicQuotesOn;
/**
* @access private
*/
private function __construct()
{
$this->bIsMagicQuotesOn = (bool) @\ini_get('magic_quotes_gpc');
}
public static function NewInstance() : self public static function NewInstance() : self
{ {
return new self(); return new self();
@ -181,7 +168,7 @@ class Http
static $sRawBody = null; static $sRawBody = null;
if (null === $sRawBody) if (null === $sRawBody)
{ {
$sBody = @\file_get_contents('php://input'); $sBody = \file_get_contents('php://input');
$sRawBody = (false !== $sBody) ? $sBody : ''; $sRawBody = (false !== $sBody) ? $sBody : '';
} }
return $sRawBody; return $sRawBody;
@ -338,7 +325,7 @@ class Http
static public function DetectAndHackFollowLocationUrl(string $sUrl, array &$aOptions, ?\MailSo\Log\Logger $oLogger = null) : string static public function DetectAndHackFollowLocationUrl(string $sUrl, array &$aOptions, ?\MailSo\Log\Logger $oLogger = null) : string
{ {
$sSafeMode = \strtolower(\trim(@\ini_get('safe_mode'))); $sSafeMode = \strtolower(\trim(\ini_get('safe_mode')));
$bSafeMode = 'on' === $sSafeMode || '1' === $sSafeMode; $bSafeMode = 'on' === $sSafeMode || '1' === $sSafeMode;
$sNewUrl = null; $sNewUrl = null;
@ -537,10 +524,10 @@ class Http
{ {
if ($bSetCacheHeader) if ($bSetCacheHeader)
{ {
@\header('Cache-Control: public', true); \header('Cache-Control: public', true);
@\header('Pragma: public', true); \header('Pragma: public', true);
@\header('Last-Modified: '.\gmdate('D, d M Y H:i:s', $iUtcTimeStamp - $iExpireTime).' UTC', true); \header('Last-Modified: '.\gmdate('D, d M Y H:i:s', $iUtcTimeStamp - $iExpireTime).' UTC', true);
@\header('Expires: '.\gmdate('D, j M Y H:i:s', $iUtcTimeStamp + $iExpireTime).' UTC', true); \header('Expires: '.\gmdate('D, j M Y H:i:s', $iUtcTimeStamp + $iExpireTime).' UTC', true);
if (0 < strlen($sEtag)) if (0 < strlen($sEtag))
{ {
@ -567,11 +554,11 @@ class Http
if (false === $bCache) if (false === $bCache)
{ {
$bCache = true; $bCache = true;
@\header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); \header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
@\header('Last-Modified: '.\gmdate('D, d M Y H:i:s').' GMT'); \header('Last-Modified: '.\gmdate('D, d M Y H:i:s').' GMT');
@\header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); \header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
@\header('Cache-Control: post-check=0, pre-check=0', false); \header('Cache-Control: post-check=0, pre-check=0', false);
@\header('Pragma: no-cache'); \header('Pragma: no-cache');
} }
} }
@ -584,10 +571,10 @@ class Http
if (false === $bCache) if (false === $bCache)
{ {
$bCache = true; $bCache = true;
@\header('Cache-Control: private', true); \header('Cache-Control: private', true);
@\header('ETag: '.$sEtag, true); \header('ETag: '.$sEtag, true);
@\header('Last-Modified: '.\gmdate('D, d M Y H:i:s', $iLastModified).' UTC', true); \header('Last-Modified: '.\gmdate('D, d M Y H:i:s', $iLastModified).' UTC', true);
@\header('Expires: '.\gmdate('D, j M Y H:i:s', $iExpires).' UTC', true); \header('Expires: '.\gmdate('D, j M Y H:i:s', $iExpires).' UTC', true);
} }
} }

View file

@ -149,7 +149,7 @@ class LinkFinder
$sResult = ''; $sResult = '';
if ($bUseHtmlSpecialChars) if ($bUseHtmlSpecialChars)
{ {
$sResult = @\htmlentities($sText.$sSubText, $this->iHtmlSpecialCharsFlags, 'UTF-8'); $sResult = \htmlentities($sText.$sSubText, $this->iHtmlSpecialCharsFlags, 'UTF-8');
} }
else else
{ {

View file

@ -57,7 +57,7 @@ abstract class ResourceRegistry
{ {
self::regResourcesShutdownFunc(); self::regResourcesShutdownFunc();
$oResult = @\fopen('php://temp/maxmemory:'.($iMemoryMaxInMb * 1024 * 1024), 'r+b'); $oResult = \fopen('php://temp/maxmemory:'.($iMemoryMaxInMb * 1024 * 1024), 'r+b');
if (\is_resource($oResult)) if (\is_resource($oResult))
{ {
\MailSo\Base\Loader::IncStatistic('CreateMemoryResource'); \MailSo\Base\Loader::IncStatistic('CreateMemoryResource');

View file

@ -106,7 +106,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;

View file

@ -147,7 +147,7 @@ class SubStreams
{ {
if (!\feof($mCurrentPart)) if (!\feof($mCurrentPart))
{ {
$sReadResult = @\fread($mCurrentPart, 8192); $sReadResult = \fread($mCurrentPart, 8192);
if (false === $sReadResult) if (false === $sReadResult)
{ {
return false; return false;

View file

@ -117,7 +117,7 @@ END;
public static function DetectSystemCharset() : string public static function DetectSystemCharset() : string
{ {
$sResult = ''; $sResult = '';
$sLocale = @\setlocale(LC_ALL, ''); $sLocale = \setlocale(LC_ALL, '');
$sLocaleLower = \strtolower(\trim($sLocale)); $sLocaleLower = \strtolower(\trim($sLocale));
foreach (static::$aLocaleMapping as $sKey => $sValue) foreach (static::$aLocaleMapping as $sKey => $sValue)
@ -464,7 +464,7 @@ END;
{ {
if (isset($aMatch[0][$iIndex])) if (isset($aMatch[0][$iIndex]))
{ {
$iPos = @\strpos($aMatch[0][$iIndex], '*'); $iPos = \strpos($aMatch[0][$iIndex], '*');
if (false !== $iPos) if (false !== $iPos)
{ {
$aMatch[0][$iIndex][0] = \substr($aMatch[0][$iIndex][0], 0, $iPos); $aMatch[0][$iIndex][0] = \substr($aMatch[0][$iIndex][0], 0, $iPos);
@ -985,7 +985,7 @@ END;
{ {
$iResetTimer = 0; $iResetTimer = 0;
$sSafeMode = \strtolower(\trim(@\ini_get('safe_mode'))); $sSafeMode = \strtolower(\trim(\ini_get('safe_mode')));
$bSafeMode = 'on' === $sSafeMode || '1' === $sSafeMode || 'true' === $sSafeMode; $bSafeMode = 'on' === $sSafeMode || '1' === $sSafeMode || 'true' === $sSafeMode;
$bValidateAction = !$bSafeMode && static::FunctionExistsAndEnabled('set_time_limit'); $bValidateAction = !$bSafeMode && static::FunctionExistsAndEnabled('set_time_limit');
@ -994,7 +994,7 @@ END;
if ($bValidateAction && $iTimeToReset < $iTime - $iResetTimer) if ($bValidateAction && $iTimeToReset < $iTime - $iResetTimer)
{ {
$iResetTimer = $iTime; $iResetTimer = $iTime;
if (!@\set_time_limit($iTimeToAdd)) if (!\set_time_limit($iTimeToAdd))
{ {
$bValidateAction = false; $bValidateAction = false;
return false; return false;
@ -1041,13 +1041,7 @@ END;
*/ */
public static function Php2js($mInput, ?\MailSo\Log\Logger $oLogger = null) : string public static function Php2js($mInput, ?\MailSo\Log\Logger $oLogger = null) : string
{ {
static $iOpt = null; $sResult = \json_encode($mInput, JSON_UNESCAPED_UNICODE);
if (null === $iOpt)
{
$iOpt = \defined('JSON_UNESCAPED_UNICODE') ? JSON_UNESCAPED_UNICODE : 0;
}
$sResult = @\json_encode($mInput, $iOpt);
if (!\is_string($sResult) || '' === $sResult) if (!\is_string($sResult) || '' === $sResult)
{ {
if (!$oLogger && \MailSo\Log\Logger::IsSystemEnabled()) if (!$oLogger && \MailSo\Log\Logger::IsSystemEnabled())
@ -1078,7 +1072,7 @@ END;
} }
static::ClearArrayUtf8Values($mInput); static::ClearArrayUtf8Values($mInput);
$sResult = @\json_encode($mInput, $iOpt); $sResult = \json_encode($mInput, JSON_UNESCAPED_UNICODE);
} }
} }
@ -1106,7 +1100,7 @@ END;
public static function RecRmDir(string $sDir) : bool public static function RecRmDir(string $sDir) : bool
{ {
if (@\is_dir($sDir)) if (\is_dir($sDir))
{ {
$aObjects = \scandir($sDir); $aObjects = \scandir($sDir);
foreach ($aObjects as $sObject) foreach ($aObjects as $sObject)
@ -1120,12 +1114,12 @@ END;
} }
else else
{ {
@\unlink($sDir.'/'.$sObject); \unlink($sDir.'/'.$sObject);
} }
} }
} }
return @\rmdir($sDir); return \rmdir($sDir);
} }
return false; return false;
@ -1170,17 +1164,17 @@ END;
$iFileCount = 0; $iFileCount = 0;
$sTempPath = rtrim($sTempPath, '\\/'); $sTempPath = rtrim($sTempPath, '\\/');
if (@\is_dir($sTempPath)) if (\is_dir($sTempPath))
{ {
$rDirH = @\opendir($sTempPath); $rDirH = \opendir($sTempPath);
if ($rDirH) if ($rDirH)
{ {
$bRemoveAllDirs = true; $bRemoveAllDirs = true;
while (($sFile = @\readdir($rDirH)) !== false) while (($sFile = \readdir($rDirH)) !== false)
{ {
if ('.' !== $sFile && '..' !== $sFile) if ('.' !== $sFile && '..' !== $sFile)
{ {
if (@\is_dir($sTempPath.'/'.$sFile)) if (\is_dir($sTempPath.'/'.$sFile))
{ {
if (!static::RecTimeDirRemove($sTempPath.'/'.$sFile, $iTime2Kill, $iNow)) if (!static::RecTimeDirRemove($sTempPath.'/'.$sFile, $iTime2Kill, $iNow))
{ {
@ -1194,19 +1188,19 @@ END;
} }
} }
@\closedir($rDirH); \closedir($rDirH);
} }
if ($iFileCount > 0) if ($iFileCount > 0)
{ {
if (static::TimeFilesRemove($sTempPath, $iTime2Kill, $iNow)) if (static::TimeFilesRemove($sTempPath, $iTime2Kill, $iNow))
{ {
return @\rmdir($sTempPath); return \rmdir($sTempPath);
} }
} }
else else
{ {
return $bRemoveAllDirs ? @\rmdir($sTempPath) : false; return $bRemoveAllDirs ? \rmdir($sTempPath) : false;
} }
return false; return false;
@ -1220,18 +1214,18 @@ 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);
if ($rDirH) if ($rDirH)
{ {
while (($sFile = @\readdir($rDirH)) !== false) while (($sFile = \readdir($rDirH)) !== false)
{ {
if ($sFile !== '.' && $sFile !== '..') if ($sFile !== '.' && $sFile !== '..')
{ {
if ($iNow - \filemtime($sTempPath.'/'.$sFile) > $iTime2Kill) if ($iNow - \filemtime($sTempPath.'/'.$sFile) > $iTime2Kill)
{ {
@\unlink($sTempPath.'/'.$sFile); \unlink($sTempPath.'/'.$sFile);
} }
else else
{ {
@ -1240,7 +1234,7 @@ END;
} }
} }
@\closedir($rDirH); \closedir($rDirH);
} }
} }
@ -1417,7 +1411,7 @@ END;
{ {
while (!\feof($fResource)) while (!\feof($fResource))
{ {
$sBuffer = @\fread($fResource, $iBufferLen); $sBuffer = \fread($fResource, $iBufferLen);
if (false !== $sBuffer) if (false !== $sBuffer)
{ {
echo $sBuffer; echo $sBuffer;
@ -1487,7 +1481,7 @@ END;
{ {
if (\is_resource($rWriteStream)) if (\is_resource($rWriteStream))
{ {
@\rewind($rWriteStream); \rewind($rWriteStream);
} }
} }
} }
@ -1800,7 +1794,7 @@ END;
if (null === $aCache) if (null === $aCache)
{ {
$sDisableFunctions = @\ini_get('disable_functions'); $sDisableFunctions = \ini_get('disable_functions');
$sDisableFunctions = \is_string($sDisableFunctions) && 0 < \strlen($sDisableFunctions) ? $sDisableFunctions : ''; $sDisableFunctions = \is_string($sDisableFunctions) && 0 < \strlen($sDisableFunctions) ? $sDisableFunctions : '';
$aCache = \explode(',', $sDisableFunctions); $aCache = \explode(',', $sDisableFunctions);
@ -1808,7 +1802,7 @@ END;
if (\extension_loaded('suhosin')) if (\extension_loaded('suhosin'))
{ {
$sSuhosin = @\ini_get('suhosin.executor.func.blacklist'); $sSuhosin = \ini_get('suhosin.executor.func.blacklist');
$sSuhosin = \is_string($sSuhosin) && 0 < \strlen($sSuhosin) ? $sSuhosin : ''; $sSuhosin = \is_string($sSuhosin) && 0 < \strlen($sSuhosin) ? $sSuhosin : '';
$aSuhosinCache = \explode(',', $sSuhosin); $aSuhosinCache = \explode(',', $sSuhosin);
@ -1869,7 +1863,7 @@ END;
public static function ValidateIP(string $sIp) : bool public static function ValidateIP(string $sIp) : bool
{ {
return !empty($sIp) && $sIp === @\filter_var($sIp, FILTER_VALIDATE_IP); return !empty($sIp) && $sIp === \filter_var($sIp, FILTER_VALIDATE_IP);
} }
private static function idn() : \Net private static function idn() : \Net

View file

@ -99,9 +99,9 @@ class File implements \MailSo\Cache\DriverInterface
$sFilePath = $this->sCacheFolder.$this->sKeyPrefix.$sKeyPath; $sFilePath = $this->sCacheFolder.$this->sKeyPrefix.$sKeyPath;
if ($bMkDir && !\is_dir(\dirname($sFilePath))) if ($bMkDir && !\is_dir(\dirname($sFilePath)))
{ {
if (!@\mkdir(\dirname($sFilePath), 0755, true)) if (!\mkdir(\dirname($sFilePath), 0755, true))
{ {
if (!@\mkdir(\dirname($sFilePath), 0755, true)) if (!\mkdir(\dirname($sFilePath), 0755, true))
{ {
$sFilePath = ''; $sFilePath = '';
} }

View file

@ -109,7 +109,7 @@ class ImapClient extends \MailSo\Net\NetClient
$this->__FORCE_SELECT_ON_EXAMINE__ = false; $this->__FORCE_SELECT_ON_EXAMINE__ = false;
@\ini_set('xdebug.max_nesting_level', 500); \ini_set('xdebug.max_nesting_level', 500);
} }
public static function NewInstance() : self public static function NewInstance() : self
@ -2187,9 +2187,9 @@ class ImapClient extends \MailSo\Net\NetClient
if (!$bFeof) if (!$bFeof)
{ {
while (!@\feof($rImapLiteralStream)) while (!\feof($rImapLiteralStream))
{ {
$sBuf = @\fread($rImapLiteralStream, 1024 * 1024); $sBuf = \fread($rImapLiteralStream, 1024 * 1024);
if (false === $sBuf || 0 === \strlen($sBuf) || null === $sBuf) if (false === $sBuf || 0 === \strlen($sBuf) || null === $sBuf)
{ {
break; break;
@ -2199,15 +2199,15 @@ class ImapClient extends \MailSo\Net\NetClient
$iNotReadLiteralLen += \strlen($sBuf); $iNotReadLiteralLen += \strlen($sBuf);
} }
if (\is_resource($rImapLiteralStream) && !@\feof($rImapLiteralStream)) if (\is_resource($rImapLiteralStream) && !\feof($rImapLiteralStream))
{ {
@\stream_get_contents($rImapLiteralStream); \stream_get_contents($rImapLiteralStream);
} }
} }
if (\is_resource($rImapLiteralStream)) if (\is_resource($rImapLiteralStream))
{ {
@\fclose($rImapLiteralStream); \fclose($rImapLiteralStream);
} }
if ($iNotReadLiteralLen > 0) if ($iNotReadLiteralLen > 0)

View file

@ -31,7 +31,7 @@ class Syslog extends \MailSo\Log\Driver
\openlog('rainloop', LOG_ODELAY, LOG_USER); \openlog('rainloop', LOG_ODELAY, LOG_USER);
\register_shutdown_function(function () { \register_shutdown_function(function () {
@\closelog(); \closelog();
}); });
} }
else else

View file

@ -558,7 +558,7 @@ class MailClient
public function MessageAppendFile(string $sMessageFileName, string $sFolderToSave, array $aAppendFlags = null, int &$iUid = null) : self public function MessageAppendFile(string $sMessageFileName, string $sFolderToSave, array $aAppendFlags = null, int &$iUid = null) : self
{ {
if (!@\is_file($sMessageFileName) || !@\is_readable($sMessageFileName)) if (!\is_file($sMessageFileName) || !\is_readable($sMessageFileName))
{ {
throw new \MailSo\Base\Exceptions\InvalidArgumentException(); throw new \MailSo\Base\Exceptions\InvalidArgumentException();
} }
@ -570,7 +570,7 @@ class MailClient
if (\is_resource($rMessageStream)) if (\is_resource($rMessageStream))
{ {
@fclose($rMessageStream); fclose($rMessageStream);
} }
return $this; return $this;
@ -1324,7 +1324,7 @@ class MailClient
$sSerializedUids = $oCacher->Get($sSerializedHashKey); $sSerializedUids = $oCacher->Get($sSerializedHashKey);
if (!empty($sSerializedUids)) if (!empty($sSerializedUids))
{ {
$aSerializedUids = @\json_decode($sSerializedUids, true); $aSerializedUids = \json_decode($sSerializedUids, true);
if (isset($aSerializedUids['ThreadsUids']) && \is_array($aSerializedUids['ThreadsUids'])) if (isset($aSerializedUids['ThreadsUids']) && \is_array($aSerializedUids['ThreadsUids']))
{ {
if ($this->oLogger) if ($this->oLogger)
@ -1465,7 +1465,7 @@ class MailClient
if ($oCacher && $oCacher->IsInited() && !empty($sSerializedHashKey)) if ($oCacher && $oCacher->IsInited() && !empty($sSerializedHashKey))
{ {
$oCacher->Set($sSerializedHashKey, @\json_encode(array( $oCacher->Set($sSerializedHashKey, \json_encode(array(
'ThreadsUids' => $aResult 'ThreadsUids' => $aResult
))); )));
@ -1568,7 +1568,7 @@ class MailClient
$sSerialized = $oCacher->Get($sSerializedHash); $sSerialized = $oCacher->Get($sSerializedHash);
if (!empty($sSerialized)) if (!empty($sSerialized))
{ {
$aSerialized = @\json_decode($sSerialized, true); $aSerialized = \json_decode($sSerialized, true);
if (\is_array($aSerialized) && isset($aSerialized['FolderHash'], $aSerialized['Uids']) && if (\is_array($aSerialized) && isset($aSerialized['FolderHash'], $aSerialized['Uids']) &&
$sFolderHash === $aSerialized['FolderHash'] && $sFolderHash === $aSerialized['FolderHash'] &&
\is_array($aSerialized['Uids']) \is_array($aSerialized['Uids'])
@ -1594,7 +1594,7 @@ class MailClient
if (!$bUidsFromCacher && $bUseCacheAfterSearch && \is_array($aResultUids) && $oCacher && $oCacher->IsInited() && 0 < \strlen($sSerializedHash)) if (!$bUidsFromCacher && $bUseCacheAfterSearch && \is_array($aResultUids) && $oCacher && $oCacher->IsInited() && 0 < \strlen($sSerializedHash))
{ {
$oCacher->Set($sSerializedHash, @\json_encode(array( $oCacher->Set($sSerializedHash, \json_encode(array(
'FolderHash' => $sFolderHash, 'FolderHash' => $sFolderHash,
'Uids' => $aResultUids 'Uids' => $aResultUids
))); )));

View file

@ -377,7 +377,7 @@ class Message
return '<'. return '<'.
\MailSo\Base\Utils::Md5Rand($sHostName. \MailSo\Base\Utils::Md5Rand($sHostName.
(\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? @\getmypid() : '')).'@'.$sHostName.'>'; (\MailSo\Base\Utils::FunctionExistsAndEnabled('getmypid') ? \getmypid() : '')).'@'.$sHostName.'>';
} }
private function createNewMessageAttachmentBody(\MailSo\Mime\Attachment $oAttachment) : \MailSo\Mime\Part private function createNewMessageAttachmentBody(\MailSo\Mime\Attachment $oAttachment) : \MailSo\Mime\Part

View file

@ -205,7 +205,7 @@ 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);
@ -324,7 +324,7 @@ class Part
{ {
if (!$bNotFirstRead) if (!$bNotFirstRead)
{ {
$sBuffer = @fread($rStreamHandle, $this->iParseBuffer); $sBuffer = fread($rStreamHandle, $this->iParseBuffer);
if (false === $sBuffer) if (false === $sBuffer)
{ {
break; break;

View file

@ -213,7 +213,7 @@ abstract class NetClient
$this->writeLog('Start connection to "'.$this->sConnectedHost.':'.$this->iConnectedPort.'"', $this->writeLog('Start connection to "'.$this->sConnectedHost.':'.$this->iConnectedPort.'"',
\MailSo\Log\Enumerations\Type::NOTE); \MailSo\Log\Enumerations\Type::NOTE);
// $this->rConnect = @\fsockopen($this->sConnectedHost, $this->iConnectedPort, // $this->rConnect = \fsockopen($this->sConnectedHost, $this->iConnectedPort,
// $iErrorNo, $sErrorStr, $this->iConnectTimeOut); // $iErrorNo, $sErrorStr, $this->iConnectTimeOut);
$bVerifySsl = !!$bVerifySsl; $bVerifySsl = !!$bVerifySsl;
@ -270,7 +270,7 @@ abstract class NetClient
{ {
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('stream_set_timeout')) if (\MailSo\Base\Utils::FunctionExistsAndEnabled('stream_set_timeout'))
{ {
@\stream_set_timeout($this->rConnect, $this->iSocketTimeOut); \stream_set_timeout($this->rConnect, $this->iSocketTimeOut);
} }
} }
} }
@ -284,11 +284,11 @@ abstract class NetClient
switch (true) switch (true)
{ {
case defined('STREAM_CRYPTO_METHOD_ANY_CLIENT') && case defined('STREAM_CRYPTO_METHOD_ANY_CLIENT') &&
@\stream_socket_enable_crypto($this->rConnect, true, STREAM_CRYPTO_METHOD_ANY_CLIENT): \stream_socket_enable_crypto($this->rConnect, true, STREAM_CRYPTO_METHOD_ANY_CLIENT):
case defined('STREAM_CRYPTO_METHOD_TLS_CLIENT') && case defined('STREAM_CRYPTO_METHOD_TLS_CLIENT') &&
@\stream_socket_enable_crypto($this->rConnect, true, STREAM_CRYPTO_METHOD_TLS_CLIENT): \stream_socket_enable_crypto($this->rConnect, true, STREAM_CRYPTO_METHOD_TLS_CLIENT):
case defined('STREAM_CRYPTO_METHOD_SSLv23_CLIENT') && case defined('STREAM_CRYPTO_METHOD_SSLv23_CLIENT') &&
@\stream_socket_enable_crypto($this->rConnect, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT): \stream_socket_enable_crypto($this->rConnect, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT):
$bError = false; $bError = false;
break; break;
} }
@ -389,7 +389,7 @@ abstract class NetClient
$sFakeRaw .= "\r\n"; $sFakeRaw .= "\r\n";
} }
$mResult = @\fwrite($this->rConnect, $sRaw); $mResult = \fwrite($this->rConnect, $sRaw);
if (false === $mResult) if (false === $mResult)
{ {
$this->IsConnected(true); $this->IsConnected(true);
@ -420,7 +420,7 @@ abstract class NetClient
{ {
if (null === $mReadLen) if (null === $mReadLen)
{ {
$this->sResponseBuffer = @\fgets($this->rConnect); $this->sResponseBuffer = \fgets($this->rConnect);
} }
else else
{ {
@ -428,7 +428,7 @@ abstract class NetClient
$iRead = $mReadLen; $iRead = $mReadLen;
while (0 < $iRead) while (0 < $iRead)
{ {
$sAddRead = @\fread($this->rConnect, $iRead); $sAddRead = \fread($this->rConnect, $iRead);
if (false === $sAddRead) if (false === $sAddRead)
{ {
$this->sResponseBuffer = false; $this->sResponseBuffer = false;
@ -445,7 +445,7 @@ abstract class NetClient
$this->IsConnected(true); $this->IsConnected(true);
$this->bUnreadBuffer = true; $this->bUnreadBuffer = true;
$aSocketStatus = @\stream_get_meta_data($this->rConnect); $aSocketStatus = \stream_get_meta_data($this->rConnect);
if (isset($aSocketStatus['timed_out']) && $aSocketStatus['timed_out']) if (isset($aSocketStatus['timed_out']) && $aSocketStatus['timed_out'])
{ {
$this->writeLogException( $this->writeLogException(

View file

@ -528,7 +528,7 @@ class Actions
public function SetAuthLogoutToken() : void public function SetAuthLogoutToken() : void
{ {
@\header('X-RainLoop-Action: Logout'); \header('X-RainLoop-Action: Logout');
\RainLoop\Utils::SetCookie(self::AUTH_SPEC_LOGOUT_TOKEN_KEY, \md5($_SERVER['REQUEST_TIME_FLOAT']), 0); \RainLoop\Utils::SetCookie(self::AUTH_SPEC_LOGOUT_TOKEN_KEY, \md5($_SERVER['REQUEST_TIME_FLOAT']), 0);
} }
@ -899,9 +899,9 @@ class Actions
$sLogFileFullPath = \APP_PRIVATE_DATA.'logs/'.$this->compileLogFileName($sLogFileName); $sLogFileFullPath = \APP_PRIVATE_DATA.'logs/'.$this->compileLogFileName($sLogFileName);
$sLogFileDir = \dirname($sLogFileFullPath); $sLogFileDir = \dirname($sLogFileFullPath);
if (!@is_dir($sLogFileDir)) if (!is_dir($sLogFileDir))
{ {
@mkdir($sLogFileDir, 0755, true); mkdir($sLogFileDir, 0755, true);
} }
$oDriver = \MailSo\Log\Drivers\File::NewInstance($sLogFileFullPath); $oDriver = \MailSo\Log\Drivers\File::NewInstance($sLogFileFullPath);
@ -937,7 +937,7 @@ class Actions
$sPdo = empty($sPdo) ? '~' : $sPdo; $sPdo = empty($sPdo) ? '~' : $sPdo;
$this->oLogger->Write('['. $this->oLogger->Write('['.
'Suhosin:'.(\extension_loaded('suhosin') || @\ini_get('suhosin.get.max_value_length') ? 'on' : 'off'). 'Suhosin:'.(\extension_loaded('suhosin') || \ini_get('suhosin.get.max_value_length') ? 'on' : 'off').
'][APC:'.(\MailSo\Base\Utils::FunctionExistsAndEnabled('apc_fetch') ? 'on' : 'off'). '][APC:'.(\MailSo\Base\Utils::FunctionExistsAndEnabled('apc_fetch') ? 'on' : 'off').
'][MB:'.(\MailSo\Base\Utils::FunctionExistsAndEnabled('mb_convert_encoding') ? 'on' : 'off'). '][MB:'.(\MailSo\Base\Utils::FunctionExistsAndEnabled('mb_convert_encoding') ? 'on' : 'off').
'][PDO:'.$sPdo. '][PDO:'.$sPdo.
@ -966,9 +966,9 @@ class Actions
$sLogFileDir = \dirname($sAuthLogFileFullPath); $sLogFileDir = \dirname($sAuthLogFileFullPath);
if (!@is_dir($sLogFileDir)) if (!is_dir($sLogFileDir))
{ {
@mkdir($sLogFileDir, 0755, true); mkdir($sLogFileDir, 0755, true);
} }
$this->oLoggerAuth->AddForbiddenType(\MailSo\Log\Enumerations\Type::MEMORY); $this->oLoggerAuth->AddForbiddenType(\MailSo\Log\Enumerations\Type::MEMORY);
@ -1298,7 +1298,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if ('' !== $aResult['LoadingDescription'] && 'RainLoop' !== $aResult['LoadingDescription']) if ('' !== $aResult['LoadingDescription'] && 'RainLoop' !== $aResult['LoadingDescription'])
{ {
$aResult['LoadingDescriptionEsc'] = @\htmlspecialchars($aResult['LoadingDescription'], ENT_QUOTES|ENT_IGNORE, 'UTF-8'); $aResult['LoadingDescriptionEsc'] = \htmlspecialchars($aResult['LoadingDescription'], ENT_QUOTES|ENT_IGNORE, 'UTF-8');
} }
$oSettings = null; $oSettings = null;
@ -2043,7 +2043,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$aAccounts = array(); $aAccounts = array();
if ('' !== $sAccounts && '{' === \substr($sAccounts, 0, 1)) if ('' !== $sAccounts && '{' === \substr($sAccounts, 0, 1))
{ {
$aAccounts = @\json_decode($sAccounts, true); $aAccounts = \json_decode($sAccounts, true);
} }
if (\is_array($aAccounts) && 0 < \count($aAccounts)) if (\is_array($aAccounts) && 0 < \count($aAccounts))
@ -2060,7 +2060,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
'accounts_identities_order' 'accounts_identities_order'
); );
$aOrder = empty($sOrder) ? array() : @\json_decode($sOrder, true); $aOrder = empty($sOrder) ? array() : \json_decode($sOrder, true);
if (isset($aOrder['Accounts']) && \is_array($aOrder['Accounts']) && if (isset($aOrder['Accounts']) && \is_array($aOrder['Accounts']) &&
1 < \count($aOrder['Accounts'])) 1 < \count($aOrder['Accounts']))
{ {
@ -2099,7 +2099,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if ('' !== $sData && '[' === \substr($sData, 0, 1)) if ('' !== $sData && '[' === \substr($sData, 0, 1))
{ {
$aData = @\json_decode($sData, true); $aData = \json_decode($sData, true);
} }
if (\is_array($aData) && 0 < \count($aData)) if (\is_array($aData) && 0 < \count($aData))
@ -2123,7 +2123,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
'templates_order' 'templates_order'
); );
$aOrder = empty($sOrder) ? array() : @\json_decode($sOrder, true); $aOrder = empty($sOrder) ? array() : \json_decode($sOrder, true);
if (\is_array($aOrder) && 1 < \count($aOrder)) if (\is_array($aOrder) && 1 < \count($aOrder))
{ {
\usort($aTemplates, function ($a, $b) use ($aOrder) { \usort($aTemplates, function ($a, $b) use ($aOrder) {
@ -2170,7 +2170,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if ('' !== $sData && '[' === \substr($sData, 0, 1)) if ('' !== $sData && '[' === \substr($sData, 0, 1))
{ {
$aSubIdentities = @\json_decode($sData, true); $aSubIdentities = \json_decode($sData, true);
} }
$bHasAccountIdentity = false; $bHasAccountIdentity = false;
@ -2212,7 +2212,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
'accounts_identities_order' 'accounts_identities_order'
); );
$aOrder = empty($sOrder) ? array() : @\json_decode($sOrder, true); $aOrder = empty($sOrder) ? array() : \json_decode($sOrder, true);
if (isset($aOrder['Identities']) && \is_array($aOrder['Identities']) && if (isset($aOrder['Identities']) && \is_array($aOrder['Identities']) &&
1 < \count($aOrder['Identities'])) 1 < \count($aOrder['Identities']))
{ {
@ -2274,7 +2274,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$this->StorageProvider()->Put($oAccount, $this->StorageProvider()->Put($oAccount,
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
'accounts', 'accounts',
@\json_encode($aAccounts) \json_encode($aAccounts)
); );
} }
} }
@ -2297,7 +2297,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
return $this->StorageProvider(true)->Put($oAccount, return $this->StorageProvider(true)->Put($oAccount,
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
'identities', 'identities',
@\json_encode($aResult) \json_encode($aResult)
); );
} }
@ -2312,7 +2312,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
return $this->StorageProvider(true)->Put($oAccount, return $this->StorageProvider(true)->Put($oAccount,
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
'templates', 'templates',
@\json_encode($aResult) \json_encode($aResult)
); );
} }
@ -3576,7 +3576,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (false !== $sRep) if (false !== $sRep)
{ {
$aRep = @\json_decode($sRep); $aRep = \json_decode($sRep);
$bReal = \is_array($aRep) && 0 < \count($aRep); $bReal = \is_array($aRep) && 0 < \count($aRep);
if ($bReal) if ($bReal)
@ -3592,7 +3592,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
} }
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) && 0 < \count($aRep);
} }
@ -3672,7 +3672,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (false !== $sRep) if (false !== $sRep)
{ {
$aRep = @\json_decode($sRep, true, 10); $aRep = \json_decode($sRep, true, 10);
$bReal = \is_array($aRep) && 0 < \count($aRep) && isset($aRep['id']) && 'rainloop' === $aRep['id']; $bReal = \is_array($aRep) && 0 < \count($aRep) && isset($aRep['id']) && 'rainloop' === $aRep['id'];
if ($bReal) if ($bReal)
@ -3688,7 +3688,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
} }
else if ('' !== $sRep) else if ('' !== $sRep)
{ {
$aRep = @\json_decode($sRep, true, 10); $aRep = \json_decode($sRep, true, 10);
$bReal = \is_array($aRep) && 0 < \count($aRep) && isset($aRep['id']) && 'rainloop' === $aRep['id']; $bReal = \is_array($aRep) && 0 < \count($aRep) && isset($aRep['id']) && 'rainloop' === $aRep['id'];
} }
@ -3868,13 +3868,13 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
{ {
$bResult = false; $bResult = false;
$sTmp = APP_PRIVATE_DATA.\md5(\microtime(true).$sUrl).'.zip'; $sTmp = APP_PRIVATE_DATA.\md5(\microtime(true).$sUrl).'.zip';
$pDest = @\fopen($sTmp, 'w+b'); $pDest = \fopen($sTmp, 'w+b');
if ($pDest) if ($pDest)
{ {
$iCode = 0; $iCode = 0;
$sContentType = ''; $sContentType = '';
@\set_time_limit(120); \set_time_limit(120);
$oHttp = \MailSo\Base\Http::SingletonInstance(); $oHttp = \MailSo\Base\Http::SingletonInstance();
$bResult = $oHttp->SaveUrlToFile($sUrl, $pDest, $sTmp, $sContentType, $iCode, $this->Logger(), 60, $bResult = $oHttp->SaveUrlToFile($sUrl, $pDest, $sTmp, $sContentType, $iCode, $this->Logger(), 60,
@ -3886,7 +3886,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$this->Logger()->Write($sUrl.' -> '.$sTmp, \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER'); $this->Logger()->Write($sUrl.' -> '.$sTmp, \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER');
} }
@\fclose($pDest); \fclose($pDest);
} }
else else
{ {
@ -3959,7 +3959,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
} }
$oArchive->close(); $oArchive->close();
@\unlink($sTmp); \unlink($sTmp);
} }
return $this->DefaultResponse(__FUNCTION__, $bResult ? return $this->DefaultResponse(__FUNCTION__, $bResult ?
@ -4625,7 +4625,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
$sCheckableFolder = $oSettingsLocal->GetConf('CheckableFolder', '[]'); $sCheckableFolder = $oSettingsLocal->GetConf('CheckableFolder', '[]');
$aCheckableFolder = @\json_decode($sCheckableFolder); $aCheckableFolder = \json_decode($sCheckableFolder);
if (!\is_array($aCheckableFolder)) if (!\is_array($aCheckableFolder))
{ {
@ -4651,7 +4651,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$aCheckableFolder = \array_unique($aCheckableFolder); $aCheckableFolder = \array_unique($aCheckableFolder);
$oSettingsLocal->SetConf('CheckableFolder', @\json_encode($aCheckableFolder)); $oSettingsLocal->SetConf('CheckableFolder', \json_encode($aCheckableFolder));
return $this->DefaultResponse(__FUNCTION__, return $this->DefaultResponse(__FUNCTION__,
$this->SettingsProvider(true)->Save($oAccount, $oSettingsLocal)); $this->SettingsProvider(true)->Save($oAccount, $oSettingsLocal));
@ -5277,7 +5277,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$aToCollection = $oMessage->GetTo(); $aToCollection = $oMessage->GetTo();
if ($aToCollection && $oFrom) if ($aToCollection && $oFrom)
{ {
$sRawBody = @\stream_get_contents($rMessageStream); $sRawBody = \stream_get_contents($rMessageStream);
if (!empty($sRawBody)) if (!empty($sRawBody))
{ {
$sMailTo = \trim($aToCollection->ToString(true)); $sMailTo = \trim($aToCollection->ToString(true));
@ -5492,7 +5492,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (\is_resource($rAppendMessageStream)) if (\is_resource($rAppendMessageStream))
{ {
@fclose($rAppendMessageStream); fclose($rAppendMessageStream);
} }
} }
} }
@ -5504,7 +5504,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (\is_resource($rMessageStream)) if (\is_resource($rMessageStream))
{ {
@\fclose($rMessageStream); \fclose($rMessageStream);
} }
$this->deleteMessageAttachmnets($oAccount); $this->deleteMessageAttachmnets($oAccount);
@ -5601,7 +5601,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (\is_resource($rMessageStream)) if (\is_resource($rMessageStream))
{ {
@\fclose($rMessageStream); \fclose($rMessageStream);
} }
$mResult = true; $mResult = true;
@ -6529,7 +6529,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (\is_resource($rFile)) if (\is_resource($rFile))
{ {
@\fclose($rFile); \fclose($rFile);
} }
} }
} }
@ -6683,9 +6683,9 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
else else
{ {
$rData = $this->FilesProvider()->GetFile($oAccount, $sSavedName); $rData = $this->FilesProvider()->GetFile($oAccount, $sSavedName);
if (@\is_resource($rData)) if (\is_resource($rData))
{ {
$sData = @\stream_get_contents($rData); $sData = \stream_get_contents($rData);
if (!empty($sData) && 0 < \strlen($sData)) if (!empty($sData) && 0 < \strlen($sData))
{ {
$sName = $aFile['name']; $sName = $aFile['name'];
@ -6719,9 +6719,9 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
unset($sData); unset($sData);
} }
if (@\is_resource($rData)) if (\is_resource($rData))
{ {
@\fclose($rData); \fclose($rData);
} }
unset($rData); unset($rData);
@ -6770,11 +6770,11 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
} }
else else
{ {
@\ini_set('auto_detect_line_endings', true); \ini_set('auto_detect_line_endings', true);
$mData = $this->FilesProvider()->GetFile($oAccount, $sSavedName); $mData = $this->FilesProvider()->GetFile($oAccount, $sSavedName);
if ($mData) if ($mData)
{ {
$sFileStart = @\fread($mData, 20); $sFileStart = \fread($mData, 20);
\rewind($mData); \rewind($mData);
if (false !== $sFileStart) if (false !== $sFileStart)
@ -6793,13 +6793,13 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (\is_resource($mData)) if (\is_resource($mData))
{ {
@\fclose($mData); \fclose($mData);
} }
unset($mData); unset($mData);
$this->FilesProvider()->Clear($oAccount, $sSavedName); $this->FilesProvider()->Clear($oAccount, $sSavedName);
@\ini_set('auto_detect_line_endings', false); \ini_set('auto_detect_line_endings', false);
} }
} }
@ -6830,7 +6830,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
{ {
$sDelimiter = ((int) \strpos($sFileStart, ',') > (int) \strpos($sFileStart, ';')) ? ',' : ';'; $sDelimiter = ((int) \strpos($sFileStart, ',') > (int) \strpos($sFileStart, ';')) ? ',' : ';';
@\setlocale(LC_CTYPE, 'en_US.UTF-8'); \setlocale(LC_CTYPE, 'en_US.UTF-8');
while (false !== ($mRow = \fgetcsv($rFile, 5000, $sDelimiter, '"'))) while (false !== ($mRow = \fgetcsv($rFile, 5000, $sDelimiter, '"')))
{ {
if (null === $aHeaders) if (null === $aHeaders)
@ -6946,7 +6946,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$sUrl = $this->Http()->GetFullUrl().'?/Raw/&q[]=/'.\implode('/', $aParams).'/&q[]=/'.$sLast; $sUrl = $this->Http()->GetFullUrl().'?/Raw/&q[]=/'.\implode('/', $aParams).'/&q[]=/'.$sLast;
$sFullUrl = 'https://docs.google.com/viewer?embedded=true&url='.\urlencode($sUrl); $sFullUrl = 'https://docs.google.com/viewer?embedded=true&url='.\urlencode($sUrl);
@\header('Content-Type: text/html; charset=utf-8'); \header('Content-Type: text/html; charset=utf-8');
echo '<html style="height: 100%; width: 100%; margin: 0; padding: 0"><head></head>'. echo '<html style="height: 100%; width: 100%; margin: 0; padding: 0"><head></head>'.
'<body style="height: 100%; width: 100%; margin: 0; padding: 0">'. '<body style="height: 100%; width: 100%; margin: 0; padding: 0">'.
'<iframe style="height: 100%; width: 100%; margin: 0; padding: 0; border: 0" src="'.$sFullUrl.'"></iframe>'. '<iframe style="height: 100%; width: 100%; margin: 0; padding: 0; border: 0" src="'.$sFullUrl.'"></iframe>'.
@ -7206,14 +7206,14 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$sHash = \MailSo\Base\Utils::Md5Rand($sFileNameIn.'~'.$sContentTypeIn); $sHash = \MailSo\Base\Utils::Md5Rand($sFileNameIn.'~'.$sContentTypeIn);
$rTempResource = $oFileProvider->GetFile($oAccount, $sHash, 'wb+'); $rTempResource = $oFileProvider->GetFile($oAccount, $sHash, 'wb+');
if (@\is_resource($rTempResource)) if (\is_resource($rTempResource))
{ {
if (false !== \MailSo\Base\Utils::MultipleStreamWriter($rResource, array($rTempResource))) if (false !== \MailSo\Base\Utils::MultipleStreamWriter($rResource, array($rTempResource)))
{ {
$sResultHash = $sHash; $sResultHash = $sHash;
} }
@\fclose($rTempResource); \fclose($rTempResource);
} }
} }
@ -7555,7 +7555,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
{ {
$this->cacheByKey($sRawKey); $this->cacheByKey($sRawKey);
@\header('Content-Type: '.$aData['ContentType']); \header('Content-Type: '.$aData['ContentType']);
echo \base64_decode($aData['Raw']); echo \base64_decode($aData['Raw']);
unset($aData); unset($aData);
@ -7591,7 +7591,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
{ {
$this->cacheByKey($sRawKey); $this->cacheByKey($sRawKey);
@\header('Content-Type: '.$sContentType); \header('Content-Type: '.$sContentType);
echo \preg_replace('/^data:[^:]+:/', '', $sData); echo \preg_replace('/^data:[^:]+:/', '', $sData);
unset($sData); unset($sData);
@ -7839,7 +7839,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$bDefault = false; $bDefault = false;
$sList = array(); $sList = array();
$sDir = APP_VERSION_ROOT_PATH.'themes'; $sDir = APP_VERSION_ROOT_PATH.'themes';
if (@\is_dir($sDir)) if (\is_dir($sDir))
{ {
$rDirH = \opendir($sDir); $rDirH = \opendir($sDir);
if ($rDirH) if ($rDirH)
@ -7862,12 +7862,12 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
} }
} }
} }
@closedir($rDirH); closedir($rDirH);
} }
} }
$sDir = APP_INDEX_ROOT_PATH.'themes'; // custom user themes $sDir = APP_INDEX_ROOT_PATH.'themes'; // custom user themes
if (@\is_dir($sDir)) if (\is_dir($sDir))
{ {
$rDirH = \opendir($sDir); $rDirH = \opendir($sDir);
if ($rDirH) if ($rDirH)
@ -7880,7 +7880,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
} }
} }
@\closedir($rDirH); \closedir($rDirH);
} }
} }
@ -7917,7 +7917,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$aTop = array(); $aTop = array();
$aList = array(); $aList = array();
if (@\is_dir($sDir)) if (\is_dir($sDir))
{ {
$rDirH = \opendir($sDir); $rDirH = \opendir($sDir);
if ($rDirH) if ($rDirH)
@ -7934,7 +7934,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
} }
} }
@\closedir($rDirH); \closedir($rDirH);
} }
} }
@ -8603,7 +8603,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (null === $this->oAccount) { if (null === $this->oAccount) {
$this->oAccount = $this->getAccountFromToken(false); $this->oAccount = $this->getAccountFromToken(false);
} }
$aCheckable = @\json_decode( $aCheckable = \json_decode(
$this->SettingsProvider(true) $this->SettingsProvider(true)
->Load($this->oAccount) ->Load($this->oAccount)
->GetConf('CheckableFolder', '[]') ->GetConf('CheckableFolder', '[]')

View file

@ -184,7 +184,7 @@ abstract class PdoAbstract
if ($bLogParams && $aLogs) if ($bLogParams && $aLogs)
{ {
$this->writeLog('Params: '.@\json_encode($aLogs, \defined('JSON_UNESCAPED_UNICODE') ? JSON_UNESCAPED_UNICODE : 0)); $this->writeLog('Params: '.\json_encode($aLogs, JSON_UNESCAPED_UNICODE));
} }
} }

View file

@ -107,10 +107,10 @@ abstract class AbstractConfig
{ {
if ($this->bUseApcCache) if ($this->bUseApcCache)
{ {
$iMTime = @\filemtime($this->sFile); $iMTime = \filemtime($this->sFile);
$iMTime = \is_int($iMTime) && 0 < $iMTime ? $iMTime : 0; $iMTime = \is_int($iMTime) && 0 < $iMTime ? $iMTime : 0;
$iATime = $this->sAdditionalFile ? @\filemtime($this->sAdditionalFile) : 0; $iATime = $this->sAdditionalFile ? \filemtime($this->sAdditionalFile) : 0;
$iATime = \is_int($iATime) && 0 < $iATime ? $iATime : 0; $iATime = \is_int($iATime) && 0 < $iATime ? $iATime : 0;
if (0 < $iMTime) if (0 < $iMTime)
@ -137,10 +137,10 @@ abstract class AbstractConfig
{ {
if ($this->bUseApcCache) if ($this->bUseApcCache)
{ {
$iMTime = @\filemtime($this->sFile); $iMTime = \filemtime($this->sFile);
$iMTime = \is_int($iMTime) && 0 < $iMTime ? $iMTime : 0; $iMTime = \is_int($iMTime) && 0 < $iMTime ? $iMTime : 0;
$iATime = $this->sAdditionalFile ? @\filemtime($this->sAdditionalFile) : 0; $iATime = $this->sAdditionalFile ? \filemtime($this->sAdditionalFile) : 0;
$iATime = \is_int($iATime) && 0 < $iATime ? $iATime : 0; $iATime = \is_int($iATime) && 0 < $iATime ? $iATime : 0;
if (0 < $iMTime) if (0 < $iMTime)

View file

@ -150,7 +150,7 @@ class Manager
{ {
$aList = array(); $aList = array();
$aGlob = @\glob(APP_PLUGINS_PATH.'*', GLOB_ONLYDIR|GLOB_NOSORT); $aGlob = \glob(APP_PLUGINS_PATH.'*', GLOB_ONLYDIR|GLOB_NOSORT);
if (\is_array($aGlob)) if (\is_array($aGlob))
{ {
foreach ($aGlob as $sPathName) foreach ($aGlob as $sPathName)

View file

@ -131,7 +131,7 @@ class Property
// lower value for searching // lower value for searching
if ($this->IsValueForLower() && \MailSo\Base\Utils::FunctionExistsAndEnabled('mb_strtolower')) if ($this->IsValueForLower() && \MailSo\Base\Utils::FunctionExistsAndEnabled('mb_strtolower'))
{ {
$this->ValueLower = (string) @\mb_strtolower($this->Value, 'UTF-8'); $this->ValueLower = (string) \mb_strtolower($this->Value, 'UTF-8');
} }
// phone value for searching // phone value for searching

View file

@ -1869,7 +1869,7 @@ SQLITEINITIAL;
return '%'.\str_replace(array($sEscapeSign, '_', '%'), return '%'.\str_replace(array($sEscapeSign, '_', '%'),
array($sEscapeSign.$sEscapeSign, $sEscapeSign.'_', $sEscapeSign.'%'), array($sEscapeSign.$sEscapeSign, $sEscapeSign.'_', $sEscapeSign.'%'),
(string) @\mb_strtolower($sSearch, 'UTF-8')).'%'; (string) \mb_strtolower($sSearch, 'UTF-8')).'%';
} }
private function specialConvertSearchValueCustomPhone(string $sSearch) : string private function specialConvertSearchValueCustomPhone(string $sSearch) : string

View file

@ -97,7 +97,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
if (\file_exists($this->sDomainPath.'/disabled')) if (\file_exists($this->sDomainPath.'/disabled'))
{ {
$sDisabled = @\file_get_contents($this->sDomainPath.'/disabled'); $sDisabled = \file_get_contents($this->sDomainPath.'/disabled');
} }
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini') && if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini') &&
@ -183,7 +183,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
$sFile = ''; $sFile = '';
if (\file_exists($this->sDomainPath.'/disabled')) if (\file_exists($this->sDomainPath.'/disabled'))
{ {
$sFile = @\file_get_contents($this->sDomainPath.'/disabled'); $sFile = \file_get_contents($this->sDomainPath.'/disabled');
} }
$aResult = array(); $aResult = array();
@ -245,7 +245,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
$aAliases = array(); $aAliases = array();
// $aList = \glob($this->sDomainPath.'/*.{ini,alias}', GLOB_BRACE); // $aList = \glob($this->sDomainPath.'/*.{ini,alias}', GLOB_BRACE);
$aList = @\array_diff(\scandir($this->sDomainPath), array('.', '..')); $aList = \array_diff(\scandir($this->sDomainPath), array('.', '..'));
if (\is_array($aList)) if (\is_array($aList))
{ {
foreach ($aList as $sFile) foreach ($aList as $sFile)
@ -291,7 +291,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
$aDisabledNames = array(); $aDisabledNames = array();
if (0 < \count($aResult) && \file_exists($this->sDomainPath.'/disabled')) if (0 < \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 && 0 < strlen($sDisabled))
{ {
$aDisabledNames = \explode(',', $sDisabled); $aDisabledNames = \explode(',', $sDisabled);

View file

@ -30,11 +30,11 @@ class FileStorage implements \RainLoop\Providers\Files\IFiles
$bResult = false; $bResult = false;
if ($rSource) if ($rSource)
{ {
$rOpenOutput = @\fopen($this->generateFullFileName($oAccount, $sKey, true), 'w+b'); $rOpenOutput = \fopen($this->generateFullFileName($oAccount, $sKey, true), 'w+b');
if ($rOpenOutput) if ($rOpenOutput)
{ {
$bResult = (false !== \MailSo\Base\Utils::MultipleStreamWriter($rSource, array($rOpenOutput))); $bResult = (false !== \MailSo\Base\Utils::MultipleStreamWriter($rSource, array($rOpenOutput)));
@\fclose($rOpenOutput); \fclose($rOpenOutput);
} }
} }
return $bResult; return $bResult;
@ -42,7 +42,7 @@ class FileStorage implements \RainLoop\Providers\Files\IFiles
public function MoveUploadedFile(\RainLoop\Model\Account $oAccount, string $sKey, string $sSource) : bool public function MoveUploadedFile(\RainLoop\Model\Account $oAccount, string $sKey, string $sSource) : bool
{ {
return @\move_uploaded_file($sSource, return \move_uploaded_file($sSource,
$this->generateFullFileName($oAccount, $sKey, true)); $this->generateFullFileName($oAccount, $sKey, true));
} }
@ -57,7 +57,7 @@ class FileStorage implements \RainLoop\Providers\Files\IFiles
$sFileName = $this->generateFullFileName($oAccount, $sKey, $bCreate); $sFileName = $this->generateFullFileName($oAccount, $sKey, $bCreate);
if ($bCreate || \file_exists($sFileName)) if ($bCreate || \file_exists($sFileName))
{ {
$mResult = @\fopen($sFileName, $sOpenMode); $mResult = \fopen($sFileName, $sOpenMode);
if (\is_resource($mResult)) if (\is_resource($mResult))
{ {
@ -88,10 +88,10 @@ class FileStorage implements \RainLoop\Providers\Files\IFiles
{ {
if (isset($this->aResources[$sFileName]) && \is_resource($this->aResources[$sFileName])) if (isset($this->aResources[$sFileName]) && \is_resource($this->aResources[$sFileName]))
{ {
@\fclose($this->aResources[$sFileName]); \fclose($this->aResources[$sFileName]);
} }
$mResult = @\unlink($sFileName); $mResult = \unlink($sFileName);
} }
return $mResult; return $mResult;
@ -111,7 +111,7 @@ class FileStorage implements \RainLoop\Providers\Files\IFiles
public function FileExists(\RainLoop\Model\Account $oAccount, string $sKey) : bool public function FileExists(\RainLoop\Model\Account $oAccount, string $sKey) : bool
{ {
return @\file_exists($this->generateFullFileName($oAccount, $sKey)); return \file_exists($this->generateFullFileName($oAccount, $sKey));
} }
public function GC(int $iTimeToClearInHours = 24) : bool public function GC(int $iTimeToClearInHours = 24) : bool
@ -133,7 +133,7 @@ class FileStorage implements \RainLoop\Providers\Files\IFiles
{ {
if (!empty($sFileName) && \is_resource($rFile)) if (!empty($sFileName) && \is_resource($rFile))
{ {
@\fclose($rFile); \fclose($rFile);
} }
} }
} }
@ -166,9 +166,9 @@ class FileStorage implements \RainLoop\Providers\Files\IFiles
(0 < \strlen($sSubEmail) ? $sSubEmail.'/' : ''). (0 < \strlen($sSubEmail) ? $sSubEmail.'/' : '').
$sKeyPath; $sKeyPath;
if ($bMkDir && !empty($sFilePath) && !@\is_dir(\dirname($sFilePath))) if ($bMkDir && !empty($sFilePath) && !\is_dir(\dirname($sFilePath)))
{ {
if (!@\mkdir(\dirname($sFilePath), 0755, true)) if (!\mkdir(\dirname($sFilePath), 0755, true))
{ {
throw new \RainLoop\Exceptions\Exception('Can\'t make storage directory "'.$sFilePath.'"'); throw new \RainLoop\Exceptions\Exception('Can\'t make storage directory "'.$sFilePath.'"');
} }

View file

@ -31,7 +31,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
*/ */
public function Put($oAccount, int $iStorageType, string $sKey, string $sValue) : bool public function Put($oAccount, int $iStorageType, string $sKey, string $sValue) : bool
{ {
return false !== @\file_put_contents( return false !== \file_put_contents(
$this->generateFileName($oAccount, $iStorageType, $sKey, true), $sValue); $this->generateFileName($oAccount, $iStorageType, $sKey, true), $sValue);
} }
@ -62,7 +62,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
$sFileName = $this->generateFileName($oAccount, $iStorageType, $sKey); $sFileName = $this->generateFileName($oAccount, $iStorageType, $sKey);
if (\file_exists($sFileName)) if (\file_exists($sFileName))
{ {
$mResult = @\unlink($sFileName); $mResult = \unlink($sFileName);
} }
return $mResult; return $mResult;
@ -154,9 +154,9 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
($bForDeleteAction ? '' : $sKeyPath); ($bForDeleteAction ? '' : $sKeyPath);
} }
if ($bMkDir && !$bForDeleteAction && !empty($sFilePath) && !@\is_dir(\dirname($sFilePath))) if ($bMkDir && !$bForDeleteAction && !empty($sFilePath) && !\is_dir(\dirname($sFilePath)))
{ {
if (!@\mkdir(\dirname($sFilePath), 0755, true)) if (!\mkdir(\dirname($sFilePath), 0755, true))
{ {
throw new \RainLoop\Exceptions\Exception('Can\'t make storage directory "'.$sFilePath.'"'); throw new \RainLoop\Exceptions\Exception('Can\'t make storage directory "'.$sFilePath.'"');
} }

View file

@ -9,7 +9,7 @@ class TemproryApcStorage extends \RainLoop\Providers\Storage\FileStorage
*/ */
public function Put($oAccount, int $iStorageType, string $sKey, string $sValue) : bool public function Put($oAccount, int $iStorageType, string $sKey, string $sValue) : bool
{ {
return !!@\apc_store($this->generateFileName($oAccount, $iStorageType, $sKey, true), $sValue); return !!\apc_store($this->generateFileName($oAccount, $iStorageType, $sKey, true), $sValue);
} }
/** /**
@ -21,7 +21,7 @@ class TemproryApcStorage extends \RainLoop\Providers\Storage\FileStorage
public function Get($oAccount, int $iStorageType, string $sKey, $mDefault = false) public function Get($oAccount, int $iStorageType, string $sKey, $mDefault = false)
{ {
$bValue = false; $bValue = false;
$mValue = @\apc_fetch($this->generateFileName($oAccount, $iStorageType, $sKey), $bValue); $mValue = \apc_fetch($this->generateFileName($oAccount, $iStorageType, $sKey), $bValue);
if (!$bValue) if (!$bValue)
{ {
$mValue = $mDefault; $mValue = $mDefault;
@ -35,7 +35,7 @@ class TemproryApcStorage extends \RainLoop\Providers\Storage\FileStorage
*/ */
public function Clear($oAccount, int $iStorageType, string $sKey) : bool public function Clear($oAccount, int $iStorageType, string $sKey) : bool
{ {
@\apc_delete($this->generateFileName($oAccount, $iStorageType, $sKey)); \apc_delete($this->generateFileName($oAccount, $iStorageType, $sKey));
return true; return true;
} }

View file

@ -35,24 +35,24 @@ class Service
$sServer = \trim($this->oActions->Config()->Get('security', 'custom_server_signature', '')); $sServer = \trim($this->oActions->Config()->Get('security', 'custom_server_signature', ''));
if (0 < \strlen($sServer)) if (0 < \strlen($sServer))
{ {
@\header('Server: '.$sServer, true); \header('Server: '.$sServer, true);
} }
$sXFrameOptionsHeader = \trim($this->oActions->Config()->Get('security', 'x_frame_options_header', '')); $sXFrameOptionsHeader = \trim($this->oActions->Config()->Get('security', 'x_frame_options_header', ''));
if (0 < \strlen($sXFrameOptionsHeader)) if (0 < \strlen($sXFrameOptionsHeader))
{ {
@\header('X-Frame-Options: '.$sXFrameOptionsHeader, true); \header('X-Frame-Options: '.$sXFrameOptionsHeader, true);
} }
$sXssProtectionOptionsHeader = \trim($this->oActions->Config()->Get('security', 'x_xss_protection_header', '')); $sXssProtectionOptionsHeader = \trim($this->oActions->Config()->Get('security', 'x_xss_protection_header', ''));
if (0 < \strlen($sXssProtectionOptionsHeader)) if (0 < \strlen($sXssProtectionOptionsHeader))
{ {
@\header('X-XSS-Protection: '.$sXssProtectionOptionsHeader, true); \header('X-XSS-Protection: '.$sXssProtectionOptionsHeader, true);
} }
if ($this->oActions->Config()->Get('labs', 'force_https', false) && !$this->oHttp->IsSecure()) if ($this->oActions->Config()->Get('labs', 'force_https', false) && !$this->oHttp->IsSecure())
{ {
@\header('Location: https://'.$this->oHttp->GetHost(false, false).$this->oHttp->GetUrl(), true); \header('Location: https://'.$this->oHttp->GetHost(false, false).$this->oHttp->GetUrl(), true);
exit(0); exit(0);
} }
@ -157,13 +157,13 @@ class Service
} }
} }
@\header('Content-Security-Policy:'); \header('Content-Security-Policy:');
@\header_remove('Content-Security-Policy'); \header_remove('Content-Security-Policy');
@header('Content-Type: text/html; charset=utf-8'); header('Content-Type: text/html; charset=utf-8');
$this->oHttp->ServerNoCache(); $this->oHttp->ServerNoCache();
if (!@\is_dir(APP_DATA_FOLDER_PATH) || !@\is_writable(APP_DATA_FOLDER_PATH)) if (!\is_dir(APP_DATA_FOLDER_PATH) || !\is_writable(APP_DATA_FOLDER_PATH))
{ {
echo $this->oServiceActions->ErrorTemplates( echo $this->oServiceActions->ErrorTemplates(
'Permission denied!', 'Permission denied!',
@ -214,7 +214,7 @@ class Service
} }
else else
{ {
@\header('X-XSS-Protection: 1; mode=block'); \header('X-XSS-Protection: 1; mode=block');
} }
// Output result // Output result

View file

@ -76,7 +76,7 @@ class ServiceActions
public function ServiceAjax() : string public function ServiceAjax() : string
{ {
@\ob_start(); \ob_start();
$aResponseItem = null; $aResponseItem = null;
$oException = null; $oException = null;
@ -187,11 +187,11 @@ class ServiceActions
$this->Plugins()->RunHook('filter.ajax-response', array($sAction, &$aResponseItem)); $this->Plugins()->RunHook('filter.ajax-response', array($sAction, &$aResponseItem));
@\header('Content-Type: application/json; charset=utf-8'); \header('Content-Type: application/json; charset=utf-8');
$sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger()); $sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger());
$sObResult = @\ob_get_clean(); $sObResult = \ob_get_clean();
if ($this->Logger()->IsEnabled()) if ($this->Logger()->IsEnabled())
{ {
@ -215,7 +215,7 @@ class ServiceActions
public function ServiceAppend() : string public function ServiceAppend() : string
{ {
@\ob_start(); \ob_start();
$bResponse = false; $bResponse = false;
$oException = null; $oException = null;
try try
@ -232,10 +232,10 @@ class ServiceActions
$bResponse = false; $bResponse = false;
} }
@\header('Content-Type: text/plain; charset=utf-8'); \header('Content-Type: text/plain; charset=utf-8');
$sResult = true === $bResponse ? '1' : '0'; $sResult = true === $bResponse ? '1' : '0';
$sObResult = @\ob_get_clean(); $sObResult = \ob_get_clean();
if (0 < \strlen($sObResult)) if (0 < \strlen($sObResult))
{ {
$this->Logger()->Write($sObResult, \MailSo\Log\Enumerations\Type::ERROR, 'OB-DATA'); $this->Logger()->Write($sObResult, \MailSo\Log\Enumerations\Type::ERROR, 'OB-DATA');
@ -255,7 +255,7 @@ class ServiceActions
{ {
$oConfig = $this->Config(); $oConfig = $this->Config();
@\ob_start(); \ob_start();
$aResponseItem = null; $aResponseItem = null;
try try
{ {
@ -314,17 +314,17 @@ class ServiceActions
if ('iframe' === $this->oHttp->GetPost('jua-post-type', '')) if ('iframe' === $this->oHttp->GetPost('jua-post-type', ''))
{ {
@\header('Content-Type: text/html; charset=utf-8'); \header('Content-Type: text/html; charset=utf-8');
} }
else else
{ {
@\header('Content-Type: application/json; charset=utf-8'); \header('Content-Type: application/json; charset=utf-8');
} }
$this->Plugins()->RunHook('filter.upload-response', array(&$aResponseItem)); $this->Plugins()->RunHook('filter.upload-response', array(&$aResponseItem));
$sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger()); $sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger());
$sObResult = @\ob_get_clean(); $sObResult = \ob_get_clean();
if (0 < \strlen($sObResult)) if (0 < \strlen($sObResult))
{ {
$this->Logger()->Write($sObResult, \MailSo\Log\Enumerations\Type::ERROR, 'OB-DATA'); $this->Logger()->Write($sObResult, \MailSo\Log\Enumerations\Type::ERROR, 'OB-DATA');
@ -401,8 +401,8 @@ class ServiceActions
$sMethodName = 'Raw'.$sAction; $sMethodName = 'Raw'.$sAction;
if (\method_exists($this->oActions, $sMethodName)) if (\method_exists($this->oActions, $sMethodName))
{ {
@\header('X-Raw-Action: '.$sMethodName, true); \header('X-Raw-Action: '.$sMethodName, true);
@\header('Content-Security-Policy: script-src \'none\'; frame-src \'none\'; child-src \'none\'', true); \header('Content-Security-Policy: script-src \'none\'; frame-src \'none\'; child-src \'none\'', true);
$sRawError = ''; $sRawError = '';
$this->oActions->SetActionParams(array( $this->oActions->SetActionParams(array(
@ -462,7 +462,7 @@ class ServiceActions
{ {
// sleep(2); // sleep(2);
$sResult = ''; $sResult = '';
@\header('Content-Type: application/javascript; charset=utf-8'); \header('Content-Type: application/javascript; charset=utf-8');
if (!empty($this->aPaths[3])) if (!empty($this->aPaths[3]))
{ {
@ -505,7 +505,7 @@ class ServiceActions
public function ServiceTemplates() : string public function ServiceTemplates() : string
{ {
$sResult = ''; $sResult = '';
@\header('Content-Type: application/javascript; charset=utf-8'); \header('Content-Type: application/javascript; charset=utf-8');
$bCacheEnabled = $this->Config()->Get('labs', 'cache_system_data', true); $bCacheEnabled = $this->Config()->Get('labs', 'cache_system_data', true);
if ($bCacheEnabled) if ($bCacheEnabled)
@ -544,7 +544,7 @@ class ServiceActions
$sResult = ''; $sResult = '';
$bAdmin = !empty($this->aPaths[2]) && 'Admin' === $this->aPaths[2]; $bAdmin = !empty($this->aPaths[2]) && 'Admin' === $this->aPaths[2];
@\header('Content-Type: application/javascript; charset=utf-8'); \header('Content-Type: application/javascript; charset=utf-8');
$bCacheEnabled = $this->Config()->Get('labs', 'cache_system_data', true); $bCacheEnabled = $this->Config()->Get('labs', 'cache_system_data', true);
if ($bCacheEnabled) if ($bCacheEnabled)
@ -585,11 +585,11 @@ class ServiceActions
if ($bJson) if ($bJson)
{ {
@\header('Content-Type: application/json; charset=utf-8'); \header('Content-Type: application/json; charset=utf-8');
} }
else else
{ {
@\header('Content-Type: text/css; charset=utf-8'); \header('Content-Type: text/css; charset=utf-8');
} }
$sTheme = ''; $sTheme = '';
@ -717,7 +717,7 @@ class ServiceActions
$sTitle = $this->oActions->StaticI18N('STATIC/BAD_BROWSER_TITLE'); $sTitle = $this->oActions->StaticI18N('STATIC/BAD_BROWSER_TITLE');
$sDesc = \nl2br($this->oActions->StaticI18N('STATIC/BAD_BROWSER_DESC')); $sDesc = \nl2br($this->oActions->StaticI18N('STATIC/BAD_BROWSER_DESC'));
@\header('Content-Type: text/html; charset=utf-8'); \header('Content-Type: text/html; charset=utf-8');
return \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/BadBrowser.html'), array( return \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/BadBrowser.html'), array(
'{{BaseWebStaticPath}}' => \RainLoop\Utils::WebStaticPath(), '{{BaseWebStaticPath}}' => \RainLoop\Utils::WebStaticPath(),
'{{ErrorTitle}}' => $sTitle, '{{ErrorTitle}}' => $sTitle,
@ -748,7 +748,7 @@ class ServiceActions
{ {
$this->oHttp->ServerNoCache(); $this->oHttp->ServerNoCache();
@\header('Content-Type: text/plain; charset=utf-8'); \header('Content-Type: text/plain; charset=utf-8');
$this->oActions->Logger()->Write('Pong', \MailSo\Log\Enumerations\Type::INFO, 'PING'); $this->oActions->Logger()->Write('Pong', \MailSo\Log\Enumerations\Type::INFO, 'PING');
return 'Pong'; return 'Pong';
} }
@ -759,7 +759,7 @@ class ServiceActions
if ($this->oActions->IsAdminLoggined(false)) if ($this->oActions->IsAdminLoggined(false))
{ {
@\header('Content-Type: text/html; charset=utf-8'); \header('Content-Type: text/html; charset=utf-8');
\phpinfo(); \phpinfo();
} }
} }
@ -888,7 +888,7 @@ class ServiceActions
{ {
case 'json': case 'json':
@\header('Content-Type: application/json; charset=utf-8'); \header('Content-Type: application/json; charset=utf-8');
$aResult = array( $aResult = array(
'Action' => 'ExternalLogin', 'Action' => 'ExternalLogin',
@ -972,13 +972,13 @@ class ServiceActions
private function localError(string $sTitle, string $sDesc) : string private function localError(string $sTitle, string $sDesc) : string
{ {
@header('Content-Type: text/html; charset=utf-8'); header('Content-Type: text/html; charset=utf-8');
return $this->ErrorTemplates($sTitle, \nl2br($sDesc)); return $this->ErrorTemplates($sTitle, \nl2br($sDesc));
} }
private function localAppData(bool $bAdmin = false, string $sAdd = '') : string private function localAppData(bool $bAdmin = false, string $sAdd = '') : string
{ {
@\header('Content-Type: application/javascript; charset=utf-8'); \header('Content-Type: application/javascript; charset=utf-8');
$this->oHttp->ServerNoCache(); $this->oHttp->ServerNoCache();
$sAuthAccountHash = ''; $sAuthAccountHash = '';

View file

@ -27,7 +27,7 @@ class Utils
$sKeyFile = APP_VERSION_ROOT_PATH.'app/resources/RainLoop.asc'; $sKeyFile = APP_VERSION_ROOT_PATH.'app/resources/RainLoop.asc';
if (\file_exists($sKeyFile) && \file_exists($sFileName) && !empty($sSignature)) if (\file_exists($sKeyFile) && \file_exists($sFileName) && !empty($sSignature))
{ {
$sKeyFile = @\file_get_contents($sKeyFile); $sKeyFile = \file_get_contents($sKeyFile);
return !empty($sKeyFile); // TODO return !empty($sKeyFile); // TODO
} }
@ -73,7 +73,7 @@ class Utils
} }
$aString[] = $sKey; $aString[] = $sKey;
$sResult = @\serialize($aString); $sResult = \serialize($aString);
\openssl_free_key($oPubKey); \openssl_free_key($oPubKey);
} }
@ -94,7 +94,7 @@ class Utils
{ {
$oPrivKey = \openssl_pkey_get_private($sPrivateKey); $oPrivKey = \openssl_pkey_get_private($sPrivateKey);
$aString = @\unserialize($sString); $aString = \unserialize($sString);
if (\is_array($aString)) if (\is_array($aString))
{ {
if ($sKey === \array_pop($aString)) if ($sKey === \array_pop($aString))
@ -153,12 +153,12 @@ class Utils
static public function EncodeKeyValues(array $aValues, string $sCustomKey = '') : string static public function EncodeKeyValues(array $aValues, string $sCustomKey = '') : string
{ {
return \MailSo\Base\Utils::UrlSafeBase64Encode( return \MailSo\Base\Utils::UrlSafeBase64Encode(
static::EncryptString(@\serialize($aValues), \md5(APP_SALT.$sCustomKey))); static::EncryptString(\serialize($aValues), \md5(APP_SALT.$sCustomKey)));
} }
static public function DecodeKeyValues(string $sEncodedValues, string $sCustomKey = '') : array static public function DecodeKeyValues(string $sEncodedValues, string $sCustomKey = '') : array
{ {
$aResult = @\unserialize( $aResult = \unserialize(
static::DecryptString( static::DecryptString(
\MailSo\Base\Utils::UrlSafeBase64Decode($sEncodedValues), \md5(APP_SALT.$sCustomKey))); \MailSo\Base\Utils::UrlSafeBase64Decode($sEncodedValues), \md5(APP_SALT.$sCustomKey)));
@ -169,12 +169,12 @@ class Utils
{ {
return \MailSo\Base\Utils::UrlSafeBase64Encode( return \MailSo\Base\Utils::UrlSafeBase64Encode(
static::EncryptStringQ( static::EncryptStringQ(
@\serialize($aValues), \md5(APP_SALT.$sCustomKey))); \serialize($aValues), \md5(APP_SALT.$sCustomKey)));
} }
static public function DecodeKeyValuesQ(string $sEncodedValues, string $sCustomKey = '') : array static public function DecodeKeyValuesQ(string $sEncodedValues, string $sCustomKey = '') : array
{ {
$aResult = @\unserialize( $aResult = \unserialize(
static::DecryptStringQ( static::DecryptStringQ(
\MailSo\Base\Utils::UrlSafeBase64Decode($sEncodedValues), \md5(APP_SALT.$sCustomKey))); \MailSo\Base\Utils::UrlSafeBase64Decode($sEncodedValues), \md5(APP_SALT.$sCustomKey)));
@ -233,7 +233,7 @@ class Utils
public static function PathMD5(string $sPath) : string public static function PathMD5(string $sPath) : string
{ {
$sResult = ''; $sResult = '';
if (@\is_dir($sPath)) if (\is_dir($sPath))
{ {
$oDirIterator = new \RecursiveDirectoryIterator($sPath); $oDirIterator = new \RecursiveDirectoryIterator($sPath);
$oIterator = new \RecursiveIteratorIterator($oDirIterator, \RecursiveIteratorIterator::SELF_FIRST); $oIterator = new \RecursiveIteratorIterator($oDirIterator, \RecursiveIteratorIterator::SELF_FIRST);
@ -297,11 +297,11 @@ class Utils
public static function FolderFiles(string $sDir, string $sType = '') : array public static function FolderFiles(string $sDir, string $sType = '') : array
{ {
$aResult = array(); $aResult = array();
if (@\is_dir($sDir)) if (\is_dir($sDir))
{ {
if (false !== ($rDirHandle = @\opendir($sDir))) if (false !== ($rDirHandle = \opendir($sDir)))
{ {
while (false !== ($sFile = @\readdir($rDirHandle))) while (false !== ($sFile = \readdir($rDirHandle)))
{ {
if (empty($sType) || $sType === \substr($sFile, -\strlen($sType))) if (empty($sType) || $sType === \substr($sFile, -\strlen($sType)))
{ {
@ -312,7 +312,7 @@ class Utils
} }
} }
@\closedir($rDirHandle); \closedir($rDirHandle);
} }
} }
@ -392,7 +392,7 @@ class Utils
} }
static::$Cookies[$sName] = $sValue; static::$Cookies[$sName] = $sValue;
@\setcookie($sName, $sValue, $iExpire, $sPath, $sDomain, $bSecure, $bHttpOnly); \setcookie($sName, $sValue, $iExpire, $sPath, $sDomain, $bSecure, $bHttpOnly);
} }
public static function ClearCookie(string $sName) public static function ClearCookie(string $sName)
@ -406,7 +406,7 @@ class Utils
$sPath = $sPath && 0 < \strlen($sPath) ? $sPath : null; $sPath = $sPath && 0 < \strlen($sPath) ? $sPath : null;
unset(static::$Cookies[$sName]); unset(static::$Cookies[$sName]);
@\setcookie($sName, '', \time() - 3600 * 24 * 30, $sPath); \setcookie($sName, '', \time() - 3600 * 24 * 30, $sPath);
} }
public static function UrlEncode(string $sV, bool $bEncode = false) : string public static function UrlEncode(string $sV, bool $bEncode = false) : string
@ -455,11 +455,11 @@ class Utils
{ {
// if (\MailSo\Base\Utils::FunctionExistsAndEnabled('parse_ini_file')) // if (\MailSo\Base\Utils::FunctionExistsAndEnabled('parse_ini_file'))
// { // {
// return @\parse_ini_file($sFileName, !!$bProcessSections); // return \parse_ini_file($sFileName, !!$bProcessSections);
// } // }
$sData = @\file_get_contents($sFileName); $sData = \file_get_contents($sFileName);
return \is_string($sData) ? @\parse_ini_string($sData, !!$bProcessSections) : null; return \is_string($sData) ? \parse_ini_string($sData, !!$bProcessSections) : null;
} }
public static function CustomBaseConvert(string $sNumberInput, string $sFromBaseInput = '0123456789', string $sToBaseInput = '0123456789') public static function CustomBaseConvert(string $sNumberInput, string $sFromBaseInput = '0123456789', string $sToBaseInput = '0123456789')

View file

@ -4,10 +4,8 @@
{ {
if (!defined('APP_REQUEST_RND')) if (!defined('APP_REQUEST_RND'))
{ {
@ini_set('register_globals', 0); ini_set('register_globals', 0);
@ini_set('zend.ze1_compatibility_mode', 0); ini_set('zend.ze1_compatibility_mode', 0);
@ini_set('magic_quotes_gpc', 0);
@ini_set('magic_quotes_runtime', 0);
define('APP_REQUEST_RND', function_exists('uuid_create') ? md5(uuid_create(UUID_TYPE_DEFAULT)) : bin2hex(random_bytes(16))); define('APP_REQUEST_RND', function_exists('uuid_create') ? md5(uuid_create(UUID_TYPE_DEFAULT)) : bin2hex(random_bytes(16)));
define('APP_VERSION_ROOT_PATH', APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/'); define('APP_VERSION_ROOT_PATH', APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/');
@ -30,7 +28,7 @@
define('APP_DEFAULT_PRIVATE_DATA_NAME', '_default_'); define('APP_DEFAULT_PRIVATE_DATA_NAME', '_default_');
$sPrivateDataFolderInternalName = @file_exists(APP_INDEX_ROOT_PATH.'MULTIPLY') ? APP_SITE : ''; $sPrivateDataFolderInternalName = file_exists(APP_INDEX_ROOT_PATH.'MULTIPLY') ? APP_SITE : '';
define('APP_PRIVATE_DATA_NAME', 0 === strlen($sPrivateDataFolderInternalName) ? APP_DEFAULT_PRIVATE_DATA_NAME : $sPrivateDataFolderInternalName); define('APP_PRIVATE_DATA_NAME', 0 === strlen($sPrivateDataFolderInternalName) ? APP_DEFAULT_PRIVATE_DATA_NAME : $sPrivateDataFolderInternalName);
define('APP_MULTIPLY', 0 < strlen($sPrivateDataFolderInternalName) && APP_DEFAULT_PRIVATE_DATA_NAME !== APP_PRIVATE_DATA_NAME); define('APP_MULTIPLY', 0 < strlen($sPrivateDataFolderInternalName) && APP_DEFAULT_PRIVATE_DATA_NAME !== APP_PRIVATE_DATA_NAME);
@ -57,9 +55,9 @@
define('APP_DATA_FOLDER_PATH_UNIX', str_replace('\\', '/', APP_DATA_FOLDER_PATH)); define('APP_DATA_FOLDER_PATH_UNIX', str_replace('\\', '/', APP_DATA_FOLDER_PATH));
$sSalt = @file_get_contents(APP_DATA_FOLDER_PATH.'SALT.php'); $sSalt = file_get_contents(APP_DATA_FOLDER_PATH.'SALT.php');
$sData = file_exists(APP_DATA_FOLDER_PATH.'DATA.php') ? @file_get_contents(APP_DATA_FOLDER_PATH.'DATA.php') : ''; $sData = file_exists(APP_DATA_FOLDER_PATH.'DATA.php') ? file_get_contents(APP_DATA_FOLDER_PATH.'DATA.php') : '';
$sInstalled = @file_get_contents(APP_DATA_FOLDER_PATH.'INSTALLED'); $sInstalled = file_get_contents(APP_DATA_FOLDER_PATH.'INSTALLED');
// installation checking data folder // installation checking data folder
if (APP_VERSION !== $sInstalled) if (APP_VERSION !== $sInstalled)
@ -70,40 +68,40 @@
$sCheckFolder = APP_DATA_FOLDER_PATH.$sCheckName; $sCheckFolder = APP_DATA_FOLDER_PATH.$sCheckName;
$sCheckFilePath = APP_DATA_FOLDER_PATH.$sCheckName.'/'.$sCheckName.'.file'; $sCheckFilePath = APP_DATA_FOLDER_PATH.$sCheckName.'/'.$sCheckName.'.file';
@unlink($sCheckFilePath); unlink($sCheckFilePath);
@rmdir($sCheckFolder); rmdir($sCheckFolder);
if (!@is_dir(APP_DATA_FOLDER_PATH)) if (!is_dir(APP_DATA_FOLDER_PATH))
{ {
@mkdir(APP_DATA_FOLDER_PATH, 0755); mkdir(APP_DATA_FOLDER_PATH, 0755);
} }
else else
{ {
@chmod(APP_DATA_FOLDER_PATH, 0755); chmod(APP_DATA_FOLDER_PATH, 0755);
} }
$sTest = ''; $sTest = '';
switch (true) switch (true)
{ {
case !@is_dir(APP_DATA_FOLDER_PATH): case !is_dir(APP_DATA_FOLDER_PATH):
$sTest = 'is_dir'; $sTest = 'is_dir';
break; break;
case !@is_readable(APP_DATA_FOLDER_PATH): case !is_readable(APP_DATA_FOLDER_PATH):
$sTest = 'is_readable'; $sTest = 'is_readable';
break; break;
case !@is_writable(APP_DATA_FOLDER_PATH): case !is_writable(APP_DATA_FOLDER_PATH):
$sTest = 'is_writable'; $sTest = 'is_writable';
break; break;
case !@mkdir($sCheckFolder, 0755): case !mkdir($sCheckFolder, 0755):
$sTest = 'mkdir'; $sTest = 'mkdir';
break; break;
case false === @file_put_contents($sCheckFilePath, time()): case false === file_put_contents($sCheckFilePath, time()):
$sTest = 'file_put_contents'; $sTest = 'file_put_contents';
break; break;
case !@unlink($sCheckFilePath): case !unlink($sCheckFilePath):
$sTest = 'unlink'; $sTest = 'unlink';
break; break;
case !@rmdir($sCheckFolder): case !rmdir($sCheckFolder):
$sTest = 'rmdir'; $sTest = 'rmdir';
break; break;
} }
@ -128,59 +126,59 @@
define('APP_PLUGINS_PATH', APP_PRIVATE_DATA.'plugins/'); define('APP_PLUGINS_PATH', APP_PRIVATE_DATA.'plugins/');
if (APP_VERSION !== $sInstalled || (APP_MULTIPLY && !@is_dir(APP_PRIVATE_DATA))) if (APP_VERSION !== $sInstalled || (APP_MULTIPLY && !is_dir(APP_PRIVATE_DATA)))
{ {
define('APP_INSTALLED_START', true); define('APP_INSTALLED_START', true);
define('APP_INSTALLED_VERSION', $sInstalled); define('APP_INSTALLED_VERSION', $sInstalled);
@file_put_contents(APP_DATA_FOLDER_PATH.'INSTALLED', APP_VERSION); file_put_contents(APP_DATA_FOLDER_PATH.'INSTALLED', APP_VERSION);
@file_put_contents(APP_DATA_FOLDER_PATH.'VERSION', APP_VERSION); file_put_contents(APP_DATA_FOLDER_PATH.'VERSION', APP_VERSION);
@file_put_contents(APP_DATA_FOLDER_PATH.'index.html', 'Forbidden'); file_put_contents(APP_DATA_FOLDER_PATH.'index.html', 'Forbidden');
@file_put_contents(APP_DATA_FOLDER_PATH.'index.php', 'Forbidden'); file_put_contents(APP_DATA_FOLDER_PATH.'index.php', 'Forbidden');
if (!@file_exists(APP_DATA_FOLDER_PATH.'.htaccess') && @file_exists(APP_VERSION_ROOT_PATH.'app/.htaccess')) if (!file_exists(APP_DATA_FOLDER_PATH.'.htaccess') && file_exists(APP_VERSION_ROOT_PATH.'app/.htaccess'))
{ {
@file_put_contents(APP_DATA_FOLDER_PATH.'.htaccess', @file_get_contents(APP_VERSION_ROOT_PATH.'app/.htaccess')); file_put_contents(APP_DATA_FOLDER_PATH.'.htaccess', file_get_contents(APP_VERSION_ROOT_PATH.'app/.htaccess'));
} }
if (!@is_dir(APP_PRIVATE_DATA)) if (!is_dir(APP_PRIVATE_DATA))
{ {
@mkdir(APP_PRIVATE_DATA, 0755, true); mkdir(APP_PRIVATE_DATA, 0755, true);
} }
foreach (array('logs', 'cache', 'configs', 'plugins', 'storage') as $sName) foreach (array('logs', 'cache', 'configs', 'plugins', 'storage') as $sName)
{ {
if (!@is_dir(APP_PRIVATE_DATA.$sName)) if (!is_dir(APP_PRIVATE_DATA.$sName))
{ {
@mkdir(APP_PRIVATE_DATA.$sName, 0755, true); mkdir(APP_PRIVATE_DATA.$sName, 0755, true);
} }
} }
if (!@file_exists(APP_PRIVATE_DATA.'domains/disabled')) if (!file_exists(APP_PRIVATE_DATA.'domains/disabled'))
{ {
if (!@is_dir(APP_PRIVATE_DATA.'domains')) if (!is_dir(APP_PRIVATE_DATA.'domains'))
{ {
@mkdir(APP_PRIVATE_DATA.'domains', 0755); mkdir(APP_PRIVATE_DATA.'domains', 0755);
} }
if (@is_dir(APP_PRIVATE_DATA.'domains')) if (is_dir(APP_PRIVATE_DATA.'domains'))
{ {
$sFile = $sNewFile = $sNewFileName = ''; $sFile = $sNewFile = $sNewFileName = '';
$aFiles = @glob(APP_VERSION_ROOT_PATH.'app/domains/*'); $aFiles = glob(APP_VERSION_ROOT_PATH.'app/domains/*');
if (is_array($aFiles) && 0 < \count($aFiles)) if (is_array($aFiles) && 0 < \count($aFiles))
{ {
foreach ($aFiles as $sFile) foreach ($aFiles as $sFile)
{ {
if (@is_file($sFile)) if (is_file($sFile))
{ {
$sNewFileName = basename($sFile); $sNewFileName = basename($sFile);
if ('default.ini.dist' !== $sNewFileName) if ('default.ini.dist' !== $sNewFileName)
{ {
$sNewFile = APP_PRIVATE_DATA.'domains/'.$sNewFileName; $sNewFile = APP_PRIVATE_DATA.'domains/'.$sNewFileName;
if (!@file_exists($sNewFile)) if (!file_exists($sNewFile))
{ {
@copy($sFile, $sNewFile); copy($sFile, $sNewFile);
} }
} }
} }
@ -188,13 +186,13 @@
} }
// $sClearedSiteName = preg_replace('/^(www|demo|rainloop|webmail|email|mail|imap|imap4|smtp)\./i', '', trim(APP_SITE)); // $sClearedSiteName = preg_replace('/^(www|demo|rainloop|webmail|email|mail|imap|imap4|smtp)\./i', '', trim(APP_SITE));
// if (!empty($sClearedSiteName) && @file_exists(APP_VERSION_ROOT_PATH.'app/domains/default.ini.dist') && // if (!empty($sClearedSiteName) && file_exists(APP_VERSION_ROOT_PATH.'app/domains/default.ini.dist') &&
// !@file_exists(APP_PRIVATE_DATA.'domains/'.$sClearedSiteName.'.ini')) // !file_exists(APP_PRIVATE_DATA.'domains/'.$sClearedSiteName.'.ini'))
// { // {
// $sConfigTemplate = @file_get_contents(APP_VERSION_ROOT_PATH.'app/domains/default.ini.dist'); // $sConfigTemplate = file_get_contents(APP_VERSION_ROOT_PATH.'app/domains/default.ini.dist');
// if (!empty($sConfigTemplate)) // if (!empty($sConfigTemplate))
// { // {
// @file_put_contents(APP_PRIVATE_DATA.'domains/'.$sClearedSiteName.'.ini', strtr($sConfigTemplate, array( // file_put_contents(APP_PRIVATE_DATA.'domains/'.$sClearedSiteName.'.ini', strtr($sConfigTemplate, array(
// 'IMAP_HOST' => 'localhost' !== $sClearedSiteName? 'imap.'.$sClearedSiteName : $sClearedSiteName, // 'IMAP_HOST' => 'localhost' !== $sClearedSiteName? 'imap.'.$sClearedSiteName : $sClearedSiteName,
// 'IMAP_PORT' => '993', // 'IMAP_PORT' => '993',
// 'SMTP_HOST' => 'localhost' !== $sClearedSiteName? 'smtp.'.$sClearedSiteName : $sClearedSiteName, // 'SMTP_HOST' => 'localhost' !== $sClearedSiteName? 'smtp.'.$sClearedSiteName : $sClearedSiteName,