Re-fix HTML entities handling

This commit is contained in:
Aleksander Machniak 2012-09-21 09:55:07 +02:00
parent 99a692f4bd
commit 39552da980
5 changed files with 16 additions and 12 deletions

View file

@ -401,10 +401,10 @@ class calendar extends rcube_plugin
// default calendar selection // default calendar selection
$field_id = 'rcmfd_default_calendar'; $field_id = 'rcmfd_default_calendar';
$select_cal = new html_select(array('name' => '_default_calendar', 'id' => $field_id)); $select_cal = new html_select(array('name' => '_default_calendar', 'id' => $field_id, 'is_escaped' => true));
foreach ((array)$this->driver->list_calendars() as $id => $prop) { foreach ((array)$this->driver->list_calendars() as $id => $prop) {
if (!$prop['readonly']) if (!$prop['readonly'])
$select_cal->add(html_entity_decode($prop['name'], ENT_COMPAT, 'UTF-8'), strval($id)); $select_cal->add($prop['name'], strval($id));
if ($prop['default']) if ($prop['default'])
$default_calendar = $id; $default_calendar = $id;
} }
@ -708,11 +708,11 @@ class calendar extends rcube_plugin
else { else {
// get a list of writeable calendars // get a list of writeable calendars
$calendars = $this->driver->list_calendars(); $calendars = $this->driver->list_calendars();
$calendar_select = new html_select(array('name' => 'calendar', 'id' => 'calendar-saveto')); $calendar_select = new html_select(array('name' => 'calendar', 'id' => 'calendar-saveto', 'is_escaped' => true));
$numcals = 0; $numcals = 0;
foreach ($calendars as $calendar) { foreach ($calendars as $calendar) {
if (!$calendar['readonly']) { if (!$calendar['readonly']) {
$calendar_select->add(html_entity_decode($calendar['name'], ENT_COMPAT, 'UTF-8'), $calendar['id']); $calendar_select->add($calendar['name'], $calendar['id']);
$numcals++; $numcals++;
} }
} }

View file

@ -92,7 +92,8 @@ class database_driver extends calendar_driver
); );
while ($result && ($arr = $this->rc->db->fetch_assoc($result))) { while ($result && ($arr = $this->rc->db->fetch_assoc($result))) {
$arr['showalarms'] = intval($arr['showalarms']); $arr['showalarms'] = intval($arr['showalarms']);
$arr['active'] = !in_array($arr['id'], $hidden); $arr['active'] = !in_array($arr['id'], $hidden);
$arr['name'] = html::quote($arr['name']);
$this->calendars[$arr['calendar_id']] = $arr; $this->calendars[$arr['calendar_id']] = $arr;
$calendar_ids[] = $this->rc->db->quote($arr['calendar_id']); $calendar_ids[] = $this->rc->db->quote($arr['calendar_id']);
} }

View file

@ -206,7 +206,7 @@ class calendar_ui
$li .= html::tag('li', array('id' => 'rcmlical' . $html_id, 'class' => $class), $li .= html::tag('li', array('id' => 'rcmlical' . $html_id, 'class' => $class),
html::tag('input', array('type' => 'checkbox', 'name' => '_cal[]', 'value' => $id, 'checked' => $prop['active']), '') . html::tag('input', array('type' => 'checkbox', 'name' => '_cal[]', 'value' => $id, 'checked' => $prop['active']), '') .
html::span('handle', ' ') . html::span('handle', ' ') .
html::span('calname', Q(html_entity_decode($prop['name'], ENT_COMPAT, 'UTF-8')))); html::span('calname', $prop['name']));
} }
$this->rc->output->set_env('calendars', $jsenv); $this->rc->output->set_env('calendars', $jsenv);
@ -248,11 +248,13 @@ class calendar_ui
*/ */
function calendar_select($attrib = array()) function calendar_select($attrib = array())
{ {
$attrib['name'] = 'calendar'; $attrib['name'] = 'calendar';
$attrib['is_escaped'] = true;
$select = new html_select($attrib); $select = new html_select($attrib);
foreach ((array)$this->cal->driver->list_calendars() as $id => $prop) { foreach ((array)$this->cal->driver->list_calendars() as $id => $prop) {
if (!$prop['readonly']) if (!$prop['readonly'])
$select->add(html_entity_decode($prop['name'], ENT_COMPAT, 'UTF-8'), $id); $select->add($prop['name'], $id);
} }
return $select->show(null); return $select->show(null);

View file

@ -162,7 +162,7 @@ class kolab_activesync_ui
$length = strlen($names[$i].' » '); $length = strlen($names[$i].' » ');
$prefix = substr($foldername, 0, $length); $prefix = substr($foldername, 0, $length);
$count = count(explode(' » ', $prefix)); $count = count(explode(' » ', $prefix));
$foldername = str_repeat('  ', $count-1) . '» ' . html::quote(substr($foldername, $length)); $foldername = str_repeat('  ', $count-1) . '» ' . substr($foldername, $length);
break; break;
} }
} }

View file

@ -390,10 +390,11 @@ class kolab_storage
$delim = self::$imap->get_hierarchy_delimiter(); $delim = self::$imap->get_hierarchy_delimiter();
$folder = rcube_charset::convert($folder, 'UTF7-IMAP'); $folder = rcube_charset::convert($folder, 'UTF7-IMAP');
$folder = str_replace($delim, ' » ', $folder); $folder = html::quote($folder);
$folder = str_replace(html::quote($delim), ' » ', $folder);
if ($prefix) if ($prefix)
$folder = $prefix . ' ' . $folder; $folder = html::quote($prefix) . ' ' . $folder;
if (!$folder_ns) if (!$folder_ns)
$folder_ns = 'personal'; $folder_ns = 'personal';
@ -495,7 +496,7 @@ class kolab_storage
$length = strlen($names[$i].' » '); $length = strlen($names[$i].' » ');
$prefix = substr($name, 0, $length); $prefix = substr($name, 0, $length);
$count = count(explode(' » ', $prefix)); $count = count(explode(' » ', $prefix));
$name = str_repeat('  ', $count-1) . '» ' . html::quote(substr($name, $length)); $name = str_repeat('  ', $count-1) . '» ' . substr($name, $length);
break; break;
} }
} }