Merge remote-tracking branch 'origin/support/2.5'

# Conflicts:
#	application/utils.inc.php
This commit is contained in:
Pierre Goiffon
2019-01-31 18:43:20 +01:00
4 changed files with 59 additions and 25 deletions

View File

@@ -348,7 +348,7 @@ class HTMLDOMSanitizer extends HTMLSanitizer
$this->CleanNode($oNode);
if (($oNode instanceof DOMElement) && (strtolower($oNode->tagName) == 'img'))
{
$this->ProcessImage($oNode);
InlineImage::ProcessImageTag($oNode);
}
}
}
@@ -359,24 +359,7 @@ class HTMLDOMSanitizer extends HTMLSanitizer
}
}
}
/**
* Add an extra attribute data-img-id for images which are based on an actual InlineImage
* so that we can later reconstruct the full "src" URL when needed
* @param DOMNode $oElement
*/
protected function ProcessImage(DOMNode $oElement)
{
$sSrc = $oElement->getAttribute('src');
$sDownloadUrl = str_replace(array('.', '?'), array('\.', '\?'), INLINEIMAGE_DOWNLOAD_URL); // Escape . and ?
$sUrlPattern = '|'.$sDownloadUrl.'([0-9]+)&s=([0-9a-f]+)|';
if (preg_match($sUrlPattern, $sSrc, $aMatches))
{
$oElement->setAttribute('data-img-id', $aMatches[1]);
$oElement->setAttribute('data-img-secret', $aMatches[2]);
}
}
protected function CleanStyle($sStyle)
{
$aAllowedStyles = array();