|
By dongsheng:
MDL-14129, fix misuse string
|
| 18 |
if (!empty($id)) { |
if (!empty($id)) { |
| 19 |
require_login($id); |
require_login($id); |
| 20 |
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $id))) { |
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $id))) { |
| 21 |
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); |
print_error('cannotuseadminadminorteacher', 'error', "$CFG->wwwroot/login/index.php"); |
| 22 |
} |
} |
| 23 |
} else { |
} else { |
| 24 |
require_login(); |
require_login(); |
| 25 |
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) { |
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) { |
| 26 |
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); |
print_error('cannotuseadmin', 'error', "$CFG->wwwroot/login/index.php"); |
| 27 |
} |
} |
| 28 |
} |
} |
| 29 |
|
|
| 30 |
if (!empty($to)) { |
if (!empty($to)) { |
| 31 |
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) { |
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) { |
| 32 |
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php"); |
print_error('cannotuseadminadminorteacher', 'error', "$CFG->wwwroot/login/index.php"); |
| 33 |
} |
} |
| 34 |
} |
} |
| 35 |
|
|
| 36 |
//Check site |
//Check site |
| 37 |
if (!$site = get_site()) { |
if (!$site = get_site()) { |
| 38 |
print_error("Site not found!"); |
print_error("cannotfindsite"); |
| 39 |
} |
} |
| 40 |
|
|
| 41 |
//Check necessary functions exists. Thanks to gregb@crowncollege.edu |
//Check necessary functions exists. Thanks to gregb@crowncollege.edu |
| 96 |
|
|
| 97 |
//Get and check course |
//Get and check course |
| 98 |
if (! $course = get_record("course", "id", $id)) { |
if (! $course = get_record("course", "id", $id)) { |
| 99 |
print_error("Course ID was incorrect (can't find it)"); |
print_error('unknowncourseidnumber','error'); |
| 100 |
} |
} |
| 101 |
|
|
| 102 |
//Print header |
//Print header |