"MDL-14129, fix print_error"
This commit is contained in:
@@ -23,6 +23,7 @@ $string['cannotaddnewinstance'] = 'Could not add a new instance of $a';
|
||||
$string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"';
|
||||
$string['cannotsavecomment'] = 'Cannot save comment';
|
||||
$string['cannotsavefile'] = 'Cannot save the file\"$a[0]\/$a[1]\"!';
|
||||
$string['cannotsaveagreement'] = 'Could not save your agreement';
|
||||
$string['cannotcallscript'] = 'You cannot call this script in that way';
|
||||
$string['cannotcreatebackupdir'] = 'Could not create backupdata folder. The site administrator needs to fix the file permissions';
|
||||
$string['cannotcreatedefaultcat'] = 'Error creating a default category for context $a';
|
||||
@@ -32,6 +33,7 @@ $string['cannotcreatelangbase'] = 'Error: Could not create base lang directory.'
|
||||
$string['cannotcreatetempdir'] = 'Cannot create temp dir.';
|
||||
$string['cannotcreatesitedir'] = 'Cannot create site folder. The site administrator needs to fix the file permissions.';
|
||||
$string['cannotcreateuploaddir'] = 'Cannot create upload folder. The site administrator needs to fix the file permissions';
|
||||
$string['cannotcreateuser'] = 'Error creating user record';
|
||||
$string['cannotcreateorfindstructs'] = 'Error finding or creating section structures for this course';
|
||||
$string['cannotcreatepopupwin'] = 'Undefined element - cannot create popup window.';
|
||||
$string['cannotcustomizelocallang'] = 'You do not have permission to customize the strings translation. This permission is controlled by the capability "moodle/site:langeditlocal". Set this capability to allow you to edit local language packages in case you want to modify translations for your site.';
|
||||
@@ -49,6 +51,7 @@ $stirng['cannoteditcommentexpired'] = 'You can\'t edit this. Time expired!';
|
||||
$string['cannoteditsiteform'] = 'You cannot edit the site course using this form';
|
||||
$string['cannoteditpostorblog'] = 'You can not post or edit blogs.';
|
||||
$string['cannoteditmasterlang'] = 'You do not have permission to edit master language package. This permission is controlled by the capability "moodle/site:langeditmaster". Set this capability to allow you to edit master language packages in case you are the maintainer of a package.';
|
||||
$string['cannotedityourprofile'] = 'Can not edit own profile, sorry.';
|
||||
$string['cannotfindcomponent'] = 'Cannot find component.';
|
||||
$string['cannotfindcontext'] = 'Could not find context';
|
||||
$string['cannotfindcategory'] = 'Cannot find category record from database by ID - $a';
|
||||
@@ -117,7 +120,10 @@ $string['cannotupdaterole'] = 'Cannot update role!';
|
||||
$string['cannotupdatemod'] = 'Could not update $a';
|
||||
$string['cannotupdatemodcap'] = 'Could not update $a capabilities!';
|
||||
$string['cannotupdateuser'] = 'updating user failed';
|
||||
$string['cannotupdateuseronexauth'] = 'Failed to update user data on external auth: $a. See the server logs for more details.';
|
||||
$strign['cannotupdatepasswordonextauth'] = 'Failed to update password on external auth: $a. See the server logs for more details.';
|
||||
$string['cannotupdateplugincap'] = 'Could not update $a capabilities!';
|
||||
$string['cannotupdateprofile'] = 'Error updating user record';
|
||||
$stirng['cannotupdaterss'] = 'Cannot update rss';
|
||||
$string['cannotupdatesummary'] = 'Could not update the summary!';
|
||||
$string['cannotupdatesubcate'] = 'Could not update a child category!';
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ $users = optional_param('userid', array(), PARAM_INT); // array of user id
|
||||
$contents = optional_param('contents', array(), PARAM_RAW); // array of user notes
|
||||
$states = optional_param('states', array(), PARAM_ALPHA); // array of notes states
|
||||
if (! $course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error("Course ID is incorrect");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
@@ -18,7 +18,7 @@ require_capability('moodle/notes:manage', $context);
|
||||
|
||||
if (!empty($users) && confirm_sesskey()) {
|
||||
if (count($users) != count($contents) || count($users) != count($states)) {
|
||||
print_error('Parameters malformation', '', $CFG->wwwroot.'/user/index.php?id='.$id);
|
||||
print_error('invalidformdata', '', $CFG->wwwroot.'/user/index.php?id='.$id);
|
||||
}
|
||||
|
||||
$note = new object();
|
||||
|
||||
+5
-6
@@ -12,7 +12,7 @@
|
||||
$course = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site)
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$course))) {
|
||||
print_error('Course ID was incorrect');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
// The user profile we are editing
|
||||
if (!$user = $DB->get_record('user', array('id'=>$userid))) {
|
||||
print_error('User ID was incorrect');
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
|
||||
// Guest can not be edited
|
||||
@@ -62,7 +62,7 @@
|
||||
if ($user->id == $USER->id) {
|
||||
//editing own profile - require_login() MUST NOT be used here, it would result in infinite loop!
|
||||
if (!has_capability('moodle/user:editownprofile', $systemcontext)) {
|
||||
print_error('Can not edit own profile, sorry.');
|
||||
print_error('cannotedityourprofile');
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -98,15 +98,14 @@
|
||||
$usernew->timemodified = time();
|
||||
|
||||
if (!$DB->update_record('user', $usernew)) {
|
||||
print_error('Error updating user record');
|
||||
print_error('cannotupdateprofile');
|
||||
}
|
||||
|
||||
// pass a true $userold here
|
||||
if (! $authplugin->user_update($user, $userform->get_data())) {
|
||||
// auth update failed, rollback for moodle
|
||||
$DB->update_record('user', $user);
|
||||
print_error('Failed to update user data on external auth: '.$user->auth.
|
||||
'. See the server logs for more details.');
|
||||
print_error('cannotupdateprofile');
|
||||
}
|
||||
|
||||
//update preferences
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
$course = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site)
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$course))) {
|
||||
print_error('Course ID was incorrect');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
require_login($course->id);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
// editing existing user
|
||||
require_capability('moodle/user:update', $systemcontext);
|
||||
if (!$user = $DB->get_record('user', array('id'=>$id))) {
|
||||
print_error('User ID was incorrect');
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,26 +89,24 @@
|
||||
$usernew->confirmed = 1;
|
||||
$usernew->password = hash_internal_user_password($usernew->newpassword);
|
||||
if (!$usernew->id = $DB->insert_record('user', $usernew)) {
|
||||
print_error('Error creating user record');
|
||||
print_error('cannotcreateuser');
|
||||
}
|
||||
} else {
|
||||
if (!$DB->update_record('user', $usernew)) {
|
||||
print_error('Error updating user record');
|
||||
print_error('cannotupdateuser');
|
||||
}
|
||||
// pass a true $userold here
|
||||
if (! $authplugin->user_update($user, $userform->get_data())) {
|
||||
// auth update failed, rollback for moodle
|
||||
$DB->update_record('user', $user);
|
||||
print_error('Failed to update user data on external auth: '.$user->auth.
|
||||
'. See the server logs for more details.');
|
||||
print_error('cannotupdateuseronexauth', '', '', $user->auth);
|
||||
}
|
||||
|
||||
//set new password if specified
|
||||
if (!empty($usernew->newpassword)) {
|
||||
if ($authplugin->can_change_password()) {
|
||||
if (!$authplugin->user_update_password($usernew, $usernew->newpassword)){
|
||||
print_error('Failed to update password on external auth: ' . $usernew->auth .
|
||||
'. See the server logs for more details.');
|
||||
print_error('cannotupdatepasswordonextauth', '', '', $usernew->auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ $id = required_param('id', PARAM_INT); // course id
|
||||
$users = optional_param('userid', array(), PARAM_INT); // array of user id
|
||||
|
||||
if (! $course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error("Course ID is incorrect");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
@@ -17,7 +17,7 @@ $today = time();
|
||||
$today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
|
||||
if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) {
|
||||
if (count($form->userid) != count($form->extendperiod) || count($form->userid) != count($form->extendbase)) {
|
||||
print_error('Parameters malformation', '', $CFG->wwwroot.'/user/index.php?id='.$id);
|
||||
print_error('invalidformdata', '', $CFG->wwwroot.'/user/index.php?id='.$id);
|
||||
}
|
||||
|
||||
foreach ($form->userid as $k => $v) {
|
||||
|
||||
@@ -8,7 +8,7 @@ $content = optional_param('content', '', PARAM_RAW); // note content
|
||||
$state = optional_param('state', '', PARAM_ALPHA); // note publish state
|
||||
|
||||
if (! $course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error("Course ID is incorrect");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
|
||||
@@ -5,7 +5,7 @@ $id = required_param('id', PARAM_INT); // course id
|
||||
$users = optional_param('userid', array(), PARAM_INT); // array of user id
|
||||
|
||||
if (! $course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error("Course ID is incorrect");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $id);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
$deluser = optional_param('deluser',0,PARAM_INT);
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error("Invalid course id");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
require_login();
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
if ($agree and confirm_sesskey()) { // User has agreed
|
||||
if (!isguestuser()) { // Don't remember guests
|
||||
if (!$DB->set_field('user', 'policyagreed', 1, array('id'=>$USER->id))) {
|
||||
print_error('Could not save your agreement');
|
||||
print_error('cannotsaveagreement');
|
||||
}
|
||||
}
|
||||
$USER->policyagreed = 1;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
$filterselect = clean_param($filterselect, PARAM_INT);
|
||||
|
||||
if (empty($currenttab) or empty($user) or empty($course)) {
|
||||
//print_error('You cannot call this script in that way');
|
||||
//print_error('cannotcallscript');
|
||||
}
|
||||
|
||||
if (($filtertype == 'site' && $filterselect) || ($filtertype=='user' && $filterselect)) {
|
||||
|
||||
+2
-2
@@ -17,11 +17,11 @@
|
||||
}
|
||||
|
||||
if (! $user = $DB->get_record("user", array("id"=>$id))) {
|
||||
print_error("No such user in this course");
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$course))) {
|
||||
print_error("No such course id");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
/// Make sure the current user is allowed to see this user
|
||||
|
||||
Reference in New Issue
Block a user