From 2698d7ff8c4e283ca09514e6b5bd3a3aebf60525 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Thu, 28 Jun 2012 13:38:50 -0400
Subject: [PATCH] Fixed Konqueror browser detection

---
 program/include/rcmail.php |   49 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index e684a15..8ec8cfe 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -19,9 +19,6 @@
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  | Author: Aleksander Machniak <alec@alec.pl>                            |
  +-----------------------------------------------------------------------+
-
- $Id$
-
 */
 
 
@@ -549,15 +546,16 @@
 
     if (is_array($default_host)) {
       $post_host = rcube_utils::get_input_value('_host', rcube_utils::INPUT_POST);
+      $post_user = rcube_utils::get_input_value('_user', rcube_utils::INPUT_POST);
+
+      list($user, $domain) = explode('@', $post_user);
 
       // direct match in default_host array
       if ($default_host[$post_host] || in_array($post_host, array_values($default_host))) {
         $host = $post_host;
       }
-
       // try to select host by mail domain
-      list($user, $domain) = explode('@', rcube_utils::get_input_value('_user', rcube_utils::INPUT_POST));
-      if (!empty($domain)) {
+      else if (!empty($domain)) {
         foreach ($default_host as $storage_host => $mail_domains) {
           if (is_array($mail_domains) && in_array_nocase($domain, $mail_domains)) {
             $host = $storage_host;
@@ -1329,11 +1327,12 @@
         $attrib      = $hook['attribs'];
 
         if ($type == 'select') {
+            $attrib['is_escaped'] = true;
             $select = new html_select($attrib);
 
             // add no-selection option
             if ($attrib['noselection']) {
-                $select->add($rcmail->gettext($attrib['noselection']), '');
+                $select->add(html::quote($rcmail->gettext($attrib['noselection'])), '');
             }
 
             $rcmail->render_folder_tree_select($a_mailboxes, $mbox_name, $attrib['maxlength'], $select, $attrib['realnames']);
@@ -1362,7 +1361,7 @@
      */
     public function folder_selector($p = array())
     {
-        $p += array('maxlength' => 100, 'realnames' => false);
+        $p += array('maxlength' => 100, 'realnames' => false, 'is_escaped' => true);
         $a_mailboxes = array();
         $storage = $this->get_storage();
 
@@ -1388,7 +1387,7 @@
         $select = new html_select($p);
 
         if ($p['noselection']) {
-            $select->add($p['noselection'], '');
+            $select->add(html::quote($p['noselection']), '');
         }
 
         $this->render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p);
@@ -1579,7 +1578,7 @@
                 }
             }
 
-            $select->add(str_repeat('&nbsp;', $nestLevel*4) . $foldername, $folder['id']);
+            $select->add(str_repeat('&nbsp;', $nestLevel*4) . html::quote($foldername), $folder['id']);
 
             if (!empty($folder['folders'])) {
                 $out .= $this->render_folder_tree_select($folder['folders'], $mbox_name, $maxlength,
@@ -1998,6 +1997,31 @@
     }
 
 
+    /**
+     * Returns real size (calculated) of the message part
+     *
+     * @param rcube_message_part  Message part
+     *
+     * @return string Part size (and unit)
+     */
+    public function message_part_size($part)
+    {
+        if (isset($part->d_parameters['size'])) {
+            $size = $this->show_bytes((int)$part->d_parameters['size']);
+        }
+        else {
+          $size = $part->size;
+          if ($part->encoding == 'base64') {
+            $size = $size / 1.33;
+          }
+
+          $size = '~' . $this->show_bytes($size);
+        }
+
+        return $size;
+    }
+
+
     /************************************************************************
      *********          Deprecated methods (to be removed)          *********
      ***********************************************************************/
@@ -2012,6 +2036,11 @@
         return $this->storage_connect();
     }
 
+    public function imap_init()
+    {
+        return $this->storage_init();
+    }
+
     /**
      * Connect to the mail storage server with stored session data
      *

--
Gitblit v1.9.1