From c4daf3f14fa34bb78fe86410bfd79bd8951d7a71 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 30 Aug 2015 12:41:13 -0400
Subject: [PATCH] Fix regression in converting signatures to text, fixed PHP warning in html2text() call

---
 program/steps/mail/compose.inc |    5 +++--
 program/include/rcmail.php     |    4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index db5fce6..faf7af8 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -2305,7 +2305,7 @@
      *
      * @return string Plain text
      */
-    public function html2text($html, $options)
+    public function html2text($html, $options = array())
     {
         $default_options = array(
             'links'   => true,
@@ -2314,7 +2314,7 @@
             'charset' => RCUBE_CHARSET,
         );
 
-        $options = array_merge($default_options, $options);
+        $options = array_merge($default_options, (array) $options);
 
         // Plugins may want to modify HTML in another/additional way
         $options = $this->plugins->exec_hook('html2text', $options);
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 96db7e6..807d0ef 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -499,7 +499,8 @@
                 $text = $html = $sql_arr['signature'];
 
                 if ($sql_arr['html_signature']) {
-                    $text = $RCMAIL->html2text($html);
+                    $text = $RCMAIL->html2text($html, array('links' => false));
+                    $text = trim($text);
                 }
                 else {
                     $t2h  = new rcube_text2html($text, false);
@@ -1058,7 +1059,7 @@
             $suffix = '</blockquote>';
         }
         else {
-            $suffix = '</blockquote><p></p>';
+            $suffix = '</blockquote><p><br/></p>';
         }
     }
 

--
Gitblit v1.9.1