From: diml <diml>
Date: Sun, 7 Oct 2007 19:34:59 +0000 (+0000)
Subject: fix access check function for documents bug $context->instance to $context->instanceid
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=39cfb0b068cb1a0fbe22eb724ce13c5a8e8c6693;p=moodle.git

fix access check function for documents bug $context->instance to $context->instanceid
---

diff --git a/search/documents/data_document.php b/search/documents/data_document.php
index c8995279c9..b513d616b1 100644
--- a/search/documents/data_document.php
+++ b/search/documents/data_document.php
@@ -330,7 +330,7 @@ function data_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
     $data = get_record('data', 'id', $record->dataid);
     $course = get_record('course', 'id', $data->course);
     $module_context = get_record('context', 'id', $context_id);
-    $cm = get_record('course_modules', 'id', $module_context->instance);
+    $cm = get_record('course_modules', 'id', $module_context->instanceid);
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $module_context)) return false;
     
     //group consistency check : checks the following situations about groups
diff --git a/search/documents/glossary_document.php b/search/documents/glossary_document.php
index da9e5e78fa..cc632c80af 100644
--- a/search/documents/glossary_document.php
+++ b/search/documents/glossary_document.php
@@ -223,7 +223,7 @@ function glossary_check_text_access($path, $itemtype, $this_id, $user, $group_id
     $glossary = get_record('glossary', 'id', $entry->glossaryid);
     $course = get_record('course', 'id', $glossary->course);
     $module_context = get_record('context', 'id', $context_id);
-    $cm = get_record('course_modules', 'id', $module_context->instance);
+    $cm = get_record('course_modules', 'id', $module_context->instanceid);
     if (!$cm->visible && !has_capability('moodle/course:viewhiddenactivities', $module_context)) return false;
     
     //approval check : entries should be approved for being viewed, or belongs to the user unless the viewer can approve them or manage them 
diff --git a/search/documents/resource_document.php b/search/documents/resource_document.php
index 98722bf62c..53dc4ac10e 100644
--- a/search/documents/resource_document.php
+++ b/search/documents/resource_document.php
@@ -295,7 +295,7 @@ function resource_check_text_access($path, $itemtype, $this_id, $user, $group_id
     
     $r = get_record('resource', 'id', $this_id);
     $module_context = get_record('context', 'id', $context_id);
-    $cm = get_record('course_modules', 'id', $module_context->instance);
+    $cm = get_record('course_modules', 'id', $module_context->instanceid);
 
     //check if found course module is visible
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $module_context)){
diff --git a/search/documents/techproject_document.php b/search/documents/techproject_document.php
index b1f2bc5231..ad12228d67 100644
--- a/search/documents/techproject_document.php
+++ b/search/documents/techproject_document.php
@@ -252,7 +252,7 @@ function techproject_check_text_access($path, $entry_type, $this_id, $user, $gro
     $techproject = get_record('techproject', 'id', $this_id);
     $course = get_record('course', 'id', $techproject->course);
     $module_context = get_record('context', 'id', $context_id);
-    $cm = get_record('course_modules', 'id', $module_context->instance);
+    $cm = get_record('course_modules', 'id', $module_context->instanceid);
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $module_context)) return false;
     
     //group consistency check : checks the following situations about groups
diff --git a/search/documents/wiki_document.php b/search/documents/wiki_document.php
index 145111c03f..3e743f6908 100644
--- a/search/documents/wiki_document.php
+++ b/search/documents/wiki_document.php
@@ -233,7 +233,7 @@ function wiki_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
     $entry = get_record('wiki_entries', 'id', $page->wiki);
     $course = get_record('course', 'id', $entry->course);
     $module_context = get_record('context', 'id', $context_id);
-    $cm = get_record('course_modules', 'id', $module_context->instance);
+    $cm = get_record('course_modules', 'id', $module_context->instanceid);
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $module_context)) return false;
     
     //group consistency check : checks the following situations about groups