From 35b2c4d391d813cc3148b491178ac30d1cf07470 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Sun, 31 Aug 2008 17:11:22 +0000 Subject: [PATCH] * (bug 15392) ApiFormatBase::formatHTML now uses $wgUrlProtocols. --- CREDITS | 1 + RELEASE-NOTES | 4 +++- includes/api/ApiFormatBase.php | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CREDITS b/CREDITS index d5a5ac0158..0d9130ccfa 100644 --- a/CREDITS +++ b/CREDITS @@ -23,6 +23,7 @@ following names for their contribution to the product. * MinuteElectron * Mohamed Magdy * Niklas Laxström +* Platonides * Purodha Blissenbach * Raimond Spekking * Roan Kattouw diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 717c3d6c5f..300d6ae46f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -199,13 +199,15 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN section with section=new * Database replication lag doesn't cause all action=edit requests to return the nochange flag any more +* (bug 15392) ApiFormatBase::formatHTML now uses $wgUrlProtocols. + === Languages updated in 1.14 === MediaWiki supports over 300 languages. Many localisations are updated regularly. Below only new and removed languages are listed. -* Fiji Hindi (Devanagari script) (hif-deva) +* Fiji Hindi (Devanagari script) (hif-deva) * Krio (kri) * Lezghian (lez) * Laz (lzz) diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index be131b379c..834588a1ca 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -192,15 +192,17 @@ See complete documentation, or * This method also replaces any '<' with < */ protected function formatHTML($text) { + global $wgUrlProtocols; + // Escape everything first for full coverage $text = htmlspecialchars($text); // encode all comments or tags as safe blue strings $text = preg_replace('/\<(!--.*?--|.*?)\>/', '<\1>', $text); // identify URLs - $protos = "http|https|ftp|gopher"; + $protos = implode("|", $wgUrlProtocols); # This regex hacks around bug 13218 (" included in the URL) - $text = preg_replace("#(($protos)://.*?)(")?([ \\'\"()<\n])#", '\\1\\3\\4', $text); + $text = preg_replace("#(($protos).*?)(")?([ \\'\"()<\n])#", '\\1\\3\\4', $text); // identify requests to api.php $text = preg_replace("#api\\.php\\?[^ \\()<\n\t]+#", '\\0', $text); if( $this->mHelp ) { -- 2.20.1