From bbc8565e5afa7e5352bc3aaf7cf067066ec6d4b1 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 04 Mar 2010 03:17:04 -0500
Subject: [PATCH] Flag original messages after sending a draft (#1486203)
---
program/include/rcube_string_replacer.php | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/program/include/rcube_string_replacer.php b/program/include/rcube_string_replacer.php
index 064a723..03c04dd 100644
--- a/program/include/rcube_string_replacer.php
+++ b/program/include/rcube_string_replacer.php
@@ -15,7 +15,7 @@
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
- $Id: $
+ $Id$
*/
@@ -39,7 +39,7 @@
$url_chars_within = '\?\.~,!';
$this->link_pattern = "/([\w]+:\/\/|\Wwww\.)([a-z0-9\-\.]+[a-z]{2,4}([$url_chars$url_chars_within]*[$url_chars])?)/i";
- $this->mailto_pattern = "/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/i";
+ $this->mailto_pattern = "/([a-z0-9][a-z0-9\-\.\+\_]*@([a-z0-9]([-a-z0-9]*[a-z0-9])?\\.)+[a-z]{2,5})/i";
}
/**
@@ -74,7 +74,7 @@
$i = -1;
$scheme = strtolower($matches[1]);
- if ($scheme == 'http://' || $scheme == 'https://' || $scheme == 'ftp://') {
+ if (preg_match('!^(http|ftp|file)s?://!', $scheme)) {
$url = $matches[1] . $matches[2];
$i = $this->add(html::a(array('href' => $url, 'target' => '_blank'), Q($url)));
}
@@ -83,7 +83,8 @@
$i = $this->add($m[1] . html::a(array('href' => 'http://' . $url, 'target' => '_blank'), Q($url)));
}
- return $i >= 0 ? $this->get_replacement($i) : '';
+ // Return valid link for recognized schemes, otherwise, return the unmodified string for unrecognized schemes.
+ return $i >= 0 ? $this->get_replacement($i) : $matches[0];
}
/**
--
Gitblit v1.9.1