forked from Wavyzz/dolibarr
Fix type of param
Fix test of ckeditor for html doc Fix when MAIN_RESTRICTHTML_ONLY_VALID_HTML is on
This commit is contained in:
@@ -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++;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 '<h1>Foo</h1><p>bar</p>' that ends up with '<h1>Foo<p>bar</p></h1>'
|
||||
// like 'abc' that ends up with '<p>abc</p>'
|
||||
$out = '<div class="tricktoremove">'.$out.'</div>';
|
||||
|
||||
$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('/^<div class="tricktoremove">/', '', $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.
|
||||
|
||||
@@ -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 .= ' <strong>'.$line->label.'</strong>';
|
||||
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 '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
|
||||
print '<br><div class="clearboth nowraponall opacitymedium">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
|
||||
}
|
||||
//print get_date_range($line->date_start, $line->date_end, $format);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user