]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error"
authordongsheng <dongsheng>
Sun, 15 Jun 2008 10:06:06 +0000 (10:06 +0000)
committerdongsheng <dongsheng>
Sun, 15 Jun 2008 10:06:06 +0000 (10:06 +0000)
lang/en_utf8/error.php
login/change_password.php
login/confirm.php
login/forgot_password.php
login/index.php

index b365ce87a61faf226e10ff68030954dcb42cf3b5..08beca639d60b5e372cd674ea06943391cfdd2c5 100644 (file)
@@ -67,6 +67,7 @@ $string['cannotfindinfo'] = 'Cannot find info for: \"$a\"';
 $string['cannotfindlang'] = 'Cannot find \"$a\" language pack!';
 $string['cannotfindsite'] = 'Cannot find site-level course';
 $string['cannotfindteacher'] = 'Cannot find teacher.';
+$string['cannotfinduser'] = 'Cannot find user named \"$a\"';
 $string['cannotimportgrade'] = 'Grade import error';
 $string['cannotimportformat'] = 'Sorry, importing this format is not yet implemented!';
 $string['cannotnetgeo'] = 'Can not connect to NetGeo server at http://netgeo.caida.org, please check proxy settings or better install MaxMind GeoLite City data file.';
@@ -75,6 +76,7 @@ $string['cannotgetcats'] = 'Cannot get category record';
 $string['cannotgetdata'] = 'Cannot get data';
 $string['cannotgradeuser'] = 'Can not grade this user';
 $string['cannothaveparentcate'] = 'Course category can not have parent!';
+$string['cannotmailconfirm'] = 'error sending password change confirmation email';
 $string['cannotmapfield'] = 'mapping collision detected, 2 fields maps to the same grade item $a';
 $string['cannotmarktopic'] = 'Could not mark that topic for this course';
 $string['cannotmoverolewithid'] = 'Cannot move role with ID $a';
@@ -90,6 +92,8 @@ $string['cannotreaduploadfile'] = 'Could not read uploaded file';
 $string['cannotreadfile'] = 'Can not read file';
 $string['cannotremovefrommeta'] = 'Could not remove the selected course from this meta course!';
 $string['cannotrestore'] = 'An error has occurred and the restore could not be completed!';
+$string['cannotresetguestpwd'] = 'You cannot reset the guest password';
+$string['cannotresetmail'] = 'Error resetting password and mailing you';
 $string['cannotsaveblock'] = 'Error saving block configuration';
 $string['cannotsavefile'] = 'Cannot save the file \"$a\".';
 $string['cannotinitpage'] = 'Cannot quickly initialize page, course id: $a';
@@ -132,6 +136,7 @@ $string['cannotupdateplugincap'] = 'Could not update $a capabilities!';
 $string['cannotupdateprofile'] = 'Error updating user record';
 $string['cannotupdatecustomprofile'] = 'Error updating user custom record';
 $stirng['cannotupdaterss'] = 'Cannot update rss';
+$string['cannotupdatesecret'] = 'Error resetting user secret string';
 $string['cannotupdatesummary'] = 'Could not update the summary!';
 $string['cannotupdatesubcate'] = 'Could not update a child category!';
 $string['cannotupdatesubcourse'] = 'Could not update a child course!';
@@ -143,6 +148,7 @@ $string['cannotunassigncap'] = 'Could not unassign deprecated capability $a[0] f
 $string['cannotrestoreadminorcreator'] = 'You need to be a creator or admin user to restore into new course!';
 $string['cannotrestoreadminoredit'] = 'You need to be a edit teacher or admin user to restore into selected course!';
 $string['cannotusepage'] = 'Only teacher and administrator can use this page.';
+$string['cannotusepage2'] = 'Sorry, you may not use this page.';
 $string['cannotviewprofile'] = 'You can not view the profile of this user.';
 $string['cantunenrollfrommetacourse'] = 'You can not unenrol from this meta course.';
 $string['cantunenrollinthisrole'] = 'You can not unenrol from this course while you are in your current role.';
@@ -209,6 +215,7 @@ $string['invalidcourse'] = 'Invalid course';
 $string['invalidcourseid'] = 'You are trying to use an invalid course ID: ($a)';
 $string['invalidcourselevel'] = 'Incorrect context level';
 $string['invalidcoursemodule'] = 'Invalid course module ID';
+$string['invalidconfirmdata'] = 'Invalid confirmation data';
 $string['invalidcontext'] = 'Invalid context';
 $string['invalidcomment'] = 'Comment is incorrect';
 $string['invaliddata'] = 'Data submitted is invalid.';
index 94a9b28b96b99500347c3964769ba5c40f7b3870..ecb40b3868194bfd78ec36c32a5abe05a39f194e 100644 (file)
@@ -13,7 +13,7 @@
     $systemcontext = get_context_instance(CONTEXT_SYSTEM);
 
     if (!$course = $DB->get_record('course', array('id'=>$id))) {
-        print_error('No such course!');
+        print_error('invalidcourseid');
     }
 
     // require proper login; guest user can not change password
@@ -31,7 +31,7 @@
 
     // do not allow "Logged in as" users to change any passwords
     if (!empty($USER->realuser)) {
-        print_error('Can not use this script when "Logged in as"!');
+        print_error('cannotcallscript');
     }
 
     if (is_mnet_remote_user($USER)) {
@@ -39,7 +39,7 @@
         if ($idprovider = $DB->get_record('mnet_host', array('id'=>$USER->mnethostid))) {
             $message .= get_string('userchangepasswordlink', 'mnet', $idprovider);
         }
-        print_error($message);
+        print_error('userchangepasswordlink', 'mnet', '', $message);
     }
 
     // load the appropriate auth plugin
index 04251de1c638b85814bbc593a0872ec6298faf9b..5e4a15e9a3e1495397fe94a544475ff1b9ddbc29 100644 (file)
@@ -8,12 +8,12 @@
     $s = optional_param('s', '', PARAM_CLEAN);        // Old parameter:  username
 
     if (empty($CFG->registerauth)) {
-        print_error("Sorry, you may not use this page.");
+        print_error('cannotusepage2');
     }
     $authplugin = get_auth_plugin($CFG->registerauth);
 
     if (!$authplugin->can_confirm()) {
-        print_error("Sorry, you may not use this page.");
+        print_error('cannotusepage2');
     }
 
     if (!empty($data) || (!empty($p) && !empty($s))) {
@@ -45,7 +45,7 @@
             // The user has confirmed successfully, let's log them in
 
             if (!$USER = get_complete_user_data('username', $username)) {
-                print_error("Something serious is wrong with the database");
+                print_error('cannotfinduser', '', '', $username);
             }
 
             set_moodle_cookie($USER->username);
@@ -65,7 +65,7 @@
             print_footer();
             exit;
         } else {
-            print_error("Invalid confirmation data");
+            print_error('invalidconfirmdata');
         }
     } else {
         print_error("errorwhenconfirming");
index c39e09f94aa79702568ed76f7e87e3901ab56adf..123861f82f1f04d42dae8be8271674a9bbfee624 100644 (file)
@@ -48,7 +48,7 @@ if ($p_secret !== false) {
 
         // check this isn't guest user
         if (isguestuser($user)) {
-            print_error('You cannot reset the guest password');
+            print_error('cannotresetguestpwd');
         }
 
         // make sure user is allowed to change password
@@ -57,13 +57,13 @@ if ($p_secret !== false) {
         // override email stop and mail new password
         $user->emailstop = 0;
         if (!reset_password_and_mail($user)) {
-            print_error('Error resetting password and mailing you');
+            print_error('cannotresetmail');
         }
 
         // Clear secret so that it can not be used again
         $user->secret = '';
         if (!$DB->set_field('user', 'secret', $user->secret, array('id'=>$user->id))) {
-            print_error('Error resetting user secret string');
+            print_error('cannotupdatesecret');
         }
 
         reset_login_count();
@@ -115,16 +115,16 @@ if ($mform->is_cancelled()) {
             // set 'secret' string
             $user->secret = random_string(15);
             if (!$DB->set_field('user', 'secret', $user->secret, array('id'=>$user->id))) {
-                print_error('error setting user secret string');
+                print_error('cannotupdatesecret');
             }
 
             if (!send_password_change_confirmation_email($user)) {
-                print_error('error sending password change confirmation email');
+                print_error('cannotmailconfirm');
             }
 
         } else {
             if (!send_password_change_info($user)) {
-                print_error('error sending password change confirmation email');
+                print_error('cannotmailconfirm');
             }
         }
     }
index 01551bf4dbdfda8086b43762db686037b73084e9..f8a61df48c561699f394544abb02feaee8bb1e3f 100644 (file)
@@ -56,7 +56,7 @@ httpsrequired();
 
 /// Define variables used in page
     if (!$site = get_site()) {
-        print_error("No site found!");
+        print_error('siteisnotdefined', 'debug');
     }
 
     if (empty($CFG->langmenu)) {