summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-09-27 16:52:15 -0400
committerCraig Andrews <candrews@integralblue.com>2009-09-27 16:52:15 -0400
commitfc2426d7ce33bba0e1ad4dfc1ed9af7749695b20 (patch)
tree4a6b9cf632e10f8b947a4d8b9be56a1c69d46674 /lib
parent7f3c1ac2beca8f0e21c002930a5df6dc2d9415ad (diff)
Fix some bugs in the URL linkification, and fixed the unit test.
Diffstat (limited to 'lib')
-rw-r--r--lib/util.php23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/util.php b/lib/util.php
index 56753debe..d249b154f 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -522,20 +522,21 @@ function common_linkify($url) {
if(strpos($url, '@') !== false && strpos($url, ':') === false) {
//url is an email address without the mailto: protocol
- return XMLStringer::estring('a', array('href' => "mailto:$url", 'rel' => 'external'), $url);
- }
+ $canon = "mailto:$url";
+ $longurl = "mailto:$url";
+ }else{
- $canon = File_redirection::_canonUrl($url);
+ $canon = File_redirection::_canonUrl($url);
- $longurl_data = File_redirection::where($url);
- if (is_array($longurl_data)) {
- $longurl = $longurl_data['url'];
- } elseif (is_string($longurl_data)) {
- $longurl = $longurl_data;
- } else {
- throw new ServerException("Can't linkify url '$url'");
+ $longurl_data = File_redirection::where($canon);
+ if (is_array($longurl_data)) {
+ $longurl = $longurl_data['url'];
+ } elseif (is_string($longurl_data)) {
+ $longurl = $longurl_data;
+ } else {
+ throw new ServerException("Can't linkify url '$url'");
+ }
}
-
$attrs = array('href' => $canon, 'title' => $longurl, 'rel' => 'external');
$is_attachment = false;