mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-17518 resource names filter: Improve handling when name contains htmlentities() chars. Merged from 19_STABLE
This commit is contained in:
parent
a4f2b684d6
commit
e6b3d18342
@ -53,14 +53,22 @@
|
||||
$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 (& " < >) 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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user