mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-14129, remove all the other error() call
This commit is contained in:
parent
f44ee03b4f
commit
5a2a53316f
@ -34,7 +34,7 @@ if ($frm = data_submitted() and confirm_sesskey()) {
|
||||
$plugin = "auth/$auth";
|
||||
$name = $matches[1];
|
||||
if (!set_config($name, $value, $plugin)) {
|
||||
error("Problem saving config $name as $value for plugin $plugin");
|
||||
print_error("Problem saving config $name as $value for plugin $plugin");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,14 +9,14 @@
|
||||
$blockid = required_param('block', PARAM_INT);
|
||||
|
||||
if(!$blockrecord = blocks_get_record($blockid)) {
|
||||
error('This block does not exist');
|
||||
print_error('This block does not exist');
|
||||
}
|
||||
|
||||
admin_externalpage_setup('blocksetting'.$blockrecord->name);
|
||||
|
||||
$block = block_instance($blockrecord->name);
|
||||
if($block === false) {
|
||||
error('Problem in instantiating block object');
|
||||
print_error('Problem in instantiating block object');
|
||||
}
|
||||
|
||||
// Define the data we're going to silently include in the instance config form here,
|
||||
@ -31,10 +31,10 @@
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
if(!$block->has_config()) {
|
||||
error('This block does not support global configuration');
|
||||
print_error('This block does not support global configuration');
|
||||
}
|
||||
$remove = array_keys($hiddendata);
|
||||
foreach($remove as $item) {
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
if (!empty($hide) && confirm_sesskey()) {
|
||||
if (!$block = get_record('block', 'id', $hide)) {
|
||||
error("Block doesn't exist!");
|
||||
print_error("Block doesn't exist!");
|
||||
}
|
||||
set_field('block', 'visible', '0', 'id', $block->id); // Hide block
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
if (!empty($show) && confirm_sesskey() ) {
|
||||
if (!$block = get_record('block', 'id', $show)) {
|
||||
error("Block doesn't exist!");
|
||||
print_error("Block doesn't exist!");
|
||||
}
|
||||
set_field('block', 'visible', '1', 'id', $block->id); // Show block
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
if (!empty($multiple) && confirm_sesskey()) {
|
||||
if (!$block = blocks_get_record($multiple)) {
|
||||
error("Block doesn't exist!");
|
||||
print_error("Block doesn't exist!");
|
||||
}
|
||||
$block->multiple = !$block->multiple;
|
||||
update_record('block', $block);
|
||||
@ -61,7 +61,7 @@
|
||||
print_heading($strmanageblocks);
|
||||
|
||||
if (!$block = blocks_get_record($delete)) {
|
||||
error("Block doesn't exist!");
|
||||
print_error("Block doesn't exist!");
|
||||
}
|
||||
|
||||
if (!block_is_compatible($block->name)) {
|
||||
@ -123,7 +123,7 @@
|
||||
/// Get and sort the existing blocks
|
||||
|
||||
if (false === ($blocks = get_records('block'))) {
|
||||
error('No blocks found!'); // Should never happen
|
||||
print_error('No blocks found!'); // Should never happen
|
||||
}
|
||||
|
||||
$incompatible = array();
|
||||
@ -143,7 +143,7 @@
|
||||
}
|
||||
|
||||
if(empty($blockbyname)) {
|
||||
error('One or more blocks are registered in the database, but they all failed to load!');
|
||||
print_error('One or more blocks are registered in the database, but they all failed to load!');
|
||||
}
|
||||
|
||||
ksort($blockbyname);
|
||||
|
@ -1234,10 +1234,10 @@ if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
|
||||
mark_context_dirty('/'.SYSCONTEXTID);
|
||||
// do nothing
|
||||
} else {
|
||||
error("Serious Error! Could not set up a default course category!");
|
||||
print_error("Serious Error! Could not set up a default course category!");
|
||||
}
|
||||
} else {
|
||||
error("Serious Error! Could not set up the site!");
|
||||
print_error("Serious Error! Could not set up the site!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error('This script was called wrongly');
|
||||
print_error('This script was called wrongly');
|
||||
}
|
||||
|
||||
/// OK, here goes ...
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
// check session key
|
||||
if (!confirm_sesskey()) {
|
||||
error( get_string('confirmsesskeybad', 'error' ) );
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
$configpath = $CFG->dirroot.'/filter/'.$filtername.'/filterconfig.php';
|
||||
|
@ -53,7 +53,7 @@
|
||||
case 'show':
|
||||
// check filterpath is valid
|
||||
if (!array_key_exists($filterpath, $installedfilters)) {
|
||||
error("Filter $filterpath is not currently installed", $url);
|
||||
print_error("Filter $filterpath is not currently installed", '', $url);
|
||||
} elseif (array_search($filterpath,$activefilters)) {
|
||||
// filterpath is already active - doubleclick??
|
||||
} else {
|
||||
@ -67,7 +67,7 @@
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
error("Filter $filterpath is not currently active", $url);
|
||||
print_error("Filter $filterpath is not currently active", '', $url);
|
||||
} elseif ($key>=(count($activefilters)-1)) {
|
||||
// cannot be moved any further down - doubleclick??
|
||||
} else {
|
||||
@ -82,7 +82,7 @@
|
||||
$key=array_search($filterpath, $activefilters);
|
||||
// check filterpath is valid
|
||||
if ($key===false) {
|
||||
error("Filter $filterpath is not currently active", $url);
|
||||
print_error("Filter $filterpath is not currently active", '', $url);
|
||||
} elseif ($key<1) {
|
||||
//cannot be moved any further up - doubleclick??
|
||||
} else {
|
||||
|
@ -50,29 +50,29 @@
|
||||
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
|
||||
|
||||
if (ini_get_bool('session.auto_start')) {
|
||||
error("The PHP server variable 'session.auto_start' should be Off - $documentationlink");
|
||||
print_error("The PHP server variable 'session.auto_start' should be Off - $documentationlink");
|
||||
}
|
||||
|
||||
if (ini_get_bool('magic_quotes_runtime')) {
|
||||
error("The PHP server variable 'magic_quotes_runtime' should be Off - $documentationlink");
|
||||
print_error("The PHP server variable 'magic_quotes_runtime' should be Off - $documentationlink");
|
||||
}
|
||||
|
||||
if (!ini_get_bool('file_uploads')) {
|
||||
error("The PHP server variable 'file_uploads' is not turned On - $documentationlink");
|
||||
print_error("The PHP server variable 'file_uploads' is not turned On - $documentationlink");
|
||||
}
|
||||
|
||||
if (empty($CFG->prefix) && $CFG->dbfamily != 'mysql') { //Enforce prefixes for everybody but mysql
|
||||
error('$CFG->prefix can\'t be empty for your target DB (' . $CFG->dbtype . ')');
|
||||
print_error('$CFG->prefix can\'t be empty for your target DB (' . $CFG->dbtype . ')');
|
||||
}
|
||||
|
||||
if ($CFG->dbfamily == 'oracle' && strlen($CFG->prefix) > 2) { //Max prefix length for Oracle is 2cc
|
||||
error('$CFG->prefix maximum allowed length for Oracle DBs is 2cc.');
|
||||
print_error('$CFG->prefix maximum allowed length for Oracle DBs is 2cc.');
|
||||
}
|
||||
|
||||
/// Check that config.php has been edited
|
||||
|
||||
if ($CFG->wwwroot == "http://example.com/moodle") {
|
||||
error("Moodle has not been configured yet. You need to edit config.php first.");
|
||||
print_error("Moodle has not been configured yet. You need to edit config.php first.");
|
||||
}
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
|
||||
$dirroot = dirname(realpath("../index.php"));
|
||||
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
|
||||
error("Please fix your settings in config.php:
|
||||
print_error("Please fix your settings in config.php:
|
||||
<p>You have:
|
||||
<p>\$CFG->dirroot = \"".addslashes($CFG->dirroot)."\";
|
||||
<p>but it should be:
|
||||
@ -100,11 +100,11 @@
|
||||
}
|
||||
|
||||
if (is_readable("$CFG->dirroot/version.php")) {
|
||||
include_once("$CFG->dirroot/version.php"); # defines $version
|
||||
include_once("$CFG->dirroot/version.php"); // defines $version
|
||||
}
|
||||
|
||||
if (!$version or !$release) {
|
||||
error('Main version.php was not readable or specified');# without version, stop
|
||||
print_error('Main version.php was not readable or specified'); // without version, stop
|
||||
}
|
||||
|
||||
/// Check if the main tables have been installed yet or not.
|
||||
@ -186,7 +186,7 @@
|
||||
} else if (file_exists("$CFG->libdir/db/$CFG->dbtype.sql")) {
|
||||
$status = modify_database("$CFG->libdir/db/$CFG->dbtype.sql"); //Old method
|
||||
} else {
|
||||
error("Error: Your database ($CFG->dbtype) is not yet fully supported by Moodle or install.xml is not present. See the lib/db directory.");
|
||||
print_error("Error: Your database ($CFG->dbtype) is not yet fully supported by Moodle or install.xml is not present. See the lib/db directory.");
|
||||
}
|
||||
|
||||
// all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
|
||||
@ -223,7 +223,7 @@
|
||||
notify($strdatabasesuccess, "green");
|
||||
require_once $CFG->dirroot.'/mnet/lib.php';
|
||||
} else {
|
||||
error("Error: Main databases NOT set up successfully");
|
||||
print_error("Error: Main databases NOT set up successfully");
|
||||
}
|
||||
print_continue('index.php');
|
||||
print_footer('none');
|
||||
@ -367,7 +367,7 @@
|
||||
moodle_install_roles();
|
||||
set_config('rolesactive', 1);
|
||||
} else if (!update_capabilities()) {
|
||||
error('Had trouble upgrading the core capabilities for the Roles System');
|
||||
print_error('Had trouble upgrading the core capabilities for the Roles System');
|
||||
}
|
||||
// update core events
|
||||
events_update_definition();
|
||||
@ -383,7 +383,7 @@
|
||||
print_footer('none');
|
||||
exit;
|
||||
} else {
|
||||
error('Upgrade failed! (Could not update version in config table)');
|
||||
print_error('Upgrade failed! (Could not update version in config table)');
|
||||
}
|
||||
/// Main upgrade not success
|
||||
} else {
|
||||
@ -401,7 +401,7 @@
|
||||
}
|
||||
} else {
|
||||
if (!set_config("version", $version)) {
|
||||
error("A problem occurred inserting current version into databases");
|
||||
print_error("A problem occurred inserting current version into databases");
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,7 +409,7 @@
|
||||
|
||||
if ($release <> $CFG->release) { // Update the release version
|
||||
if (!set_config("release", $release)) {
|
||||
error("ERROR: Could not update release version in database!!");
|
||||
print_error("ERROR: Could not update release version in database!!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,7 +495,7 @@
|
||||
$newsite->timemodified = time();
|
||||
|
||||
if (!$newid = insert_record('course', $newsite)) {
|
||||
error("Serious Error! Could not set up the site!");
|
||||
print_error("Serious Error! Could not set up the site!");
|
||||
}
|
||||
// make sure course context exists
|
||||
get_context_instance(CONTEXT_COURSE, $newid);
|
||||
@ -508,7 +508,7 @@
|
||||
$cat->name = get_string('miscellaneous');
|
||||
$cat->depth = 1;
|
||||
if (!$catid = insert_record('course_categories', $cat)) {
|
||||
error("Serious Error! Could not set up a default course category!");
|
||||
print_error("Serious Error! Could not set up a default course category!");
|
||||
}
|
||||
// make sure category context exists
|
||||
get_context_instance(CONTEXT_COURSECAT, $catid);
|
||||
|
@ -164,7 +164,7 @@
|
||||
$stringfiles += lang_extra_locations();
|
||||
}
|
||||
if (count($stringfiles) == 0) {
|
||||
error("Could not find English language pack!");
|
||||
print_error("Could not find English language pack!");
|
||||
}
|
||||
} elseif ($mode == 'helpfiles') {
|
||||
$helpfiles = lang_help_standard_locations();
|
||||
@ -172,7 +172,7 @@
|
||||
$helpfiles += lang_help_extra_locations();
|
||||
}
|
||||
if (count($helpfiles) == 0) {
|
||||
error("Could not find help files in the English language pack!");
|
||||
print_error("Could not find help files in the English language pack!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@
|
||||
echo $o;
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
|
||||
error("Could not find English language help files!");
|
||||
print_error("Could not find English language help files!");
|
||||
}
|
||||
|
||||
foreach ($files as $filekey => $file) { // check all the help files.
|
||||
@ -343,7 +343,7 @@
|
||||
}
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) {
|
||||
error("Could not find English language docs files!");
|
||||
print_error("Could not find English language docs files!");
|
||||
}
|
||||
foreach ($files as $filekey => $file) { // check all the docs files.
|
||||
if (!file_exists("$langdir/docs/$file")) {
|
||||
@ -363,7 +363,7 @@
|
||||
|
||||
if (!file_exists($langbase) ){
|
||||
if (!lang_make_directory($langbase) ){
|
||||
error('ERROR: Could not create base lang directory ' . $langbase);
|
||||
print_error('ERROR: Could not create base lang directory ' . $langbase);
|
||||
} else {
|
||||
echo '<div class="notifysuccess">Created directory '.
|
||||
$langbase .'</div>'."<br />\n";
|
||||
@ -371,7 +371,7 @@
|
||||
}
|
||||
if (!$uselocal && !file_exists($langdir)) {
|
||||
if (!lang_make_directory($langdir)) {
|
||||
error('ERROR: Could not create directory '.$langdir);
|
||||
print_error('ERROR: Could not create directory '.$langdir);
|
||||
} else {
|
||||
echo '<div class="notifysuccess">Created directory '.
|
||||
$langdir .'</div>'."<br />\n";
|
||||
@ -390,7 +390,7 @@
|
||||
|
||||
if ($currentfile <> '') {
|
||||
if (!$fileinfo = lang_get_file_info($currentfile, $stringfiles)) {
|
||||
error('Unable to find info for: '.$currentfile);
|
||||
print_error('Unable to find info for: '.$currentfile);
|
||||
}
|
||||
// check the filename is set up correctly, prevents bugs similar to MDL-10920
|
||||
$location = $fileinfo['location'];
|
||||
@ -400,7 +400,7 @@
|
||||
if ($location || $plugin) {
|
||||
// file in an extra location
|
||||
if ($currentfile != "{$prefix}{$plugin}.php") {
|
||||
error("Non-core filename mismatch. The file $currentfile should be {$prefix}{$plugin}.php");
|
||||
print_error("Non-core filename mismatch. The file $currentfile should be {$prefix}{$plugin}.php");
|
||||
}
|
||||
if (!$uselocal) {
|
||||
notify($streditingnoncorelangfile);
|
||||
@ -409,7 +409,7 @@
|
||||
} else {
|
||||
// file in standard location
|
||||
if ($currentfile != $filename) {
|
||||
error("Core filename mismatch. The file $currentfile should be $filename");
|
||||
print_error("Core filename mismatch. The file $currentfile should be $filename");
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,7 +435,7 @@
|
||||
|
||||
if (isset($_POST['currentfile'])){ // Save a file
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
$newstrings = array();
|
||||
@ -463,7 +463,7 @@
|
||||
if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
|
||||
notify(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
|
||||
} else {
|
||||
error("Could not save the file '$saveinto/$currentfile'!", "lang.php?mode=compare&currentfile=$currentfile");
|
||||
print_error("Could not save the file '$saveinto/$currentfile'!", '', "lang.php?mode=compare&currentfile=$currentfile");
|
||||
}
|
||||
unset($packstring);
|
||||
}
|
||||
@ -707,12 +707,12 @@
|
||||
|
||||
if (isset($_POST['currentfile'])) { // Save a file
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
if (lang_help_save_file($saveto, $currentfile, $_POST['filedata'])) {
|
||||
notify(get_string("changessaved")." ($saveto/$currentfile)", "notifysuccess");
|
||||
} else {
|
||||
error("Could not save the file '$currentfile'!", "lang.php?mode=helpfiles&currentfile=$currentfile&sesskey=$USER->sesskey");
|
||||
print_error("Could not save the file '$currentfile'!", '', "lang.php?mode=helpfiles&currentfile=$currentfile&sesskey=$USER->sesskey");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
||||
if (langdoc_save_file($langdir, $currentfile, $_POST['filedata'])) {
|
||||
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
|
||||
} else {
|
||||
error("Could not save the file '$currentfile'!", "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey");
|
||||
print_error("Could not save the file '$currentfile'!", '', "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@
|
||||
// Get all files from /docs directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) {
|
||||
error("Could not find English language docs files!");
|
||||
print_error("Could not find English language docs files!");
|
||||
}
|
||||
|
||||
$options = array();
|
||||
@ -83,7 +83,7 @@
|
||||
// Get all files from /help directory
|
||||
|
||||
if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
|
||||
error("Could not find English language help files!");
|
||||
print_error("Could not find English language help files!");
|
||||
}
|
||||
|
||||
foreach ($files as $filekey => $file) { // check all the help files.
|
||||
|
@ -30,7 +30,7 @@
|
||||
//reset and diagnose lang cache permissions
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
if (file_exists($CFG->dataroot.'/cache/languages')) {
|
||||
error('Language cache can not be deleted, please fix permissions in dataroot/cache/languages!');
|
||||
print_error('Language cache can not be deleted, please fix permissions in dataroot/cache/languages!');
|
||||
}
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
//Check folder exists
|
||||
if (! make_upload_directory(SITEID)) { // Site folder
|
||||
error("Could not create site folder. The site administrator needs to fix the file permissions");
|
||||
print_error("Could not create site folder. The site administrator needs to fix the file permissions");
|
||||
}
|
||||
|
||||
$filename = $CFG->dataroot.'/'.SITEID.'/maintenance.html';
|
||||
|
@ -17,19 +17,19 @@
|
||||
if (!extension_loaded('openssl')) {
|
||||
admin_externalpage_print_header();
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
print_error('requiresopenssl', 'mnet');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
admin_externalpage_print_header();
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
print_error('nosite');
|
||||
}
|
||||
|
||||
if (!function_exists('curl_init') ) {
|
||||
admin_externalpage_print_header();
|
||||
set_config('mnet_dispatcher_mode', 'off');
|
||||
print_error('nocurl', 'mnet', '', NULL, true);
|
||||
print_error('nocurl', 'mnet');
|
||||
}
|
||||
|
||||
if (!isset($CFG->mnet_dispatcher_mode)) {
|
||||
@ -43,7 +43,7 @@
|
||||
if (set_config('mnet_dispatcher_mode', $form->mode)) {
|
||||
redirect('index.php', get_string('changessaved'));
|
||||
} else {
|
||||
error('Invalid action parameter.', 'index.php');
|
||||
print_error('Invalid action parameter.', '', 'index.php');
|
||||
}
|
||||
}
|
||||
} elseif (!empty($form->submit) && $form->submit == get_string('delete')) {
|
||||
|
@ -15,17 +15,17 @@ require_capability('moodle/site:config', $context, $USER->id, true, "nopermissio
|
||||
|
||||
if (!extension_loaded('openssl')) {
|
||||
admin_externalpage_print_header();
|
||||
print_error('requiresopenssl', 'mnet', '', NULL, true);
|
||||
print_error('requiresopenssl', 'mnet');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
admin_externalpage_print_header();
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
print_error('nosite', '');
|
||||
}
|
||||
|
||||
if (!function_exists('curl_init') ) {
|
||||
admin_externalpage_print_header();
|
||||
print_error('nocurl', 'mnet', '', NULL, true);
|
||||
print_error('nocurl', 'mnet');
|
||||
}
|
||||
|
||||
/// Initialize variables.
|
||||
@ -59,7 +59,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
|
||||
if(!function_exists('xmlrpc_encode_request')) {
|
||||
trigger_error("You must have xml-rpc enabled in your PHP build to use this feature.");
|
||||
error(get_string('xmlrpc-missing', 'mnet'),'peers.php');
|
||||
print_error('xmlrpc-missing', 'mnet','peers.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
$temp_wwwroot = clean_param($form->wwwroot, PARAM_URL);
|
||||
if ($temp_wwwroot !== $form->wwwroot) {
|
||||
trigger_error("We now parse the wwwroot with PARAM_URL. Your URL will need to have a valid TLD, etc.");
|
||||
error(get_string("invalidurl", 'mnet'),'peers.php');
|
||||
print_error("invalidurl", 'mnet','peers.php');
|
||||
exit;
|
||||
}
|
||||
unset($temp_wwwroot);
|
||||
@ -103,7 +103,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
if (isset($form->public_key)) {
|
||||
$form->public_key = clean_param($form->public_key, PARAM_PEM);
|
||||
if (empty($form->public_key)) {
|
||||
error(get_string("invalidpubkey", 'mnet'),'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
print_error("invalidpubkey", 'mnet', 'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
exit;
|
||||
} else {
|
||||
$oldkey = $mnet_peer->public_key;
|
||||
@ -116,7 +116,8 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
foreach ($mnet_peer->error as $err) {
|
||||
$errmsg .= $err['code'] . ': ' . $err['text'].'<br />';
|
||||
}
|
||||
error(get_string("invalidpubkey", 'mnet') . $errmsg ,'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
//error(get_string("invalidpubkey", 'mnet') . $errmsg ,'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
print_error("invalidpubkey", 'mnet', 'peers.php?step=update&hostid='.$mnet_peer->id, $errmsg);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -127,7 +128,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
// PREVENT DUPLICATE RECORDS ///////////////////////////////////////////
|
||||
if ('input' == $form->step) {
|
||||
if ( isset($mnet_peer->id) && $mnet_peer->id > 0 ) {
|
||||
error(get_string("hostexists", 'mnet', $mnet_peer->id),'peers.php?step=update&hostid='.$mnet_peer->id);
|
||||
print_error("hostexists", 'mnet', 'peers.php?step=update&hostid='.$mnet_peer->id, $mnet_peer->id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,7 +139,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
if ($bool) {
|
||||
redirect('peers.php?step=update&hostid='.$mnet_peer->id, get_string('changessaved'));
|
||||
} else {
|
||||
error('Invalid action parameter.', 'index.php');
|
||||
print_error('Invalid action parameter.', '', 'index.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
if (!empty($hide) and confirm_sesskey()) {
|
||||
if (!$module = get_record("modules", "name", $hide)) {
|
||||
error("Module doesn't exist!");
|
||||
print_error("Module doesn't exist!");
|
||||
}
|
||||
set_field("modules", "visible", "0", "id", $module->id); // Hide main module
|
||||
// Remember the visibility status in visibleold
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
if (!empty($show) and confirm_sesskey()) {
|
||||
if (!$module = get_record("modules", "name", $show)) {
|
||||
error("Module doesn't exist!");
|
||||
print_error("Module doesn't exist!");
|
||||
}
|
||||
set_field("modules", "visible", "1", "id", $module->id); // Show main module
|
||||
set_field('course_modules', 'visible', '1', 'visibleold',
|
||||
@ -89,11 +89,11 @@
|
||||
} else { // Delete everything!!
|
||||
|
||||
if ($delete == "forum") {
|
||||
error("You can not delete the forum module!!");
|
||||
print_error("You can not delete the forum module!!");
|
||||
}
|
||||
|
||||
if (!$module = get_record("modules", "name", $delete)) {
|
||||
error("Module doesn't exist!");
|
||||
print_error("Module doesn't exist!");
|
||||
}
|
||||
|
||||
// OK, first delete all the relevant instances from all course sections
|
||||
@ -180,7 +180,7 @@
|
||||
/// Get and sort the existing modules
|
||||
|
||||
if (!$modules = get_records("modules")) {
|
||||
error("No modules found!!"); // Should never happen
|
||||
print_error("No modules found!!"); // Should never happen
|
||||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
|
@ -25,7 +25,7 @@ if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
|
||||
|
||||
|
||||
if (!$tables = $db->Metatables() ) { // No tables yet at all.
|
||||
error("no tables");
|
||||
print_error("no tables");
|
||||
}
|
||||
|
||||
print_simple_box_start('center');
|
||||
|
@ -12,11 +12,11 @@
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
if (!$admin = get_admin()) {
|
||||
error("No admins");
|
||||
print_error("No admins");
|
||||
}
|
||||
|
||||
if (!$admin->country and $CFG->country) {
|
||||
|
@ -35,7 +35,7 @@ if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Pr
|
||||
print_simple_box_start('center');
|
||||
|
||||
if (!db_replace($search, $replace)) {
|
||||
error('An error has occured during this process');
|
||||
print_error('An error has occured during this process');
|
||||
}
|
||||
|
||||
print_simple_box_end();
|
||||
|
@ -32,12 +32,12 @@
|
||||
}
|
||||
|
||||
if (!$course = get_record("course","id",$courseid)) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
if (!empty($userid)) {
|
||||
if (!$user = get_record('user','id',$userid)) {
|
||||
error("That's an invalid user id");
|
||||
print_error("That's an invalid user id");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
}
|
||||
|
||||
if (! $context = get_context_instance_by_id($contextid)) {
|
||||
error("Context ID was incorrect (can't find it)");
|
||||
print_error("Context ID was incorrect (can't find it)");
|
||||
}
|
||||
|
||||
$inmeta = 0;
|
||||
@ -43,13 +43,13 @@
|
||||
if ($course = get_record('course', 'id', $courseid)) {
|
||||
$inmeta = $course->metacourse;
|
||||
} else {
|
||||
error('Invalid course id');
|
||||
print_error('Invalid course id');
|
||||
}
|
||||
$coursecontext = $context;
|
||||
|
||||
} else if (!empty($courseid)){ // we need this for user tabs in user context
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Invalid course id');
|
||||
print_error('Invalid course id');
|
||||
}
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
|
@ -222,7 +222,7 @@
|
||||
$role->description = $description;
|
||||
|
||||
if (!update_record('role', $role)) {
|
||||
error('Could not update role!');
|
||||
print_error('Could not update role!');
|
||||
}
|
||||
|
||||
// set proper legacy type
|
||||
@ -249,7 +249,7 @@
|
||||
|
||||
case 'delete':
|
||||
if (in_array($roleid, $defaultroles)) {
|
||||
error('This role is used as one of the default system roles, it can not be deleted');
|
||||
print_error('This role is used as one of the default system roles, it can not be deleted');
|
||||
}
|
||||
if ($confirm and data_submitted() and confirm_sesskey()) {
|
||||
if (!delete_role($roleid)) {
|
||||
@ -257,7 +257,7 @@
|
||||
// partially deleted a role sitewide...?
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
error('Could not delete role with ID '.$roleid);
|
||||
print_error('Could not delete role with ID '.$roleid);
|
||||
}
|
||||
// deleted a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
@ -286,7 +286,7 @@
|
||||
$above = $roles[$rolesort[$role->sortorder - 1]];
|
||||
|
||||
if (!switch_roles($role, $above)) {
|
||||
error("Cannot move role with ID $roleid");
|
||||
print_error("Cannot move role with ID $roleid");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -301,7 +301,7 @@
|
||||
$below = $roles[$rolesort[$role->sortorder + 1]];
|
||||
|
||||
if (!switch_roles($role, $below)) {
|
||||
error("Cannot move role with ID $roleid");
|
||||
print_error("Cannot move role with ID $roleid");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -436,7 +436,7 @@
|
||||
$role = stripslashes_safe($newrole);
|
||||
} else {
|
||||
if(!$role = get_record('role', 'id', $roleid)) {
|
||||
error('Incorrect role ID!');
|
||||
print_error('Incorrect role ID!');
|
||||
}
|
||||
$role->legacytype = get_legacy_type($role->id);
|
||||
}
|
||||
|
@ -9,24 +9,24 @@
|
||||
$cancel = optional_param('cancel', 0, PARAM_BOOL);
|
||||
|
||||
if (!$context = get_record('context', 'id', $contextid)) {
|
||||
error('Bad context ID');
|
||||
print_error('Bad context ID');
|
||||
}
|
||||
|
||||
if (!$sitecontext = get_context_instance(CONTEXT_SYSTEM)) {
|
||||
error('No site ID');
|
||||
print_error('No site ID');
|
||||
}
|
||||
|
||||
if ($context->id == $sitecontext->id) {
|
||||
error('Can not override base role capabilities');
|
||||
print_error('Can not override base role capabilities');
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/role:override', $context)) {
|
||||
error('You do not have permission to change overrides in this context!');
|
||||
print_error('You do not have permission to change overrides in this context!');
|
||||
}
|
||||
|
||||
if ($courseid) {
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Bad course ID');
|
||||
print_error('Bad course ID');
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
@ -61,16 +61,16 @@ if ($currenttab != 'update') {
|
||||
case CONTEXT_MODULE:
|
||||
// get module type?
|
||||
if (!$cm = get_record('course_modules','id',$context->instanceid)) {
|
||||
error('Bad course module ID');
|
||||
print_error('Bad course module ID');
|
||||
}
|
||||
if (!$module = get_record('modules','id',$cm->module)) { //$module->name;
|
||||
error('Bad module ID');
|
||||
print_error('Bad module ID');
|
||||
}
|
||||
if (!$course = get_record('course','id',$cm->course)) {
|
||||
error('Bad course ID');
|
||||
print_error('Bad course ID');
|
||||
}
|
||||
if (!$instance = get_record($module->name, 'id', $cm->instance)) {
|
||||
error("The required instance of this module doesn't exist");
|
||||
print_error("The required instance of this module doesn't exist");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
@ -9,7 +9,7 @@
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
if ($CFG->version < 2005042300) {
|
||||
error("This script does not work with this old version of Moodle");
|
||||
print_error("This script does not work with this old version of Moodle");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
if ($CFG->version < 2004013101) {
|
||||
error("This script does not work with this old version of Moodle");
|
||||
print_error("This script does not work with this old version of Moodle");
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
|
@ -35,11 +35,11 @@ require_login();
|
||||
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Could not find site-level course");
|
||||
print_error("Could not find site-level course");
|
||||
}
|
||||
|
||||
if (!$adminuser = get_admin()) {
|
||||
error("Could not find site admin");
|
||||
print_error("Could not find site admin");
|
||||
}
|
||||
|
||||
$strfile = get_string('file');
|
||||
|
@ -92,9 +92,9 @@ if (empty($iid)) {
|
||||
unset($content);
|
||||
|
||||
if ($readcount === false) {
|
||||
error($cir->get_error(), $returnurl);
|
||||
print_error($cir->get_error(), '', $returnurl);
|
||||
} else if ($readcount == 0) {
|
||||
error(get_string('csvemptyfile', 'error'), $returnurl);
|
||||
print_error('csvemptyfile', 'error', $returnurl);
|
||||
}
|
||||
// continue to form2
|
||||
|
||||
@ -110,7 +110,7 @@ if (empty($iid)) {
|
||||
}
|
||||
|
||||
if (!$columns = $cir->get_columns()) {
|
||||
error('Error reading temporary file', $returnurl);
|
||||
print_error('Error reading temporary file', '', $returnurl);
|
||||
}
|
||||
$mform = new admin_uploaduser_form2(null, $columns);
|
||||
// get initial date from form1
|
||||
|
@ -22,7 +22,7 @@
|
||||
$site = get_site();
|
||||
|
||||
if (!has_capability('moodle/user:update', $sitecontext) and !has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error('You do not have the required permission to edit/delete users.');
|
||||
print_error('You do not have the required permission to edit/delete users.');
|
||||
}
|
||||
|
||||
$stredit = get_string('edit');
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
if ($confirmuser and confirm_sesskey()) {
|
||||
if (!$user = get_record('user', 'id', $confirmuser)) {
|
||||
error("No such user!", '', true);
|
||||
print_error("No such user!");
|
||||
}
|
||||
|
||||
$auth = get_auth_plugin($user->auth);
|
||||
@ -56,15 +56,15 @@
|
||||
} else if ($delete and confirm_sesskey()) { // Delete a selected user, after confirmation
|
||||
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
error('You do not have the required permission to delete a user.');
|
||||
print_error('You do not have the required permission to delete a user.');
|
||||
}
|
||||
|
||||
if (!$user = get_record('user', 'id', $delete)) {
|
||||
error("No such user!", '', true);
|
||||
print_error("No such user!");
|
||||
}
|
||||
|
||||
if (is_primary_admin($user->id)) {
|
||||
error("You are not allowed to delete the primary admin user!", '', true);
|
||||
print_error("You are not allowed to delete the primary admin user!");
|
||||
}
|
||||
|
||||
if ($confirm != md5($delete)) {
|
||||
@ -84,17 +84,17 @@
|
||||
} else if ($acl and confirm_sesskey()) {
|
||||
if (!has_capability('moodle/user:delete', $sitecontext)) {
|
||||
// TODO: this should be under a separate capability
|
||||
error('You are not permitted to modify the MNET access control list.');
|
||||
print_error('You are not permitted to modify the MNET access control list.');
|
||||
}
|
||||
if (!$user = get_record('user', 'id', $acl)) {
|
||||
error("No such user.", '', true);
|
||||
print_error("No such user.");
|
||||
}
|
||||
if (!is_mnet_remote_user($user)) {
|
||||
error('Users in the MNET access control list must be remote MNET users.');
|
||||
print_error('Users in the MNET access control list must be remote MNET users.');
|
||||
}
|
||||
$accessctrl = strtolower(required_param('accessctrl', PARAM_ALPHA));
|
||||
if ($accessctrl != 'allow' and $accessctrl != 'deny') {
|
||||
error('Invalid access parameter.');
|
||||
print_error('Invalid access parameter.');
|
||||
}
|
||||
$aclrecord = get_record('mnet_sso_access_control', 'username', $user->username, 'mnet_host_id', $user->mnethostid);
|
||||
if (empty($aclrecord)) {
|
||||
@ -103,12 +103,12 @@
|
||||
$aclrecord->username = $user->username;
|
||||
$aclrecord->accessctrl = $accessctrl;
|
||||
if (!insert_record('mnet_sso_access_control', $aclrecord)) {
|
||||
error("Database error - Couldn't modify the MNET access control list.", '', true);
|
||||
print_error("Database error - Couldn't modify the MNET access control list.");
|
||||
}
|
||||
} else {
|
||||
$aclrecord->accessctrl = $accessctrl;
|
||||
if (!update_record('mnet_sso_access_control', $aclrecord)) {
|
||||
error("Database error - Couldn't modify the MNET access control list.", '', true);
|
||||
print_error("Database error - Couldn't modify the MNET access control list.");
|
||||
}
|
||||
}
|
||||
$mnethosts = get_records('mnet_host', '', '', 'id', 'id,wwwroot,name');
|
||||
|
@ -17,7 +17,7 @@ if (empty($SESSION->bulk_users)) {
|
||||
}
|
||||
|
||||
if (empty($CFG->messaging)) {
|
||||
error("Messaging is disabled on this site");
|
||||
print_error("Messaging is disabled on this site");
|
||||
}
|
||||
|
||||
//TODO: add support for large number of users
|
||||
|
@ -76,7 +76,7 @@ class edit_field_save extends XMLDBAction {
|
||||
/// Do the job, setting result as needed
|
||||
|
||||
if (!data_submitted('nomatch')) { ///Basic prevention
|
||||
error('Wrong action call');
|
||||
print_error('Wrong action call');
|
||||
}
|
||||
|
||||
/// Get parameters
|
||||
|
@ -70,7 +70,7 @@ class edit_index_save extends XMLDBAction {
|
||||
/// Do the job, setting result as needed
|
||||
|
||||
if (!data_submitted('nomatch')) { ///Basic prevention
|
||||
error('Wrong action call');
|
||||
print_error('Wrong action call');
|
||||
}
|
||||
|
||||
/// Get parameters
|
||||
|
@ -76,7 +76,7 @@ class edit_key_save extends XMLDBAction {
|
||||
/// Do the job, setting result as needed
|
||||
|
||||
if (!data_submitted('nomatch')) { ///Basic prevention
|
||||
error('Wrong action call');
|
||||
print_error('Wrong action call');
|
||||
}
|
||||
|
||||
/// Get parameters
|
||||
|
@ -66,7 +66,7 @@ class edit_table_save extends XMLDBAction {
|
||||
/// Do the job, setting result as needed
|
||||
|
||||
if (!data_submitted('nomatch')) { ///Basic prevention
|
||||
error('Wrong action call');
|
||||
print_error('Wrong action call');
|
||||
}
|
||||
|
||||
/// Get parameters
|
||||
|
@ -62,7 +62,7 @@ class edit_xml_file_save extends XMLDBAction {
|
||||
/// Do the job, setting result as needed
|
||||
|
||||
if (!data_submitted('nomatch')) { ///Basic prevention
|
||||
error('Wrong action call');
|
||||
print_error('Wrong action call');
|
||||
}
|
||||
|
||||
/// Get parameters
|
||||
|
@ -116,7 +116,7 @@
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
error($xmldb_action->getError());
|
||||
print_error($xmldb_action->getError());
|
||||
}
|
||||
} else {
|
||||
error ("Error: cannot instantiate class (actions/$action/$actionclass)");
|
||||
|
@ -7,7 +7,7 @@ httpsrequired();
|
||||
|
||||
/// Define variables used in page
|
||||
if (!$site = get_site()) {
|
||||
error("No site found!");
|
||||
print_error("No site found!");
|
||||
}
|
||||
|
||||
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
|
||||
|
@ -7,7 +7,7 @@ httpsrequired();
|
||||
|
||||
/// Define variables used in page
|
||||
if (!$site = get_site()) {
|
||||
error("No site found!");
|
||||
print_error("No site found!");
|
||||
}
|
||||
|
||||
$authsequence = get_enabled_auth_plugins(true); // auths, in sequence
|
||||
|
@ -62,7 +62,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
* @return bool Authentication success or failure.
|
||||
*/
|
||||
function user_login($username, $password) {
|
||||
return false; // error("Remote MNET users cannot login locally.");
|
||||
return false; // print_error("Remote MNET users cannot login locally.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,12 +175,12 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
or is_mnet_remote_user($USER)
|
||||
or $USER->username == 'guest'
|
||||
or empty($USER->id)) {
|
||||
error(get_string('notpermittedtojump', 'mnet'));
|
||||
print_error('notpermittedtojump', 'mnet');
|
||||
}
|
||||
|
||||
// check for SSO publish permission first
|
||||
if ($this->has_service($mnethostid, 'sso_sp') == false) {
|
||||
error(get_string('hostnotconfiguredforsso', 'mnet'));
|
||||
print_error('hostnotconfiguredforsso', 'mnet');
|
||||
}
|
||||
|
||||
// set RPC timeout to 30 seconds if not configured
|
||||
@ -209,7 +209,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_session->expires = time() + (integer)ini_get('session.gc_maxlifetime');
|
||||
$mnet_session->session_id = session_id();
|
||||
if (! $mnet_session->id = insert_record('mnet_session', addslashes_object($mnet_session))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
print_error('databaseerror', 'mnet');
|
||||
}
|
||||
} else {
|
||||
$mnet_session->useragent = sha1($_SERVER['HTTP_USER_AGENT']);
|
||||
@ -218,7 +218,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_session->expires = time() + (integer)ini_get('session.gc_maxlifetime');
|
||||
$mnet_session->session_id = session_id();
|
||||
if (false == update_record('mnet_session', addslashes_object($mnet_session))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
print_error('databaseerror', 'mnet');
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
// verify the remote host is configured locally before attempting RPC call
|
||||
if (! $remotehost = get_record('mnet_host', 'wwwroot', $remotewwwroot)) {
|
||||
error(get_string('notpermittedtoland', 'mnet'));
|
||||
print_error('notpermittedtoland', 'mnet');
|
||||
}
|
||||
|
||||
// get the originating (ID provider) host info
|
||||
@ -268,12 +268,12 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
list($code, $message) = array_map('trim',explode(':', $errormessage, 2));
|
||||
if($code == 702) {
|
||||
$site = get_site();
|
||||
print_error('mnet_session_prohibited','mnet', $remotewwwroot, format_string($site->fullname));
|
||||
print_error('mnet_session_prohibited', 'mnet', $remotewwwroot, format_string($site->fullname));
|
||||
exit;
|
||||
}
|
||||
$message .= "ERROR $code:<br/>$errormessage<br/>";
|
||||
}
|
||||
error("RPC auth/mnet/user_authorise:<br/>$message");
|
||||
print_error("RPC auth/mnet/user_authorise:<br/>$message");
|
||||
}
|
||||
unset($mnetrequest);
|
||||
|
||||
@ -291,15 +291,15 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
// TODO: refactor into a separate function
|
||||
if (empty($localuser) || ! $localuser->id) {
|
||||
if (empty($this->config->auto_add_remote_users)) {
|
||||
error(get_string('nolocaluser', 'mnet'));
|
||||
print_error('nolocaluser', 'mnet');
|
||||
}
|
||||
$remoteuser->mnethostid = $remotehost->id;
|
||||
if (! insert_record('user', addslashes_object($remoteuser))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
print_error('databaseerror', 'mnet');
|
||||
}
|
||||
$firsttime = true;
|
||||
if (! $localuser = get_record('user', 'username', addslashes($remoteuser->username), 'mnethostid', $remotehost->id)) {
|
||||
error(get_string('nolocaluser', 'mnet'));
|
||||
print_error('nolocaluser', 'mnet');
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
if (!$bool) {
|
||||
// TODO: Jonathan to clean up mess
|
||||
// Actually, this should never happen (modulo race conditions) - ML
|
||||
error("updating user failed in mnet/auth/confirm_mnet_session ");
|
||||
print_error("updating user failed in mnet/auth/confirm_mnet_session ");
|
||||
}
|
||||
|
||||
// set up the session
|
||||
@ -392,7 +392,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_session->expires = time() + (integer)$session_gc_maxlifetime;
|
||||
$mnet_session->session_id = session_id();
|
||||
if (! $mnet_session->id = insert_record('mnet_session', addslashes_object($mnet_session))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
print_error('databaseerror', 'mnet');
|
||||
}
|
||||
} else {
|
||||
$mnet_session->expires = time() + (integer)$session_gc_maxlifetime;
|
||||
|
@ -15,7 +15,7 @@
|
||||
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
|
||||
|
||||
if (!is_enabled_auth('mnet')) {
|
||||
error('mnet is disabled');
|
||||
print_error('mnet is disabled');
|
||||
}
|
||||
|
||||
// grab the GET params - wantsurl could be anything - take it
|
||||
@ -28,7 +28,7 @@ $mnetauth = get_auth_plugin('mnet');
|
||||
$url = $mnetauth->start_jump_session($hostid, $wantsurl);
|
||||
|
||||
if (empty($url)) {
|
||||
error('DEBUG: Jump session was not started correctly or blank URL returned.'); // TODO: errors
|
||||
print_error('DEBUG: Jump session was not started correctly or blank URL returned.'); // TODO: errors
|
||||
}
|
||||
redirect($url);
|
||||
|
||||
|
@ -20,7 +20,7 @@ if (!$site = get_site()) {
|
||||
}
|
||||
|
||||
if (!is_enabled_auth('mnet')) {
|
||||
error('mnet is disabled');
|
||||
print_error('mnet is disabled');
|
||||
}
|
||||
// grab the GET params
|
||||
$token = required_param('token', PARAM_BASE64);
|
||||
|
@ -21,7 +21,7 @@ httpsrequired();
|
||||
|
||||
/// Define variables used in page
|
||||
if (!$site = get_site()) {
|
||||
error("No site found!");
|
||||
print_error("No site found!");
|
||||
}
|
||||
|
||||
if (empty($CFG->langmenu)) {
|
||||
|
@ -18,24 +18,24 @@
|
||||
if (!empty($id)) {
|
||||
require_login($id);
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
} else {
|
||||
require_login();
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($to)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
|
||||
//Check necessary functions exists. Thanks to gregb@crowncollege.edu
|
||||
@ -96,7 +96,7 @@
|
||||
|
||||
//Get and check course
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course ID was incorrect (can't find it)");
|
||||
print_error("Course ID was incorrect (can't find it)");
|
||||
}
|
||||
|
||||
//Print header
|
||||
|
@ -7,16 +7,16 @@
|
||||
if (!empty($course->id)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,14 +30,14 @@
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
if ($count == 0) {
|
||||
notice("No backupable modules are installed!");
|
||||
}
|
||||
|
||||
if (!execute_sql("DELETE FROM {$CFG->prefix}backup_ids WHERE backup_code = '{$backupprefs->backup_unique_code}'",false)){
|
||||
error('Couldn\'t delete previous backup ids.');
|
||||
print_error('Couldn\'t delete previous backup ids.');
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -7,23 +7,23 @@
|
||||
if (!empty($course->id)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
|
||||
$preferences = new StdClass;
|
||||
|
@ -7,22 +7,22 @@
|
||||
if (!empty($course->id)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
|
||||
//Checks for the required files/functions to backup every mod
|
||||
|
@ -375,10 +375,10 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
error("Upgrade of backup system failed! (Could not update version in config table)");
|
||||
print_error("Upgrade of backup system failed! (Could not update version in config table)");
|
||||
}
|
||||
} else {
|
||||
error("Backup tables could NOT be set up successfully!");
|
||||
print_error("Backup tables could NOT be set up successfully!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -448,10 +448,10 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
error("Upgrade of backup system failed! (Could not update version in config table)");
|
||||
print_error("Upgrade of backup system failed! (Could not update version in config table)");
|
||||
}
|
||||
} else {
|
||||
error("Upgrade failed! See backup/version.php");
|
||||
print_error("Upgrade failed! See backup/version.php");
|
||||
}
|
||||
|
||||
} else if ($backup_version < $CFG->backup_version) {
|
||||
@ -590,7 +590,7 @@
|
||||
|
||||
if(!function_exists('utf8_encode')) {
|
||||
if (empty($justcheck)) {
|
||||
error('You need to add XML support to your PHP installation');
|
||||
print_error('You need to add XML support to your PHP installation');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -53,23 +53,23 @@
|
||||
require_login($id);
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
|
||||
//Check necessary functions exists. Thanks to gregb@crowncollege.edu
|
||||
@ -118,7 +118,7 @@
|
||||
|
||||
//Get and check course
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course ID was incorrect (can't find it)");
|
||||
print_error("Course ID was incorrect (can't find it)");
|
||||
}
|
||||
|
||||
//Print header
|
||||
@ -161,7 +161,7 @@
|
||||
} else if ($launch == "execute") {
|
||||
//Prevent multiple restore executions...
|
||||
if (empty($SESSION->cancontinue)) {
|
||||
error("Multiple restore execution not allowed!");
|
||||
print_error("Multiple restore execution not allowed!");
|
||||
}
|
||||
//Unset this for the future
|
||||
unset($SESSION->cancontinue);
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
// check for session objects
|
||||
if (empty($info) or empty($course_header)) {
|
||||
error( 'important information missing from SESSION' );
|
||||
print_error( 'important information missing from SESSION' );
|
||||
}
|
||||
|
||||
|
||||
@ -189,17 +189,17 @@
|
||||
//Check admin
|
||||
if (!empty($id)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
|
||||
//Depending the selected restoreto:
|
||||
@ -275,9 +275,9 @@
|
||||
} else if ((($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id != 0)) or ($restore->restoreto == 2)) {
|
||||
//Final access control check
|
||||
if ($restore->course_id == 0 and !user_can_create_courses()) {
|
||||
error("You need to be a creator or admin to restore into new course!");
|
||||
print_error("You need to be a creator or admin to restore into new course!");
|
||||
} else if ($restore->course_id != 0 and !has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $restore->course_id))) {
|
||||
error("You need to be an edit teacher or admin to restore into selected course!");
|
||||
print_error("You need to be an edit teacher or admin to restore into selected course!");
|
||||
}
|
||||
$show_continue_button = true;
|
||||
//Check if we've selected any mod's user info and restore->users
|
||||
|
@ -24,30 +24,30 @@
|
||||
if (!empty($id)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
$errorstr = '';
|
||||
|
||||
$status = restore_execute($restore,$info,$course_header,$errorstr);
|
||||
|
||||
if (!$status) {
|
||||
error ("An error has occurred and the restore could not be completed!");
|
||||
print_error ("An error has occurred and the restore could not be completed!");
|
||||
}
|
||||
|
||||
if (empty($restore->importing)) {
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
//Get objects from session
|
||||
if (!($info = $SESSION->info)) {
|
||||
error( 'info object missing from session' );
|
||||
print_error( 'info object missing from session' );
|
||||
}
|
||||
if (!($course_header = $SESSION->course_header)) {
|
||||
error( 'course_header object missing from session' );
|
||||
print_error( 'course_header object missing from session' );
|
||||
}
|
||||
|
||||
$restore_gradebook_history = optional_param('restore_gradebook_history', 0, PARAM_INT);
|
||||
@ -26,17 +26,17 @@
|
||||
//Check admin
|
||||
if (!empty($id)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
|
||||
//Checks for the required files/functions to restore every mod
|
||||
@ -757,4 +757,4 @@ function restore_is_samerole($testroleid, $rolefromxml) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -16,23 +16,23 @@
|
||||
if (!empty($id)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
if (empty($to)) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
|
||||
print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
|
||||
}
|
||||
}
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
|
||||
$errorstr = '';
|
||||
@ -42,7 +42,7 @@
|
||||
$status = restore_precheck($id,$file,$errorstr);
|
||||
|
||||
if (!$status) {
|
||||
error("An error occured");
|
||||
print_error("An error occured");
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -2426,7 +2426,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
} else {
|
||||
// should not happen, as we check in restore_chech.php
|
||||
// but handle the error if it does
|
||||
error("This backup file contains external Moodle Network Hosts that are not configured locally.");
|
||||
print_error("This backup file contains external Moodle Network Hosts that are not configured locally.");
|
||||
}
|
||||
}
|
||||
unset($user->mnethosturl);
|
||||
@ -6925,7 +6925,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
|
||||
/**
|
||||
* @param string $errorstr passed by reference, if silent is true,
|
||||
* errorstr will be populated and this function will return false rather than calling error() or notify()
|
||||
* errorstr will be populated and this function will return false rather than calling print_error() or notify()
|
||||
* @param boolean $noredirect (optional) if this is passed, this function will not print continue, or
|
||||
* redirect to the next step in the restore process, instead will return $backup_unique_code
|
||||
*/
|
||||
@ -7951,7 +7951,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
//Open file for writing
|
||||
//First, we check the course_id backup data folder exists and create it as necessary in CFG->dataroot
|
||||
if (!$dest_dir = make_upload_directory("$restore->course_id/backupdata")) { // Backup folder
|
||||
error("Could not create backupdata folder. The site administrator needs to fix the file permissions");
|
||||
print_error("Could not create backupdata folder. The site administrator needs to fix the file permissions");
|
||||
}
|
||||
$status = check_dir_exists($dest_dir,true);
|
||||
$restorelog_file = fopen("$dest_dir/restorelog.html","a");
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
//Check site
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
|
||||
//Check necessary functions exists. Thanks to gregb@crowncollege.edu
|
||||
|
@ -27,7 +27,7 @@ if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
|
||||
// Ensure that the logged in user is not using the guest account
|
||||
if (isguest()) {
|
||||
error(get_string('noguestpost', 'forum'), $referrer);
|
||||
print_error('noguestpost', 'forum', $referrer);
|
||||
}
|
||||
|
||||
|
||||
@ -99,14 +99,15 @@ if (isset($rss_record)) {
|
||||
if ($act == 'updfeed') {
|
||||
|
||||
if (!$managefeeds) {
|
||||
error(get_string('noguestpost', 'forum').
|
||||
' You are not allowed to make modifications to this RSS feed at this time.',
|
||||
$referrer);
|
||||
//print_error(get_string('noguestpost', 'forum').
|
||||
// ' You are not allowed to make modifications to this RSS feed at this time.',
|
||||
// $referrer);
|
||||
print_error('noguestpost', 'forum', $referrer, 'You are not allowed to make modifications to this RSS feed at this time.');
|
||||
}
|
||||
|
||||
|
||||
if (empty($url)) {
|
||||
error( 'URL not defined for rss feed' );
|
||||
print_error( 'URL not defined for rss feed' );
|
||||
}
|
||||
|
||||
// By capturing the output from fetch_rss this way
|
||||
@ -141,7 +142,7 @@ if ($act == 'updfeed') {
|
||||
$dataobject->url = addslashes($url);
|
||||
|
||||
if (!update_record('block_rss_client', $dataobject)) {
|
||||
error('There was an error trying to update rss feed with id:'. $rssid);
|
||||
print_error('There was an error trying to update rss feed with id:'. $rssid);
|
||||
}
|
||||
|
||||
$message .= '<br />'. get_string('feedupdated', 'block_rss_client');
|
||||
@ -153,11 +154,11 @@ if ($act == 'updfeed') {
|
||||
$canaddsharedfeeds = has_capability('block/rss_client:createsharedfeeds', $context);
|
||||
|
||||
if (!$canaddprivfeeds && !$canaddsharedfeeds) {
|
||||
error('You do not have the permission to add RSS feeds');
|
||||
print_error('You do not have the permission to add RSS feeds');
|
||||
}
|
||||
|
||||
if (empty($url)) {
|
||||
error('URL not defined for rss feed');
|
||||
print_error('URL not defined for rss feed');
|
||||
}
|
||||
$dataobject->userid = $USER->id;
|
||||
$dataobject->description = '';
|
||||
@ -173,7 +174,7 @@ if ($act == 'updfeed') {
|
||||
|
||||
$rssid = insert_record('block_rss_client', $dataobject);
|
||||
if (!$rssid) {
|
||||
error('There was an error trying to add a new rss feed:'. $url);
|
||||
print_error('There was an error trying to add a new rss feed:'. $url);
|
||||
}
|
||||
|
||||
// By capturing the output from fetch_rss this way
|
||||
@ -199,7 +200,7 @@ if ($act == 'updfeed') {
|
||||
$dataobject->title = addslashes($rss->channel['title']);
|
||||
}
|
||||
if (!update_record('block_rss_client', $dataobject)) {
|
||||
error('There was an error trying to update rss feed with id:'. $rssid);
|
||||
print_error('There was an error trying to update rss feed with id:'. $rssid);
|
||||
}
|
||||
$message .= '<br />'. get_string('feedadded', 'block_rss_client');
|
||||
}
|
||||
@ -222,9 +223,10 @@ if ($act == 'updfeed') {
|
||||
} else if ($act == 'delfeed') {
|
||||
|
||||
if (!$managefeeds) {
|
||||
error(get_string('noguestpost', 'forum').
|
||||
' You are not allowed to make modifications to this RSS feed at this time.',
|
||||
$referrer);
|
||||
//print_error(get_string('noguestpost', 'forum').
|
||||
// ' You are not allowed to make modifications to this RSS feed at this time.',
|
||||
// $referrer);
|
||||
print_error('noguestpost', 'forum', $referrer, 'You are not allowed to make modifications to this RSS feed at this time.');
|
||||
}
|
||||
|
||||
$file = $CFG->dataroot .'/cache/rsscache/'. $rssid .'.xml';
|
||||
|
@ -57,7 +57,7 @@ class page_blog extends page_base {
|
||||
$courserecord = NULL;
|
||||
} else {
|
||||
if (! ($courserecord = get_record('course', 'id', $this->courseid)) ) {
|
||||
error( 'You are tring to view an invalid course. Id: ('. $this->courseid .')' );
|
||||
print_error( 'You are tring to view an invalid course. Id: ('. $this->courseid .')' );
|
||||
}
|
||||
}
|
||||
$this->full_init_done = true;
|
||||
|
@ -12,32 +12,32 @@ $courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tab - d
|
||||
require_login($courseid);
|
||||
|
||||
if (empty($CFG->bloglevel)) {
|
||||
error('Blogging is disabled!');
|
||||
print_error('Blogging is disabled!');
|
||||
}
|
||||
|
||||
if (isguest()) {
|
||||
error(get_string('noguestpost', 'blog'));
|
||||
print_error('noguestpost', 'blog');
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
if (!has_capability('moodle/blog:create', $sitecontext) and !has_capability('moodle/blog:manageentries', $sitecontext)) {
|
||||
error('You can not post or edit blogs.');
|
||||
print_error('You can not post or edit blogs.');
|
||||
}
|
||||
|
||||
// Make sure that the person trying to edit have access right
|
||||
if ($id) {
|
||||
if (!$existing = get_record('post', 'id', $id)) {
|
||||
error('Wrong blog post id');
|
||||
print_error('Wrong blog post id');
|
||||
}
|
||||
|
||||
if (!blog_user_can_edit_post($existing)) {
|
||||
error(get_string('notallowedtoedit', 'blog'));
|
||||
print_error('notallowedtoedit', 'blog');
|
||||
}
|
||||
$userid = $existing->userid;
|
||||
$returnurl = $CFG->wwwroot.'/blog/index.php?userid='.$existing->userid;
|
||||
} else {
|
||||
if (!has_capability('moodle/blog:create', $sitecontext)) {
|
||||
error(get_string('nopost', 'blog')); // manageentries is not enough for adding
|
||||
print_error('nopost', 'blog'); // manageentries is not enough for adding
|
||||
}
|
||||
$existing = false;
|
||||
$userid = $USER->id;
|
||||
@ -52,7 +52,7 @@ $strblogs = get_string('blogs','blog');
|
||||
|
||||
if ($action=='delete'){
|
||||
if (!$existing) {
|
||||
error('Incorrect blog post id');
|
||||
print_error('Incorrect blog post id');
|
||||
}
|
||||
if (data_submitted() and $confirm and confirm_sesskey()) {
|
||||
do_delete($existing);
|
||||
@ -83,12 +83,12 @@ if ($blogeditform->is_cancelled()){
|
||||
|
||||
case 'edit':
|
||||
if (!$existing) {
|
||||
error('Incorrect blog post id');
|
||||
print_error('Incorrect blog post id');
|
||||
}
|
||||
do_edit($fromform, $blogeditform);
|
||||
break;
|
||||
default :
|
||||
error('Unknown action!');
|
||||
print_error('Unknown action!');
|
||||
}
|
||||
redirect($returnurl);
|
||||
}
|
||||
@ -105,7 +105,7 @@ switch ($action) {
|
||||
|
||||
case 'edit':
|
||||
if (!$existing) {
|
||||
error('Incorrect blog post id');
|
||||
print_error('Incorrect blog post id');
|
||||
}
|
||||
$post->id = $existing->id;
|
||||
$post->subject = $existing->subject;
|
||||
@ -124,12 +124,12 @@ switch ($action) {
|
||||
}
|
||||
break;
|
||||
default :
|
||||
error('Unknown action!');
|
||||
print_error('Unknown action!');
|
||||
}
|
||||
|
||||
// done here in order to allow deleting of posts with wrong user id above
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
error('Incorrect user id');
|
||||
print_error('Incorrect user id');
|
||||
}
|
||||
$navlinks = array();
|
||||
$navlinks[] = array('name' => fullname($user), 'link' => "$CFG->wwwroot/user/view.php?id=$userid", 'type' => 'misc');
|
||||
@ -164,7 +164,7 @@ function do_delete($post) {
|
||||
add_to_log(SITEID, 'blog', 'delete', 'index.php?userid='. $post->userid, 'deleted blog entry with entry id# '. $post->id);
|
||||
|
||||
if (!$status) {
|
||||
error('Error occured while deleting post', $returnurl);
|
||||
print_error('Error occured while deleting post', '', $returnurl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ function do_add($post, $blogeditform) {
|
||||
add_to_log(SITEID, 'blog', 'add', 'index.php?userid='.$post->userid.'&postid='.$post->id, $post->subject);
|
||||
|
||||
} else {
|
||||
error('There was an error adding this post in the database', $returnurl);
|
||||
print_error('There was an error adding this post in the database', '', $returnurl);
|
||||
}
|
||||
|
||||
}
|
||||
@ -226,7 +226,7 @@ function do_edit($post, $blogeditform) {
|
||||
add_to_log(SITEID, 'blog', 'update', 'index.php?userid='.$USER->id.'&postid='.$post->id, $post->subject);
|
||||
|
||||
} else {
|
||||
error('There was an error updating this post in the database', $returnurl);
|
||||
print_error('There was an error updating this post in the database', '', $returnurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ blog_check_and_install_blocks();
|
||||
|
||||
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('The course number was incorrect ('. $courseid .')');
|
||||
print_error('The course number was incorrect ('. $courseid .')');
|
||||
}
|
||||
|
||||
// Bounds for block widths
|
||||
@ -99,7 +99,7 @@ $tagstring = get_string('tag');
|
||||
|
||||
// needed also for user tabs later
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Wrong course id');
|
||||
print_error('Wrong course id');
|
||||
}
|
||||
|
||||
$navlinks = array();
|
||||
@ -165,7 +165,7 @@ $navlinks = array();
|
||||
case 'user':
|
||||
$participants = get_string('participants');
|
||||
if (!$user = get_record('user', 'id', $filterselect)) {
|
||||
error('Wrong user id');
|
||||
print_error('Wrong user id');
|
||||
}
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
|
@ -24,7 +24,7 @@ $courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tab
|
||||
|
||||
|
||||
if (empty($CFG->bloglevel)) {
|
||||
error('Blogging is disabled!');
|
||||
print_error('Blogging is disabled!');
|
||||
}
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
@ -55,48 +55,48 @@ switch ($filtertype) {
|
||||
|
||||
case 'site':
|
||||
if ($CFG->bloglevel < BLOG_SITE_LEVEL) {
|
||||
error('Site blogs is not enabled');
|
||||
print_error('Site blogs is not enabled');
|
||||
}
|
||||
if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL) {
|
||||
require_login();
|
||||
}
|
||||
if (!has_capability('moodle/blog:view', $sitecontext)) {
|
||||
error('You do not have the required permissions to view all site blogs');
|
||||
print_error('You do not have the required permissions to view all site blogs');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'course':
|
||||
if ($CFG->bloglevel < BLOG_COURSE_LEVEL) {
|
||||
error('Course blogs is not enabled');
|
||||
print_error('Course blogs is not enabled');
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $filterselect)) {
|
||||
error('Incorrect course id specified');
|
||||
print_error('Incorrect course id specified');
|
||||
}
|
||||
$courseid = $course->id;
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_login($course);
|
||||
if (!has_capability('moodle/blog:view', $coursecontext)) {
|
||||
error('You do not have the required permissions to view blogs in this course');
|
||||
print_error('You do not have the required permissions to view blogs in this course');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'group':
|
||||
if ($CFG->bloglevel < BLOG_GROUP_LEVEL) {
|
||||
error('Group blogs is not enabled');
|
||||
print_error('Group blogs is not enabled');
|
||||
}
|
||||
|
||||
// fix for MDL-9268
|
||||
if (! $group = groups_get_group($filterselect)) { //TODO:check.
|
||||
error('Incorrect group id specified');
|
||||
print_error('Incorrect group id specified');
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $group->courseid)) {
|
||||
error('Incorrect course id specified');
|
||||
print_error('Incorrect course id specified');
|
||||
}
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
$courseid = $course->id;
|
||||
require_login($course);
|
||||
if (!has_capability('moodle/blog:view', $coursecontext)) {
|
||||
error('You do not have the required permissions to view blogs in this course/group');
|
||||
print_error('You do not have the required permissions to view blogs in this course/group');
|
||||
}
|
||||
if (groups_get_course_groupmode($course) == SEPARATEGROUPS
|
||||
and !has_capability('moodle/site:accessallgroups', $coursecontext)) {
|
||||
@ -109,24 +109,24 @@ switch ($filtertype) {
|
||||
|
||||
case 'user':
|
||||
if ($CFG->bloglevel < BLOG_USER_LEVEL) {
|
||||
error('Blogs is not enabled');
|
||||
print_error('Blogs is not enabled');
|
||||
}
|
||||
if (!$user = get_record('user', 'id', $filterselect)) {
|
||||
error('Incorrect user id');
|
||||
print_error('Incorrect user id');
|
||||
}
|
||||
if ($USER->id == $filterselect) {
|
||||
if (!has_capability('moodle/blog:create', $sitecontext)
|
||||
and !has_capability('moodle/blog:view', $sitecontext)) {
|
||||
error('You do not have your own blog, sorry.');
|
||||
print_error('You do not have your own blog, sorry.');
|
||||
}
|
||||
} else {
|
||||
$personalcontext = get_context_instance(CONTEXT_USER, $filterselect);
|
||||
if (!has_capability('moodle/blog:view', $sitecontext)
|
||||
and !has_capability('moodle/user:readuserblogs', $personalcontext)) {
|
||||
error('You do not have the required permissions to read user blogs');
|
||||
print_error('You do not have the required permissions to read user blogs');
|
||||
}
|
||||
if (!blog_user_can_view_user_post($filterselect)) {
|
||||
error('You can not view blog of this user, sorry.');
|
||||
print_error('You can not view blog of this user, sorry.');
|
||||
}
|
||||
}
|
||||
$userid = $filterselect;
|
||||
@ -138,7 +138,7 @@ switch ($filtertype) {
|
||||
break;
|
||||
|
||||
default:
|
||||
error('Incorrect blog filter type specified');
|
||||
print_error('Incorrect blog filter type specified');
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
}
|
||||
|
||||
if (empty($CFG->bloglevel)) {
|
||||
error('Blogging is disabled!');
|
||||
print_error('Blogging is disabled!');
|
||||
}
|
||||
|
||||
require_capability('moodle/blog:view', $context);
|
||||
@ -26,7 +26,7 @@
|
||||
$pagesize = required_param('pagesize', PARAM_INT);
|
||||
|
||||
if ($pagesize < 1) {
|
||||
error('invalid page size');
|
||||
print_error('invalid page size');
|
||||
}
|
||||
set_user_preference('blogpagesize', $pagesize);
|
||||
|
||||
|
@ -107,10 +107,10 @@
|
||||
$title = get_string('deleteevent', 'calendar');
|
||||
$event = get_record('event', 'id', $eventid);
|
||||
if($event === false) {
|
||||
error('Invalid event');
|
||||
print_error('Invalid event');
|
||||
}
|
||||
if(!calendar_edit_event_allowed($event)) {
|
||||
error('You are not authorized to do this');
|
||||
print_error('You are not authorized to do this');
|
||||
}
|
||||
break;
|
||||
|
||||
@ -120,10 +120,10 @@
|
||||
$repeats = optional_param('repeats', 0, PARAM_INT);
|
||||
|
||||
if($event === false) {
|
||||
error('Invalid event');
|
||||
print_error('Invalid event');
|
||||
}
|
||||
if(!calendar_edit_event_allowed($event)) {
|
||||
error('You are not authorized to do this');
|
||||
print_error('You are not authorized to do this');
|
||||
}
|
||||
|
||||
if($form = data_submitted()) {
|
||||
@ -211,7 +211,7 @@
|
||||
$form->timeduration = 0;
|
||||
}
|
||||
if(!calendar_add_event_allowed($form)) {
|
||||
error('You are not authorized to do this');
|
||||
print_error('You are not authorized to do this');
|
||||
}
|
||||
validate_form($form, $err);
|
||||
if (count($err) == 0) {
|
||||
@ -488,7 +488,7 @@
|
||||
case 'select':
|
||||
break;
|
||||
default:
|
||||
error('Unsupported event type');
|
||||
print_error('Unsupported event type');
|
||||
}
|
||||
|
||||
$form->format = $defaultformat;
|
||||
@ -504,7 +504,7 @@
|
||||
$courseid = SITEID;
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Incorrect course ID');
|
||||
print_error('Incorrect course ID');
|
||||
}
|
||||
|
||||
$groupid = groups_get_course_group($course);
|
||||
@ -593,7 +593,7 @@ function validate_form(&$form, &$err) {
|
||||
// Timestamps must be >= course startdate
|
||||
$course = get_record('course', 'id', $form->courseid);
|
||||
if($course === false) {
|
||||
error('Event belongs to invalid course');
|
||||
print_error('Event belongs to invalid course');
|
||||
}
|
||||
else if($form->timestart < $course->startdate) {
|
||||
$err['timestart'] = get_string('errorbeforecoursestart', 'calendar');
|
||||
|
@ -431,7 +431,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
|
||||
// TODO: rewrite this hack somehow
|
||||
if (!calendar_edit_event_allowed($event)){ // cannot manage entries, eg. student
|
||||
if(!$assignment = get_record('assignment','id',$event->instance)){
|
||||
// error("assignment ID was incorrect");
|
||||
// print_error("assignment ID was incorrect");
|
||||
continue;
|
||||
}
|
||||
// assign assignment to assignment object to use hidden_is_hidden method
|
||||
|
@ -24,19 +24,19 @@
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
print_error("Site isn't defined!");
|
||||
}
|
||||
|
||||
if (empty($id)) {
|
||||
error("Category not known!");
|
||||
print_error("Category not known!");
|
||||
}
|
||||
|
||||
if (!$context = get_context_instance(CONTEXT_COURSECAT, $id)) {
|
||||
error("Category not known!");
|
||||
print_error("Category not known!");
|
||||
}
|
||||
|
||||
if (!$category = get_record("course_categories", "id", $id)) {
|
||||
error("Category not known!");
|
||||
print_error("Category not known!");
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:create', $context)) {
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
} else {
|
||||
if (!$category->visible) {
|
||||
error(get_string('notavailable', 'error'));
|
||||
print_error('notavailable', 'error');
|
||||
}
|
||||
$navbaritem = print_course_search("", true, "navbar");
|
||||
$adminediting = false;
|
||||
@ -170,7 +170,7 @@
|
||||
require_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $moveto));
|
||||
|
||||
if (! $destcategory = get_record("course_categories", "id", $data->moveto)) {
|
||||
error("Error finding the category");
|
||||
print_error("Error finding the category");
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,11 +9,11 @@
|
||||
require_login();
|
||||
|
||||
if (!can_delete_course($id)) {
|
||||
error('You do not have the permission to delete this course.');
|
||||
print_error('You do not have the permission to delete this course.');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site not found!");
|
||||
print_error("Site not found!");
|
||||
}
|
||||
|
||||
$strdeletecourse = get_string("deletecourse");
|
||||
@ -21,7 +21,7 @@
|
||||
$strcategories = get_string("categories");
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course ID was incorrect (can't find it)");
|
||||
print_error("Course ID was incorrect (can't find it)");
|
||||
}
|
||||
|
||||
$category = get_record("course_categories", "id", $course->category);
|
||||
@ -49,11 +49,11 @@
|
||||
}
|
||||
|
||||
if ($delete != md5($course->timemodified)) {
|
||||
error("The check variable was wrong - try again");
|
||||
print_error("The check variable was wrong - try again");
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
// OK checks done, delete the course now.
|
||||
|
@ -16,11 +16,11 @@
|
||||
|
||||
if($id == SITEID){
|
||||
// don't allow editing of 'site course' using this from
|
||||
error('You cannot edit the site course using this form');
|
||||
print_error('You cannot edit the site course using this form');
|
||||
}
|
||||
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
error('Course ID was incorrect');
|
||||
print_error('Course ID was incorrect');
|
||||
}
|
||||
require_login($course->id);
|
||||
$category = get_record('course_categories', 'id', $course->category);
|
||||
@ -30,12 +30,12 @@
|
||||
$course = null;
|
||||
require_login();
|
||||
if (!$category = get_record('course_categories', 'id', $categoryid)) {
|
||||
error('Category ID was incorrect');
|
||||
print_error('Category ID was incorrect');
|
||||
}
|
||||
require_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id));
|
||||
} else {
|
||||
require_login();
|
||||
error('Either course id or category must be specified');
|
||||
print_error('Either course id or category must be specified');
|
||||
}
|
||||
|
||||
/// prepare course
|
||||
|
@ -22,7 +22,7 @@ $categoryupdate = optional_param('categoryupdate', 0, PARAM_BOOL); // Enables th
|
||||
$resort = optional_param('resort', 0, PARAM_BOOL);
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error("Site isn't defined!");
|
||||
print_error("Site isn't defined!");
|
||||
}
|
||||
|
||||
if ($categoryadd) { // Show Add category form: if $id is given, it is used as the parent category
|
||||
@ -33,7 +33,7 @@ if ($categoryadd) { // Show Add category form: if $id is given, it is used as th
|
||||
$strtitle = get_string("editcategorysettings");
|
||||
$context = get_context_instance(CONTEXT_COURSECAT, $id);
|
||||
if (!$category = get_record("course_categories", "id", $id)) {
|
||||
error("Category not known!");
|
||||
print_error("Category not known!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ if ($mform->is_cancelled()){
|
||||
}
|
||||
|
||||
if (!update_record('course_categories', $newcategory)) {
|
||||
error( "Could not update the category '$newcategory->name' ");
|
||||
print_error( "Could not update the category '$newcategory->name' ");
|
||||
} else {
|
||||
if ($newcategory->parent == 0) {
|
||||
$redirect_link = 'index.php?categoryedit=on';
|
||||
@ -117,7 +117,7 @@ if ($id && !$categoryadd && !$categoryupdate && false) {
|
||||
|
||||
} else {
|
||||
if (!$category->visible) {
|
||||
error(get_string('notavailable', 'error'));
|
||||
print_error('notavailable', 'error');
|
||||
}
|
||||
$navbaritem = print_course_search("", true, "navbar");
|
||||
$adminediting = false;
|
||||
@ -210,7 +210,7 @@ if ($id && !$categoryadd && !$categoryupdate && false) {
|
||||
require_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $moveto));
|
||||
|
||||
if (!$destcategory = get_record("course_categories", "id", $data->moveto)) {
|
||||
error("Error finding the destination category");
|
||||
print_error("Error finding the destination category");
|
||||
}
|
||||
// TODO function to move the category
|
||||
}
|
||||
|
@ -7,11 +7,11 @@
|
||||
$id = required_param('id',PARAM_INT); // Week ID
|
||||
|
||||
if (! $section = get_record("course_sections", "id", $id)) {
|
||||
error("Course section is incorrect");
|
||||
print_error("Course section is incorrect");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $section->course)) {
|
||||
error("Could not find the course!");
|
||||
print_error("Could not find the course!");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
@ -25,7 +25,7 @@
|
||||
$timenow = time();
|
||||
|
||||
if (! set_field("course_sections", "summary", $form->summary, "id", $section->id)) {
|
||||
error("Could not update the summary!");
|
||||
print_error("Could not update the summary!");
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section");
|
||||
|
@ -20,11 +20,11 @@
|
||||
}
|
||||
|
||||
if (! $course = get_record('course', 'id', $id) ) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
if (! $context = get_context_instance(CONTEXT_COURSE, $course->id) ) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
/// do not use when in course login as
|
||||
|
@ -39,7 +39,7 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
if (($marker >=0) and has_capability('moodle/course:setcurrentsection', $context) and confirm_sesskey()) {
|
||||
$course->marker = $marker;
|
||||
if (! set_field("course", "marker", $marker, "id", $course->id)) {
|
||||
error("Could not mark that topic for this course");
|
||||
print_error("Could not mark that topic for this course");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
if (($marker >=0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
|
||||
$course->marker = $marker;
|
||||
if (! set_field("course", "marker", $marker, "id", $course->id)) {
|
||||
error("Could not mark that topic for this course");
|
||||
print_error("Could not mark that topic for this course");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
$id = required_param('id', PARAM_INT); // course id to import TO
|
||||
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
@ -13,11 +13,11 @@
|
||||
$strimportactivities = get_string('importactivities');
|
||||
|
||||
if (! ($course = get_record("course", "id", $id)) ) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
if (!$site = get_site()){
|
||||
error("Couldn't get site course");
|
||||
print_error("Couldn't get site course");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
@ -28,7 +28,7 @@
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
if (!has_capability('moodle/course:manageactivities', $tocontext)) {
|
||||
error("You need do not have the required permissions to import activities to this course");
|
||||
print_error("You need do not have the required permissions to import activities to this course");
|
||||
}
|
||||
|
||||
// if we're not a course creator , we can only import from our own courses.
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
if ($from = get_record('course', 'id', $fromcourse)) {
|
||||
if (!has_capability('moodle/course:manageactivities', $fromcontext)) {
|
||||
error("You need to have the required permissions in the course you are importing data from, as well");
|
||||
print_error("You need to have the required permissions in the course you are importing data from, as well");
|
||||
}
|
||||
if (!empty($filename) && file_exists($CFG->dataroot.'/'.$filename) && !empty($SESSION->import_preferences)) {
|
||||
$restore = backup_to_restore_array($SESSION->import_preferences);
|
||||
|
@ -9,7 +9,7 @@
|
||||
$id = required_param('id', PARAM_INT); // Course id
|
||||
|
||||
if (! $course = get_record('course', 'id', $id) ) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
@ -17,11 +17,11 @@
|
||||
|
||||
|
||||
if (!has_capability('moodle/course:managegroups', $context)) {
|
||||
error("You do not have the required permissions to manage groups.");
|
||||
print_error("You do not have the required permissions to manage groups.");
|
||||
}
|
||||
|
||||
//if (!confirm_sesskey()) {
|
||||
// error(get_string('confirmsesskeybad', 'error'));
|
||||
// print_error('confirmsesskeybad', 'error');
|
||||
//}
|
||||
|
||||
$strimportgroups = get_string("importgroups");
|
||||
@ -87,7 +87,7 @@
|
||||
if ( !(isset($required[$h]) or
|
||||
isset($optionalDefaults[$h]) or
|
||||
isset($optional[$h])) ) {
|
||||
error(get_string('invalidfieldname', 'error', $h), 'index.php?id='.$id.'&sesskey='.$USER->sesskey);
|
||||
print_error('invalidfieldname', 'error', 'index.php?id='.$id.'&sesskey='.$USER->sesskey, $h);
|
||||
}
|
||||
if ( isset($required[$h]) ) {
|
||||
$required[$h] = 2;
|
||||
@ -96,7 +96,7 @@
|
||||
// check for required fields
|
||||
foreach ($required as $key => $value) {
|
||||
if ($value < 2) {
|
||||
error(get_string('fieldrequired', 'error', $key), 'uploaduser.php?id='.$id.'&sesskey='.$USER->sesskey);
|
||||
print_error('fieldrequired', 'error', 'uploaduser.php?id='.$id.'&sesskey='.$USER->sesskey, $key);
|
||||
}
|
||||
}
|
||||
$linenum = 2; // since header is line 1
|
||||
@ -121,10 +121,11 @@
|
||||
foreach ($record as $name => $value) {
|
||||
// check for required values
|
||||
if (isset($required[$name]) and !$value) {
|
||||
error(get_string('missingfield', 'error', $name). " ".
|
||||
get_string('erroronline', 'error', $linenum) .". ".
|
||||
get_string('processingstops', 'error'),
|
||||
'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
//error(get_string('missingfield', 'error', $name). " ".
|
||||
// get_string('erroronline', 'error', $linenum) .". ".
|
||||
// get_string('processingstops', 'error'),
|
||||
// 'uploaduser.php?sesskey='.$USER->sesskey);
|
||||
print_error('missingfield', 'error', 'uploaduser.php?sesskey='.$USER->sesskey, $name);
|
||||
}
|
||||
else if ($name == "groupname") {
|
||||
$newgroup->name = addslashes($value);
|
||||
|
@ -20,7 +20,7 @@
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course ID was incorrect (can't find it)");
|
||||
print_error("Course ID was incorrect (can't find it)");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
@ -65,7 +65,7 @@
|
||||
$addcourse = clean_param($addcourse, PARAM_INT);
|
||||
set_time_limit(180);
|
||||
if (!add_to_metacourse($course->id,$addcourse)) {
|
||||
error("Could not add the selected course to this meta course!");
|
||||
print_error("Could not add the selected course to this meta course!");
|
||||
}
|
||||
}
|
||||
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
|
||||
@ -73,7 +73,7 @@
|
||||
set_time_limit(180);
|
||||
$removecourse = clean_param($removecourse, PARAM_INT);
|
||||
if (! remove_from_metacourse($course->id,$removecourse)) {
|
||||
error("Could not remove the selected course from this meta course!");
|
||||
print_error("Could not remove the selected course from this meta course!");
|
||||
}
|
||||
}
|
||||
} else if ($showall and confirm_sesskey()) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
$context = $sysctx;
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error('Site isn\'t defined!');
|
||||
print_error('Site isn\'t defined!');
|
||||
}
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
@ -120,7 +120,7 @@
|
||||
if ($childcats = get_records('course_categories', 'parent', $deletecat->id)) {
|
||||
foreach ($childcats as $childcat) {
|
||||
if (! set_field('course_categories', 'parent', $deletecat->parent, 'id', $childcat->id)) {
|
||||
error('Could not update a child category!', 'index.php');
|
||||
print_error('Could not update a child category!', 'index.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -131,7 +131,7 @@
|
||||
if ($childcourses = get_records('course', 'category', $deletecat->id)) {
|
||||
foreach ($childcourses as $childcourse) {
|
||||
if (! set_field('course', 'category', $deletecat->parent, 'id', $childcourse->id)) {
|
||||
error('Could not update a child course!', 'index.php');
|
||||
print_error('Could not update a child course!', 'index.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,7 +163,7 @@
|
||||
unset($tempcat);
|
||||
$tempcat->name = get_string('miscellaneous');
|
||||
if (!$tempcat->id = insert_record('course_categories', $tempcat)) {
|
||||
error('Serious error: Could not create a default category!');
|
||||
print_error('Serious error: Could not create a default category!');
|
||||
}
|
||||
$tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id);
|
||||
mark_context_dirty('/'.SYSCONTEXTID);
|
||||
|
@ -9,16 +9,16 @@
|
||||
$name = optional_param('name', false, PARAM_RAW); // Course short name
|
||||
|
||||
if (!$id and !$name) {
|
||||
error("Must specify course id or short name");
|
||||
print_error("Must specify course id or short name");
|
||||
}
|
||||
|
||||
if ($name) {
|
||||
if (! $course = get_record("course", "shortname", $name) ) {
|
||||
error("That's an invalid short course name");
|
||||
print_error("That's an invalid short course name");
|
||||
}
|
||||
} else {
|
||||
if (! $course = get_record("course", "id", $id) ) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
if ((!course_parent_visible($course) || (! $course->visible)) && !has_capability('moodle/course:viewhiddencourses', $context)) {
|
||||
error(get_string('coursehidden'), $CFG->wwwroot .'/');
|
||||
print_error('coursehidden', '', $CFG->wwwroot .'/');
|
||||
}
|
||||
|
||||
print_header(get_string("summaryof", "", $course->fullname));
|
||||
|
@ -1169,7 +1169,7 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
|
||||
}
|
||||
asort($modnames, SORT_LOCALE_STRING);
|
||||
} else {
|
||||
error("No modules are installed!");
|
||||
print_error("No modules are installed!");
|
||||
}
|
||||
|
||||
if ($rawmods = get_course_mods($courseid)) {
|
||||
@ -1930,7 +1930,7 @@ function print_my_moodle() {
|
||||
global $USER, $CFG;
|
||||
|
||||
if (empty($USER->id)) {
|
||||
error("It shouldn't be possible to see My Moodle without being logged in.");
|
||||
print_error("It shouldn't be possible to see My Moodle without being logged in.");
|
||||
}
|
||||
|
||||
$courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', array('summary'));
|
||||
@ -2511,7 +2511,7 @@ function course_in_meta ($course) {
|
||||
*/
|
||||
function print_standard_coursemodule_settings($form, $features=null) {
|
||||
if (! $course = get_record('course', 'id', $form->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
print_groupmode_setting($form, $course);
|
||||
if (!empty($features->groupings)) {
|
||||
@ -2527,12 +2527,12 @@ function print_groupmode_setting($form, $course=NULL) {
|
||||
|
||||
if (empty($course)) {
|
||||
if (! $course = get_record('course', 'id', $form->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
}
|
||||
if ($form->coursemodule) {
|
||||
if (! $cm = get_record('course_modules', 'id', $form->coursemodule)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
$groupmode = groups_get_activity_groupmode($cm);
|
||||
} else {
|
||||
@ -2560,12 +2560,12 @@ function print_grouping_settings($form, $course=NULL) {
|
||||
|
||||
if (empty($course)) {
|
||||
if (! $course = get_record('course', 'id', $form->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
}
|
||||
if ($form->coursemodule) {
|
||||
if (! $cm = get_record('course_modules', 'id', $form->coursemodule)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
} else {
|
||||
$cm = null;
|
||||
@ -2599,7 +2599,7 @@ function print_grouping_settings($form, $course=NULL) {
|
||||
function print_visible_setting($form, $course=NULL) {
|
||||
if (empty($course)) {
|
||||
if (! $course = get_record('course', 'id', $form->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
}
|
||||
if ($form->coursemodule) {
|
||||
|
@ -46,7 +46,7 @@
|
||||
}
|
||||
|
||||
if (! $course = get_record('course', 'id', $id)) {
|
||||
error("Course ID was incorrect");
|
||||
print_error("Course ID was incorrect");
|
||||
}
|
||||
|
||||
/// User must be logged in
|
||||
@ -65,7 +65,7 @@
|
||||
require_login($course);
|
||||
require_capability('moodle/user:loginas', $coursecontext);
|
||||
if (!has_capability('moodle/course:view', $coursecontext, $userid, false)) {
|
||||
error('This user is not in this course!');
|
||||
print_error('This user is not in this course!');
|
||||
}
|
||||
if (has_capability('moodle/site:doanything', $coursecontext, $userid, false)) {
|
||||
print_error('nologinas');
|
||||
|
@ -58,7 +58,7 @@
|
||||
{$CFG->prefix}modules md
|
||||
WHERE cm.id = '$update' AND
|
||||
md.id = cm.module")){
|
||||
error('Invalid course module id!');
|
||||
print_error('Invalid course module id!');
|
||||
}
|
||||
$returntomod = optional_param('return', 0, PARAM_BOOL);
|
||||
if (file_exists("../mod/$modname/mod_form.php")) {
|
||||
@ -72,17 +72,17 @@
|
||||
|
||||
if (empty($mod->coursemodule)) { //add
|
||||
if (! $course = get_record("course", "id", $mod->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
$mod->instance = '';
|
||||
$mod->coursemodule = '';
|
||||
} else { //delete and update
|
||||
if (! $cm = get_record("course_modules", "id", $mod->coursemodule)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
$mod->instance = $cm->instance;
|
||||
$mod->coursemodule = $cm->id;
|
||||
@ -99,7 +99,7 @@
|
||||
if (file_exists($modlib)) {
|
||||
include_once($modlib);
|
||||
} else {
|
||||
error("This module is missing important code! ($modlib)");
|
||||
print_error("This module is missing important code! ($modlib)");
|
||||
}
|
||||
$addinstancefunction = $mod->modulename."_add_instance";
|
||||
$updateinstancefunction = $mod->modulename."_update_instance";
|
||||
@ -122,10 +122,10 @@
|
||||
include_once($moderr);
|
||||
die;
|
||||
}
|
||||
error("Could not update the $mod->modulename", "view.php?id=$course->id");
|
||||
print_error("Could not update the $mod->modulename", '', "view.php?id=$course->id");
|
||||
}
|
||||
if (is_string($return)) {
|
||||
error($return, "view.php?id=$course->id");
|
||||
print_error($return, '', "view.php?id=$course->id");
|
||||
}
|
||||
|
||||
if (isset($mod->visible)) {
|
||||
@ -161,7 +161,7 @@
|
||||
case "add":
|
||||
|
||||
if (!course_allowed_module($course,$mod->modulename)) {
|
||||
error("This module ($mod->modulename) has been disabled for this particular course");
|
||||
print_error("This module ($mod->modulename) has been disabled for this particular course");
|
||||
}
|
||||
|
||||
if (!isset($mod->name) || trim($mod->name) == '') {
|
||||
@ -175,10 +175,10 @@
|
||||
include_once($moderr);
|
||||
die;
|
||||
}
|
||||
error("Could not add a new instance of $mod->modulename", "view.php?id=$course->id");
|
||||
print_error("Could not add a new instance of $mod->modulename", '', "view.php?id=$course->id");
|
||||
}
|
||||
if (is_string($return)) {
|
||||
error($return, "view.php?id=$course->id");
|
||||
print_error($return, '', "view.php?id=$course->id");
|
||||
}
|
||||
|
||||
if (!isset($mod->groupmode)) { // to deal with pre-1.5 modules
|
||||
@ -198,14 +198,14 @@
|
||||
// to each other, so we have to update one of them twice.
|
||||
|
||||
if (! $mod->coursemodule = add_course_module($mod) ) {
|
||||
error("Could not add a new course module");
|
||||
print_error("Could not add a new course module");
|
||||
}
|
||||
if (! $sectionid = add_mod_to_section($mod) ) {
|
||||
error("Could not add the new course module to that section");
|
||||
print_error("Could not add the new course module to that section");
|
||||
}
|
||||
|
||||
if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
|
||||
error("Could not update the course module with the correct section");
|
||||
print_error("Could not update the course module with the correct section");
|
||||
}
|
||||
|
||||
if (!isset($mod->visible)) { // We get the section's visible field status
|
||||
@ -250,7 +250,7 @@
|
||||
"$mod->modulename $mod->instance", $mod->coursemodule);
|
||||
break;
|
||||
default:
|
||||
error("No mode defined");
|
||||
print_error("No mode defined");
|
||||
|
||||
}
|
||||
|
||||
@ -269,21 +269,21 @@
|
||||
if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $USER->activitycopy)) {
|
||||
error("The copied course module doesn't exist!");
|
||||
print_error("The copied course module doesn't exist!");
|
||||
}
|
||||
|
||||
if (!empty($movetosection)) {
|
||||
if (! $section = get_record("course_sections", "id", $movetosection)) {
|
||||
error("This section doesn't exist");
|
||||
print_error("This section doesn't exist");
|
||||
}
|
||||
$beforecm = NULL;
|
||||
|
||||
} else { // normal moveto
|
||||
if (! $beforecm = get_record("course_modules", "id", $moveto)) {
|
||||
error("The destination course module doesn't exist");
|
||||
print_error("The destination course module doesn't exist");
|
||||
}
|
||||
if (! $section = get_record("course_sections", "id", $beforecm->section)) {
|
||||
error("This section doesn't exist");
|
||||
print_error("This section doesn't exist");
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (!ismoving($section->course)) {
|
||||
error("You need to copy something first!");
|
||||
print_error("You need to copy something first!");
|
||||
}
|
||||
|
||||
moveto_module($cm, $section, $beforecm);
|
||||
@ -314,7 +314,7 @@
|
||||
$id = required_param('id',PARAM_INT);
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
@ -328,7 +328,7 @@
|
||||
}
|
||||
|
||||
if (!set_field("course_modules", "indent", $cm->indent, "id", $cm->id)) {
|
||||
error("Could not update the indent level on that course module");
|
||||
print_error("Could not update the indent level on that course module");
|
||||
}
|
||||
|
||||
if (SITEID == $cm->course) {
|
||||
@ -341,7 +341,7 @@
|
||||
} else if (!empty($hide) and confirm_sesskey()) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $hide)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
@ -362,7 +362,7 @@
|
||||
} else if (!empty($show) and confirm_sesskey()) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $show)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
@ -370,11 +370,11 @@
|
||||
require_capability('moodle/course:activityvisibility', $context);
|
||||
|
||||
if (! $section = get_record("course_sections", "id", $cm->section)) {
|
||||
error("This module doesn't exist");
|
||||
print_error("This module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
error("This module doesn't exist");
|
||||
print_error("This module doesn't exist");
|
||||
}
|
||||
|
||||
if ($module->visible and ($section->visible or (SITEID == $cm->course))) {
|
||||
@ -394,7 +394,7 @@
|
||||
$id = required_param( 'id', PARAM_INT );
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
@ -415,7 +415,7 @@
|
||||
} else if (!empty($copy) and confirm_sesskey()) { // value = course module
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $copy)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
@ -423,15 +423,15 @@
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $section = get_record("course_sections", "id", $cm->section)) {
|
||||
error("This module doesn't exist");
|
||||
print_error("This module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
error("This module doesn't exist");
|
||||
print_error("This module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $instance = get_record($module->name, "id", $cm->instance)) {
|
||||
error("Could not find the instance of this module");
|
||||
print_error("Could not find the instance of this module");
|
||||
}
|
||||
|
||||
$USER->activitycopy = $copy;
|
||||
@ -453,11 +453,11 @@
|
||||
} else if (!empty($delete) and confirm_sesskey()) { // value = course module
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $delete)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
@ -465,7 +465,7 @@
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
error("This module doesn't exist");
|
||||
print_error("This module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $instance = get_record($module->name, "id", $cm->instance)) {
|
||||
@ -476,7 +476,7 @@
|
||||
if (! delete_course_module($cm->id)) {
|
||||
notify("Could not delete the $module->name (coursemodule)");
|
||||
}
|
||||
error("The required instance of this module didn't exist. Module deleted.",
|
||||
print_error("The required instance of this module didn't exist. Module deleted.",
|
||||
"$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
}
|
||||
|
||||
@ -510,11 +510,11 @@
|
||||
} else if (!empty($update) and confirm_sesskey()) { // value = course module
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $update)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
|
||||
require_login($course->id); // needed to setup proper $COURSE
|
||||
@ -522,15 +522,15 @@
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
error("This module doesn't exist");
|
||||
print_error("This module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $form = get_record($module->name, "id", $cm->instance)) {
|
||||
error("The required instance of this module doesn't exist");
|
||||
print_error("The required instance of this module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $cw = get_record("course_sections", "id", $cm->section)) {
|
||||
error("This course section doesn't exist");
|
||||
print_error("This course section doesn't exist");
|
||||
}
|
||||
|
||||
if (isset($return)) {
|
||||
@ -568,11 +568,11 @@
|
||||
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $duplicate)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
|
||||
require_login($course->id); // needed to setup proper $COURSE
|
||||
@ -580,15 +580,15 @@
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
error("This module doesn't exist");
|
||||
print_error("This module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $form = get_record($module->name, "id", $cm->instance)) {
|
||||
error("The required instance of this module doesn't exist");
|
||||
print_error("The required instance of this module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $cw = get_record("course_sections", "id", $cm->section)) {
|
||||
error("This course section doesn't exist");
|
||||
print_error("This course section doesn't exist");
|
||||
}
|
||||
|
||||
if (isset($return)) {
|
||||
@ -627,18 +627,18 @@
|
||||
$section = required_param('section',PARAM_INT);
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
|
||||
if (! $module = get_record("modules", "name", $add)) {
|
||||
error("This module type doesn't exist");
|
||||
print_error("This module type doesn't exist");
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (!course_allowed_module($course,$module->id)) {
|
||||
error("This module has been disabled for this particular course");
|
||||
print_error("This module has been disabled for this particular course");
|
||||
}
|
||||
|
||||
require_login($course->id); // needed to setup proper $COURSE
|
||||
@ -675,7 +675,7 @@
|
||||
}
|
||||
|
||||
} else {
|
||||
error("No action was specified");
|
||||
print_error("No action was specified");
|
||||
}
|
||||
|
||||
require_login($course->id); // needed to setup proper $COURSE
|
||||
|
@ -18,7 +18,7 @@
|
||||
$course = required_param('course', PARAM_INT);
|
||||
|
||||
if (! $course = get_record("course", "id", $course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
@ -26,13 +26,13 @@
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "name", $add)) {
|
||||
error("This module type doesn't exist");
|
||||
print_error("This module type doesn't exist");
|
||||
}
|
||||
|
||||
$cw = get_course_section($section, $course->id);
|
||||
|
||||
if (!course_allowed_module($course, $module->id)) {
|
||||
error("This module has been disabled for this particular course");
|
||||
print_error("This module has been disabled for this particular course");
|
||||
}
|
||||
|
||||
$cm = null;
|
||||
@ -75,11 +75,11 @@
|
||||
$navlinksinstancename = '';
|
||||
} else if (!empty($update)) {
|
||||
if (! $cm = get_record("course_modules", "id", $update)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
|
||||
require_login($course); // needed to setup proper $COURSE
|
||||
@ -87,15 +87,15 @@
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
error("This module doesn't exist");
|
||||
print_error("This module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $form = get_record($module->name, "id", $cm->instance)) {
|
||||
error("The required instance of this module doesn't exist");
|
||||
print_error("The required instance of this module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $cw = get_record("course_sections", "id", $cm->section)) {
|
||||
error("This course section doesn't exist");
|
||||
print_error("This course section doesn't exist");
|
||||
}
|
||||
|
||||
$form->coursemodule = $cm->id;
|
||||
@ -160,7 +160,7 @@
|
||||
$CFG->pagepath .= '/mod';
|
||||
}
|
||||
} else {
|
||||
error('Invalid operation.');
|
||||
print_error('Invalid operation.');
|
||||
}
|
||||
|
||||
$modmoodleform = "$CFG->dirroot/mod/$module->name/mod_form.php";
|
||||
@ -168,14 +168,14 @@
|
||||
require_once($modmoodleform);
|
||||
|
||||
} else {
|
||||
error('No formslib form description file found for this activity.');
|
||||
print_error('No formslib form description file found for this activity.');
|
||||
}
|
||||
|
||||
$modlib = "$CFG->dirroot/mod/$module->name/lib.php";
|
||||
if (file_exists($modlib)) {
|
||||
include_once($modlib);
|
||||
} else {
|
||||
error("This module is missing important code! ($modlib)");
|
||||
print_error("This module is missing important code! ($modlib)");
|
||||
}
|
||||
|
||||
$mformclassname = 'mod_'.$module->name.'_mod_form';
|
||||
@ -192,17 +192,17 @@
|
||||
if (empty($fromform->coursemodule)) { //add
|
||||
$cm = null;
|
||||
if (! $course = get_record("course", "id", $fromform->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
$fromform->instance = '';
|
||||
$fromform->coursemodule = '';
|
||||
} else { //update
|
||||
if (! $cm = get_record("course_modules", "id", $fromform->coursemodule)) {
|
||||
error("This course module doesn't exist");
|
||||
print_error("This course module doesn't exist");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("This course doesn't exist");
|
||||
print_error("This course doesn't exist");
|
||||
}
|
||||
$fromform->instance = $cm->instance;
|
||||
$fromform->coursemodule = $cm->id;
|
||||
@ -243,10 +243,10 @@
|
||||
|
||||
$returnfromfunc = $updateinstancefunction($fromform);
|
||||
if (!$returnfromfunc) {
|
||||
error("Could not update the $fromform->modulename", "view.php?id=$course->id");
|
||||
print_error("Could not update the $fromform->modulename", '', "view.php?id=$course->id");
|
||||
}
|
||||
if (is_string($returnfromfunc)) {
|
||||
error($returnfromfunc, "view.php?id=$course->id");
|
||||
print_error($returnfromfunc, '', "view.php?id=$course->id");
|
||||
}
|
||||
|
||||
set_coursemodule_visible($fromform->coursemodule, $fromform->visible);
|
||||
@ -273,15 +273,15 @@
|
||||
}
|
||||
|
||||
if (!course_allowed_module($course,$fromform->modulename)) {
|
||||
error("This module ($fromform->modulename) has been disabled for this particular course");
|
||||
print_error("This module ($fromform->modulename) has been disabled for this particular course");
|
||||
}
|
||||
|
||||
$returnfromfunc = $addinstancefunction($fromform);
|
||||
if (!$returnfromfunc) {
|
||||
error("Could not add a new instance of $fromform->modulename", "view.php?id=$course->id");
|
||||
print_error("Could not add a new instance of $fromform->modulename", '', "view.php?id=$course->id");
|
||||
}
|
||||
if (is_string($returnfromfunc)) {
|
||||
error($returnfromfunc, "view.php?id=$course->id");
|
||||
print_error($returnfromfunc, '', "view.php?id=$course->id");
|
||||
}
|
||||
|
||||
$fromform->instance = $returnfromfunc;
|
||||
@ -290,14 +290,14 @@
|
||||
// to each other, so we have to update one of them twice.
|
||||
|
||||
if (! $fromform->coursemodule = add_course_module($fromform) ) {
|
||||
error("Could not add a new course module");
|
||||
print_error("Could not add a new course module");
|
||||
}
|
||||
if (! $sectionid = add_mod_to_section($fromform) ) {
|
||||
error("Could not add the new course module to that section");
|
||||
print_error("Could not add the new course module to that section");
|
||||
}
|
||||
|
||||
if (! set_field("course_modules", "section", $sectionid, "id", $fromform->coursemodule)) {
|
||||
error("Could not update the course module with the correct section");
|
||||
print_error("Could not update the course module with the correct section");
|
||||
}
|
||||
|
||||
// make sure visibility is set correctly (in particular in calendar)
|
||||
@ -315,7 +315,7 @@
|
||||
"view.php?id=$fromform->coursemodule",
|
||||
"$fromform->instance", $fromform->coursemodule);
|
||||
} else {
|
||||
error("Data submitted is invalid.");
|
||||
print_error("Data submitted is invalid.");
|
||||
}
|
||||
|
||||
// sync idnumber with grade_item
|
||||
|
@ -9,7 +9,7 @@
|
||||
$id = required_param('id', PARAM_INT);
|
||||
|
||||
if (!$course = get_record('course', 'id', $id) ) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
if (!empty($param->user)) {
|
||||
if (!$u = get_record('user', 'id', $param->user) ) {
|
||||
error("That's an invalid user!");
|
||||
print_error("That's an invalid user!");
|
||||
}
|
||||
$userinfo = fullname($u);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
$id = required_param('id', PARAM_INT); // course id to import TO
|
||||
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
@ -11,7 +11,7 @@
|
||||
$date = optional_param('date', 0, PARAM_INT); // A time of a day (in GMT)
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course is misconfigured");
|
||||
print_error("Course is misconfigured");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
@ -19,12 +19,12 @@
|
||||
|
||||
if (! (has_capability('moodle/site:viewreports', $context)
|
||||
or ($course->showreports and $USER->id == $user)) ) {
|
||||
error("Sorry, you aren't allowed to see this.");
|
||||
print_error("Sorry, you aren't allowed to see this.");
|
||||
}
|
||||
|
||||
if ($user) {
|
||||
if (! $user = get_record("user", "id", $user)) {
|
||||
error("Can not find that user");
|
||||
print_error("Can not find that user");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
if ($hostid == $CFG->mnet_localhost_id) {
|
||||
if (!$course = get_record('course', 'id', $id) ) {
|
||||
error('That\'s an invalid course id'.$id);
|
||||
print_error('That\'s an invalid course id'.$id);
|
||||
}
|
||||
} else {
|
||||
$course_stub = array_pop(get_records_select('mnet_log', " hostid='$hostid' AND course='$id' ", '', '*', '', '1'));
|
||||
@ -66,7 +66,7 @@
|
||||
|
||||
if ($user) {
|
||||
if (!$u = get_record('user', 'id', $user) ) {
|
||||
error('That\'s an invalid user!');
|
||||
print_error('That\'s an invalid user!');
|
||||
}
|
||||
$userinfo = fullname($u, has_capability('moodle/site:viewfullnames', $context));
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
$page = optional_param('page', 0, PARAM_INT); // which page to show
|
||||
|
||||
if (! $course = get_record("course", "id", $id) ) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
if (!has_capability('moodle/site:viewreports', $context)) {
|
||||
error('You need do not have the required permission to view this report');
|
||||
print_error('You need do not have the required permission to view this report');
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "report live", "report/log/live.php?id=$course->id", $course->id);
|
||||
|
@ -8,7 +8,7 @@
|
||||
$id = required_param('id',PARAM_INT); // course id
|
||||
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
error('Course id is incorrect.');
|
||||
print_error('Course id is incorrect.');
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
@ -32,7 +32,7 @@
|
||||
print_heading(format_string($course->fullname));
|
||||
|
||||
if (!$logstart = get_field_sql("SELECT MIN(time) FROM {$CFG->prefix}log")) {
|
||||
error('Logs not available');
|
||||
print_error('Logs not available');
|
||||
}
|
||||
|
||||
echo '<div class="loginfo">'.get_string('computedfromlogs', 'admin', userdate($logstart)).'</div>';
|
||||
|
@ -12,12 +12,12 @@
|
||||
$roleid = optional_param('roleid',0,PARAM_INT);
|
||||
|
||||
if (!$course = get_record("course","id",$courseid)) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
if (!empty($userid)) {
|
||||
if (!$user = get_record('user','id',$userid)) {
|
||||
error("That's an invalid user id");
|
||||
print_error("That's an invalid user id");
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
if (!has_capability('moodle/site:viewreports', $context)) {
|
||||
error('You need do not have the required permission to view reports for this course');
|
||||
print_error('You need do not have the required permission to view reports for this course');
|
||||
}
|
||||
|
||||
stats_check_uptodate($course->id);
|
||||
|
@ -5,7 +5,7 @@
|
||||
require_once($CFG->dirroot.'/course/report/stats/lib.php');
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
error("Stats is not enabled.");
|
||||
print_error("Stats is not enabled.");
|
||||
}
|
||||
|
||||
$courseid = required_param('course', PARAM_INT);
|
||||
@ -29,12 +29,12 @@
|
||||
}
|
||||
|
||||
if (!$course = get_record("course","id",$courseid)) {
|
||||
error("That's an invalid course id");
|
||||
print_error("That's an invalid course id");
|
||||
}
|
||||
|
||||
if (!empty($userid)) {
|
||||
if (!$user = get_record('user','id',$userid)) {
|
||||
error("That's an invalid user id");
|
||||
print_error("That's an invalid user id");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
$reportoptions = stats_get_report_options($course->id, $mode);
|
||||
$timeoptions = report_stats_timeoptions($mode);
|
||||
if (empty($timeoptions)) {
|
||||
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
$table->width = 'auto';
|
||||
@ -31,7 +31,7 @@
|
||||
.' ORDER BY u.lastname, u.firstname ASC';
|
||||
|
||||
if (!$us = get_records_sql($sql)) {
|
||||
error('Cannot enter detailed view: No users found for this course.');
|
||||
print_error('Cannot enter detailed view: No users found for this course.');
|
||||
}
|
||||
|
||||
foreach ($us as $u) {
|
||||
@ -68,7 +68,7 @@
|
||||
|
||||
if (!empty($report) && !empty($time)) {
|
||||
if ($report == STATS_REPORT_LOGINS && $course->id != SITEID) {
|
||||
error('This type of report is only available for the site course');
|
||||
print_error('This type of report is only available for the site course');
|
||||
}
|
||||
|
||||
$param = stats_get_parameters($time,$report,$course->id,$mode);
|
||||
|
@ -8,7 +8,7 @@
|
||||
require_login();
|
||||
|
||||
if (isguest()) {
|
||||
error("No guests here!");
|
||||
print_error("No guests here!");
|
||||
}
|
||||
|
||||
if (empty($CFG->enablecourserequests)) {
|
||||
|
@ -14,7 +14,7 @@ require_once('reset_form.php');
|
||||
$id = required_param('id', PARAM_INT);
|
||||
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
error("Course is misconfigured");
|
||||
print_error("Course is misconfigured");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
@ -7,7 +7,7 @@
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course ID was incorrect");
|
||||
print_error("Course ID was incorrect");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
@ -108,7 +108,7 @@
|
||||
if (!empty($moveto) and $data = data_submitted() and confirm_sesskey()) { // Some courses are being moved
|
||||
|
||||
if (! $destcategory = get_record("course_categories", "id", $data->moveto)) {
|
||||
error("Error finding the category");
|
||||
print_error("Error finding the category");
|
||||
}
|
||||
|
||||
$courses = array();
|
||||
@ -124,7 +124,7 @@
|
||||
if (!empty($blocklist) and confirm_sesskey()) {
|
||||
$blockid = $blocklist;
|
||||
if (!$blocks = get_records('block_instance', 'blockid', $blockid)) {
|
||||
error( "Could not read data for blockid=$blockid" );
|
||||
print_error( "Could not read data for blockid=$blockid" );
|
||||
}
|
||||
|
||||
// run through blocks and get (unique) courses
|
||||
@ -137,7 +137,7 @@
|
||||
continue;
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error( "Could not read data for courseid=$courseid" );
|
||||
print_error( "Could not read data for courseid=$courseid" );
|
||||
}
|
||||
$courses[$courseid] = $course;
|
||||
}
|
||||
@ -147,7 +147,7 @@
|
||||
elseif (!empty($modulelist) and confirm_sesskey()) {
|
||||
$modulename = $modulelist;
|
||||
if (!$modules = get_records($modulename)) {
|
||||
error( "Could not read data for module=$modulename" );
|
||||
print_error( "Could not read data for module=$modulename" );
|
||||
}
|
||||
|
||||
// run through modules and get (unique) courses
|
||||
@ -158,7 +158,7 @@
|
||||
continue;
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error( "Could not read data for courseid=$courseid" );
|
||||
print_error( "Could not read data for courseid=$courseid" );
|
||||
}
|
||||
$courses[$courseid] = $course;
|
||||
}
|
||||
|
@ -22,11 +22,11 @@
|
||||
}
|
||||
|
||||
if (! $course = get_record('course', 'id', $id) ) {
|
||||
error('Invalid course id');
|
||||
print_error('Invalid course id');
|
||||
}
|
||||
|
||||
if (! $context = get_context_instance(CONTEXT_COURSE, $course->id)) {
|
||||
error('Invalid context');
|
||||
print_error('Invalid context');
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
@ -43,7 +43,7 @@
|
||||
// verify user may unassign all roles at course context
|
||||
foreach($roles as $role) {
|
||||
if (!user_can_assign($context, $role->roleid)) {
|
||||
error('Can not unassign this user from role id:'.$role->roleid);
|
||||
print_error('Can not unassign this user from role id:'.$role->roleid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
if ($confirm and confirm_sesskey()) {
|
||||
if ($userid) {
|
||||
if (! role_unassign(0, $userid, 0, $context->id)) {
|
||||
error("An error occurred while trying to unenrol that person.");
|
||||
print_error("An error occurred while trying to unenrol that person.");
|
||||
}
|
||||
|
||||
add_to_log($course->id, 'course', 'unenrol', "view.php?id=$course->id", $userid);
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
} else {
|
||||
if (! role_unassign(0, $USER->id, 0, $context->id)) {
|
||||
error("An error occurred while trying to unenrol you.");
|
||||
print_error("An error occurred while trying to unenrol you.");
|
||||
}
|
||||
|
||||
// force a refresh of mycourses
|
||||
@ -88,7 +88,7 @@
|
||||
|
||||
if ($userid) {
|
||||
if (!$user = get_record('user', 'id', $userid)) {
|
||||
error('That user does not exist!');
|
||||
print_error('That user does not exist!');
|
||||
}
|
||||
$strunenrolsure = get_string('unenrolsure', '', fullname($user, true));
|
||||
notice_yesno($strunenrolsure, "unenrol.php?id=$id&user=$user->id&confirm=yes&sesskey=".sesskey(),
|
||||
|
@ -14,11 +14,11 @@
|
||||
$perpage = optional_param('perpage', 100, PARAM_INT);
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course id is incorrect.");
|
||||
print_error("Course id is incorrect.");
|
||||
}
|
||||
|
||||
if (! $user = get_record("user", "id", $user)) {
|
||||
error("User ID is incorrect");
|
||||
print_error("User ID is incorrect");
|
||||
}
|
||||
|
||||
//require_login($course);
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
// if in either context, we can read report, then we can proceed
|
||||
if (!(has_capability('moodle/site:viewreports', $coursecontext) or ($course->showreports and $USER->id == $user->id) or has_capability('moodle/user:viewuseractivitiesreport', $personalcontext))) {
|
||||
error("You are not allowed to look at this page");
|
||||
print_error("You are not allowed to look at this page");
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "user report", "user.php?id=$course->id&user=$user->id&mode=$mode", "$user->id");
|
||||
@ -102,7 +102,7 @@
|
||||
case 'stats':
|
||||
|
||||
if (empty($CFG->enablestats)) {
|
||||
error("Stats is not enabled.");
|
||||
print_error("Stats is not enabled.");
|
||||
}
|
||||
|
||||
require_once($CFG->dirroot.'/lib/statslib.php');
|
||||
@ -127,7 +127,7 @@
|
||||
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
|
||||
|
||||
if (empty($timeoptions)) {
|
||||
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/user.php?id='.$course->id.'&user='.$user->id.'&mode=outline');
|
||||
print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/user.php?id='.$course->id.'&user='.$user->id.'&mode=outline');
|
||||
}
|
||||
|
||||
// use the earliest.
|
||||
@ -146,7 +146,7 @@
|
||||
$stats = get_records_sql($sql);
|
||||
|
||||
if (empty($stats)) {
|
||||
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/user.php?id='.$course->id.'&user='.$user->id.'&mode=outline');
|
||||
print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/user.php?id='.$course->id.'&user='.$user->id.'&mode=outline');
|
||||
}
|
||||
|
||||
// MDL-10818, do not display broken graph when user has no permission to view graph
|
||||
|
@ -22,20 +22,20 @@
|
||||
|
||||
|
||||
if (empty($id) && empty($name) && empty($idnumber)) {
|
||||
error("Must specify course id, short name or idnumber");
|
||||
print_error("Must specify course id, short name or idnumber");
|
||||
}
|
||||
|
||||
if (!empty($name)) {
|
||||
if (! ($course = get_record('course', 'shortname', $name)) ) {
|
||||
error('Invalid short course name');
|
||||
print_error('Invalid short course name');
|
||||
}
|
||||
} else if (!empty($idnumber)) {
|
||||
if (! ($course = get_record('course', 'idnumber', $idnumber)) ) {
|
||||
error('Invalid course idnumber');
|
||||
print_error('Invalid course idnumber');
|
||||
}
|
||||
} else {
|
||||
if (! ($course = get_record('course', 'id', $id)) ) {
|
||||
error('Invalid course id');
|
||||
print_error('Invalid course id');
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@
|
||||
$section->id = insert_record('course_sections', $section);
|
||||
}
|
||||
if (! $sections = get_all_sections($course->id) ) { // Try again
|
||||
error('Error finding or creating section structures for this course');
|
||||
print_error('Error finding or creating section structures for this course');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class enrolment_plugin_authorize
|
||||
|
||||
if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 443) { // MDL-9836
|
||||
if (empty($CFG->loginhttps)) {
|
||||
error(get_string('httpsrequired', 'enrol_authorize'));
|
||||
print_error('httpsrequired', 'enrol_authorize');
|
||||
} else {
|
||||
$wwwsroot = str_replace('http:','https:', $CFG->wwwroot);
|
||||
redirect("$wwwsroot/course/enrol.php?id=$course->id");
|
||||
@ -92,7 +92,7 @@ class enrolment_plugin_authorize
|
||||
break;
|
||||
}
|
||||
if (!empty($authorizeerror)) {
|
||||
error($authorizeerror);
|
||||
print_error($authorizeerror);
|
||||
}
|
||||
}
|
||||
$frmenrol->display();
|
||||
|
@ -11,7 +11,7 @@ class enrol_authorize_form extends moodleform
|
||||
$paymentmethodsenabled = get_list_of_payment_methods();
|
||||
$paymentmethod = optional_param('paymentmethod', $paymentmethodsenabled[0], PARAM_ALPHA);
|
||||
if (!in_array($paymentmethod, $paymentmethodsenabled)) {
|
||||
error("Invalid payment method: $paymentmethod");
|
||||
print_error("Invalid payment method: $paymentmethod");
|
||||
}
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
@ -5,7 +5,7 @@
|
||||
require_once('const.php');
|
||||
require_once('locallib.php');
|
||||
require_once('localfuncs.php');
|
||||
require_once('authorizenetlib.php');
|
||||
require_once('authorizenet.class.php');
|
||||
|
||||
/// Parameters
|
||||
$orderid = optional_param('order', 0, PARAM_INT);
|
||||
@ -14,13 +14,13 @@
|
||||
|
||||
/// Get course
|
||||
if (! $course = get_record('course', 'id', $courseid)) {
|
||||
error('Could not find that course');
|
||||
print_error('Could not find that course');
|
||||
}
|
||||
|
||||
/// Only SITE users can access to this page
|
||||
require_login(); // Don't use $courseid! User may want to see old orders.
|
||||
if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), $USER->id, false)) {
|
||||
error("Guests cannot use this page.");
|
||||
print_error("Guests cannot use this page.");
|
||||
}
|
||||
|
||||
/// Load strings. All strings should be defined here. locallib.php uses these strings.
|
||||
|
@ -92,10 +92,11 @@ function authorize_print_orders($courseid, $userid)
|
||||
if ($perpage > 100) { $perpage = 100; }
|
||||
$perpagemenus = array(5 => 5, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
|
||||
$perpagemenu = popup_form($baseurl.'&status='.$status.'&course='.$courseid.'&perpage=',$perpagemenus,'perpagemenu',$perpage,'','','',true);
|
||||
$table->define_columns(array('id', 'userid', 'timecreated', 'status', ''));
|
||||
$table->define_columns(array('id', 'userid', 'timecreated', 'status', 'action'));
|
||||
$table->define_headers(array($authstrs->orderid, $authstrs->shopper, $strs->time, $strs->status, $perpagemenu));
|
||||
$table->define_baseurl($baseurl."&status=$status&course=$courseid&perpage=$perpage");
|
||||
|
||||
$table->no_sorting('action');
|
||||
$table->sortable(true, 'id', SORT_DESC);
|
||||
$table->pageable(true);
|
||||
$table->setup();
|
||||
@ -210,15 +211,15 @@ function authorize_print_order($orderid)
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
if (!$order = get_record('enrol_authorize', 'id', $orderid)) {
|
||||
error("Order $orderid not found.", "$CFG->wwwroot/enrol/authorize/index.php");
|
||||
print_error("Order $orderid not found.", '', "$CFG->wwwroot/enrol/authorize/index.php");
|
||||
}
|
||||
|
||||
if (!$course = get_record('course', 'id', $order->courseid)) {
|
||||
error("Could not find that course id $order->courseid", "$CFG->wwwroot/enrol/authorize/index.php");
|
||||
print_error("Could not find that course id $order->courseid", '', "$CFG->wwwroot/enrol/authorize/index.php");
|
||||
}
|
||||
|
||||
if (!$user = get_record('user', 'id', $order->userid)) {
|
||||
error("Could not find that user id $order->userid", "$CFG->wwwroot/enrol/authorize/index.php");
|
||||
print_error("Could not find that user id $order->userid", '', "$CFG->wwwroot/enrol/authorize/index.php");
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
@ -226,7 +227,7 @@ function authorize_print_order($orderid)
|
||||
require_capability('enrol/authorize:managepayments', $coursecontext);
|
||||
}
|
||||
|
||||
$settled = authorize_settled($order);
|
||||
$settled = AuthorizeNet::settled($order);
|
||||
$statusandactions = authorize_get_status_action($order);
|
||||
$color = authorize_get_status_color($statusandactions->status);
|
||||
|
||||
@ -280,7 +281,7 @@ function authorize_print_order($orderid)
|
||||
if ($confirm && confirm_sesskey()) {
|
||||
$message = '';
|
||||
$extra = NULL;
|
||||
if (AN_APPROVED == authorize_action($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE)) {
|
||||
if (AN_APPROVED == AuthorizeNet::process($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE)) {
|
||||
if (empty($CFG->an_test)) {
|
||||
if (enrol_into_course($course, $user, 'authorize')) {
|
||||
if (!empty($CFG->enrol_mailstudents)) {
|
||||
@ -316,18 +317,18 @@ function authorize_print_order($orderid)
|
||||
}
|
||||
$upto = round($order->amount - $refunded, 2);
|
||||
if ($upto <= 0) {
|
||||
error("Refunded to original amount: $order->amount", "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
|
||||
print_error("Refunded to original amount: $order->amount", '', "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
|
||||
}
|
||||
$amount = round(optional_param('amount', $upto), 2);
|
||||
if ($amount > $upto) {
|
||||
error("Can be refunded to $upto", "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
|
||||
print_error("Can be refunded to $upto", '', "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
|
||||
}
|
||||
if ($confirm && confirm_sesskey()) {
|
||||
$extra = new stdClass;
|
||||
$extra->orderid = $orderid;
|
||||
$extra->amount = $amount;
|
||||
$message = '';
|
||||
$success = authorize_action($order, $message, $extra, AN_ACTION_CREDIT);
|
||||
$success = AuthorizeNet::process($order, $message, $extra, AN_ACTION_CREDIT);
|
||||
if (AN_APPROVED == $success || AN_REVIEW == $success) {
|
||||
if (empty($CFG->an_test)) {
|
||||
if (empty($extra->id)) {
|
||||
@ -375,7 +376,7 @@ function authorize_print_order($orderid)
|
||||
if ($confirm && confirm_sesskey()) {
|
||||
$extra = NULL;
|
||||
$message = '';
|
||||
if (AN_APPROVED == authorize_action($order, $message, $extra, AN_ACTION_VOID)) {
|
||||
if (AN_APPROVED == AuthorizeNet::process($order, $message, $extra, AN_ACTION_VOID)) {
|
||||
if (empty($CFG->an_test)) {
|
||||
redirect("$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
|
||||
}
|
||||
@ -402,7 +403,7 @@ function authorize_print_order($orderid)
|
||||
|
||||
$suborder = get_record_sql($sql);
|
||||
if (!$suborder) { // not found
|
||||
error("Transaction can not be voided because of already been voided.", "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
|
||||
print_error("Transaction can not be voided because of already been voided.", '', "$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
|
||||
}
|
||||
$refundedstatus = authorize_get_status_action($suborder);
|
||||
unset($suborder->courseid);
|
||||
@ -410,7 +411,7 @@ function authorize_print_order($orderid)
|
||||
if ($confirm && confirm_sesskey()) {
|
||||
$message = '';
|
||||
$extra = NULL;
|
||||
if (AN_APPROVED == authorize_action($suborder, $message, $extra, AN_ACTION_VOID)) {
|
||||
if (AN_APPROVED == AuthorizeNet::process($suborder, $message, $extra, AN_ACTION_VOID)) {
|
||||
if (empty($CFG->an_test)) {
|
||||
if (!empty($unenrol)) {
|
||||
role_unassign(0, $order->userid, 0, $coursecontext->id);
|
||||
@ -524,7 +525,7 @@ function authorize_get_status_action($order)
|
||||
|
||||
switch ($order->status) {
|
||||
case AN_STATUS_AUTH:
|
||||
if (authorize_expired($order)) {
|
||||
if (AuthorizeNet::expired($order)) {
|
||||
if ($canmanage) {
|
||||
$ret->actions = array(ORDER_DELETE);
|
||||
}
|
||||
@ -539,7 +540,7 @@ function authorize_get_status_action($order)
|
||||
return $ret;
|
||||
|
||||
case AN_STATUS_AUTHCAPTURE:
|
||||
if (authorize_settled($order)) {
|
||||
if (AuthorizeNet::settled($order)) {
|
||||
if ($canmanage) {
|
||||
if (($order->paymentmethod == AN_METHOD_CC) || ($order->paymentmethod == AN_METHOD_ECHECK && !empty($order->refundinfo))) {
|
||||
$ret->actions = array(ORDER_REFUND);
|
||||
@ -556,7 +557,7 @@ function authorize_get_status_action($order)
|
||||
return $ret;
|
||||
|
||||
case AN_STATUS_CREDIT:
|
||||
if (authorize_settled($order)) {
|
||||
if (AuthorizeNet::settled($order)) {
|
||||
$ret->status = 'settled';
|
||||
}
|
||||
else {
|
||||
|
@ -76,13 +76,13 @@ function authorize_process_csv($filename)
|
||||
/// Open the file and get first line
|
||||
$handle = fopen($filename, "r");
|
||||
if (!$handle) {
|
||||
error('CANNOT OPEN CSV FILE');
|
||||
print_error('CANNOT OPEN CSV FILE');
|
||||
}
|
||||
$firstline = fgetcsv($handle, 8192, ",");
|
||||
$numfields = count($firstline);
|
||||
if ($numfields != 49 && $numfields != 70) {
|
||||
@fclose($handle);
|
||||
error('INVALID CSV FILE; Each line must include 49 or 70 fields');
|
||||
print_error('INVALID CSV FILE; Each line must include 49 or 70 fields');
|
||||
}
|
||||
|
||||
/// Re-sort fields
|
||||
@ -97,7 +97,7 @@ function authorize_process_csv($filename)
|
||||
}
|
||||
if (empty($csvfields)) {
|
||||
@fclose($handle);
|
||||
error("<b>INVALID CSV FILE:</b> First line must include 'Header Fields' and
|
||||
print_error("<b>INVALID CSV FILE:</b> First line must include 'Header Fields' and
|
||||
the file must be type of <br />'Expanded Fields/Comma Separated'<br />or<br />
|
||||
'Expanded Fields with CAVV Result Code/Comma Separated'");
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user