diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml
index 07a0923c48d..71400eaf826 100644
--- a/lib/thirdpartylibs.xml
+++ b/lib/thirdpartylibs.xml
@@ -304,4 +304,10 @@
4.7.0
1.1
+
+ validateurlsyntax.php
+ Url Syntax Validation using PHP and Regular Expressions
+ GPL
+ 2.0+
+
diff --git a/lib/validateurlsyntax.php b/lib/validateurlsyntax.php
index aa9c24a37d1..e96162f8d67 100644
--- a/lib/validateurlsyntax.php
+++ b/lib/validateurlsyntax.php
@@ -76,10 +76,13 @@
*
*
* Last Edited:
- * December 15th 2004
+ * June 15th 2017
*
*
* Changelog:
+ * June 15th 2017 by Moodle.
+ * -Added rtmp:// option.
+ *
* December 15th 2004
* -Added new TLD's - .jobs, .mobi, .post and .travel. They are official, but not yet active.
*
@@ -174,7 +177,7 @@ function validateUrlSyntax( $urladdr, $options="" ){
// $options = strtolower($options);
// Check Options Parameter
- if (!preg_match( '/^([sHSEFuPaIpfqr][+?-])*$/', $options ))
+ if (!preg_match( '/^([sHSEFRuPaIpfqr][+?-])*$/', $options ))
{
trigger_error("Options attribute malformed", E_USER_ERROR);
}
@@ -195,6 +198,9 @@ function validateUrlSyntax( $urladdr, $options="" ){
// ftp://
if (strpos( $options, 'F') === false) $aOptions['F'] = '-';
else $aOptions['F'] = substr( $options, strpos( $options, 'F') + 1, 1);
+ // rtmp://
+ if (strpos( $options, 'R') === false) $aOptions['R'] = '-';
+ else $aOptions['R'] = substr( $options, strpos( $options, 'R') + 1, 1);
// User section
if (strpos( $options, 'u') === false) $aOptions['u'] = '?';
else $aOptions['u'] = substr( $options, strpos( $options, 'u') + 1, 1);
@@ -245,18 +251,20 @@ function validateUrlSyntax( $urladdr, $options="" ){
$reserved = '[;/?:@&=+$,]'; // Special characters in the URI
// Beginning Regular Expression
- // Scheme - Allows for 'http://', 'https://', 'mailto:', or 'ftp://'
+ // Scheme - Allows for 'http://', 'https://', 'mailto:', 'ftp://' or 'rtmp://'
$scheme = '(';
if ($aOptions['H'] === '') { $scheme .= 'http://'; }
elseif ($aOptions['S'] === '') { $scheme .= 'https://'; }
elseif ($aOptions['E'] === '') { $scheme .= 'mailto:'; }
elseif ($aOptions['F'] === '') { $scheme .= 'ftp://'; }
+ elseif ($aOptions['R'] === '') { $scheme .= 'rtmp://'; }
else
{
if ($aOptions['H'] === '?') { $scheme .= '|(http://)'; }
if ($aOptions['S'] === '?') { $scheme .= '|(https://)'; }
if ($aOptions['E'] === '?') { $scheme .= '|(mailto:)'; }
if ($aOptions['F'] === '?') { $scheme .= '|(ftp://)'; }
+ if ($aOptions['R'] === '?') { $scheme .= '|(rtmp://)'; }
$scheme = str_replace('(|', '(', $scheme); // fix first pipe
}
$scheme .= ')' . $aOptions['s'];