From b7c84a1bb82a8446241517577875afd5f9c3a26c Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 15 Aug 2012 10:23:11 -0400
Subject: [PATCH] Fix lower-casing email address on replies (#1488598)

---
 program/include/rcube_shared.inc |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index 9340091..3d32555 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -66,7 +66,7 @@
   if (headers_sent())
     return;
 
-  header("Expires: ".gmdate("D, d M Y H:i:s", mktime()+$offset)." GMT");
+  header("Expires: ".gmdate("D, d M Y H:i:s", time()+$offset)." GMT");
   header("Cache-Control: max-age=$offset");
   header("Pragma: ");
 }
@@ -82,9 +82,11 @@
 function in_array_nocase($needle, $haystack)
 {
   $needle = mb_strtolower($needle);
-  foreach ($haystack as $value)
-    if ($needle===mb_strtolower($value))
-      return true;
+  foreach ((array)$haystack as $value) {
+    if ($needle === mb_strtolower($value)) {
+       return true;
+    }
+  }
 
   return false;
 }
@@ -299,7 +301,7 @@
     $unit = 's';
   }
 
-  $ts = mktime();
+  $ts = time();
   switch ($unit)
   {
     case 'w':
@@ -468,6 +470,29 @@
 
 
 /**
+ * Format e-mail address
+ *
+ * @param string $email E-mail address
+ *
+ * @return string Formatted e-mail address
+ */
+function format_email($email)
+{
+    $email = trim($email);
+    $parts = explode('@', $email);
+    $count = count($parts);
+
+    if ($count > 1) {
+        $parts[$count-1] = mb_strtolower($parts[$count-1]);
+
+        $email = implode('@', $parts);
+    }
+
+    return $email;
+}
+
+
+/**
  * mbstring replacement functions
  */
 

--
Gitblit v1.9.1