Skip to content
Browse files

MDL-30376 mod_glossary: Integration tidy up

  • Loading branch information...
1 parent 63a0768 commit eb7ee1565933c0f3191f016693ab43517ad1bab6 Sam Hemelryk committed Dec 1, 2011
Showing with 8 additions and 4 deletions.
  1. +2 −2 mod/glossary/lib.php
  2. +6 −2 mod/glossary/rsslib.php
View
4 mod/glossary/lib.php
@@ -2748,7 +2748,7 @@ function glossary_extend_navigation($navigation, $course, $module, $cm) {
* @param navigation_node $glossarynode The node to add module settings to
*/
function glossary_extend_settings_navigation(settings_navigation $settings, navigation_node $glossarynode) {
- global $PAGE, $DB, $CFG, $USER, $COURSE;
+ global $PAGE, $DB, $CFG, $USER;
$mode = optional_param('mode', '', PARAM_ALPHA);
$hook = optional_param('hook', 'ALL', PARAM_CLEAN);
@@ -2771,7 +2771,7 @@ function glossary_extend_settings_navigation(settings_navigation $settings, navi
$glossary = $DB->get_record('glossary', array("id" => $PAGE->cm->instance));
- if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds) && $glossary->rsstype && $glossary->rssarticles && can_access_course($COURSE, $USER)) {
+ if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds) && $glossary->rsstype && $glossary->rssarticles && can_access_course($PAGE->course, $USER)) {
require_once("$CFG->libdir/rsslib.php");
$string = get_string('rsstype','forum');
View
8 mod/glossary/rsslib.php
@@ -17,10 +17,14 @@ function glossary_rss_get_feed($context, $args) {
$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)) {
+ if ($context->id != $modcontext->id || !can_access_course($course, $USER)) {
return null;
}
}

0 comments on commit eb7ee15

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