mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-22 17:31:25 +01:00
Fix: html detection was not working with hx tags.
This commit is contained in:
@@ -3673,6 +3673,7 @@ function dol_textishtml($msg,$option=0)
|
|||||||
elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/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|img|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|img|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('/<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)
|
||||||
return false;
|
return false;
|
||||||
@@ -4532,4 +4533,4 @@ function natural_search($fields, $value)
|
|||||||
return " AND " . ($end > 1? '(' : '') . $res;
|
return " AND " . ($end > 1? '(' : '') . $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -186,6 +186,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$input='xxx<br style="eee" >';
|
$input='xxx<br style="eee" >';
|
||||||
$after=dol_textishtml($input);
|
$after=dol_textishtml($input);
|
||||||
$this->assertTrue($after);
|
$this->assertTrue($after);
|
||||||
|
$input='<h2>abc</h2>';
|
||||||
|
$after=dol_textishtml($input);
|
||||||
|
$this->assertTrue($after);
|
||||||
|
|
||||||
// False
|
// False
|
||||||
$input='xxx < br>';
|
$input='xxx < br>';
|
||||||
@@ -528,16 +531,16 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testVerifCond()
|
public function testVerifCond()
|
||||||
{
|
{
|
||||||
$verifcond=verifCond('1==1');
|
$verifcond=verifCond('1==1');
|
||||||
$this->assertTrue($verifcond);
|
$this->assertTrue($verifcond,'Test a true comparison');
|
||||||
|
|
||||||
$verifcond=verifCond('1==2');
|
$verifcond=verifCond('1==2');
|
||||||
$this->assertFalse($verifcond);
|
$this->assertFalse($verifcond,'Test a false comparison');
|
||||||
|
|
||||||
$verifcond=verifCond('$conf->facture->enabled');
|
$verifcond=verifCond('$conf->facture->enabled');
|
||||||
$this->assertTrue($verifcond);
|
$this->assertTrue($verifcond,'Test that conf property of a module report true when enabled');
|
||||||
|
|
||||||
$verifcond=verifCond('$conf->moduledummy->enabled');
|
$verifcond=verifCond('$conf->moduledummy->enabled');
|
||||||
$this->assertFalse($verifcond);
|
$this->assertFalse($verifcond,'Test that conf property of a module report false when disabled');
|
||||||
|
|
||||||
$verifcond=verifCond('');
|
$verifcond=verifCond('');
|
||||||
$this->assertTrue($verifcond);
|
$this->assertTrue($verifcond);
|
||||||
|
|||||||
Reference in New Issue
Block a user