diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 987f435e38f..3388b649a67 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -117,7 +117,7 @@ if (GETPOST('save', 'alpha')) { $error++; } - $fckeditor_test = GETPOST('formtestfield'); + $fckeditor_test = GETPOST('formtestfield', 'restricthtml'); if (!empty($fckeditor_test)) { if (!dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity)) { $error++; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 83f66b204ee..d7097587a73 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -589,6 +589,7 @@ class Form if (!$htmltext) { return $text; } + $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0 $tag = 'td'; if ($notabs == 2) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2d560281394..721c553c291 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -782,14 +782,22 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = if (!empty($out) && !empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) && $check != 'restricthtmlallowunvalid') { try { $dom = new DOMDocument; + // Add a trick to solve pb with text without parent tag + // like '

Foo

bar

' that ends up with '

Foo

bar

' + // like 'abc' that ends up with '

abc

' + $out = '
'.$out.'
'; + $dom->loadHTML($out, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|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('/<\/div>$/', '', $out); } catch (Exception $e) { //print $e->getMessage(); return 'InvalidHTMLString'; } - $out = $dom->saveHTML(); } - //var_dump($oldstringtoclean);var_dump($out); // Ckeditor use the numeric entitic for apostrophe so we force it to text entity (all other special chars are correctly // encoded using text entities). This is a fix for CKeditor. diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index a89ac4f826a..3e8ef7ea411 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -135,7 +135,7 @@ if (($line->info_bits & 2) == 2) { $format = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 'dayhour' : 'day'); if ($line->fk_product > 0) { - print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); + print $form->textwithtooltip($text, $description, 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); } else { $type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type); if ($type == 1) { @@ -146,7 +146,7 @@ if (($line->info_bits & 2) == 2) { if (!empty($line->label)) { $text .= ' '.$line->label.''; - print $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); + print $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); } else { if (!empty($line->fk_parent_line)) { print img_picto('', 'rightarrow'); @@ -179,7 +179,7 @@ if (($line->info_bits & 2) == 2) { } } else { if ($line->date_start || $line->date_end) { - print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; } //print get_date_range($line->date_start, $line->date_end, $format); }