mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
"MDL-14129, fix all print_error"
This commit is contained in:
parent
b936956e2f
commit
baa336f08e
@ -5,7 +5,7 @@
|
||||
$id = required_param( 'id', PARAM_INT ); // course
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error("Course ID is incorrect");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
require_course_login($course, true);
|
||||
|
@ -39,15 +39,15 @@ class resource_base {
|
||||
|
||||
if ($cmid) {
|
||||
if (! $this->cm = get_coursemodule_from_id('resource', $cmid)) {
|
||||
print_error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $this->course = $DB->get_record("course", array("id"=>$this->cm->course))) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
|
||||
if (! $this->resource = $DB->get_record("resource", array("id"=>$this->cm->instance))) {
|
||||
print_error("Resource ID was incorrect");
|
||||
print_error('invalidid', 'resource');
|
||||
}
|
||||
|
||||
$this->strresource = get_string("modulename", "resource");
|
||||
@ -597,7 +597,7 @@ function resource_renamefiles($course, $wdir, $oldname, $name) {
|
||||
$status .= "<li><a href=\"$CFG->wwwroot/mod/resource/view.php?id=$resource->cmid\" target=\"_blank\">$resource->name</a>: $resource->reference ==> $r->reference</li>";
|
||||
if (!empty($CFG->resource_autofilerename)) {
|
||||
if (!$DB->update_record('resource', $r)) {
|
||||
print_error("Error updating resource with ID $r->id.");
|
||||
print_error('cannotupdate', 'resource');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ class mod_resource_mod_form extends moodleform_mod {
|
||||
if($res = $DB->get_record('resource', array('id'=>$this->_instance))) {
|
||||
$type = $res->type;
|
||||
} else {
|
||||
print_error('incorrect assignment');
|
||||
print_error('invalidassignment', 'resource');
|
||||
}
|
||||
} else {
|
||||
$type = required_param('type', PARAM_ALPHA);
|
||||
@ -53,4 +53,4 @@ class mod_resource_mod_form extends moodleform_mod {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -55,7 +55,7 @@ function display() {
|
||||
if ($subdir) {
|
||||
$relativepath = "$relativepath$subdir";
|
||||
if (stripos($relativepath, 'backupdata') !== FALSE or stripos($relativepath, $CFG->moddata) !== FALSE) {
|
||||
print_error("Access not allowed!");
|
||||
print_error('invalidaccess');
|
||||
}
|
||||
|
||||
$subs = explode('/', $subdir);
|
||||
|
@ -8,7 +8,7 @@
|
||||
require_login();
|
||||
|
||||
if (!$CFG->resource_allowlocalfiles) {
|
||||
print_error('You cannot access this script');
|
||||
print_error('cannotcallscript');
|
||||
}
|
||||
|
||||
print_header(get_string('localfilechoose', 'resource'));
|
||||
@ -47,4 +47,4 @@
|
||||
|
||||
<?php
|
||||
print_footer('empty');
|
||||
?>
|
||||
?>
|
||||
|
@ -8,27 +8,27 @@
|
||||
|
||||
if ($r) { // Two ways to specify the resource
|
||||
if (! $resource = $DB->get_record('resource', array('id'=>$r))) {
|
||||
print_error('Resource ID was incorrect');
|
||||
print_error('invalidid', 'resource');
|
||||
}
|
||||
|
||||
if (! $cm = get_coursemodule_from_instance('resource', $resource->id, $resource->course)) {
|
||||
print_error('Course Module ID was incorrect');
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
} else if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('resource', $id)) {
|
||||
print_error('Course Module ID was incorrect');
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $resource = $DB->get_record('resource', array('id'=>$cm->instance))) {
|
||||
print_error('Resource ID was incorrect');
|
||||
print_error('invalidid', 'resource');
|
||||
}
|
||||
} else {
|
||||
print_error('No valid parameters!!');
|
||||
print_error('invalidaccessparameter');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record('course', array('id'=>$cm->course))) {
|
||||
print_error('Incorrect course id');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user