From a3861ba02f0ad7fdec4e13bab8a4194f920733a5 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 06 Jan 2011 08:58:13 -0500
Subject: [PATCH] Fix message position on older IE

---
 program/include/rcube_string_replacer.php |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/program/include/rcube_string_replacer.php b/program/include/rcube_string_replacer.php
index 962ea04..e219f30 100644
--- a/program/include/rcube_string_replacer.php
+++ b/program/include/rcube_string_replacer.php
@@ -35,13 +35,15 @@
 
   function __construct()
   {
-    $url_chars = 'a-z0-9_\-\+\*\$\/&%=@#:;';
-    $url_chars_within = '\?\.~,!';
+    // Simplified domain expression for UTF8 characters handling
+    $utf_domain = '[^?&@"\'\\/()\s\r\t\n]+\\.[a-z]{2,5}';
+    $url = '[a-z0-9%=#@+?.:;&\\/_~-]+';
 
-    $this->link_pattern = "/([\w]+:\/\/|\Wwww\.)([a-z0-9\-\.]+[a-z]{2,4}([$url_chars$url_chars_within]*[$url_chars])?)/i";
+    $this->link_pattern = "/([\w]+:\/\/|\Wwww\.)($utf_domain($url)?)/i";
     $this->mailto_pattern = "/("
         ."[-\w!\#\$%&\'*+~\/^`|{}=]+(?:\.[-\w!\#\$%&\'*+~\/^`|{}=]+)*"  // local-part
-        ."@([a-z0-9]([-a-z0-9]*[a-z0-9])?\\.)+[a-z]{2,5}"               // domain-part
+        ."@$utf_domain"                                                 // domain-part
+        ."(\?$url)?"                                                    // e.g. ?subject=test...
         .")/i";
   }
 

--
Gitblit v1.9.1