From fa6086a84b936e2408a25c6f6b2b054fbb092819 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Tue, 22 Apr 2008 08:52:25 +0000 Subject: [PATCH] MDL-14129, fix print_error --- backup/backup.php | 10 +++++----- lang/en_utf8/error.php | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backup/backup.php b/backup/backup.php index a4c352e6bc..31b811607b 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -18,24 +18,24 @@ if (!empty($id)) { require_login($id); if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $id))) { - print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); + print_error('cannotusepage', 'error', "$CFG->wwwroot/login/index.php"); } } else { require_login(); if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) { - print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); + print_error('cannotusepage', 'error', "$CFG->wwwroot/login/index.php"); } } if (!empty($to)) { if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) { - print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); + print_error('cannotusepage', 'error', "$CFG->wwwroot/login/index.php"); } } //Check site if (!$site = get_site()) { - print_error("Site not found!"); + print_error("cannotfindsite"); } //Check necessary functions exists. Thanks to gregb@crowncollege.edu @@ -96,7 +96,7 @@ //Get and check course if (! $course = get_record("course", "id", $id)) { - print_error("Course ID was incorrect (can't find it)"); + print_error('unknowncourseidnumber','error'); } //Print header diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index d8f966a5d9..acd6453024 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -6,6 +6,7 @@ $string['adminprimarynoedit'] = 'The primary admin cannot be edited by others'; $string['blockdoesnotexist'] = 'This block does not exist'; $string['blockcannotinistantiate'] = 'Problem in instantiating block object'; $string['blockcannotconfig'] = 'This block does not support global configuration'; +$string['backupcontainexternal'] = 'This backup file contains external Moodle Network Hosts that are not configured locally.'; $string['cannotassignrole'] = 'Cannot assign role in course'; $string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"'; $string['cannotsavefile'] = 'Cannot save the file\"$a[0]\/$a[1]\"!'; @@ -38,6 +39,7 @@ $string['cannotsetupcategory'] = 'Serious Error! Could not set up a default cour $string['cannotsetupsite'] = 'Serious Error! Could not set up the site!'; $string['cannotunzipfile'] = 'Cannot unzip file.'; $string['cannotupdaterole'] = 'Cannot update role!'; +$string['cannotusepage'] = 'Only teacher and administrator can use this page.'; $string['cannotviewprofile'] = 'You can not view the profile of this user.'; $string['cantunenrollfrommetacourse'] = 'You can not unenrol from this meta course.'; $string['cantunenrollinthisrole'] = 'You can not unenrol from this course while you are in your current role.'; -- 2.39.5