Merge branch 'MDL-59255-MOODLE_32_STABLE' of github.com:lucisgit/moodle into MOODLE_32_STABLE

This commit is contained in:
Dan Poltawski
2017-07-18 10:54:07 +01:00
2 changed files with 17 additions and 1 deletions
+10
View File
@@ -413,6 +413,16 @@ class core_medialib_testcase extends advanced_testcase {
$this->assertEquals($webm, $result[1]->out(false));
$this->assertEquals(400, $w);
$this->assertEquals(280, $h);
// Support for rtmp.
$rtmp = 'rtmp://rtmpsite.net/somestream';
$result = $mediamanager->split_alternatives($rtmp, $w, $h);
$this->assertEquals($rtmp, $result[0]->out(false));
// Invalid URL is not supported.
$invalid = 'mailto:[email protected]';
$result = $mediamanager->split_alternatives($invalid, $w, $h);
$this->assertEmpty($result);
}
/**
+7 -1
View File
@@ -422,11 +422,17 @@ class core_media_manager {
$url = str_replace($matches[0], '', $url);
}
// Clean up url.
// Clean up url. Allow rtmp:// protocol even though it's not allowed by clean_param(..., PARAM_URL).
if ($isrtmp = preg_match('|^(rtmp://)(.*)$|i', trim($url), $matches)) {
$url = "http://" . $matches[2];
}
$url = clean_param($url, PARAM_URL);
if (empty($url)) {
continue;
}
if ($isrtmp) {
$url = preg_replace('|^http://|', $matches[1], $url);
}
// Turn it into moodle_url object.
$returnurls[] = new moodle_url($url);