]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error"
authordongsheng <dongsheng>
Fri, 13 Jun 2008 07:07:45 +0000 (07:07 +0000)
committerdongsheng <dongsheng>
Fri, 13 Jun 2008 07:07:45 +0000 (07:07 +0000)
lang/en_utf8/error.php
user/addnote.php
user/edit.php
user/editadvanced.php
user/extendenrol.php
user/groupaddnote.php
user/groupextendenrol.php
user/messageselect.php
user/policy.php
user/tabs.php
user/view.php

index 87e10cd088c39385e73caa792a4781c8697343c7..4a6b3e03b8f68f82a005ec6bef83b3b84ce8081a 100644 (file)
@@ -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!';
index fce7e91e49ae382a6b118dab0561982048ff8133..60ca56831eed8b98c7dd7a8238a3f7071b2c802a 100644 (file)
@@ -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();
index 7844dc80a368584652df9f1d20bce7c4b7781b19..46ea23c061f8da1b16291570bb2d10acc7195faa 100644 (file)
@@ -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 {
         $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
index c40048f4ee8830f61b8fa06787689142ab0581fe..8d3f88ebae14b6007cc9e08bfade499f448949ee 100644 (file)
@@ -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');
         }
     }
 
             $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);
                     }
                 }
             }
index a84f13a9a757013fd4d537e084dbcc5942600781..ec5ddb2862e09c77fec007c12648d6fc96925572 100644 (file)
@@ -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) {
index 0deff44691fbfae6e4fa8cc9f7d2ebaa571a1ed7..bc3145ce78d30ac531837ddf374d2c02bb61f14b 100644 (file)
@@ -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);
index de0897c5a7bf6087b0b5575b081f6937c56814e4..6f32af5ec129f4f631fc52ef5b0e3d7a3f7e94ff 100755 (executable)
@@ -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);
index 256e90cacdd65f95266bf62714195fe2a3ab3851..c049e4713afa7423c7573fddc0e38bef5905ce9e 100644 (file)
@@ -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();
index 0545455f1ede82096ee9b3cc72ee7b46aeca37bf..00a58a6e886682c948c3d3b002f5006de60c00af 100644 (file)
@@ -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;
index 1b6062bbd8ef3d41fec32f35b5676eb7d5669f68..7deeada633506e6bbb27fee31fcd17a5b33641a4 100644 (file)
@@ -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)) {
index 79340dc43e9d8848aa162349bc609c3d72b7b41e..2e829f54dfc8eedf36300d77c7bc8517e07df7a5 100644 (file)
     }
 
     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