]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17545 activity names filter: Improve handling when name contains htmlentities...
authorstronk7 <stronk7>
Sun, 7 Dec 2008 18:57:38 +0000 (18:57 +0000)
committerstronk7 <stronk7>
Sun, 7 Dec 2008 18:57:38 +0000 (18:57 +0000)
filter/activitynames/filter.php

index 9c2f866f36513e91367ed90f99e1aca84fa1e5ab..7027a7d1341f10a350a0efa5e597f610434f70d2 100644 (file)
                     //Exclude labels, hidden activities and activities for group members only 
                     if ($activity->mod != "label" and $activity->visible and empty($activity->groupmembersonly)) {
                         $title = s(trim(strip_tags(urldecode($activity->name))));
+                        $currentname = trim(urldecode($activity->name));
+                        $entitisedname  = s($currentname);
                         /// Avoid empty or unlinkable activity names
                         if (!empty($title)) {
                             $href_tag_begin = "<a class=\"autolink\" title=\"$title\" href=\"$CFG->wwwroot/mod/$activity->mod/view.php?id=$activity->cm\" $CFG->frametarget>";
-                            $currentname = urldecode($activity->name);
-                            if ($currentname = trim($currentname)) {
-                                $activitylist[] = new filterobject($currentname, $href_tag_begin, '</a>', false, true);
+                            $activitylist[] = new filterobject($currentname, $href_tag_begin, '</a>', false, true);
+                            if ($currentname != $entitisedname) { /// If name has some entity (&amp; &quot; &lt; &gt;) add that filter too. MDL-17545
+                                $activitylist[] = new filterobject($entitisedname, $href_tag_begin, '</a>', false, true);
                             }
                         }
                     }