MDL-14128, remove all uses of error(get_string())

This commit is contained in:
dongsheng
2008-04-02 06:09:56 +00:00
parent 003f4c662a
commit dbb82a47ca
83 changed files with 189 additions and 185 deletions
+3 -3
View File
@@ -30,7 +30,7 @@ if (empty($CFG->auth)) {
}
if (!empty($auth) and !exists_auth_plugin($auth)) {
error(get_string('pluginnotinstalled', 'auth', $auth), $url);
print_error('pluginnotinstalled', 'auth', $url, $auth);
}
////////////////////////////////////////////////////////////////////////////////
@@ -67,7 +67,7 @@ switch ($action) {
$key = array_search($auth, $authsenabled);
// check auth plugin is valid
if ($key === false) {
error(get_string('pluginnotenabled', 'auth', $auth), $url);
print_error('pluginnotenabled', 'auth', $url, $auth);
}
// move down the list
if ($key < (count($authsenabled) - 1)) {
@@ -82,7 +82,7 @@ switch ($action) {
$key = array_search($auth, $authsenabled);
// check auth is valid
if ($key === false) {
error(get_string('pluginnotenabled', 'auth', $auth), $url);
print_error('pluginnotenabled', 'auth', $url, $auth);
}
// move up the list
if ($key >= 1) {
+1 -1
View File
@@ -31,7 +31,7 @@
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');
+2 -2
View File
@@ -18,7 +18,7 @@
if ($frm = data_submitted()) {
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
print_error('confirmsesskeybad', 'error');
}
if (empty($frm->enable)) {
$frm->enable = array();
@@ -103,4 +103,4 @@
admin_externalpage_print_footer();
?>
?>
+1 -1
View File
@@ -19,7 +19,7 @@
if ($frm = data_submitted()) {
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
print_error('confirmsesskeybad', 'error');
}
if ($enrolment->process_config($frm)) {
redirect("enrol.php?sesskey=$USER->sesskey", get_string("changessaved"), 1);
+2 -2
View File
@@ -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();
@@ -707,7 +707,7 @@
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");
+4 -4
View File
@@ -63,9 +63,9 @@
$a = new object();
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
$a->dest= $CFG->dataroot.'/lang';
error(get_string($cd->get_error(), 'error', $a), 'langimport.php');
print_error($cd->get_error(), 'error', 'langimport.php', $a);
} else {
error(get_string($cd->get_error(), 'error'), 'langimport.php');
print_error($cd->get_error(), 'error', 'langimport.php');
}
break;
@@ -198,9 +198,9 @@
$a = new stdClass();
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
$a->dest= $CFG->dataroot.'/lang';
error(get_string($cd->get_error(), 'error', $a)); // not probable
print_error($cd->get_error(), 'error', "", $a)); // not probable
} else {
error(get_string($cd->get_error(), 'error')); // not probable
print_error($cd->get_error(), 'error'); // not probable
}
break;
case COMPONENT_UPTODATE:
+5 -5
View File
@@ -19,7 +19,7 @@ admin_externalpage_setup('ssoaccesscontrol');
admin_externalpage_print_header();
if (!extension_loaded('openssl')) {
print_error('requiresopenssl', 'mnet', '', NULL, true);
print_error('requiresopenssl', 'mnet');
}
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
@@ -39,13 +39,13 @@ if (!empty($action) and confirm_sesskey()) {
// boot if insufficient permission
if (!has_capability('moodle/user:delete', $sitecontext)) {
error(get_string('nomodifyacl','mnet'));
print_error('nomodifyacl','mnet');
}
// fetch the record in question
$id = required_param('id', PARAM_INT);
if (!$idrec = get_record('mnet_sso_access_control', 'id', $id)) {
error(get_string('recordnoexists','mnet'), "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
print_error('recordnoexists','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
switch ($action) {
@@ -60,7 +60,7 @@ if (!empty($action) and confirm_sesskey()) {
// require the access parameter, and it must be 'allow' or 'deny'
$accessctrl = trim(strtolower(required_param('accessctrl', PARAM_ALPHA)));
if ($accessctrl != 'allow' and $accessctrl != 'deny') {
error(get_string('invalidaccessparam', 'mnet') , "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
print_error('invalidaccessparam', 'mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
if (mnet_update_sso_access_control($idrec->username, $idrec->mnet_host_id, $accessctrl)) {
@@ -84,7 +84,7 @@ if ($form = data_submitted() and confirm_sesskey()) {
// check permissions and verify form input
if (!has_capability('moodle/user:delete', $sitecontext)) {
error(get_string('nomodifyacl','mnet'), "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
print_error('nomodifyacl','mnet', "$CFG->wwwroot/$CFG->admin/mnet/access_control.php");
}
if (empty($form->username)) {
$formerror['username'] = get_string('enterausername','mnet');
+1 -1
View File
@@ -7,7 +7,7 @@
include_once($CFG->dirroot.'/mnet/xmlrpc/client.php');
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
print_error('confirmsesskeybad', 'error');
}
admin_externalpage_setup('mnetenrol');
+1 -1
View File
@@ -6,7 +6,7 @@
require_once($CFG->libdir.'/adminlib.php');
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
print_error('confirmsesskeybad', 'error');
}
+9 -8
View File
@@ -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&amp;hostid='.$mnet_peer->id);
print_error("invalidpubkey", 'mnet', 'peers.php?step=update&amp;hostid='.$mnet_peer->id);
exit;
} else {
$oldkey = $mnet_peer->public_key;
@@ -115,7 +115,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&amp;hostid='.$mnet_peer->id);
//error(get_string("invalidpubkey", 'mnet') . $errmsg ,'peers.php?step=update&amp;hostid='.$mnet_peer->id);
print_error("invalidpubkey", 'mnet', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $errmsg);
exit;
}
}
@@ -124,7 +125,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&amp;hostid='.$mnet_peer->id);
print_error("hostexists", 'mnet', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $mnet_peer->id);
}
}
+1 -1
View File
@@ -10,7 +10,7 @@
$module = optional_param('module', '', PARAM_SAFEDIR);
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
print_error('confirmsesskeybad', 'error');
}
if ($module != '') {
+1 -1
View File
@@ -12,7 +12,7 @@
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
print_error('confirmsesskeybad', 'error');
}
if (!$admin = get_admin()) {
+1 -1
View File
@@ -43,7 +43,7 @@
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
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);
}
echo '<form action="index.php" method="post">'."\n";
+1 -1
View File
@@ -29,7 +29,7 @@
$courses = get_records_sql($sql, 0, $numcourses);
if (empty($courses)) {
error(get_string('statsnodata'),$CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
print_error('statsnodata', "", $CFG->wwwroot.'/'.$CFG->admin.'/report/course/index.php');
}
+2 -2
View File
@@ -16,12 +16,12 @@ $adminroot =& admin_get_root(); // need all settings
$page =& $adminroot->locate($section);
if (empty($page) or !is_a($page, 'admin_settingpage')) {
error(get_string('sectionerror', 'admin'), "$CFG->wwwroot/$CFG->admin/");
print_error('sectionerror', 'admin', "$CFG->wwwroot/$CFG->admin/");
die;
}
if (!($page->check_access())) {
error(get_string('accessdenied', 'admin'));
print_error('accessdenied', 'admin');
die;
}
+1 -1
View File
@@ -94,7 +94,7 @@ if (empty($iid)) {
if ($readcount === false) {
error($cir->get_error(), $returnurl);
} else if ($readcount == 0) {
error(get_string('csvemptyfile', 'error'), $returnurl);
print_error('csvemptyfile', 'error', $returnurl);
}
// continue to form2
+10 -10
View File
@@ -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,7 +268,7 @@ 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/>";
@@ -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');
}
}
@@ -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;
+1 -1
View File
@@ -76,7 +76,7 @@ class auth_plugin_shibboleth extends auth_plugin_base {
// Check whether we have got all the essential attributes
if ( empty($_SERVER[$this->config->user_attribute]) ) {
error(get_string( 'shib_not_all_attributes_error', 'auth' , "'".$this->config->user_attribute."' ('".$_SERVER[$this->config->user_attribute]."'), '".$this->config->field_map_firstname."' ('".$_SERVER[$this->config->field_map_firstname]."'), '".$this->config->field_map_lastname."' ('".$_SERVER[$this->config->field_map_lastname]."') and '".$this->config->field_map_email."' ('".$_SERVER[$this->config->field_map_email]."')"));
print_error( 'shib_not_all_attributes_error', 'auth' , '', "'".$this->config->user_attribute."' ('".$_SERVER[$this->config->user_attribute]."'), '".$this->config->field_map_firstname."' ('".$_SERVER[$this->config->field_map_firstname]."'), '".$this->config->field_map_lastname."' ('".$_SERVER[$this->config->field_map_lastname]."') and '".$this->config->field_map_email."' ('".$_SERVER[$this->config->field_map_email]."')");
}
$attrmap = $this->get_attributes();
+3 -3
View File
@@ -21,7 +21,7 @@
// Check whether Shibboleth is configured properly
if (empty($pluginconfig->user_attribute)) {
error(get_string( 'shib_not_set_up_error', 'auth'));
print_error('shib_not_set_up_error', 'auth');
}
/// If we can find the Shibboleth attribute, save it in session and return to main login page
@@ -88,9 +88,9 @@
// If we can find any (user independent) Shibboleth attributes but no user
// attributes we probably didn't receive any user attributes
elseif (!empty($_SERVER['HTTP_SHIB_APPLICATION_ID'])) {
error(get_string( 'shib_no_attributes_error', 'auth' , '\''.$pluginconfig->user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\''));
print_error('shib_no_attributes_error', 'auth' , '', '\''.$pluginconfig->user_attribute.'\', \''.$pluginconfig->field_map_firstname.'\', \''.$pluginconfig->field_map_lastname.'\' and \''.$pluginconfig->field_map_email.'\'');
} else {
error(get_string( 'shib_not_set_up_error', 'auth'));
print_error('shib_not_set_up_error', 'auth');
}
?>
+3 -3
View File
@@ -12,7 +12,7 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
$bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
if (in_array($section, $bookmarks)) {
error(get_string('bookmarkalreadyexists','admin'));
print_error('bookmarkalreadyexists','admin');
die;
}
@@ -28,7 +28,7 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
set_user_preference('admin_bookmarks', $bookmarks);
} else {
error(get_string('invalidsection','admin'));
print_error('invalidsection','admin');
die;
}
@@ -40,7 +40,7 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
}
} else {
error(get_string('invalidsection','admin'));
print_error('invalidsection','admin');
die;
}
+4 -4
View File
@@ -16,7 +16,7 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
$key = array_search($section, $bookmarks);
if ($key === false) {
error(get_string('nonexistentbookmark','admin'));
print_error('nonexistentbookmark','admin');
die;
}
@@ -38,12 +38,12 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey(
}
error(get_string('nobookmarksforuser','admin'));
print_error('nobookmarksforuser','admin');
die;
} else {
error(get_string('invalidsection', 'admin'));
print_error('invalidsection', 'admin');
die;
}
?>
?>
@@ -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,9 +99,10 @@ 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.');
}
@@ -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';
+3 -3
View File
@@ -16,7 +16,7 @@ if (empty($CFG->bloglevel)) {
}
if (isguest()) {
error(get_string('noguestpost', 'blog'));
print_error('noguestpost', 'blog');
}
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
@@ -31,13 +31,13 @@ if ($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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -53,7 +53,7 @@
}
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
print_error('confirmsesskeybad', 'error');
}
// OK checks done, delete the course now.
+1 -1
View File
@@ -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;
+8 -7
View File
@@ -21,7 +21,7 @@
}
//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.'&amp;sesskey='.$USER->sesskey);
print_error('invalidfieldname', 'error', 'index.php?id='.$id.'&amp;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.'&amp;sesskey='.$USER->sesskey);
print_error('fieldrequired', 'error', 'uploaduser.php?id='.$id.'&amp;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);
+1 -1
View File
@@ -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));
+1 -1
View File
@@ -67,7 +67,7 @@
exit;
}
else {
error(get_string('courseapprovedfailed'));
print_error('courseapprovedfailed');
exit;
}
}
+1 -1
View File
@@ -139,7 +139,7 @@
$postfun = $cm->modname.'_get_post_actions';
if (!function_exists($viewfun) || !function_exists($postfun)) {
error(get_string('modulemissingcode','error',$cm->modname), $baseurl);
print_error('modulemissingcode', 'error', $baseurl, $cm->modname);
}
$viewnames = $viewfun();
+1 -1
View File
@@ -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);
}
*/
+1 -1
View File
@@ -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';
+2 -2
View File
@@ -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
+1 -1
View File
@@ -43,7 +43,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");
+5 -5
View File
@@ -257,7 +257,7 @@ function authorize_print_order_details($orderno)
if (!in_array(ORDER_CAPTURE, $status->actions)) {
$a = new stdClass;
$a->action = $authstrs->capture;
error(get_string('youcantdo', 'enrol_authorize', $a));
print_error('youcantdo', 'enrol_authorize', '', $a);
}
if (empty($confirm)) {
@@ -299,7 +299,7 @@ function authorize_print_order_details($orderno)
if (!in_array(ORDER_REFUND, $status->actions)) {
$a = new stdClass;
$a->action = $authstrs->refund;
error(get_string('youcantdo', 'enrol_authorize', $a));
print_error('youcantdo', 'enrol_authorize', '', $a);
}
$refunded = 0.0;
@@ -363,7 +363,7 @@ function authorize_print_order_details($orderno)
if (!in_array(ORDER_VOID, $status->actions)) {
$a = new stdClass;
$a->action = $authstrs->void;
error(get_string('youcantdo', 'enrol_authorize', $a));
print_error('youcantdo', 'enrol_authorize', '', $a);
}
if (empty($confirm)) {
$strvoidyes = get_string('voidyes', 'enrol_authorize');
@@ -404,7 +404,7 @@ function authorize_print_order_details($orderno)
if (!in_array(ORDER_VOID, $refundedstatus->actions)) {
$a = new stdClass;
$a->action = $authstrs->void;
error(get_string('youcantdo', 'enrol_authorize', $a));
print_error('youcantdo', 'enrol_authorize', '', $a);
}
unset($suborder->courseid);
if (empty($confirm)) {
@@ -448,7 +448,7 @@ function authorize_print_order_details($orderno)
if (!in_array(ORDER_DELETE, $status->actions)) {
$a = new stdClass;
$a->action = $authstrs->delete;
error(get_string('youcantdo', 'enrol_authorize', $a));
print_error('youcantdo', 'enrol_authorize', '', $a);
}
if (empty($confirm)) {
$cbunenrol = print_checkbox('unenrol', '1', !empty($unenrol), '', '', '', true);
+1 -1
View File
@@ -169,6 +169,6 @@
function not_found($courseid) {
global $CFG;
header('HTTP/1.0 404 not found');
error(get_string('filenotfound', 'error'), $CFG->wwwroot.'/course/view.php?id='.$courseid); //this is not displayed on IIS??
print_error('filenotfound', 'error', $CFG->wwwroot.'/course/view.php?id='.$courseid); //this is not displayed on IIS??
}
?>
+2 -2
View File
@@ -474,7 +474,7 @@
}
if (!zip_files($files,"$basedir$wdir/$name")) {
error(get_string("zipfileserror","error"));
print_error("zipfileserror","error");
}
clearfilelist();
@@ -532,7 +532,7 @@
$file = basename($file);
if (!unzip_file("$basedir$wdir/$file")) {
error(get_string("unzipfileserror","error"));
print_error("unzipfileserror","error");
}
echo "<div style=\"text-align:center\"><form action=\"index.php\" method=\"get\">";
+2 -2
View File
@@ -3902,13 +3902,13 @@ function admin_externalpage_setup($section) {
$extpage =& $adminroot->locate($section);
if (empty($extpage) or !is_a($extpage, 'admin_externalpage')) {
error(get_string('sectionerror','admin'), "$CFG->wwwroot/$CFG->admin/");
print_error('sectionerror', 'admin', "$CFG->wwwroot/$CFG->admin/");
die;
}
// this eliminates our need to authenticate on the actual pages
if (!($extpage->check_access())) {
error(get_string('accessdenied', 'admin'));
print_error('accessdenied', 'admin');
die;
}
+2 -2
View File
@@ -84,9 +84,9 @@
// $a = new stdClass();
// $a->url = 'http://download.moodle.org/lang16/es_utf8.zip';
// $a->dest= $CFG->dataroot.'/lang';
// error(get_string($cd->get_error(), 'error', $a));
// print_error($cd->get_error(), 'error', '', $a);
// } else {
// error(get_string($cd->get_error(), 'error'));
// print_error($cd->get_error(), 'error');
// }
// break;
// case COMPONENT_UPTODATE:
+2 -2
View File
@@ -439,7 +439,7 @@
}
if (!zip_files($files,"$basedir/$wdir/$name")) {
error(get_string("zipfileserror","error"));
print_error("zipfileserror","error");
}
clearfilelist();
@@ -491,7 +491,7 @@
$file = basename($file);
if (!unzip_file("$basedir/$wdir/$file")) {
error(get_string("unzipfileserror","error"));
print_error("unzipfileserror","error");
}
echo "<center><form action=\"coursefiles.php\" method=\"get\">\n";
+5 -5
View File
@@ -1888,7 +1888,7 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null) {
}
}
} else {
error(get_string('nopasswordchangeforced', 'auth'));
print_error('nopasswordchangeforced', 'auth');
}
}
@@ -1901,7 +1901,7 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null) {
/// Make sure current IP matches the one for this session (if required)
if (!empty($CFG->tracksessionip)) {
if ($USER->sessionIP != md5(getremoteaddr())) {
error(get_string('sessionipnomatch', 'error'));
print_error('sessionipnomatch', 'error');
}
}
@@ -1930,7 +1930,7 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null) {
/// groupmembersonly access control
if (!empty($CFG->enablegroupings) and $cm and $cm->groupmembersonly and !has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_MODULE, $cm->id))) {
if (isguestuser() or !groups_has_membership($cm)) {
error(get_string('groupmembersonlyerror', 'group'), $CFG->wwwroot.'/course/view.php?id='.$cm->course);
print_error('groupmembersonlyerror', 'group', $CFG->wwwroot.'/course/view.php?id='.$cm->course);
}
}
@@ -2324,7 +2324,7 @@ function update_login_count() {
if ($SESSION->logincount > $max_logins) {
unset($SESSION->wantsurl);
error(get_string('errortoomanylogins'));
print_error('errortoomanylogins');
}
}
@@ -3153,7 +3153,7 @@ function complete_user_login($user) {
redirect($CFG->httpswwwroot.'/login/change_password.php');
}
} else {
error(get_string('nopasswordchangeforced', 'auth'));
print_error('nopasswordchangeforced', 'auth');
}
}
return $USER;
+2 -2
View File
@@ -46,7 +46,7 @@
$userauth = get_auth_plugin($USER->auth);
if (!$userauth->can_change_password()) {
error(get_string('nopasswordchange', 'auth'));
print_error('nopasswordchange', 'auth');
}
if ($changeurl = $userauth->change_password_url()) {
@@ -65,7 +65,7 @@
} else if ($data = $mform->get_data()) {
if (!$userauth->user_update_password(addslashes_recursive($USER), $data->newpassword1)) {
error(get_string('errorpasswordupdate', 'auth'));
print_error('errorpasswordupdate', 'auth');
}
// register success changing password
+1 -1
View File
@@ -68,7 +68,7 @@
error("Invalid confirmation data");
}
} else {
error(get_string("errorwhenconfirming"));
print_error("errorwhenconfirming");
}
redirect("$CFG->wwwroot/");
+2 -2
View File
@@ -41,7 +41,7 @@ if ($p_secret !== false) {
$user = get_complete_user_data('username', $p_username);
if (!empty($user) and $user->secret === '') {
print_header($strforgotten, $strforgotten, $navigation);
error(get_string('secretalreadyused'));
print_error('secretalreadyused');
} else if (!empty($user) and $user->secret == stripslashes($p_secret)) {
// make sure that url relates to a valid user
@@ -78,7 +78,7 @@ if ($p_secret !== false) {
} else {
print_header($strforgotten, $strforgotten, $navigation);
error(get_string('forgotteninvalidurl'));
print_error('forgotteninvalidurl');
}
die; //never reached
+2 -2
View File
@@ -487,7 +487,7 @@ function mnet_update_sso_access_control($username, $mnet_host_id, $accessctrl) {
add_to_log(SITEID, 'admin/mnet', 'update', 'admin/mnet/access_control.php',
"SSO ACL: $accessctrl user '$username' from {$mnethost->name}");
} else {
error(get_string('failedaclwrite','mnet', $username));
print_error('failedaclwrite', 'mnet', '', $username);
return false;
}
} else {
@@ -499,7 +499,7 @@ function mnet_update_sso_access_control($username, $mnet_host_id, $accessctrl) {
add_to_log(SITEID, 'admin/mnet', 'add', 'admin/mnet/access_control.php',
"SSO ACL: $accessctrl user '$username' from {$mnethost->name}");
} else {
error(get_string('failedaclwrite','mnet', $username));
print_error('failedaclwrite', 'mnet', '', $username);
return false;
}
}
@@ -35,7 +35,7 @@ class assignment_online extends assignment_base {
if ($editmode) {
//guest can not edit or submit assignment
if (!has_capability('mod/assignment:submit', $context)) {
error(get_string('guestnosubmit', 'assignment'));
print_error('guestnosubmit', 'assignment');
}
}
+1 -1
View File
@@ -49,7 +49,7 @@
}
if (!$chatusers = chat_get_users($chat->id, $groupid, $cm->groupingid)) {
error(get_string('errornousers', 'chat'));
print_error('errornousers', 'chat');
}
set_field('chat_users', 'lastping', time(), 'sid', $chat_sid);
+1 -1
View File
@@ -55,7 +55,7 @@
/// Get list of users
if (!$chatusers = chat_get_users($chatuser->chatid, $chatuser->groupid, $cm->groupingid)) {
error(get_string('errornousers', 'chat'));
print_error('errornousers', 'chat');
}
ob_start();
+2 -2
View File
@@ -82,7 +82,7 @@
if ($rid) { // So do you have access?
if (!(has_capability('mod/data:manageentries', $context) or data_isowner($rid)) or !confirm_sesskey() ) {
error(get_string('noaccess','data'));
print_error('noaccess','data');
}
}
@@ -341,7 +341,7 @@
// Print the stuff that need to come after the form fields.
if (!$fields = get_records('data_fields', 'dataid', $data->id)) {
error(get_string('nofieldindatabase', 'data'));
print_error('nofieldindatabase', 'data');
}
foreach ($fields as $eachfield) {
$field = data_get_field($eachfield, $data);
+1 -1
View File
@@ -5657,7 +5657,7 @@ function forum_check_throttling($forum) {
$a->blockperiod = get_string('secondstotime'.$forum->blockperiod);
if ($forum->blockafter <= $numposts) {
error(get_string('forumblockingtoomanyposts','error',$a),$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id);
print_error('forumblockingtoomanyposts', 'error', $CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id, $a);
}
if ($forum->warnafter <= $numposts) {
notify(get_string('forumblockingalmosttoomanyposts','forum',$a));
+8 -8
View File
@@ -91,7 +91,7 @@
}
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $coursecontext)) {
error(get_string("activityiscurrentlyhidden"));
print_error("activityiscurrentlyhidden");
}
if (isset($_SERVER["HTTP_REFERER"])) {
@@ -162,7 +162,7 @@
}
}
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $coursecontext)) {
error(get_string("activityiscurrentlyhidden"));
print_error("activityiscurrentlyhidden");
}
// Load up the $post variable.
@@ -266,7 +266,7 @@
forum_go_back_to("discuss.php?d=$post->discussion"));
} else if ($replycount && !has_capability('mod/forum:deleteanypost', $modcontext)) {
error(get_string("couldnotdeletereplies", "forum"),
print_error("couldnotdeletereplies", "forum",
forum_go_back_to("discuss.php?d=$post->discussion"));
} else {
@@ -308,7 +308,7 @@
if ($replycount) {
if (!has_capability('mod/forum:deleteanypost', $modcontext)) {
error(get_string("couldnotdeletereplies", "forum"),
print_error("couldnotdeletereplies", "forum",
forum_go_back_to("discuss.php?d=$post->discussion"));
}
print_header();
@@ -480,7 +480,7 @@
$updatepost = $fromform; //realpost
$updatepost->forum = $forum->id;
if (!forum_update_post($updatepost, $message)) {
error(get_string("couldnotupdate", "forum"), $errordestination);
print_error("couldnotupdate", "forum", $errordestination);
}
// MDL-11818
@@ -488,7 +488,7 @@
$forum->intro = $updatepost->message;
$forum->timemodified = time();
if (!update_record("forum", $forum)) {
error(get_string("couldnotupdate", "forum"), $errordestination);
print_error("couldnotupdate", "forum", $errordestination);
}
}
@@ -554,7 +554,7 @@
redirect(forum_go_back_to("$discussionurl#p$fromform->id"), $message.$subscribemessage, $timemessage);
} else {
error(get_string("couldnotadd", "forum"), $errordestination);
print_error("couldnotadd", "forum", $errordestination);
}
exit;
@@ -597,7 +597,7 @@
redirect(forum_go_back_to("view.php?f=$fromform->forum"), $message.$subscribemessage, $timemessage);
} else {
error(get_string("couldnotadd", "forum"), $errordestination);
print_error("couldnotadd", "forum", $errordestination);
}
exit;
+1 -1
View File
@@ -92,7 +92,7 @@
} else { // subscribe
if ($forum->forcesubscribe == FORUM_DISALLOWSUBSCRIBE &&
!has_capability('mod/forum:managesubscriptions', $context)) {
error(get_string('disallowsubscribe', 'forum'),$_SERVER["HTTP_REFERER"]);
print_error('disallowsubscribe', 'forum', $_SERVER["HTTP_REFERER"]);
}
if (!has_capability('mod/forum:viewdiscussion', $context)) {
error("Could not subscribe you to that forum", $_SERVER["HTTP_REFERER"]);
+3 -3
View File
@@ -41,7 +41,7 @@ if ($e) { // if entry is specified
$ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if (!has_capability('mod/glossary:manageentries', $context) and !($entry->userid == $USER->id and ($ineditperiod and has_capability('mod/glossary:write', $context)))) {
//expired edit time is the most probable cause here
error(get_string('erredittimeexpired', 'glossary'), "view.php?id=$cm->id&amp;mode=entry&amp;hook=$e");
print_error('erredittimeexpired', 'glossary', "view.php?id=$cm->id&amp;mode=entry&amp;hook=$e");
}
} else { // new entry
require_capability('mod/glossary:write', $context);
@@ -174,9 +174,9 @@ if ($mform->is_cancelled()){
$ineditperiod = ((time() - $fromdb->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if ((!$ineditperiod || $USER->id != $fromdb->userid) and !has_capability('mod/glossary:manageentries', $context)) {
if ( $USER->id != $fromdb->userid ) {
error(get_string('errcannoteditothers', 'glossary'));
print_error('errcannoteditothers', 'glossary');
} elseif (!$ineditperiod) {
error(get_string('erredittimeexpired', 'glossary'));
print_error('erredittimeexpired', 'glossary');
}
die;
}
+2 -2
View File
@@ -29,7 +29,7 @@
// check user can access this hotpot activity
if (!hotpot_is_visible($cm)) {
error(get_string("activityiscurrentlyhidden"), $next_url);
print_error("activityiscurrentlyhidden", 'hotpot', $next_url);
}
// update attempt record fields using incoming data
@@ -220,7 +220,7 @@ function hotpot_set_attempt_details(&$attempt) {
if (!$ok) {
return;
// error('Quiz type is missing or invalid');
// error(get_string('error_invalidquiztype', 'hotpot'));
// print_error('error_invalidquiztype', 'hotpot');
//
// script finishes here if quiztype is invalid
//
+1 -1
View File
@@ -24,7 +24,7 @@
// check user can access this hotpot activity
if (!hotpot_is_visible($cm)) {
error(get_string("activityiscurrentlyhidden"));
print_error("activityiscurrentlyhidden");
}
if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_MODULE, $cm->id))) {
+1 -1
View File
@@ -42,7 +42,7 @@
// check user can access this hotpot activity
if (!hotpot_is_visible($cm)) {
error(get_string("activityiscurrentlyhidden"));
print_error("activityiscurrentlyhidden");
}
// get report mode
+3 -3
View File
@@ -36,16 +36,16 @@
// check user can access this hotpot activity
if (!hotpot_is_visible($cm)) {
error(get_string("activityiscurrentlyhidden"));
print_error("activityiscurrentlyhidden");
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!has_capability('mod/hotpot:viewreport',$context)) {
if (!$hotpot->review) {
error(get_string("noreview", "quiz"));
print_error("noreview", "quiz");
}
//if (time() < $hotpot->timeclose) {
// error(get_string("noreviewuntil", "quiz", userdate($hotpot->timeclose)));
// print_error("noreviewuntil", "quiz", '', userdate($hotpot->timeclose));
//}
if ($attempt->userid != $USER->id) {
error("This is not your attempt!");
+7 -7
View File
@@ -86,12 +86,12 @@
$numberofpreviousattempts = count_records_select('quiz_attempts', "quiz = '{$quiz->id}' AND " .
"userid = '{$USER->id}' AND timefinish > 0 AND preview != 1");
if ($quiz->attempts and $numberofpreviousattempts >= $quiz->attempts) {
error(get_string('nomoreattempts', 'quiz'), "view.php?id={$cm->id}");
print_error('nomoreattempts', 'quiz', "view.php?id={$cm->id}");
}
/// Check subnet access
if (!$ispreviewing && $quiz->subnet && !address_in_subnet(getremoteaddr(), $quiz->subnet)) {
error(get_string("subneterror", "quiz"), "view.php?id=$cm->id");
print_error("subneterror", "quiz", "view.php?id=$cm->id");
}
/// Check password access
@@ -156,11 +156,11 @@
}
if ($numattempts == 1 && $quiz->delay1) {
if ($timenow - $quiz->delay1 < $lastattempt) {
error(get_string('timedelay', 'quiz'), 'view.php?q='.$quiz->id);
print_error('timedelay', 'quiz', 'view.php?q='.$quiz->id);
}
} else if($numattempts > 1 && $quiz->delay2) {
if ($timenow - $quiz->delay2 < $lastattempt) {
error(get_string('timedelay', 'quiz'), 'view.php?q='.$quiz->id);
print_error('timedelay', 'quiz', 'view.php?q='.$quiz->id);
}
}
}
@@ -235,7 +235,7 @@
}
if (!$questionlist) {
error(get_string('noquestionsfound', 'quiz'), 'view.php?q='.$quiz->id);
print_error('noquestionsfound', 'quiz', 'view.php?q='.$quiz->id);
}
$sql = "SELECT q.*, i.grade AS maxgrade, i.id AS instance".
@@ -246,7 +246,7 @@
// Load the questions
if (!$questions = get_records_sql($sql)) {
error(get_string('noquestionsfound', 'quiz'), 'view.php?q='.$quiz->id);
print_error('noquestionsfound', 'quiz', 'view.php?q='.$quiz->id);
}
// Load the question type specific information
@@ -382,7 +382,7 @@
// Now is the right time to check the open and close times.
if (!$ispreviewing && ($timestamp < $quiz->timeopen || ($quiz->timeclose && $timestamp > $quiz->timeclose))) {
error(get_string('notavailable', 'quiz'), "view.php?id={$cm->id}");
print_error('notavailable', 'quiz', "view.php?id={$cm->id}");
}
/// Print the quiz page ////////////////////////////////////////////////////////
+1 -1
View File
@@ -106,6 +106,6 @@
send_file($pathname, $filename, $lifetime);
} else {
header('HTTP/1.0 404 not found');
error(get_string('filenotfound', 'error')); //this is not displayed on IIS??
print_error('filenotfound', 'error'); //this is not displayed on IIS??
}
?>
+3 -3
View File
@@ -66,14 +66,14 @@
// If not even responses are to be shown in review then we
// don't allow any review
if (!($quiz->review & QUIZ_REVIEW_RESPONSES)) {
error(get_string("noreview", "quiz"));
print_error("noreview", "quiz");
}
if ((time() - $attempt->timefinish) > 120) { // always allow review right after attempt
if ((!$quiz->timeclose or time() < $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_OPEN)) {
error(get_string("noreviewuntil", "quiz", userdate($quiz->timeclose)));
print_error("noreviewuntil", "quiz", '', userdate($quiz->timeclose));
}
if ($quiz->timeclose and time() >= $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_CLOSED)) {
error(get_string("noreview", "quiz"));
print_error("noreview", "quiz");
}
}
if ($attempt->userid != $USER->id) {
+2 -2
View File
@@ -73,9 +73,9 @@
/// Security Constraints (sesskey and isteacheredit)
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
print_error('confirmsesskeybad', 'error');
} else if (!has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $courseid))) {
error(get_string('onlyeditingteachers', 'error'));
print_error('onlyeditingteachers', 'error');
}
///
+1 -1
View File
@@ -61,7 +61,7 @@ function scorm_add_instance($scorm) {
return $id;
} else {
error(get_string('badpackage','scorm'));
print_error('badpackage','scorm');
}
}
+2 -2
View File
@@ -58,7 +58,7 @@
/// Is an Action given ?
if(!$action) {
error(get_string("noadministrationaction","wiki"));
print_error("noadministrationaction","wiki");
}
/// Correct Action ?
@@ -69,7 +69,7 @@
/// May the User administrate it ?
if (($wiki_entry = wiki_get_entry($wiki, $course, $userid, $groupid)) === false || wiki_can_edit_entry($wiki_entry, $wiki, $USER, $course) === false) {
error(get_string("notadministratewiki","wiki"));
print_error("notadministratewiki","wiki");
}
$canedit = wiki_can_edit_entry($wiki_entry, $wiki, $USER, $course);
+1 -1
View File
@@ -238,7 +238,7 @@
error("Edit submission: Userids do not match");
}
if (($submission->timecreated < ($timenow - $CFG->maxeditingtime)) and ($workshop->assessmentstart < $timenow)) {
error(get_string('notallowed', 'workshop'));
print_error('notallowed', 'workshop');
}
?>
<form id="editform" enctype="multipart/form-data" action="submissions.php" method="post">
+2 -2
View File
@@ -363,7 +363,7 @@ class question_category_object {
*/
function add_category($newparent, $newcategory, $newinfo) {
if (empty($newcategory)) {
error(get_string('categorynamecantbeblank', 'quiz'));
print_error('categorynamecantbeblank', 'quiz');
}
list($parentid, $contextid) = explode(',', $newparent);
//moodle_form makes sure select element output is legal no need for further cleaning
@@ -396,7 +396,7 @@ class question_category_object {
function update_category($updateid, $newparent, $newname, $newinfo) {
global $CFG, $QTYPES;
if (empty($newname)) {
error(get_string('categorynamecantbeblank', 'quiz'));
print_error('categorynamecantbeblank', 'quiz');
}
list($parentid, $tocontextid) = explode(',', $newparent);
+1 -1
View File
@@ -680,7 +680,7 @@ function question_edit_setup($edittab, $requirecmid = false, $requirecourseid =
if (!empty($pagevars['cat'])){
$catparts = explode(',', $pagevars['cat']);
if (!$catparts[0] || (FALSE !== array_search($catparts[1], $contextlistarr)) || !count_records_select("question_categories", "id = '".$catparts[0]."' AND contextid = $catparts[1]")) {
error(get_string('invalidcategory', 'quiz'));
print_error('invalidcategory', 'quiz');
}
} else {
$category = $defaultcategory;
+1 -1
View File
@@ -81,6 +81,6 @@
function question_attempt_not_found() {
global $CFG;
header('HTTP/1.0 404 not found');
error(get_string('filenotfound', 'error'), $CFG->wwwroot); //this is not displayed on IIS??
print_error('filenotfound', 'error', $CFG->wwwroot); //this is not displayed on IIS??
}
?>
+3 -3
View File
@@ -95,12 +95,12 @@
if (file_exists($importfile)) {
$fileisgood = true;
} else {
error(get_string('uploadproblem', 'moodle', $form->choosefile));
print_error('uploadproblem', 'moodle', $form->choosefile);
}
} else {
// must be upload file
if (!$importfile = $import_form->get_importfile_name()) {
error(get_string('uploadproblem', 'moodle'));
print_error('uploadproblem', 'moodle');
}else {
$fileisgood = true;
}
@@ -110,7 +110,7 @@
if ($fileisgood) {
if (! is_readable("format/$form->format/format.php")) {
error(get_string('formatnotfound','quiz', $form->format));
print_error('formatnotfound','quiz', $form->format);
}
require_once("format.php"); // Parent class
+2 -2
View File
@@ -98,7 +98,7 @@
// Load the question type specific information
if (!get_question_options($questions)) {
error(get_string('newattemptfail', 'quiz'));
print_error('newattemptfail', 'quiz');
}
// Create a dummy quiz attempt
@@ -133,7 +133,7 @@
// Create an empty session for the question
if (!$newstates =
get_question_states($questions, $quiz, $attempt)) {
error(get_string('newattemptfail', 'quiz'));
print_error('newattemptfail', 'quiz');
}
$SESSION->quizpreview->states = array($newstates);
$states =& $SESSION->quizpreview->states;
+3 -3
View File
@@ -17,11 +17,11 @@ require_once("$CFG->dirroot/search/lib.php");
require_login();
if (empty($CFG->enableglobalsearch)) {
error(get_string('globalsearchdisabled', 'search'));
print_error('globalsearchdisabled', 'search');
}
if (!isadmin()) {
error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
}
//check for php5 (lib.php)
@@ -141,4 +141,4 @@ set_config("search_index_size", (int)$CFG->search_index_size + (int)$addition_co
mtrace("Added $addition_count documents.");
mtrace('Index size after: '.$index->count());
?>
?>
+3 -3
View File
@@ -17,11 +17,11 @@ require_once("$CFG->dirroot/search/lib.php");
require_login();
if (empty($CFG->enableglobalsearch)) {
error(get_string('globalsearchdisabled', 'search'));
print_error('globalsearchdisabled', 'search');
}
if (!isadmin()) {
error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
} //if
//check for php5 (lib.php)
@@ -129,4 +129,4 @@ set_config("search_index_size", (int)$CFG->search_index_size - (int)$deletion_co
mtrace("Finished $deletion_count removals.");
mtrace('Index size after: '.$index->count());
?>
?>
+3 -3
View File
@@ -33,11 +33,11 @@ require_once("$CFG->dirroot/search/lib.php");
require_login();
if (empty($CFG->enableglobalsearch)) {
error(get_string('globalsearchdisabled', 'search'));
print_error('globalsearchdisabled', 'search');
}
if (!isadmin()) {
error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
} //if
//confirmation flag to prevent accidental reindexing (indexersplash.php is the correct entry point)
@@ -200,4 +200,4 @@ set_config('search_indexer_run_date', time());
//and the index size
set_config('search_index_size', (int)$index->count());
?>
?>
+2 -2
View File
@@ -16,11 +16,11 @@ require_once("$CFG->dirroot/search/lib.php");
require_login();
if (empty($CFG->enableglobalsearch)) {
error(get_string('globalsearchdisabled', 'search'));
print_error('globalsearchdisabled', 'search');
}
if (!isadmin()) {
error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
}
//check for php5 (lib.php)
+2 -2
View File
@@ -35,7 +35,7 @@ if ($CFG->forcelogin) {
}
if (empty($CFG->enableglobalsearch)) {
error(get_string('globalsearchdisabled', 'search'));
print_error('globalsearchdisabled', 'search');
}
$adv = new Object();
@@ -343,4 +343,4 @@ if ($sq->is_valid()) {
}
print_box_end();
print_footer();
?>
?>
+1 -1
View File
@@ -18,7 +18,7 @@ if ($CFG->forcelogin) {
}
if (empty($CFG->enableglobalsearch)) {
error(get_string('globalsearchdisabled', 'search'));
print_error('globalsearchdisabled', 'search');
}
//check for php5, but don't die yet
+3 -3
View File
@@ -17,11 +17,11 @@ require_once("$CFG->dirroot/search/lib.php");
require_login();
if (empty($CFG->enableglobalsearch)) {
error(get_string('globalsearchdisabled', 'search'));
print_error('globalsearchdisabled', 'search');
}
if (!isadmin()) {
error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
}
//check for php5 (lib.php)
@@ -140,4 +140,4 @@ set_config("search_indexer_update_date", $startupdatedate);
mtrace("Finished $update_count updates");
?>
?>
+1 -1
View File
@@ -9,7 +9,7 @@ require_js(array('yui_dom-event', 'yui_connection', 'yui_animation', 'yui_autoco
require_login();
if (empty($CFG->usetags)) {
error(get_string('tagsaredisabled', 'tag'));
print_error('tagsaredisabled', 'tag');
}
$tag_id = optional_param('id', 0, PARAM_INT);
+1 -1
View File
@@ -9,7 +9,7 @@ require_once($CFG->dirroot.'/blog/lib.php');
require_login();
if (empty($CFG->usetags)) {
error(get_string('tagsaredisabled', 'tag'));
print_error('tagsaredisabled', 'tag');
}
$tagid = optional_param('id', 0, PARAM_INT); // tag id
+1 -1
View File
@@ -16,7 +16,7 @@ $perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT);
require_login();
if (empty($CFG->usetags)) {
error(get_string('tagsaredisabled', 'tag'));
print_error('tagsaredisabled', 'tag');
}
//managing tags requires moodle/tag:manage capability
+1 -1
View File
@@ -8,7 +8,7 @@ global $CFG;
require_login();
if( empty($CFG->usetags)) {
error(get_string('tagsaredisabled', 'tag'));
print_error('tagsaredisabled', 'tag');
}
$query = optional_param('query', '', PARAM_RAW);
+1 -1
View File
@@ -6,7 +6,7 @@ require_once('lib.php');
require_login();
if (empty($CFG->usetags)) {
error(get_string('tagsaredisabled', 'tag'));
print_error('tagsaredisabled', 'tag');
}
$query = addslashes(optional_param('query', '', PARAM_RAW));
+1 -1
View File
@@ -28,6 +28,6 @@
send_file($pathname, $image);
} else {
header('HTTP/1.0 404 not found');
error(get_string('filenotfound', 'error')); //this is not displayed on IIS??
print_error('filenotfound', 'error'); //this is not displayed on IIS??
}
?>
+1 -1
View File
@@ -116,7 +116,7 @@
if (!$gtrue) {
$navigation = build_navigation($navlinks);
print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, "&nbsp;", navmenu($course));
error(get_string("groupnotamember"), "../course/view.php?id=$course->id");
print_error("groupnotamember", '', "../course/view.php?id=$course->id");
}
}
}