FIX #12838
This commit is contained in:
parent
df26bab65b
commit
d9f7c4aec4
@ -33,7 +33,7 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel
|
||||
if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before');
|
||||
if (empty($object->id)) $object->fetch($id); // Fetch may not be already done
|
||||
|
||||
$result_update=$object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES), '_public');
|
||||
$result_update = $object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES, 'UTF-8', 1), '_public');
|
||||
|
||||
if ($result_update < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
elseif (in_array($object->table_element, array('supplier_proposal', 'propal', 'commande_fournisseur', 'commande', 'facture_fourn', 'facture')))
|
||||
|
||||
@ -213,7 +213,7 @@ class Form
|
||||
$valuetoshow = price2num($editvalue ? $editvalue : $value);
|
||||
$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ?price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>';
|
||||
}
|
||||
elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata))
|
||||
elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) // if wysiwyg is enabled $typeofdata = 'ckeditor'
|
||||
{
|
||||
$tmp = explode(':', $typeofdata);
|
||||
$cols = $tmp[2];
|
||||
@ -225,8 +225,10 @@ class Form
|
||||
}
|
||||
|
||||
$valuetoshow = ($editvalue ? $editvalue : $value);
|
||||
|
||||
$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1] ? $tmp[1] : '20').'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'">';
|
||||
// textarea convert automatically entities chars into simple chars.
|
||||
// So we convert & into & so a string like 'a < <b>b</b><br>é<br><script>alert('X');<script>' stay a correct html and is not converted by textarea component when wysiwig is off.
|
||||
$valuetoshow = str_replace('&', '&', $valuetoshow);
|
||||
$ret .= dol_string_neverthesehtmltags($valuetoshow, array('textarea'));
|
||||
$ret .= '</textarea>';
|
||||
}
|
||||
|
||||
@ -5701,14 +5701,19 @@ function dol_htmlcleanlastbr($stringtodecode)
|
||||
/**
|
||||
* Replace html_entity_decode functions to manage errors
|
||||
*
|
||||
* @param string $a Operand a
|
||||
* @param string $b Operand b (ENT_QUOTES=convert simple and double quotes)
|
||||
* @param string $c Operand c
|
||||
* @return string String decoded
|
||||
* @param string $a Operand a
|
||||
* @param string $b Operand b (ENT_QUOTES=convert simple and double quotes)
|
||||
* @param string $c Operand c
|
||||
* @param string $keepsomeentities Entities but &, <, >, " are not converted.
|
||||
* @return string String decoded
|
||||
*/
|
||||
function dol_html_entity_decode($a, $b, $c = 'UTF-8')
|
||||
function dol_html_entity_decode($a, $b, $c = 'UTF-8', $keepsomeentities = 0)
|
||||
{
|
||||
return html_entity_decode($a, $b, $c);
|
||||
$newstring = $a;
|
||||
if ($keepsomeentities) $newstring = strtr($newstring, array('&'=>'__andamp__', '<'=>'__andlt__', '>'=>'__andgt__', '"'=>'__dquot__'));
|
||||
$newstring = html_entity_decode($newstring, $b, $c);
|
||||
if ($keepsomeentities) $newstring = strtr($newstring, array('__andamp__'=>'&', '__andlt__'=>'<', '__andgt__'=>'>', '__dquot__'=>'"'));
|
||||
return $newstring;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user