Permalink
Browse files

MDL-19477 - Issues on check_text access controllers

  • Loading branch information...
1 parent ffb76c3 commit 622e5c7d9cbab8b8746e5371c79935b3c22179f0 diml committed Jun 12, 2009
Showing with 4 additions and 3 deletions.
  1. +1 −0 search/documents/resource_document.php
  2. +3 −3 search/documents/wiki_document.php
@@ -310,6 +310,7 @@ function resource_check_text_access($path, $itemtype, $this_id, $user, $group_id
$cm = get_record('course_modules', 'id', $module_context->instanceid);
if (empty($cm)) return false; // Shirai 20090530 - MDL19342 - course module might have been delete
$course_context = get_context_instance(CONTEXT_COURSE, $r->course);
+ $course = get_record('course', 'id', $r->course);
//check if course is visible
if (!$course->visible && !has_capability('moodle/course:viewhiddencourses', $course_context)) {
@@ -241,9 +241,9 @@ function wiki_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
global $CFG;
// get the wiki object and all related stuff
- $page = get_record('wiki_pages', 'id', $id);
- $entry = get_record('wiki_entries', 'id', $page->wiki);
- $course = get_record('course', 'id', $entry->course);
+ $page = get_record('wiki_pages', 'id', $this_id);
+ $wiki = get_record('wiki', 'id', $page->wiki);
+ $course = get_record('course', 'id', $wiki->course);
$context = get_record('context', 'id', $context_id);
$cm = get_record('course_modules', 'id', $context->instanceid);
if (empty($cm)) return false; // Shirai 20090530 - MDL19342 - course module might have been delete

0 comments on commit 622e5c7

Please sign in to comment.