diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php
index 334113416af..bbad37ab54c 100644
--- a/htdocs/admin/system/security.php
+++ b/htdocs/admin/system/security.php
@@ -652,11 +652,35 @@ print 'MAIN_SECURITY_MAXFILESIZE_DOWNLOADED = '.getDolGlobalStr
print '
';
print 'MAIN_RESTRICTHTML_ONLY_VALID_HTML = '.(getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML') ? '1' : ''.$langs->trans("Undefined").'');
-print ' ('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)
";
+print ' ('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)";
+$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;
+$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1;
+$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
+$result=dol_htmlwithnojs('
src=>0xbeefed');
+if ($result == 'InvalidHTMLStringCantBeCleaned') {
+ print ' - '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !';
+} else {
+ print ' - Test of compatibility with this option seems ok';
+}
+print '
';
+
print '
';
print 'MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = '.(getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY') ? '1' : ''.$langs->trans("Undefined").'');
-print ' ('.$langs->trans("Recommended").': 1) - Module "php-tidy" must be enabled (currently: '.((extension_loaded('tidy') && class_exists("tidy")) ? 'Enabled' : img_picto('', 'warning').' Not available').")
";
+print ' ('.$langs->trans("Recommended").': 1) - Module "php-tidy" must be enabled (currently: '.((extension_loaded('tidy') && class_exists("tidy")) ? 'Enabled' : img_picto('', 'warning').' Not available').")";
+if (extension_loaded('tidy') && class_exists("tidy")) {
+ $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;
+ $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
+ $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
+ $result=dol_htmlwithnojs('
src=>0xbeefed');
+ if ($result == 'InvalidHTMLStringCantBeCleaned') {
+ print ' - '.img_warning().' Your libxml seems to old to work correctly with this option. Disable it !';
+ } else {
+ print ' - Test of compatibility with this option seems ok';
+ }
+}
+print '
';
+
print '
';
print 'MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = '.(getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES') ? '1' : ''.$langs->trans("Undefined").'');