forked from extern/egroupware
htmlarea-widget in mode="ascii" looses or modifies content (<, >, <tag>) by calling html::purify on it, also fixed set_attrs to expand attribute values
This commit is contained in:
parent
6ee8b47d7a
commit
cbd328eb55
@ -179,13 +179,21 @@ class etemplate_widget
|
||||
$template = clone($this);
|
||||
$cloned = true; // only clone it once, otherwise we loose attributes!
|
||||
}
|
||||
$template->attrs[$reader->name] = $reader->value;
|
||||
$value = (string)$reader->value;
|
||||
|
||||
// expand attributes values, otherwise eg. validation can not use attrs referencing to content
|
||||
if ($value[0] == '@' || strpos($value, '$') !== false)
|
||||
{
|
||||
$value = self::expand_name($value, null, null, null, null,
|
||||
isset(self::$cont) ? self::$cont : self::$request->content);
|
||||
}
|
||||
$template->attrs[$reader->name] = $value;
|
||||
|
||||
// split legacy options
|
||||
if ($legacy_options && $reader->name == 'options')
|
||||
{
|
||||
$legacy_options = explode(',', $legacy_options);
|
||||
foreach(self::csv_split($reader->value, count($legacy_options)) as $n => $val)
|
||||
foreach(self::csv_split($value, count($legacy_options)) as $n => $val)
|
||||
{
|
||||
if ($legacy_options[$n] && (string)$val !== '') $template->attrs[$legacy_options[$n]] = $val;
|
||||
}
|
||||
|
@ -56,8 +56,13 @@ class etemplate_widget_htmlarea extends etemplate_widget
|
||||
if (!$this->is_readonly($cname, $form_name))
|
||||
{
|
||||
$value = self::get_array($content, $form_name);
|
||||
// only purify for html, mode "ascii" is NO html and content get lost!
|
||||
if ($this->attrs['mode'] != 'ascii')
|
||||
{
|
||||
$value = html::purify($value, $this->attrs['validation_rules']);
|
||||
}
|
||||
$valid =& self::get_array($validated, $form_name, true);
|
||||
$valid = html::purify($value,($this->attrs['validation_rules']?$this->attrs['validation_rules']:null));
|
||||
if (true) $valid = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user