Some better security when database is hidden
This commit is contained in:
+7
-1
@@ -56,14 +56,20 @@
|
||||
}
|
||||
|
||||
require_course_login($course, false, $cm);
|
||||
|
||||
/// If it's hidden then it's don't show anything. :)
|
||||
if (empty($cm->visible) and !isteacher($course->id)) {
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
}
|
||||
|
||||
/// Can't use this if there are no fields
|
||||
if (isteacher($course->id)) {
|
||||
if (!record_exists('data_fields','dataid',$data->id)) { // Brand new database!
|
||||
redirect($CFG->wwwroot.'/mod/data/field.php?d='.$data->id); // Redirect to field entry
|
||||
}
|
||||
}
|
||||
|
||||
///checking for participants
|
||||
/// Check access for participants
|
||||
if ((!isteacher($course->id)) && $data->participants == DATA_TEACHERS_ONLY) {
|
||||
error (get_string('noaccess','data'));
|
||||
}
|
||||
|
||||
+2
-1
@@ -25,7 +25,6 @@
|
||||
require_once('../../config.php');
|
||||
require_once('lib.php');
|
||||
|
||||
require_login();
|
||||
|
||||
$id = optional_param('id', 0, PARAM_INT); // course module id
|
||||
$d = optional_param('d', 0, PARAM_INT); // database id
|
||||
@@ -64,6 +63,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
if (!isteacheredit($course->id)){
|
||||
error(get_string('noaccess','data'));
|
||||
}
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
if (!isteacheredit($course->id)){
|
||||
error(get_string('noaccess','data'));
|
||||
}
|
||||
|
||||
@@ -81,8 +81,15 @@
|
||||
$record = NULL;
|
||||
}
|
||||
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
|
||||
/// If it's hidden then it's don't show anything. :)
|
||||
if (empty($cm->visible) and !isteacher($course->id)) {
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
}
|
||||
|
||||
/// If we have an empty Database then redirect because this page is useless without data
|
||||
if (isteacher($course->id)) {
|
||||
if (!record_exists('data_fields','dataid',$data->id)) { // Brand new database!
|
||||
|
||||
Reference in New Issue
Block a user