MDL-14589 added missing require_login()
This commit is contained in:
@@ -2437,7 +2437,7 @@ function assignment_get_participants($assignmentid) {
|
||||
*/
|
||||
function assignment_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedownload) {
|
||||
global $CFG, $DB;
|
||||
|
||||
|
||||
if (!$assignment = $DB->get_record('assignment', array('id'=>$cminfo->instance))) {
|
||||
return false;
|
||||
}
|
||||
@@ -2445,6 +2445,8 @@ function assignment_pluginfile($course, $cminfo, $context, $filearea, $args, $fo
|
||||
return false;
|
||||
}
|
||||
|
||||
require_login($course, false, $cm);
|
||||
|
||||
require_once($CFG->dirroot.'/mod/assignment/type/'.$assignment->assignmenttype.'/assignment.class.php');
|
||||
$assignmentclass = 'assignment_'.$assignment->assignmenttype;
|
||||
$assignmentinstance = new $assignmentclass($cm->id, $assignment, $cm, $course);
|
||||
|
||||
+8
-2
@@ -2839,6 +2839,12 @@ function data_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedow
|
||||
if ($filearea === 'data_content') {
|
||||
$contentid = (int)array_shift($args);
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance('data', $cminfo->instance, $course->id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
if (!$content = $DB->get_record('data_content', array('id'=>$contentid))) {
|
||||
return false;
|
||||
}
|
||||
@@ -2862,7 +2868,7 @@ function data_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedow
|
||||
|
||||
// group access
|
||||
if ($record->groupid) {
|
||||
$groupmode = groups_get_activity_groupmode($cminfo, $course);
|
||||
$groupmode = groups_get_activity_groupmode($cm, $course);
|
||||
if ($groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
|
||||
if (!groups_is_member($record->groupid)) {
|
||||
return false;
|
||||
@@ -2870,7 +2876,7 @@ function data_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedow
|
||||
}
|
||||
}
|
||||
|
||||
$fieldobj = data_get_field($field, $data, $cminfo);
|
||||
$fieldobj = data_get_field($field, $data, $cm);
|
||||
|
||||
$relativepath = '/'.implode('/', $args);
|
||||
$fullpath = $context->id.'data_content'.$content->id.$relativepath;
|
||||
|
||||
@@ -4381,6 +4381,12 @@ function forum_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedo
|
||||
|
||||
$postid = (int)array_shift($args);
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $cminfo->instance, $course->id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
if (!$post = $DB->get_record('forum_posts', array('id'=>$postid))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1322,6 +1322,12 @@ function glossary_pluginfile($course, $cminfo, $context, $filearea, $args, $forc
|
||||
if ($filearea === 'glossary_attachment' or $filearea === 'glossary_entry') {
|
||||
$entryid = (int)array_shift($args);
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance('glossary', $cminfo->instance, $course->id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
if (!$entry = $DB->get_record('glossary_entries', array('id'=>$entryid))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -864,6 +864,12 @@ function scorm_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedo
|
||||
|
||||
$lifetime = isset($CFG->filelifetime) ? $CFG->filelifetime : 86400;
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance('scorm', $cminfo->instance, $course->id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
require_login($course, true, $cm);
|
||||
|
||||
if ($filearea === 'scorm_content') {
|
||||
$revision = (int)array_shift($args); // prevents caching problems - ignored here
|
||||
$relativepath = '/'.implode('/', $args);
|
||||
|
||||
Reference in New Issue
Block a user