From 817b2020180c2971024967ff3991d64f39617f55 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Mon, 7 Jul 2014 17:21:08 +0100 Subject: [PATCH] MDL-46286 lib_htmlpurifier: Add allowed URI scheme for RTMP Signed-off-by: Tony Butler --- lib/htmlpurifier/locallib.php | 16 ++++++++++++++++ lib/tests/htmlpurifier_test.php | 3 +++ lib/weblib.php | 1 + 3 files changed, 20 insertions(+) diff --git a/lib/htmlpurifier/locallib.php b/lib/htmlpurifier/locallib.php index 66e4e97ef0e..b949b7404fc 100644 --- a/lib/htmlpurifier/locallib.php +++ b/lib/htmlpurifier/locallib.php @@ -41,6 +41,22 @@ class HTMLPurifier_URIScheme_rtsp extends HTMLPurifier_URIScheme { } +/** + * Validates RTMP defined by Adobe + */ +class HTMLPurifier_URIScheme_rtmp extends HTMLPurifier_URIScheme { + + public $browsable = false; + public $hierarchical = true; + + public function doValidate(&$uri, $config, $context) { + $uri->userinfo = null; + return true; + } + +} + + /** * Validates IRC defined by IETF Draft */ diff --git a/lib/tests/htmlpurifier_test.php b/lib/tests/htmlpurifier_test.php index 88a16440ae1..51d22c83b34 100644 --- a/lib/tests/htmlpurifier_test.php +++ b/lib/tests/htmlpurifier_test.php @@ -295,6 +295,9 @@ class core_htmlpurifier_testcase extends basic_testcase { $text = 'link'; $this->assertSame($text, purify_html($text)); + $text = 'link'; + $this->assertSame($text, purify_html($text)); + $text = 'link'; $this->assertSame($text, purify_html($text)); diff --git a/lib/weblib.php b/lib/weblib.php index 55ae5f77452..c082abb2487 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1680,6 +1680,7 @@ function purify_html($text, $options = array()) { 'nntp' => true, 'news' => true, 'rtsp' => true, + 'rtmp' => true, 'teamspeak' => true, 'gopher' => true, 'mms' => true,