MDL-41623 ensure all links are valid urls
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Fri, 6 Sep 2013 09:20:19 +0000 (11:20 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Sat, 7 Sep 2013 02:06:57 +0000 (04:06 +0200)
For 23 and 24 we are modifying the default Sanitizer. Note that
for 24 and upwards we are doing the same with our extended
Sanitizer. So this is just an interim hack for those old versions.

lib/simplepie/readme_moodle.txt
lib/simplepie/simplepie.class.php

index 28bfa76..5780688 100644 (file)
@@ -5,6 +5,8 @@ Obtained from http://github.com/simplepie/simplepie/commit/798f4674468316b8cc70f
 Changes:
   * None. This import contains _NO_CHANGES_ to the simplepie.inc file, changes are
     controlled through OO extension of the classes instead.
+  * Exception: The Sanitizer has been modified to return valid URLs. The change
+    is done through OO extension in 25 and upwards but not in 23 and 24.
 
 Dan Poltawski <talktodan@gmail.com>
 Petr Skoda
index 2aeb1ff..161cdc7 100644 (file)
@@ -14466,6 +14466,10 @@ class SimplePie_Sanitize
                        if ($type & SIMPLEPIE_CONSTRUCT_IRI)
                        {
                                $data = SimplePie_Misc::absolutize_url($data, $base);
+                               // Moodle modification - Only return valid URLs. Note this change is interim and
+                               // 2.5 and upwards have the cleaning performed in our own sanitizer.
+                               $data = clean_param($data, PARAM_URL);
+                               // End of Moodle modification.
                        }
 
                        if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI))