From 1da2bb045fb75b3c22cec7605f41bfb53e5b3dae Mon Sep 17 00:00:00 2001 From: djmaze Date: Tue, 23 Nov 2021 15:09:21 +0100 Subject: [PATCH] Removed unused CopyDir() and InlineRebuildStringToJsString() Bugfix StrMailDomainToLower() --- .../app/libraries/MailSo/Base/HtmlUtils.php | 4 +- .../0.0.0/app/libraries/MailSo/Base/Utils.php | 54 ++----------------- 2 files changed, 7 insertions(+), 51 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php b/snappymail/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php index 49b46e0c2..0ee1cd061 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php @@ -55,12 +55,12 @@ abstract class HtmlUtils $sText = static::ClearBodyAndHtmlTag($sText, $sHtmlAttrs, $sBodyAttrs); $oDom = self::createDOMDocument(); - @$oDom->loadHTML('<'.'?xml version="1.0" encoding="utf-8"?'.'>'. + $oDom->loadHTML(''. ''. ''. ''.\MailSo\Base\Utils::Utf8Clear($sText).''); - @$oDom->normalizeDocument(); + $oDom->normalizeDocument(); if (\MailSo\Base\Utils::FunctionExistsAndEnabled('libxml_clear_errors')) { diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php b/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php index a8b01f215..d7863f254 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php @@ -212,10 +212,10 @@ abstract class Utils public static function StrMailDomainToLower(string $sValue) : string { - $aParts = \explode('@', $sValue, 2); - if (!empty($aParts[1])) - { - $aParts[1] = \mb_strtolower($aParts[1]); + $aParts = \explode('@', $sValue); + $iLast = \count($aParts) - 1; + if ($iLast) { + $aParts[$iLast] = \mb_strtolower($aParts[$iLast]); } return \implode('@', $aParts); @@ -633,6 +633,7 @@ abstract class Utils 'bz' => 'application/x-bzip', 'bz2' => 'application/x-bzip2', 'deb' => 'application/x-debian-package', + 'tar' => 'application/x-tar', // fonts 'psf' => 'application/x-font-linux-psf', @@ -811,17 +812,6 @@ abstract class Utils return false; } - public static function InlineRebuildStringToJsString(string $sText) : string - { - static $aJsonReplaces = array( - array('\\', "\n", "\t", "\r", '\b', "\f", '"'), - array('\\\\', '\\n', '\\t', '\\r', '\\b', '\\f', '\"') - ); - - return \str_replace('', '<\/script>', - \str_replace($aJsonReplaces[0], $aJsonReplaces[1], $sText)); - } - public static function ClearArrayUtf8Values(array &$aInput) { foreach ($aInput as $mKey => $mItem) @@ -921,40 +911,6 @@ abstract class Utils return false; } - public static function CopyDir(string $sSource, string $sDestination) - { - if (\is_dir($sSource)) - { - if (!\is_dir($sDestination)) - { - \mkdir($sDestination); - } - - $oDirectory = \dir($sSource); - if ($oDirectory) - { - while (false !== ($sRead = $oDirectory->read())) - { - if ('.' === $sRead || '..' === $sRead) - { - continue; - } - - $sPathDir = $sSource.'/'.$sRead; - if (\is_dir($sPathDir)) - { - static::CopyDir($sPathDir, $sDestination.'/'.$sRead); - continue; - } - - \copy($sPathDir, $sDestination.'/'.$sRead); - } - - $oDirectory->close(); - } - } - } - public static function RecTimeDirRemove(string $sTempPath, int $iTime2Kill, int $iNow = 0) : bool { $iNow = $iNow ?: \time();