plugins/calendar plugins/kolab_activesync plugins/libkolab

Aleksander Machniak machniak at kolabsys.com
Fri Sep 21 09:55:26 CEST 2012


 plugins/calendar/calendar.php                         |    8 ++++----
 plugins/calendar/drivers/database/database_driver.php |    3 ++-
 plugins/calendar/lib/calendar_ui.php                  |    8 +++++---
 plugins/kolab_activesync/kolab_activesync_ui.php      |    2 +-
 plugins/libkolab/lib/kolab_storage.php                |    7 ++++---
 5 files changed, 16 insertions(+), 12 deletions(-)

New commits:
commit 39552da980854bc3139ebecf9f24c826e79554ce
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Fri Sep 21 09:55:07 2012 +0200

    Re-fix HTML entities handling

diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 1fc1e5f..77f4f1f 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -401,10 +401,10 @@ class calendar extends rcube_plugin
       
       // default calendar selection
       $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) {
         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'])
           $default_calendar = $id;
       }
@@ -708,11 +708,11 @@ class calendar extends rcube_plugin
         else {
           // get a list of writeable 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;
           foreach ($calendars as $calendar) {
             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++;
             }
           }
diff --git a/plugins/calendar/drivers/database/database_driver.php b/plugins/calendar/drivers/database/database_driver.php
index 6d3a5a8..e3d9d51 100644
--- a/plugins/calendar/drivers/database/database_driver.php
+++ b/plugins/calendar/drivers/database/database_driver.php
@@ -92,7 +92,8 @@ class database_driver extends calendar_driver
       );
       while ($result && ($arr = $this->rc->db->fetch_assoc($result))) {
         $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;
         $calendar_ids[] = $this->rc->db->quote($arr['calendar_id']);
       }
diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php
index 2269a5b..63038e8 100644
--- a/plugins/calendar/lib/calendar_ui.php
+++ b/plugins/calendar/lib/calendar_ui.php
@@ -206,7 +206,7 @@ class calendar_ui
       $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::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);
@@ -248,11 +248,13 @@ class calendar_ui
    */
   function calendar_select($attrib = array())
   {
-    $attrib['name'] = 'calendar';
+    $attrib['name']       = 'calendar';
+    $attrib['is_escaped'] = true;
     $select = new html_select($attrib);
+
     foreach ((array)$this->cal->driver->list_calendars() as $id => $prop) {
       if (!$prop['readonly'])
-        $select->add(html_entity_decode($prop['name'], ENT_COMPAT, 'UTF-8'), $id);
+        $select->add($prop['name'], $id);
     }
 
     return $select->show(null);
diff --git a/plugins/kolab_activesync/kolab_activesync_ui.php b/plugins/kolab_activesync/kolab_activesync_ui.php
index e28d523..a3ca623 100644
--- a/plugins/kolab_activesync/kolab_activesync_ui.php
+++ b/plugins/kolab_activesync/kolab_activesync_ui.php
@@ -162,7 +162,7 @@ class kolab_activesync_ui
                     $length = strlen($names[$i].' » ');
                     $prefix = substr($foldername, 0, $length);
                     $count  = count(explode(' » ', $prefix));
-                    $foldername = str_repeat('  ', $count-1) . '» ' . html::quote(substr($foldername, $length));
+                    $foldername = str_repeat('  ', $count-1) . '» ' . substr($foldername, $length);
                     break;
                 }
             }
diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php
index e1aedba..546d19a 100644
--- a/plugins/libkolab/lib/kolab_storage.php
+++ b/plugins/libkolab/lib/kolab_storage.php
@@ -390,10 +390,11 @@ class kolab_storage
             $delim = self::$imap->get_hierarchy_delimiter();
 
         $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)
-            $folder = $prefix . ' ' . $folder;
+            $folder = html::quote($prefix) . ' ' . $folder;
 
         if (!$folder_ns)
             $folder_ns = 'personal';
@@ -495,7 +496,7 @@ class kolab_storage
                     $length = strlen($names[$i].' » ');
                     $prefix = substr($name, 0, $length);
                     $count  = count(explode(' » ', $prefix));
-                    $name   = str_repeat('  ', $count-1) . '» ' . html::quote(substr($name, $length));
+                    $name   = str_repeat('  ', $count-1) . '» ' . substr($name, $length);
                     break;
                 }
             }





More information about the commits mailing list