From 40ed9be1ee7ca4c4950573a18f55aeaaa15ecb3a Mon Sep 17 00:00:00 2001
From: svncommit <devs@roundcube.net>
Date: Wed, 13 Sep 2006 00:49:18 -0400
Subject: [PATCH] Fixed bug #1484019 and #1484020

---
 CHANGELOG                 |    6 ++++++
 program/lib/html2text.inc |    8 +++-----
 program/lib/imap.inc      |    2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 9295e33..e683252 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,12 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
+2006/09/12 (estadtherr)
+----------
+- Fixed html2text treatment of table headers (Bug #1484020)
+- Fixed IMAP fetch of message body (Bug #1484019)
+
+
 2006/09/08 (thomasb)
 ----------
 - Fixed safe_mode problems (Bug #1418381)
diff --git a/program/lib/html2text.inc b/program/lib/html2text.inc
index 82a254e..36849a4 100644
--- a/program/lib/html2text.inc
+++ b/program/lib/html2text.inc
@@ -126,19 +126,18 @@
         '/(<table[^>]*>|<\/table>)/i',           // <table> and </table>
         '/(<tr[^>]*>|<\/tr>)/i',                 // <tr> and </tr>
         '/<td[^>]*>(.+?)<\/td>/i',               // <td> and </td>
-        '/<th[^>]*>(.+?)<\/th>/i',               // <th> and </th>
+        '/<th[^>]*>(.+?)<\/th>/ie',              // <th> and </th>
         '/&nbsp;/i',
         '/&quot;/i',
         '/&gt;/i',
         '/&lt;/i',
-        '/&amp;/i',
+        '/&(amp|#38);/i',
         '/&copy;/i',
         '/&trade;/i',
         '/&#8220;/',
         '/&#8221;/',
         '/&#8211;/',
-        '/&#8217;/',
-        '/&#38;/',
+        '/&#(8217|39);/',
         '/&#169;/',
         '/&#8482;/',
         '/&#151;/',
@@ -188,7 +187,6 @@
         '"',
         '-',
         "'",
-        '&',
         '(c)',
         '(tm)',
         '--',
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index b2e1d43..caa1d27 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -1887,7 +1887,7 @@
                 $remaining = $bytes - $received;
                 $line = iil_ReadLine($fp, 1024);
                 $len = strlen($line);
-                if ($len > $remaining) substr($line, 0, $remaining);
+                if ($len > $remaining) $line = substr($line, 0, $remaining);
                 $received += strlen($line);
                 if ($mode==1) $result .= chop($line)."\n";
                 else if ($mode==2){ echo chop($line)."\n"; flush(); }

--
Gitblit v1.9.1