Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
"MDL-14129, fix all print_error"
  • Loading branch information
dongsheng committed Jun 12, 2008
1 parent b936956 commit baa336f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion mod/resource/index.php
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions mod/resource/lib.php
Expand Up @@ -39,15 +39,15 @@ function resource_base($cmid=0) {

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");
Expand Down Expand Up @@ -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');
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions mod/resource/mod_form.php
Expand Up @@ -13,7 +13,7 @@ function definition() {
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);
Expand Down Expand Up @@ -53,4 +53,4 @@ function data_preprocessing(&$default_values){
}

}
?>
?>
2 changes: 1 addition & 1 deletion mod/resource/type/directory/resource.class.php
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions mod/resource/type/file/localfile.php
Expand Up @@ -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'));
Expand Down Expand Up @@ -47,4 +47,4 @@ function set_value(txt) {

<?php
print_footer('empty');
?>
?>
12 changes: 6 additions & 6 deletions mod/resource/view.php
Expand Up @@ -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);
Expand Down

0 comments on commit baa336f

Please sign in to comment.