forked from Wavyzz/dolibarr
Fix detection of html was wrong with img
This commit is contained in:
@@ -3972,9 +3972,10 @@ function dol_textishtml($msg,$option=0)
|
|||||||
if (preg_match('/<html/i',$msg)) return true;
|
if (preg_match('/<html/i',$msg)) return true;
|
||||||
elseif (preg_match('/<body/i',$msg)) return true;
|
elseif (preg_match('/<body/i',$msg)) return true;
|
||||||
elseif (preg_match('/<(b|em|i)>/i',$msg)) return true;
|
elseif (preg_match('/<(b|em|i)>/i',$msg)) return true;
|
||||||
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/i',$msg)) return true;
|
elseif (preg_match('/<(br|div|font|li|span|strong|table)>/i',$msg)) return true;
|
||||||
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true;
|
elseif (preg_match('/<(br|div|font|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true;
|
||||||
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true;
|
elseif (preg_match('/<(br|div|font|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true;
|
||||||
|
elseif (preg_match('/<(img)\s+[^<>]*>/i',$msg)) return true; // must accept <img src="http://mydomain.com/aaa.png" />
|
||||||
elseif (preg_match('/<h[0-9]>/i',$msg)) return true;
|
elseif (preg_match('/<h[0-9]>/i',$msg)) return true;
|
||||||
elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
|
elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
|
||||||
elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
|
elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
|
||||||
|
|||||||
@@ -204,6 +204,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$input='<h2>abc</h2>';
|
$input='<h2>abc</h2>';
|
||||||
$after=dol_textishtml($input);
|
$after=dol_textishtml($input);
|
||||||
$this->assertTrue($after);
|
$this->assertTrue($after);
|
||||||
|
$input='<img src="https://xxx.com/aaa/image.png" />';
|
||||||
|
$after=dol_textishtml($input);
|
||||||
|
$this->assertTrue($after,'Failure on test of img tag');
|
||||||
|
|
||||||
// False
|
// False
|
||||||
$input='xxx < br>';
|
$input='xxx < br>';
|
||||||
|
|||||||
Reference in New Issue
Block a user