]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17518 resource names filter: Improve handling when name contains htmlentities...
authorstronk7 <stronk7>
Sun, 7 Dec 2008 17:34:37 +0000 (17:34 +0000)
committerstronk7 <stronk7>
Sun, 7 Dec 2008 17:34:37 +0000 (17:34 +0000)
mod/resource/filter.php

index e722b259ddc4fc888db40ea039c7ada2a4a876f9..54826a741eb3f4ec7107b3aba118df1ed7d1d694 100644 (file)
             $resourcelist = array();
 
             foreach ($resources as $resource) {
-                $currentname = trim($resource->name);
-                $strippedname = strip_tags($currentname);
+                $currentname    = trim($resource->name);
+                $entitisedname  = s($currentname);
+                $strippedname   = strip_tags($currentname);
                 /// Avoid empty or unlinkable resource names
                 if (!empty($strippedname)) {
                     $resourcelist[] = new filterobject($currentname,
                             '<a class="resource autolink" title="'.$strippedname.'" href="'.
-                             $CFG->wwwroot.'/mod/resource/view.php?r='.$resource->id.'" '.$CFG->frametarget.'>', 
+                             $CFG->wwwroot.'/mod/resource/view.php?r='.$resource->id.'" '.$CFG->frametarget.'>',
                              '</a>', false, true);
+                    if ($currentname != $entitisedname) { /// If name has some entity (&amp; &quot; &lt; &gt;) add that filter too. MDL-17518
+                        $resourcelist[] = new filterobject($entitisedname,
+                                '<a class="resource autolink" title="'.$strippedname.'" href="'.
+                                 $CFG->wwwroot.'/mod/resource/view.php?r='.$resource->id.'" '.$CFG->frametarget.'>',
+                                 '</a>', false, true);
+
+                    }
                 }
             }