Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-26500 mod/glossary: Rewrite pluginfile urls in RSS

  • Loading branch information...
commit 403c191be15a2119f2bd8b5db1b518396639aba9 1 parent 6906533
@danpoltawski danpoltawski authored
Showing with 14 additions and 13 deletions.
  1. +14 −13 mod/glossary/rsslib.php
View
27 mod/glossary/rsslib.php
@@ -15,18 +15,16 @@ function glossary_rss_get_feed($context, $args) {
$glossaryid = clean_param($args[3], PARAM_INT);
$cm = get_coursemodule_from_instance('glossary', $glossaryid, 0, false, MUST_EXIST);
- if ($cm) {
- $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
- if ($COURSE->id == $cm->course) {
- $course = $COURSE;
- } else {
- $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
- }
- //context id from db should match the submitted one
- //no specific capability required to view glossary entries so just check user is enrolled
- if ($context->id != $modcontext->id || !can_access_course($course, $USER)) {
- return null;
- }
+ $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
+ if ($COURSE->id == $cm->course) {
+ $course = $COURSE;
+ } else {
+ $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
+ }
+ //context id from db should match the submitted one
+ //no specific capability required to view glossary entries so just check user is enrolled
+ if ($context->id != $modcontext->id || !can_access_course($course, $USER)) {
+ return null;
}
$glossary = $DB->get_record('glossary', array('id' => $glossaryid), '*', MUST_EXIST);
@@ -71,7 +69,10 @@ function glossary_rss_get_feed($context, $args) {
$item->pubdate = $rec->entrytimecreated;
$item->link = $CFG->wwwroot."/mod/glossary/showentry.php?courseid=".$glossary->course."&eid=".$rec->entryid;
- $item->description = format_text($rec->entrydefinition,$rec->entryformat,$formatoptions,$glossary->course);
+
+ $definition = file_rewrite_pluginfile_urls($rec->entrydefinition, 'pluginfile.php',
+ $modcontext->id, 'mod_glossary', 'entry', $rec->entryid);
+ $item->description = format_text($definition, $rec->entryformat, $formatoptions, $glossary->course);
$items[] = $item;
}
Please sign in to comment.
Something went wrong with that request. Please try again.