From 0344b168276f80189e2254c75a762aff5b517b6b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 May 2016 06:32:57 -0400
Subject: [PATCH] Fix priority icon(s) position

---
 program/include/rcmail_string_replacer.php |   35 ++++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/program/include/rcmail_string_replacer.php b/program/include/rcmail_string_replacer.php
index 4fbc611..2037db6 100644
--- a/program/include/rcmail_string_replacer.php
+++ b/program/include/rcmail_string_replacer.php
@@ -1,11 +1,11 @@
 <?php
 
-/*
+/**
  +-----------------------------------------------------------------------+
  | program/include/rcmail_string_replacer.php                            |
  |                                                                       |
  | This file is part of the Roundcube Webmail client                     |
- | Copyright (C) 2012, The Roundcube Dev Team                            |
+ | Copyright (C) 2012-2013, The Roundcube Dev Team                       |
  |                                                                       |
  | Licensed under the GNU General Public License version 3 or            |
  | any later version with exceptions for skins & plugins.                |
@@ -19,12 +19,11 @@
  +-----------------------------------------------------------------------+
 */
 
-
 /**
  * Helper class for turning URLs and email addresses in plaintext content
  * into clickable links.
  *
- * @package    Core
+ * @package Webmail
  * @subpackage Utils
  */
 class rcmail_string_replacer extends rcube_string_replacer
@@ -40,15 +39,25 @@
      */
     public function mailto_callback($matches)
     {
-      $href   = $matches[1];
-      $suffix = $this->parse_url_brackets($href);
+        $href   = $matches[1];
+        $suffix = $this->parse_url_brackets($href);
+        $email  = $href;
 
-      $i = $this->add(html::a(array(
-          'href' => 'mailto:' . $href,
-          'onclick' => "return ".rcmail_output::JS_OBJECT_NAME.".command('compose','".rcube::JQ($href)."',this)",
-        ), rcube::Q($href)) . $suffix);
+        if (strpos($email, '?')) {
+            list($email,) = explode('?', $email);
+        }
 
-      return $i >= 0 ? $this->get_replacement($i) : '';
+        // skip invalid emails
+        if (!rcube_utils::check_email($email, false)) {
+            return $matches[1];
+        }
+
+        $i = $this->add(html::a(array(
+            'href'    => 'mailto:' . $href,
+            'onclick' => "return ".rcmail_output::JS_OBJECT_NAME.".command('compose','".rcube::JQ($href)."',this)",
+            ),
+            rcube::Q($href)) . $suffix);
+
+        return $i >= 0 ? $this->get_replacement($i) : '';
     }
-    
-}
\ No newline at end of file
+}

--
Gitblit v1.9.1