Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 15824fadc2c00fab26fed542557e81beb90a5887 1 parent 2dd1e4c
Dan Poltawski authored March 30, 2012

Showing 1 changed file with 15 additions and 14 deletions. Show diff stats Hide diff stats

  1. 29  mod/glossary/rsslib.php
29  mod/glossary/rsslib.php
@@ -15,19 +15,17 @@ function glossary_rss_get_feed($context, $args) {
15 15
 
16 16
         $glossaryid  = clean_param($args[3], PARAM_INT);
17 17
         $cm = get_coursemodule_from_instance('glossary', $glossaryid, 0, false, MUST_EXIST);
18  
-        if ($cm) {
19  
-            $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
20  
-            if ($COURSE->id == $cm->course) {
21  
-                $course = $COURSE;
22  
-            } else {
23  
-                $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
24  
-            }
25  
-            $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
26  
-            //context id from db should match the submitted one
27  
-            //no specific capability required to view glossary entries so just check user is enrolled
28  
-            if ($context->id != $modcontext->id || !can_access_course($coursecontext, $USER)) {
29  
-                return null;
30  
-            }
  18
+        $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
  19
+        if ($COURSE->id == $cm->course) {
  20
+            $course = $COURSE;
  21
+        } else {
  22
+            $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
  23
+        }
  24
+        $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
  25
+        //context id from db should match the submitted one
  26
+        //no specific capability required to view glossary entries so just check user is enrolled
  27
+        if ($context->id != $modcontext->id || !can_access_course($coursecontext, $USER)) {
  28
+            return null;
31 29
         }
32 30
 
33 31
         $glossary = $DB->get_record('glossary', array('id' => $glossaryid), '*', MUST_EXIST);
@@ -72,7 +70,10 @@ function glossary_rss_get_feed($context, $args) {
72 70
 
73 71
                 $item->pubdate = $rec->entrytimecreated;
74 72
                 $item->link = $CFG->wwwroot."/mod/glossary/showentry.php?courseid=".$glossary->course."&eid=".$rec->entryid;
75  
-                $item->description = format_text($rec->entrydefinition,$rec->entryformat,$formatoptions,$glossary->course);
  73
+
  74
+                $definition = file_rewrite_pluginfile_urls($rec->entrydefinition, 'pluginfile.php',
  75
+                    $modcontext->id, 'mod_glossary', 'entry', $rec->entryid);
  76
+                $item->description = format_text($definition, $rec->entryformat, $formatoptions, $glossary->course);
76 77
                 $items[] = $item;
77 78
             }
78 79
 

0 notes on commit 15824fa

Please sign in to comment.
Something went wrong with that request. Please try again.