From a7fa5accf9ed08be561ccd75055ded59351ec0c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Dec 2023 15:06:25 +0100 Subject: [PATCH] Debug v19 --- htdocs/admin/translation.php | 10 +++++++--- htdocs/core/lib/functions.lib.php | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index b9ccec2a4f5..e23297cc251 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -40,13 +40,17 @@ $action = GETPOST('action', 'aZ09'); $optioncss = GETPOST('optionscss', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ09'); +$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey'; + $langcode = GETPOST('langcode', 'alphanohtml'); $transkey = GETPOST('transkey', 'alphanohtml'); -$transvalue = GETPOST('transvalue', 'restricthtml'); +if ($mode == 'searchkey') { + $transvalue = GETPOST('transvalue', 'alphanohtml'); +} else { + $transvalue = GETPOST('transvalue', 'restricthtml'); +} -$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey'; - $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 19d6f425acd..375233024e4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7623,12 +7623,13 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' // Add a trick to solve pb with text without parent tag // like '

Foo

bar

' that wrongly ends up, without the trick, with '

Foo

bar

' // like 'abc' that wrongly ends up, without the trick, with '

abc

' - $out = '
'.$out.'
'; + + $out = '
'.$out.'
'; $dom->loadHTML($out, LIBXML_HTML_NODEFDTD|LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL); $out = trim($dom->saveHTML()); // Remove the trick added to solve pb with text without parent tag - $out = preg_replace('/^
/', '', $out); + $out = preg_replace('/^<\?xml encoding="UTF-8">
/', '', $out); $out = preg_replace('/<\/div>$/', '', $out); } catch (Exception $e) { // If error, invalid HTML string with no way to clean it