From fc2426d7ce33bba0e1ad4dfc1ed9af7749695b20 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Sun, 27 Sep 2009 16:52:15 -0400 Subject: Fix some bugs in the URL linkification, and fixed the unit test. --- lib/util.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'lib/util.php') 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; -- cgit v1.2.3-54-g00ecf From 353f58c23149159306131b0819de713da6b69464 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 30 Sep 2009 10:51:59 +0000 Subject: Outputting UTF-8 charset in document header irrespective of mimetype. --- lib/htmloutputter.php | 2 +- lib/util.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/util.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 9e3a5b305..99f956545 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -106,7 +106,7 @@ class HTMLOutputter extends XMLOutputter } } - header('Content-Type: '.$type); + header('Content-Type: '.$type.'; charset=UTF-8'); $this->extraHeaders(); if( ! substr($type,0,strlen('text/html'))=='text/html' ){ diff --git a/lib/util.php b/lib/util.php index b831859e9..a069ccf7b 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1148,7 +1148,7 @@ function common_negotiate_type($cprefs, $sprefs) } if ('text/html' === $besttype) { - return "text/html; charset=utf-8"; + return "text/html"; } return $besttype; } -- cgit v1.2.3-54-g00ecf From cc776478e2ea8fc861fd3b4e8e878f7d6020c34e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 1 Oct 2009 10:07:09 +0000 Subject: Revert "Outputting UTF-8 charset in document header irrespective of mimetype." This reverts commit 353f58c23149159306131b0819de713da6b69464. Even though outputting UTF-8 by default at all times is a good thing, it shouldn't be forced in startHTML(). --- lib/htmloutputter.php | 2 +- lib/util.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/util.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 64be745be..c70f96537 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -106,7 +106,7 @@ class HTMLOutputter extends XMLOutputter } } - header('Content-Type: '.$type.'; charset=UTF-8'); + header('Content-Type: '.$type); $this->extraHeaders(); if (preg_match("/.*\/.*xml/", $type)) { diff --git a/lib/util.php b/lib/util.php index 44a377220..d249b154f 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1165,7 +1165,7 @@ function common_negotiate_type($cprefs, $sprefs) } if ('text/html' === $besttype) { - return "text/html"; + return "text/html; charset=utf-8"; } return $besttype; } -- cgit v1.2.3-54-g00ecf