MDL-14129, fix print_error

This commit is contained in:
dongsheng
2008-04-22 08:52:25 +00:00
parent 52f2776d3c
commit fa6086a84b
2 changed files with 7 additions and 5 deletions
+5 -5
View File
@@ -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 [email protected]
@@ -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
+2
View File
@@ -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.';