From baa336f08e83738c039489b48224166252c8642e Mon Sep 17 00:00:00 2001 From: dongsheng Date: Thu, 12 Jun 2008 10:55:23 +0000 Subject: [PATCH] "MDL-14129, fix all print_error" --- mod/resource/index.php | 2 +- mod/resource/lib.php | 8 ++++---- mod/resource/mod_form.php | 4 ++-- mod/resource/type/directory/resource.class.php | 2 +- mod/resource/type/file/localfile.php | 4 ++-- mod/resource/view.php | 12 ++++++------ 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/mod/resource/index.php b/mod/resource/index.php index d250991c5cf..36810f67dc2 100644 --- a/mod/resource/index.php +++ b/mod/resource/index.php @@ -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); diff --git a/mod/resource/lib.php b/mod/resource/lib.php index 29a535869d9..5ea54133954 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -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 .= "
  • wwwroot/mod/resource/view.php?id=$resource->cmid\" target=\"_blank\">$resource->name: $resource->reference ==> $r->reference
  • "; if (!empty($CFG->resource_autofilerename)) { if (!$DB->update_record('resource', $r)) { - print_error("Error updating resource with ID $r->id."); + print_error('cannotupdate', 'resource'); } } } diff --git a/mod/resource/mod_form.php b/mod/resource/mod_form.php index 1eedb6a1706..88de7d5aa8f 100644 --- a/mod/resource/mod_form.php +++ b/mod/resource/mod_form.php @@ -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 { } } -?> \ No newline at end of file +?> diff --git a/mod/resource/type/directory/resource.class.php b/mod/resource/type/directory/resource.class.php index a1fb4b3bb6c..23bac67571b 100644 --- a/mod/resource/type/directory/resource.class.php +++ b/mod/resource/type/directory/resource.class.php @@ -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); diff --git a/mod/resource/type/file/localfile.php b/mod/resource/type/file/localfile.php index 29b3cae7ff9..c3bfdf5b64c 100644 --- a/mod/resource/type/file/localfile.php +++ b/mod/resource/type/file/localfile.php @@ -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 @@ \ No newline at end of file +?> diff --git a/mod/resource/view.php b/mod/resource/view.php index 455a3956411..d83e1ad7f80 100644 --- a/mod/resource/view.php +++ b/mod/resource/view.php @@ -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);