From 187833dff94146a9b176a1ca4a5c9996809fd4a7 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 02 Jun 2011 08:36:32 -0400
Subject: [PATCH] - Apply fixes from trunk

---
 CHANGELOG                                |    1 +
 installer/config.php                     |    4 ++--
 program/include/main.inc                 |    4 ++++
 program/steps/mail/func.inc              |    2 +-
 program/steps/settings/save_identity.inc |   11 +++++++----
 program/lib/washtml.php                  |    2 +-
 6 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 972c94c..0e163fd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix identities "reply-to" and "bcc" fields have a bogus value when left empty (#1487943)
 - Fix issue which cases IMAP disconnection when encrypt() method was used (#1487900)
 - Fix some CSS issues in Settings for Internet Explorer
 - Fixed handling of folder with name "0" in folder selector
diff --git a/installer/config.php b/installer/config.php
index 5250782..6b52407 100644
--- a/installer/config.php
+++ b/installer/config.php
@@ -81,7 +81,7 @@
 ?>
 <label for="cfgipcheck">Check client IP in session authorization</label><br />
 
-<p class="hint">This increases security but can cause sudden logouts when someone uses a proxy with changeing IPs.</p>
+<p class="hint">This increases security but can cause sudden logouts when someone uses a proxy with changing IPs.</p>
 </dd>
 
 <dt class="propname">des_key</dt>
@@ -93,7 +93,7 @@
 
 ?>
 <div>This key is used to encrypt the users imap password before storing in the session record</div>
-<p class="hint">It's a random generated string to ensure that every installation has it's own key.
+<p class="hint">It's a random generated string to ensure that every installation has its own key.
 If you enter it manually please provide a string of exactly 24 chars.</p>
 </dd>
 
diff --git a/program/include/main.inc b/program/include/main.inc
index 72a1905..3c04e20 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1916,6 +1916,10 @@
 
   $domain = $is_utf ? idn_to_ascii($domain) : idn_to_utf8($domain);
 
+  if ($domain === false) {
+    return '';
+  }
+
   return $at ? $user . '@' . $domain : $domain;
 }
 
diff --git a/program/lib/washtml.php b/program/lib/washtml.php
index e8befe8..a5eeb84 100644
--- a/program/lib/washtml.php
+++ b/program/lib/washtml.php
@@ -274,7 +274,7 @@
 
     // Remove invalid HTML comments (#1487759)
     // Don't remove valid conditional comments
-    $html = preg_replace('/<!--[^->[]*>/', '', $html);
+    $html = preg_replace('/<!--[^->[\n]*>/', '', $html);
 
     @$node->loadHTML($html);
     return $this->dumpHtml($node);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 5160027..d738322 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -575,7 +575,7 @@
     '',
     '<html>',
   );
-  $html = preg_replace($html_search, $html_replace, $html);
+  $html = preg_replace($html_search, $html_replace, trim($html));
 
   // PCRE errors handling (#1486856), should we use something like for every preg_* use?
   if ($html === null && ($preg_error = preg_last_error()) != PREG_NO_ERROR) {
diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc
index c8d258f..dbb4d47 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -116,9 +116,12 @@
   $plugin = $RCMAIL->plugins->exec_hook('identity_create', array('record' => $save_data));
   $save_data = $plugin['record'];
 
-  $save_data['email']    = rcube_idn_to_ascii($save_data['email']);
-  $save_data['bcc']      = rcube_idn_to_ascii($save_data['bcc']);
-  $save_data['reply-to'] = rcube_idn_to_ascii($save_data['reply-to']);
+  if ($save_data['email'])
+    $save_data['email']    = rcube_idn_to_ascii($save_data['email']);
+  if ($save_data['bcc'])
+    $save_data['bcc']      = rcube_idn_to_ascii($save_data['bcc']);
+  if ($save_data['reply-to'])
+    $save_data['reply-to'] = rcube_idn_to_ascii($save_data['reply-to']);
 
   if (!$plugin['abort'])
     $insert_id = $save_data['email'] ? $USER->insert_identity($save_data) : null;
@@ -127,7 +130,7 @@
 
   if ($insert_id) {
     $OUTPUT->show_message('successfullysaved', 'confirmation', null, false);
-    
+
     $_GET['_iid'] = $insert_id;
 
     if (!empty($_POST['_standard']))

--
Gitblit v1.9.1