Small fixes

This commit is contained in:
RainLoop Team 2014-10-23 21:59:21 +04:00
parent 300cee0b6e
commit 3e9a7a55c6
15 changed files with 405 additions and 292 deletions

View file

@ -330,7 +330,7 @@ class BodyStructure
{
$mResult = $this->SearchPlainParts();
}
return $mResult;
}
@ -465,7 +465,7 @@ class BodyStructure
* @param array $aParams
* @param string $sParamName
* @param string $sCharset = \MailSo\Base\Enumerations\Charset::UTF_8
*
*
* @return string
*/
private static function decodeAttrParamenter($aParams, $sParamName, $sCharset = \MailSo\Base\Enumerations\Charset::UTF_8)
@ -477,7 +477,7 @@ class BodyStructure
}
else if (isset($aParams[$sParamName.'*']))
{
$aValueParts = \explode('\'\'', $aParams[$sParamName.'*'], 2);
$aValueParts = \explode("''", $aParams[$sParamName.'*'], 2);
if (\is_array($aValueParts) && 2 === \count($aValueParts))
{
$sCharset = isset($aValueParts[0]) ? $aValueParts[0] : \MailSo\Base\Enumerations\Charset::UTF_8;
@ -490,30 +490,30 @@ class BodyStructure
$sResult = \urldecode($aParams[$sParamName.'*']);
}
}
else if (isset($aParams[$sParamName.'*0*']))
else
{
$sCharset = '';
$sCharsetIndex = -1;
$aFileNames = array();
foreach ($aParams as $sName => $sValue)
{
$aMatches = array();
if ($sParamName.'*0*' === $sName)
if (\preg_match('/^'.\preg_quote($sParamName, '/').'\*([0-9]+)\*$/i', $sName, $aMatches))
{
if (0 === \strlen($sCharset))
$iIndex = (int) $aMatches[1];
if ($sCharsetIndex < $iIndex && false !== \strpos($sValue, "''"))
{
$aValueParts = \explode('\'\'', $sValue, 2);
$aValueParts = \explode("''", $sValue, 2);
if (\is_array($aValueParts) && 2 === \count($aValueParts) && 0 < \strlen($aValueParts[0]))
{
$sCharsetIndex = $iIndex;
$sCharset = $aValueParts[0];
$sValue = $aValueParts[1];
}
}
$aFileNames[0] = $sValue;
}
else if ($sParamName.'*0*' !== $sName && \preg_match('/^'.\preg_quote($sParamName, '/').'\*([0-9]+)\*$/i', $sName, $aMatches) && 0 < \strlen($aMatches[1]))
{
$aFileNames[(int) $aMatches[1]] = $sValue;
$aFileNames[$iIndex] = $sValue;
}
}
@ -662,7 +662,7 @@ class BodyStructure
{
$sCharset = $aBodyParams['charset'];
}
if (\is_array($aBodyParams))
{
$sName = self::decodeAttrParamenter($aBodyParams, 'name', $sContentType);
@ -675,7 +675,7 @@ class BodyStructure
{
return null;
}
$sContentID = $aBodyStructure[3];
}
@ -685,7 +685,7 @@ class BodyStructure
{
return null;
}
$sDescription = $aBodyStructure[4];
}
@ -867,7 +867,7 @@ class BodyStructure
/**
* @param array $aList
* @param string $sPartID
*
*
* @return array|null
*/
private static function findPartByIndexInArray(array $aList, $sPartID)