From a4c970508b899fd9e467b33319d689470908a24c Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sun, 14 Nov 2010 05:09:14 -0500
Subject: [PATCH] - Re-fix handling of html entity strings in plain/text messages

---
 program/steps/mail/func.inc |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 11df128..c7498d5 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -46,7 +46,7 @@
 }
 
 // set imap properties and session vars
-if ($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC))
+if (strlen(trim($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC, true))))
   $IMAP->set_mailbox(($_SESSION['mbox'] = $mbox));
 else if ($IMAP)
   $_SESSION['mbox'] = $IMAP->get_mailbox_name();
@@ -423,14 +423,16 @@
 
 function rcmail_messagecount_display($attrib)
   {
-  global $IMAP, $OUTPUT;
+  global $RCMAIL;
 
   if (!$attrib['id'])
     $attrib['id'] = 'rcmcountdisplay';
 
-  $OUTPUT->add_gui_object('countdisplay', $attrib['id']);
+  $RCMAIL->output->add_gui_object('countdisplay', $attrib['id']);
 
-  return html::span($attrib, rcmail_get_messagecount_text());
+  $content =  $RCMAIL->action != 'show' ? rcmail_get_messagecount_text() : rcube_label('loading');
+
+  return html::span($attrib, $content);
   }
 
 
@@ -495,14 +497,7 @@
 
 function rcmail_get_messagecount_text($count=NULL, $page=NULL)
   {
-  global $RCMAIL, $IMAP, $MESSAGE;
-
-  if (isset($MESSAGE->index))
-    {
-    return rcube_label(array('name' => 'messagenrof',
-        'vars' => array('nr'  => $MESSAGE->index+1,
-        'count' => $count!==NULL ? $count : $IMAP->messagecount(NULL, 'ALL')))); // Only messages, no threads here
-    }
+  global $RCMAIL, $IMAP;
 
   if ($page===NULL)
     $page = $IMAP->list_page;
@@ -836,8 +831,12 @@
     $quote_level = $q;
   }
 
-  // quote plain text
-  $body = Q(join("\n", $a_lines), 'dummy', false);
+  $body = join("\n", $a_lines);
+
+  // quote plain text (don't use Q() here, to display entities "as is")
+  $table = get_html_translation_table(HTML_SPECIALCHARS);
+  unset($table['?']);
+  $body = strtr($body, $table);
 
   // colorize signature (up to <sig_max_lines> lines)
   $len = strlen($body);
@@ -977,7 +976,7 @@
 
   foreach ($plugin['output'] as $hkey => $row) {
     $table->add(array('class' => 'header-title'), Q($row['title']));
-    $table->add(array('class' => $hkey, 'width' => "90%"), Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show')));
+    $table->add(array('class' => 'header '.$hkey), Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show')));
   }
 
   // all headers division
@@ -1545,6 +1544,7 @@
       $delim   = $RCMAIL->config->header_delimiter();
       $to      = $headers_enc['To'];
       $subject = $headers_enc['Subject'];
+      $header_str = rtrim($header_str);
 
       if ($delim != "\r\n") {
         $header_str = str_replace("\r\n", $delim, $header_str);

--
Gitblit v1.9.1