From a95e0e174c48b7c5242b8969aef99838a52c41ee Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 21 Oct 2005 08:12:23 -0400
Subject: [PATCH] Improved support for UTF-8 and other charsets

---
 skins/default/common.css                  |    1 
 CHANGELOG                                 |   13 ++
 program/js/common.js                      |   10 +
 program/include/main.inc                  |    2 
 program/lib/utf8.inc                      |    4 
 program/lib/imap.inc                      |    9 +
 skins/default/templates/message.html      |    6 
 program/localization/en/labels.inc        |    4 
 program/localization/de/messages.inc      |    4 
 program/steps/mail/sendmail.inc           |    9 +
 program/steps/settings/manage_folders.inc |    6 
 program/include/rcube_shared.inc          |   27 +++-
 /dev/null                                 |    6 -
 skins/default/templates/mail.html         |    2 
 program/steps/error.inc                   |    1 
 skins/default/settings.css                |    6 
 program/localization/de/labels.inc        |   45 ++++----
 program/steps/mail/func.inc               |   41 +++++---
 skins/default/templates/addressbook.html  |    2 
 program/lib/Mail/mimeDecode.php           |    2 
 skins/default/templates/compose.html      |    2 
 program/js/app.js                         |   32 +++++
 program/localization/index.inc            |    2 
 program/include/rcube_imap.inc            |   23 +++
 24 files changed, 170 insertions(+), 89 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 1429671..ede37f4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -44,9 +44,16 @@
 - Enable IMAPS by host
 
 
-2005/15/16
+2005/10/20
 ----------
-- Added Portuguese and Catalan translation
+- Added Swedish, Portuguese and Catalan translation
 - Make SMTP auth method configurable
 - Make mailboxlist scrollable (Bug #1326372)
-
+- Fixed SSL support
+- Improved support for Courier IMAP (root folder and delimiter issues)
+- Moved taskbar from bottom to top
+- Added 'session_lifetime' parameter
+- Fixed wrong unread count when deleting message (Bug #1332434)
+- Srip tags when creating a new folder (Bug #1332084)
+- Translate HTML tags in message headers (Bug #1330134)
+- Correction in German translation (Bug #1329434)
diff --git a/program/include/main.inc b/program/include/main.inc
index 4a872a5..fb9d350 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -697,7 +697,7 @@
         else if (isset($GLOBALS['PAGE_TITLE']))
           return rep_specialchars_output("RoundCube|Mail :: ".$GLOBALS['PAGE_TITLE']);
         else if ($task=='mail' && ($mbox_name = $IMAP->get_mailbox_name()))
-          return "RoundCube|Mail :: $mbox_name";
+          return "RoundCube|Mail :: ".rep_specialchars_output(UTF7DecodeString($mbox_name), 'html', 'all');
         else
           return "RoundCube|Mail :: $task";
         }
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index 83ee321..009c80a 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -23,6 +23,7 @@
 
 require_once('lib/imap.inc');
 require_once('lib/mime.inc');
+require_once('lib/utf7.inc');
 
 
 class rcube_imap
@@ -723,6 +724,19 @@
     }
 
 
+  // clear all messages in a specific mailbox
+  function clear_mailbox($mbox)
+    {
+    $mailbox = $mbox ? $this->_mod_mailbox($mbox) : $this->mailbox;
+    $msg_count = $this->_messagecount($mailbox, 'ALL');
+    
+    if ($msg_count>0)
+      return iil_C_ClearFolder($this->conn, $mailbox);
+    else
+      return 0;
+    }
+
+
   // send IMAP expunge command and clear cache
   function expunge($mbox='', $clear_cache=TRUE)
     {
@@ -801,18 +815,19 @@
   function create_mailbox($name, $subscribe=FALSE)
     {
     $result = FALSE;
-    $abs_name = $this->_mod_mailbox($name);
+    $name_enc = UTF7EncodeString($name);
+    $abs_name = $this->_mod_mailbox($name_enc);
     $a_mailbox_cache = $this->get_cache('mailboxes');
     
     //if (strlen($this->root_ns))
     //  $abs_name = $this->root_ns.$abs_name;
 
     if (strlen($abs_name) && (!is_array($a_mailbox_cache) || !in_array($abs_name, $a_mailbox_cache)))
-      $result = iil_C_CreateFolder($this->conn, iil_utf7_encode($abs_name));
+      $result = iil_C_CreateFolder($this->conn, $abs_name);
 
     // update mailboxlist cache
     if ($result && $subscribe)
-      $this->subscribe($name);
+      $this->subscribe($name_enc);
 
     return $result ? $name : FALSE;
     }
@@ -1057,7 +1072,7 @@
   // convert body chars according to the ctype_parameters
   function charset_decode($body, $ctype_param)
     {
-    if (is_array($ctype_param) && strlen($ctype_param['charset']))
+    if (is_array($ctype_param) && !empty($ctype_param['charset']))
       return decode_specialchars($body, $ctype_param['charset']);
 
     return $body;
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index 8396f99..6874094 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -1032,7 +1032,7 @@
 function rcube_label($attrib)
   {
   global $sess_user_lang, $INSTALL_PATH;
-  static $sa_text_data, $s_language;
+  static $sa_text_data, $s_language, $utf8_decode;
 
   // extract attributes
   if (is_string($attrib))
@@ -1069,6 +1069,12 @@
         $sa_text_data = array_merge($sa_text_data, $labels);
       if (is_array($messages))
         $sa_text_data = array_merge($sa_text_data, $messages);
+      }
+      
+    if (isset($utf8_decoding) && $utf8_decoding==TRUE)
+      {
+      @include_once('lib/utf8.inc');
+      $utf8_decode = TRUE;
       }
       
     $s_language = $sess_user_lang;
@@ -1109,10 +1115,6 @@
   if ($text=='')
     $text = $a_text_item['single'];
 
-  // perform utf-8 decoding
-  //if (function_exists('utf8_decode'))
-  //  $text = utf8_decode($text);
-
   // replace vars in text
   if (is_array($attrib['vars']))
     {
@@ -1128,6 +1130,11 @@
 $text
 EOF;
 ");
+
+
+  // perform utf-8 decoding
+  if ($utf8_decode && function_exists('utf8ToUnicodeEntities'))
+    $text = utf8ToUnicodeEntities($text);
 
 
   // format output
@@ -1189,12 +1196,11 @@
     if (!$html_encode_arr)
       {
       $html_encode_arr = get_html_translation_table(HTML_ENTITIES);
-      $html_encode_arr["?"] = '&#150;';
       $html_encode_arr[chr(128)] = '&euro;';
       unset($html_encode_arr['?']);
       unset($html_encode_arr['&']);
       }
-    
+
     $ltpos = strpos($str, '<');
     $encode_arr = $html_encode_arr;
 
@@ -1254,8 +1260,11 @@
   {
   $charset = strtolower($charset);
   
-  if (strcasecmp($charset, 'utf-8')==0)
-    return utf8_decode($input);
+  if ($charset=='utf-8')
+    {
+    require_once('lib/utf8.inc');
+    return utf8ToUnicodeEntities($input);
+    }
   else if ($charset=="koi8-r")
     return convert_cyr_string($input, 'k', 'w');
   else if ($charset=="iso8859-5")
diff --git a/program/js/app.js b/program/js/app.js
index 418f33c..1e70c42 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -6,7 +6,7 @@
  | Copyright (C) 2005, RoundCube Dev, - Switzerland                      |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
- | Modified: 2005/10/13 (tbr)                                            |
+ | Modified: 2005/10/21 (roundcube)                                      |
  |                                                                       |
  +-----------------------------------------------------------------------+
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
@@ -31,6 +31,7 @@
   // webmail client settings
   this.dblclick_time = 600;
   this.message_time = 5000;
+  this.request_timeout = 120000;
   this.mbox_expression = new RegExp('[^0-9a-z\-_]', 'gi');
   this.env.blank_img = 'skins/default/images/blank.gif';
   
@@ -76,8 +77,7 @@
     this.task = this.env.task;
     
     // check browser
-    if (!(bw.dom && ((bw.ie && bw.vendver>=5.5 && !bw.opera) || (bw.mz && bw.vendver>=1) || (bw.safari && bw.vendver>=125) ||
-                     (bw.opera && bw.vendver>=8) || (bw.konq && bw.vendver>=3.4))))
+    if (!bw.dom || !bw.xmlhttp_test())
       {
       location.href = this.env.comm_path+'&_action=error&_code=0x199';
       return;
@@ -732,6 +732,7 @@
     };
 
 
+  // lock/unlock interface
   this.set_busy = function(a, message)
     {
     if (a && message)
@@ -744,6 +745,14 @@
     
     if (this.gui_objects.editform)
       this.lock_form(this.gui_objects.editform, a);
+      
+    // clear pending timer
+    if (this.request_timer)
+      clearTimeout(this.request_timer);
+
+    // set timer for requests
+    if (a && this.request_timeout)
+      this.request_timer = setTimeout(this.ref+'.request_timed_out()', this.request_timeout);
     };
 
 
@@ -763,6 +772,14 @@
       url = this.env.comm_path;
 
     return url.replace(/_task=[a-z]+/, '_task='+task);
+    };
+    
+  
+  // called when a request timed out
+  this.request_timed_out = function()
+    {
+    this.set_busy(false);
+    this.display_message('Request timed out!', 'error');
     };
 
 
@@ -1968,9 +1985,13 @@
     var cont = msg;
     if (type)
       cont = '<div class="'+type+'">'+cont+'</div>';
-      
+
+    this.gui_objects.message._rcube = this;
     this.gui_objects.message.innerHTML = cont;
     this.gui_objects.message.style.display = 'block';
+    
+    if (type!='loading')
+      this.gui_objects.message.onmousedown = function(){ this._rcube.hide_message(); return true; };
     
     if (!hold)
       this.message_timer = setTimeout(this.ref+'.hide_message()', this.message_time);
@@ -1981,7 +2002,10 @@
   this.hide_message = function()
     {
     if (this.gui_objects.message)
+      {
       this.gui_objects.message.style.display = 'none';
+      this.gui_objects.message.onmousedown = null;
+      }
     };
 
 
diff --git a/program/js/common.js b/program/js/common.js
index 2d2c2e9..78fecf8 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -6,7 +6,7 @@
  | Copyright (C) 2005, RoundCube Dev, - Switzerland                      |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
- | Modified: 19.08.2005 (tbr)                                            |
+ | Modified:2005/10/21 (roundcube)                                       |
  |                                                                       |
  +-----------------------------------------------------------------------+
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
@@ -81,6 +81,14 @@
                    (this.ie && this.win && this.vendver>=5.5) || this.safari);
   this.opacity = (this.mz || (this.ie && this.vendver>=5.5 && !this.opera) || (this.safari && this.vendver>=100));
   this.cookies = navigator.cookieEnabled;
+  
+  // test for XMLHTTP support
+  this.xmlhttp_test = function()
+    {
+    var activeX_test = new Function("try{var o=new ActiveXObject('Microsoft.XMLHTTP');return true;}catch(err){return false;}");
+    this.xmlhttp = (window.XMLHttpRequest || (window.ActiveXObject && activeX_test())) ? true : false;
+    return this.xmlhttp;
+    }
   }
 
 
diff --git a/program/lib/Mail/mimeDecode.php b/program/lib/Mail/mimeDecode.php
index 07fe88f..8514814 100644
--- a/program/lib/Mail/mimeDecode.php
+++ b/program/lib/Mail/mimeDecode.php
@@ -247,7 +247,7 @@
                         $return->ctype_primary   = $regs[1];
                         $return->ctype_secondary = $regs[2];
                     }
-
+                    
                     if (isset($content_type['other'])) {
                         while (list($p_name, $p_value) = each($content_type['other'])) {
                             $return->ctype_parameters[$p_name] = $p_value;
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 22757ba..3d37bed 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -1239,8 +1239,13 @@
 			$result[$id]->cc = str_replace("\n", " ", $headers["cc"]);
 			$result[$id]->encoding = str_replace("\n", " ", $headers["content-transfer-encoding"]);
 			$result[$id]->ctype = str_replace("\n", " ", $headers["content-type"]);
-			//$result[$id]->in_reply_to = ereg_replace("[\n<>]",'', $headers['in-reply-to']);
-			list($result[$id]->ctype,$foo) = explode(";", $headers["content-type"]);
+			$result[$id]->in_reply_to = ereg_replace("[\n<>]",'', $headers['in-reply-to']);
+			
+			list($result[$id]->ctype, $ctype_add) = explode(";", $headers["content-type"]);
+
+			if (preg_match('/charset="?([a-z0-9\-]+)"?/i', $ctype_add, $regs))
+				$result[$id]->charset = $regs[1];
+
 			$messageID = $headers["message-id"];
 			if ($messageID) $messageID = substr(substr($messageID, 1), 0, strlen($messageID)-2);
 			else $messageID = "mid:".$id;
diff --git a/program/lib/utf8.inc b/program/lib/utf8.inc
index 72a96b4..43ecb32 100644
--- a/program/lib/utf8.inc
+++ b/program/lib/utf8.inc
@@ -88,7 +88,9 @@
 			$thisPos++;
 		}
 
-		if ($thisLen == 1)
+		if ($decimalCode<128)
+			$encodedLetter = chr($decimalCode);
+		else if ($thisLen == 1)
 			$encodedLetter = "&#". str_pad($decimalCode, 3, "0", STR_PAD_LEFT) . ';';
 		else
 			$encodedLetter = "&#". str_pad($decimalCode, 5, "0", STR_PAD_LEFT) . ';';
diff --git a/program/localization/de/labels.inc b/program/localization/de/labels.inc
index 08fd870..a5a0a41 100644
--- a/program/localization/de/labels.inc
+++ b/program/localization/de/labels.inc
@@ -9,7 +9,8 @@
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  +-----------------------------------------------------------------------+
- | Author: Thomas Bruederli <roundcube@gmail.com>                        |
+ | Author:      Thomas Bruederli <roundcube@gmail.com>                   |
+ | Corrections: Alexander Stiebing <ja.stiebing[NOSPAM]@web.de>          |
  +-----------------------------------------------------------------------+
 
  $Id$
@@ -18,46 +19,46 @@
 
 $labels = array();
 
-// login page
+// login page // Login-Seite
 $labels['username']  = 'Benutzername';
 $labels['password']  = 'Passwort';
 $labels['server']    = 'Server';
 $labels['login']     = 'Login';
 
-// taskbar
+// taskbar // Aktionsleiste
 $labels['logout']   = 'Logout';
 $labels['mail']     = 'E-Mail';
 $labels['settings'] = 'Einstellungen';
 $labels['addressbook'] = 'Adressbuch';
 
-// mailbox names
+// mailbox names // E-Mail-Ordnernamen
 $labels['inbox']  = 'Posteingang';
 $labels['sent']   = 'Gesendet';
 $labels['trash']  = 'Gel�scht';
 $labels['drafts'] = 'Vorlagen';
 $labels['junk']   = 'Junk';
 
-// message listing
+// message listing // Nachrichtenliste
 $labels['subject'] = 'Betreff';
 $labels['from']    = 'Absender';
 $labels['to']      = 'Empf�nger';
-$labels['cc']      = 'Kopie';
-$labels['bcc']     = 'Bcc';
+$labels['cc']      = 'Kopie (CC)';
+$labels['bcc']     = 'Blind-Kopie';
 $labels['replyto'] = 'Antwort an';
 $labels['date']    = 'Datum';
-$labels['size']    = 'Gr�sse';
+$labels['size']    = 'Gr��e';
 $labels['priority'] = 'Priorit�t';
 $labels['organization'] = 'Organisation';
 
-// aliases
+// aliases // [Platzhalter]
 $labels['reply-to'] = $labels['replyto'];
 
 $labels['mailboxlist'] = 'Ordner';
 $labels['messagesfromto'] = 'Nachrichten $from bis $to von $count';
 $labels['messagenrof'] = 'Nachrichten $nr von $count';
 
-$labels['moveto']   = 'verschieben nach...';
-$labels['download'] = 'download';
+$labels['moveto']   = 'Verschieben nach...';
+$labels['download'] = 'Download';
 
 $labels['filename'] = 'Dateiname';
 $labels['filesize'] = 'Dateigr�sse';
@@ -68,7 +69,7 @@
 
 $labels['addtoaddressbook'] = 'Ins Adressbuch �bernehmen';
 
-// weekdays short
+// weekdays short // Wochentage (Abk�rzungen) 
 $labels['sun'] = 'So';
 $labels['mon'] = 'Mo';
 $labels['tue'] = 'Di';
@@ -77,7 +78,7 @@
 $labels['fri'] = 'Fr';
 $labels['sat'] = 'Sa';
 
-// weekdays long
+// weekdays long // Wochentage (normal)
 $labels['sunday']    = 'Sonntag';
 $labels['monday']    = 'Montag';
 $labels['tuesday']   = 'Dienstag';
@@ -88,7 +89,7 @@
 
 $labels['today'] = 'Heute';
 
-// toolbar buttons
+// toolbar buttons // Symbolleisten-Tipps
 $labels['writenewmessage']  = 'Neue Nachricht schreiben';
 $labels['replytomessage']   = 'Antwort verfassen';
 $labels['forwardmessage']   = 'Nachricht weiterleiten';
@@ -103,17 +104,17 @@
 $labels['none']   = 'Keine';
 $labels['unread'] = 'Ungelesene';
 
-// message compose
+// message compose // Nachrichten erstellen
 $labels['compose']  = 'Neue Nachricht verfassen';
 $labels['sendmessage']  = 'Nachricht jetzt senden';
 $labels['addattachment']  = 'Datei anf�gen';
 
 $labels['attachments'] = 'Anh�nge';
 $labels['upload'] = 'Hochladen';
-$labels['close']  = 'Schliessen';
+$labels['close']  = 'Schlie�en';
 
-$labels['low']     = 'Tief';
-$labels['lowest']  = 'Tiefste';
+$labels['low']     = 'Niedrig';
+$labels['lowest']  = 'Niedrigste';
 $labels['normal']  = 'Normal';
 $labels['high']    = 'Hoch';
 $labels['highest'] = 'H�chste';
@@ -121,7 +122,7 @@
 $labels['showimages'] = 'Bilder anzeigen';
 
 
-// address boook
+// address book // Adressbuch
 $labels['name']      = 'Anzeigename';
 $labels['firstname'] = 'Vorname';
 $labels['surname']   = 'Nachname';
@@ -139,14 +140,16 @@
 $labels['deletecontact']  = 'Gew�hlte Kontakte l�schen';
 $labels['composeto']      = 'Nachricht verfassen';
 $labels['contactsfromto'] = 'Kontakte $from bis $to von $count';
+$labels['print']          = 'Drucken';
+$labels['export']         = 'Exportieren';
 
 
-// settings
+// settings // Einstellungen
 $labels['settingsfor']  = 'Einstellungen f�r';
 
 $labels['preferences']  = 'Einstellungen';
 $labels['userpreferences']  = 'Benutzereinstellungen';
-$labels['editpreferences']  = 'Ereinstellungen bearbeiten';
+$labels['editpreferences']  = 'Einstellungen bearbeiten';
 
 $labels['identities']  = 'Absender';
 $labels['manageidentities']  = 'Absender f�r dieses Konto verwalten';
diff --git a/program/localization/de/messages.inc b/program/localization/de/messages.inc
index 3061bf0..41470fa 100644
--- a/program/localization/de/messages.inc
+++ b/program/localization/de/messages.inc
@@ -24,9 +24,9 @@
 
 $messages['sessionerror'] = 'Ihre Session ist ung�ltig oder abgelaufen';
 
-$messages['imaperror'] = 'Keine Verbindung zum IMAP server';
+$messages['imaperror'] = 'Keine Verbindung zum IMAP Server';
 
-$messages['nomessagesfound'] = 'Keine Nachrichten in diesem Order';
+$messages['nomessagesfound'] = 'Keine Nachrichten in diesem Ordner';
 
 $messages['loggedout'] = 'Sie haben Ihre Session erfolgreich beendet. Auf Wiedersehen!';
 
diff --git a/program/localization/en/labels.inc b/program/localization/en/labels.inc
index bf92bcd..35b0e3f 100644
--- a/program/localization/en/labels.inc
+++ b/program/localization/en/labels.inc
@@ -140,8 +140,8 @@
 $labels['deletecontact']  = 'Delete selected contacts';
 $labels['composeto']      = 'Compose mail to';
 $labels['contactsfromto'] = 'Contacts $from to $to of $count';
-$labels['print']          = 'Imprimir';
-$labels['export']         = 'Exportar';
+$labels['print']          = 'Print';
+$labels['export']         = 'Export';
 
 
 // settings
diff --git a/program/localization/index.inc b/program/localization/index.inc
index 6f68b0c..e50a271 100644
--- a/program/localization/index.inc
+++ b/program/localization/index.inc
@@ -39,7 +39,7 @@
 	'it'    => 'Italiano',
 	'jp'    => 'Japanese', 
 	'kr'    => 'Korean',
-	'lt'    => 'Lithuanian',
+	'lv'    => 'Latvian',
 	'nl'    => 'Nederlands',
 	'no'    => 'Norsk (bokm&aring;l)',
 	'fa'    => 'Persian',
diff --git a/program/steps/error.inc b/program/steps/error.inc
index 9e5757d..aa8036a 100644
--- a/program/steps/error.inc
+++ b/program/steps/error.inc
@@ -34,6 +34,7 @@
 &raquo; &nbsp;Safari 1.2+<br />
 <br />
 &raquo; &nbsp;JavaScript enabled<br />
+&raquo; &nbsp;Support for XMLHTTPRequest<br />
 
 <p><i>Your configuration:</i><br />
 $user_agent</p>
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 98e0cdb..059a8cf 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -21,6 +21,8 @@
 
 require_once('lib/html2text.inc');
 require_once('lib/enriched.inc');
+require_once('lib/utf8.inc');
+require_once('lib/utf7.inc');
 
 
 $EMAIL_ADDRESS_PATTERN = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/i';
@@ -157,12 +159,15 @@
     if (in_array($folder_lc, $special))
       $foldername = rcube_label($folder_lc);
     else
-      $foldername = $folder['name'];
+      {
+      $foldername = UTF7DecodeString($folder['name']);
 
-    // shorten the folder name to a given length
-    if ($maxlength && $maxlength>1)
-      $foldername = abbrevate_string($foldername, $maxlength);
+      // shorten the folder name to a given length
+      if ($maxlength && $maxlength>1)
+        $foldername = abbrevate_string($foldername, $maxlength);
+      }
 
+    // add unread message count display
     if ($unread_count = $IMAP->messagecount($folder['id'], 'UNSEEN', ($folder['id']==$mbox)))
       $foldername .= sprintf(' (%d)', $unread_count);
 
@@ -176,7 +181,7 @@
                     $folder['id'],
                     $JS_OBJECT_NAME,
                     $folder['id'],
-                    rep_specialchars_output($foldername));
+                    rep_specialchars_output($foldername, 'html', 'all'));
 
     if (!empty($folder['folders']))
       $out .= '<ul>' . rcmail_render_folder_tree_html($folder['folders'], $special, $mbox, $maxlength, $nestLevel+1) . "</ul>\n";
@@ -202,16 +207,18 @@
     if (in_array($folder_lc, $special))
       $foldername = rcube_label($folder_lc);
     else
-      $foldername = $folder['name'];
-
-    // shorten the folder name to a given length
-    if ($maxlength && $maxlength>1)
-      $foldername = abbrevate_string($foldername, $maxlength);
+      {
+      $foldername = UTF7DecodeString($folder['name']);
+      
+      // shorten the folder name to a given length
+      if ($maxlength && $maxlength>1)
+        $foldername = abbrevate_string($foldername, $maxlength);
+      }
 
     $out .= sprintf('<option value="%s">%s%s</option>'."\n",
                     $folder['id'],
                     str_repeat('&nbsp;', $nestLevel*4),
-                    rep_specialchars_output($foldername));
+                    rep_specialchars_output($foldername, 'html', 'all'));
 
     if (!empty($folder['folders']))
       $out .= rcmail_render_folder_tree_select($folder['folders'], $special, $mbox, $maxlength, $nestLevel+1);
@@ -600,6 +607,7 @@
                               'body' => $structure->body,
                               'ctype_primary' => $message_ctype_primary,
                               'ctype_secondary' => $message_ctype_secondary,
+                              'parameters' => $structure->ctype_parameters,
                               'encoding' => $structure->headers['content-transfer-encoding']);
     }
 
@@ -693,6 +701,7 @@
                                   'body' => $mail_part->body,
                                   'ctype_primary' => $primary_type,
                                   'ctype_secondary' => $secondary_type,
+                                  'parameters' => $mail_part->ctype_parameters,
                                   'encoding' => $mail_part->headers['content-transfer-encoding']);
         }
 
@@ -867,7 +876,9 @@
         $out .= rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : NULL, $part['headers']);
       else if ($part['type']=='content')
         {
-//        var_dump($part['parameters']);
+        if (empty($part['parameters']) || empty($part['parameters']['charset']))
+          $part['parameters']['charset'] = $MESSAGE['headers']->charset;
+        
         // $body = rcmail_print_body($part['body'], $part['ctype_primary'], $part['ctype_secondary'], $part['encoding'], $safe_mode);
         $body = rcmail_print_body($part, $safe_mode);
         $out .= '<div class="message-part">';
@@ -1078,7 +1089,7 @@
     {
     $j++;
     if ($PRINT_MODE)
-      $out .= sprintf('%s &lt;%s&gt;', htmlentities($part['name']), $part['mailto']);
+      $out .= sprintf('%s &lt;%s&gt;', rep_specialchars_output($part['name']), $part['mailto']);
     else if (preg_match($EMAIL_ADDRESS_PATTERN, $part['mailto']))
       {
       $out .= sprintf('<a href="mailto:%s" onclick="return %s.command(\'compose\',\'%s\',this)" class="rcmContactAddress" title="%s">%s</a>',
@@ -1086,7 +1097,7 @@
                       $JS_OBJECT_NAME,
                       $part['mailto'],
                       $part['mailto'],
-                      htmlentities($part['name']));
+                      rep_specialchars_output($part['name']));
                       
       if ($addicon)
         $out .= sprintf('&nbsp;<a href="#add" onclick="return %s.command(\'add-contact\',\'%s\',this)" title="%s"><img src="%s%s" alt="add" border="0" /></a>',
@@ -1099,7 +1110,7 @@
     else
       {
       if ($part['name'])
-        $out .= htmlentities($part['name']);
+        $out .= rep_specialchars_output($part['name']);
       if ($part['mailto'])
         $out .= (strlen($out) ? ' ' : '') . sprintf('&lt;%s&gt;', $part['mailto']);
       }
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 6182126..809aed5 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -147,9 +147,16 @@
   foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath)
     $MAIL_MIME->addAttachment($filepath, $files['type'][$i], $files['name'][$i], TRUE);
 
+// encoding settings for mail composing
+$message_param = array('text_encoding' => '7bit',
+                       'html_encoding' => 'quoted-printable',
+                       'head_encoding' => 'quoted-printable',
+                       'head_charset'  => 'ISO-8859-1',
+                       'html_charset'  => 'UTF-8',
+                       'text_charset'  => 'UTF-8');
 
 // compose message body and get headers
-$msg_body = $MAIL_MIME->get();
+$msg_body = $MAIL_MIME->get($message_param);
 $msg_subject = $headers['Subject'];
 
 
diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc
index b960561..04b2a46 100644
--- a/program/steps/settings/manage_folders.inc
+++ b/program/steps/settings/manage_folders.inc
@@ -19,6 +19,8 @@
 
 */
 
+require_once('lib/utf7.inc');
+
 // init IAMP connection
 rcmail_imap_init(TRUE);
 
@@ -47,7 +49,7 @@
 else if ($_action=='create-folder')
   {
   if (strlen($_GET['_name']))
-    $create = $IMAP->create_mailbox(trim($_GET['_name']), TRUE);
+    $create = $IMAP->create_mailbox(strip_tags(trim($_GET['_name'])), TRUE);
 
   if ($create && $_GET['_remote'])
     {
@@ -122,7 +124,7 @@
     $out .= sprintf('<tr id="rcmrow%d" class="%s"><td>%s</td><td>%s</td><td><a href="#delete" onclick="%s.command(\'delete-folder\',\'%s\')" title="%s">%s</a></td>',
                     $i+1,
                     $zebra_class,
-                    rep_specialchars_output($folder, 'html'),
+                    rep_specialchars_output(UTF7DecodeString($folder), 'html', 'all'),
                     $checkbox_subscribe->show(in_array($folder, $a_subscribed)?$folder:'', array('value' => $folder)),
                     $JS_OBJECT_NAME,
                     $folder_js,
diff --git a/skins/default/common.css b/skins/default/common.css
index 67e404e..d133bec 100755
--- a/skins/default/common.css
+++ b/skins/default/common.css
@@ -170,6 +170,7 @@
   left: 200px;
   right: 200px;
   z-index: 5000;
+  opacity: 0.85;
 }
 
 #message div
diff --git a/skins/default/includes/taskbar.html b/skins/default/includes/taskbar.html
deleted file mode 100644
index be3d57d..0000000
--- a/skins/default/includes/taskbar.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-<!--
-<form name="debugform" style="position:absolute; right:10px; bottom:10px;">
-<textarea name="console" cols="60" rows="15" wrap="off"></textarea>
-</form>
--->
\ No newline at end of file
diff --git a/skins/default/settings.css b/skins/default/settings.css
index 427a739..fe6a589 100644
--- a/skins/default/settings.css
+++ b/skins/default/settings.css
@@ -4,7 +4,7 @@
 #tabsbar
 {
   position: absolute;
-  top: 45px;
+  top: 50px;
   left: 220px;
   right: 60px;
   height: 22px;
@@ -47,7 +47,7 @@
 #userprefs-box
 {
   position: absolute;
-  top: 90px;
+  top: 95px;
   left: 20px;
   width: 550px;
   border: 1px solid #999999;  
@@ -63,7 +63,7 @@
 #folder-manager
 {
   position: absolute;
-  top: 90px;
+  top: 95px;
   left: 20px;
 }
 
diff --git a/skins/default/templates/addressbook.html b/skins/default/templates/addressbook.html
index 99c2c8e..b2ed210 100644
--- a/skins/default/templates/addressbook.html
+++ b/skins/default/templates/addressbook.html
@@ -31,7 +31,5 @@
 <roundcube:object name="addressframe" id="contact-frame" width="100%" height="100%" frameborder="0" src="/watermark.html" />
 </div>
 
-<roundcube:include file="/includes/taskbar.html" />
-
 </body>
 </html>
diff --git a/skins/default/templates/compose.html b/skins/default/templates/compose.html
index 5fd5e73..5774b78 100644
--- a/skins/default/templates/compose.html
+++ b/skins/default/templates/compose.html
@@ -112,7 +112,5 @@
 </div>
 -->
 
-<roundcube:include file="/includes/taskbar.html" />
-
 </body>
 </html>
diff --git a/skins/default/templates/mail.html b/skins/default/templates/mail.html
index 631f46d..56d0df6 100644
--- a/skins/default/templates/mail.html
+++ b/skins/default/templates/mail.html
@@ -45,7 +45,5 @@
 <roundcube:button command="select-none" label="none" classAct="active" />
 </div>
 
-<roundcube:include file="/includes/taskbar.html" />
-
 </body>
 </html>
diff --git a/skins/default/templates/message.html b/skins/default/templates/message.html
index 5eafb59..3c276d0 100644
--- a/skins/default/templates/message.html
+++ b/skins/default/templates/message.html
@@ -16,7 +16,7 @@
 <roundcube:button command="delete" imageAct="/images/buttons/delete_act.png" imagePas="/images/buttons/delete_pas.png" width="32" height="32" title="deletemessage" />
 <roundcube:button command="print" imageAct="/images/buttons/print_act.png" imagePas="/images/buttons/print_pas.png" width="32" height="32" title="printmessage" />
 <roundcube:button command="viewsource" imageAct="/images/buttons/source_act.png" imagePas="/images/buttons/source_pas.png" width="32" height="32" title="viewsource" />
-<roundcube:object name="mailboxlist" type="select" noSelection="moveto" onchange="rcmail.command('moveto', this.options[this.selectedIndex].value)" class="mboxlist" />
+<roundcube:object name="mailboxlist" type="select" noSelection="moveto" maxlength="25" onchange="rcmail.command('moveto', this.options[this.selectedIndex].value)" class="mboxlist" />
 </div>
 
 <div id="messagecountbar">
@@ -26,7 +26,7 @@
 </div>
 
 <div id="mailboxlist-header"><roundcube:label name="mailboxlist" /></div>
-<div id="mailboxlist-container"><roundcube:object name="mailboxlist" id="mailboxlist" /></div>
+<div id="mailboxlist-container"><roundcube:object name="mailboxlist" id="mailboxlist" maxlength="16" /></div>
 
 <div id="messageframe">
 <roundcube:object name="messageHeaders" class="headers-table" cellspacing="0" cellpadding="2" addicon="/images/icons/plus.gif" summary="Message headers" />
@@ -34,8 +34,6 @@
 <roundcube:object name="blockedObjects" id="remote-objects-message" />
 <roundcube:object name="messageBody" id="messagebody" showImages="true" />
 </div>
-
-<roundcube:include file="/includes/taskbar.html" />
 
 </body>
 </html>

--
Gitblit v1.9.1