From a9ad3633c7dc03b0447424eacc28edf8c7d03ee3 Mon Sep 17 00:00:00 2001 From: donal72 Date: Wed, 10 Jan 2007 23:17:51 +0000 Subject: [PATCH] Auth: Replace hardcoded strings: MDL-8069 --- auth/cas/auth.php | 2 +- auth/cas/config.html | 18 +++++------ auth/cas/forbidden.php | 2 +- auth/cas/login.php | 10 ++---- auth/db/auth.php | 25 +++++++++------ auth/db/config.html | 20 ++++++------ auth/email/auth.php | 4 +-- auth/fc/config.html | 13 ++++---- auth/fc/fcFPP.php | 2 +- auth/ldap/config.html | 43 +++++++++++++------------- lang/en_utf8/auth.php | 67 +++++++++++++++++++++++++++++++++++++++-- lang/en_utf8/moodle.php | 1 + 12 files changed, 135 insertions(+), 72 deletions(-) diff --git a/auth/cas/auth.php b/auth/cas/auth.php index b3a48d657e9..55b5b99e7b1 100644 --- a/auth/cas/auth.php +++ b/auth/cas/auth.php @@ -95,7 +95,7 @@ class auth_plugin_cas { } } else { ldap_close($ldap_connection); - error("LDAP part of CAS-module cannot connect to server: $CFG->ldap_host_url"); + print_error('auth_cas_cantconnect', 'auth', $CFG->ldap_host_url); } return false; } diff --git a/auth/cas/config.html b/auth/cas/config.html index 9d2084e7879..22250ff1a20 100644 --- a/auth/cas/config.html +++ b/auth/cas/config.html @@ -45,7 +45,7 @@ - use_cas: + : - hostname: + : - baseuri: + : - port: + : - casversion: + : - language: + : - auth_user_create: + : - create_user: + : - changepasswordurl: + : langmenu)) { @@ -118,9 +118,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); if (isset($passwordchangeurl)) { redirect($passwordchangeurl); } else { - error("You cannot proceed without changing your password. - However there is no available page for changing it. - Please contact your Moodle Administrator."); + print_error('auth_cas_broken_password','auth'); } } @@ -224,9 +222,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); if (isset($passwordchangeurl)) { redirect($passwordchangeurl); } else { - error("You cannot proceed without changing your password. - However there is no available page for changing it. - Please contact your Moodle Administrator."); + print_error('auth_cas_broken_password','auth'); } } diff --git a/auth/db/auth.php b/auth/db/auth.php index 893f11ee3d5..2d7065a11dc 100644 --- a/auth/db/auth.php +++ b/auth/db/auth.php @@ -70,8 +70,7 @@ class auth_plugin_db { $authdb->Close(); if (!$rs) { - notify("Could not connect to the specified authentication database..."); - + print_error('auth_dbcantconnect','auth'); return false; } @@ -101,7 +100,7 @@ class auth_plugin_db { $CFG->prefix = $prefix; if (!$rs) { - notify("Could not connect to the specified authentication database..."); + print_error('auth_dbcantconnect','auth'); return false; } @@ -209,7 +208,8 @@ class auth_plugin_db { $remove_users = get_records_sql($sql); if (!empty($remove_users)) { - print "User entries to remove: ". count($remove_users) . "\n"; + print_string('auth_dbuserstoremove','auth', count($remove_users)); + echo "\n"; begin_sql(); foreach ($remove_users as $user) { @@ -295,7 +295,8 @@ class auth_plugin_db { unset($usernames); if (!empty($add_users)) { - print "User entries to add: ". count($add_users). "\n"; + print_string('auth_dbuserstoadd','auth',count($add_users)); + echo "\n"; begin_sql(); foreach($add_users as $user) { $username = $user; @@ -316,9 +317,11 @@ class auth_plugin_db { if ($old_user = get_record('user', 'username', $user->username, 'deleted', 1, 'mnethostid', $user->mnethostid)) { $user->id = $old_user->id; set_field('user', 'deleted', 0, 'username', $user->username); - echo "Revived user $user->username id $user->id\n"; + print_string('auth_dbrevive','auth',array($user->username, $user->id)); + echo "\n"; } elseif ($id=insert_record ('user',$user)) { // it is truly a new user - echo "inserted user $user->username id $id\n"; + print_string('auth_dbinsertuser','auth',array($user->username, $id)); + echo "\n"; $user->id = $id; // if relevant, tag for password generation if ($this->config->passtype === 'internal') { @@ -326,7 +329,8 @@ class auth_plugin_db { set_user_preference('create_password', 1, $id); } } else { - echo "error inserting user $user->username \n"; + print_string('auth_dbinsertusererror', 'auth', $user->username); + echo "\n"; } $CFG->debug=$old_debug; } @@ -346,7 +350,7 @@ class auth_plugin_db { $authdb->Close(); if (!$rs) { - notify("Could not connect to the specified authentication database..."); + print_error('auth_dbcantconnect','auth'); return false; } @@ -377,7 +381,7 @@ class auth_plugin_db { $authdb->Close(); if (!$rs) { - notify("Could not connect to the specified authentication database..."); + print_error('auth_dbcantconnect','auth'); return false; } @@ -427,6 +431,7 @@ class auth_plugin_db { $user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id); if (empty($user)) { // trouble error_log("Cannot update non-existent user: $username"); + print_error('auth_dbusernotexist','auth',$username); die; } diff --git a/auth/db/config.html b/auth/db/config.html index e2058e681b5..09d70f4f0ac 100644 --- a/auth/db/config.html +++ b/auth/db/config.html @@ -38,7 +38,7 @@ - + - + - + - + - + - + - + - + - + - +
host: :
type: :
name: :
user: :
pass: :
table: :
fielduser: :
fieldpass: :
passtype: :
changepasswordurl: : id = insert_record('user', $user)) ) { - error('Could not add your record to the database!'); + print_error('auth_emailnoinsert','auth'); } if (! send_confirmation_email($user)) { - error('Tried to send you an email but failed!'); + print_error('auth_emailnoemail','auth'); } if ($notify) { diff --git a/auth/fc/config.html b/auth/fc/config.html index f1d87ee1a7d..e99b1188ba2 100644 --- a/auth/fc/config.html +++ b/auth/fc/config.html @@ -27,7 +27,7 @@ - + - + - + - - + - + - + - + - + - + - + - + - + - + - + - + + - + - + - + - + + - + - + - + - + - - + - +
host:: @@ -38,7 +38,7 @@
fppport:: @@ -49,7 +49,7 @@
userid:: @@ -58,9 +58,8 @@
passwd:: @@ -71,7 +70,7 @@
creators:: @@ -82,7 +81,7 @@
changepasswordurl: :
host_url:: @@ -80,7 +80,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
version::
preventpassindb::
bind_dn:: @@ -125,7 +125,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
bind_pw:: @@ -141,7 +141,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
user_type:: ldap_suppported_usertypes(), 'user_type', $config->user_type, ''); ?> @@ -152,7 +152,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
contexts:: @@ -163,7 +163,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
search_sub::
opt_deref:: - user_attribute:: @@ -206,7 +206,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
memberattribute:: @@ -216,7 +216,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
objectclass:: @@ -268,7 +268,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
changepasswordurl: :
expiration:: - expiration_warning::
exprireattr::
gracelogins::
graceattr::
auth_user_create: :
create_context:: @@ -399,7 +398,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
creators:: diff --git a/lang/en_utf8/auth.php b/lang/en_utf8/auth.php index 457a434e20c..5dfff340548 100644 --- a/lang/en_utf8/auth.php +++ b/lang/en_utf8/auth.php @@ -23,6 +23,21 @@ $string['auth_cas_enabled'] = 'Turn this on if you want to use CAS authenticatio $string['auth_cas_text'] = 'Secure connection'; $string['auth_cas_create_user'] = 'Turn this on if you want to insert CAS-authenticated users in Moodle database. If not then only users who already exist in the Moodle database can log in.'; $string['auth_casnotinstalled'] = 'Cannot use CAS authentication. The PHP LDAP module is not installed.'; +$string['auth_cas_cantconnect'] ='LDAP part of CAS-module cannot connect to server: $a'; +$string['auth_cas_use_cas'] ='Use CAS'; +$string['auth_cas_broken_password'] ='You cannot proceed without changing your password, however there is no available page for changing it. Please contact your Moodle Administrator.'; + + +$string['auth_cas_hostname_key'] ='Hostname'; +$string['auth_cas_changepasswordurl'] ='Password-change URL'; +$string['auth_cas_create_user_key'] ='Create user'; +$string['auth_cas_auth_user_create'] ='Create users externally'; +$string['auth_cas_language_key'] ='Language'; +$string['auth_cas_casversion'] ='Version'; +$string['auth_cas_port_key'] ='Port'; +$string['auth_cas_baseuri_key'] ='Base URI'; + + $string['auth_changepasswordurl'] = 'Change password URL'; $string['auth_changepasswordurl_expl'] = 'Specify the url to send users who have lost their $a password. Set Use standard Change Password page to No.'; @@ -39,15 +54,34 @@ $string['auth_dbfielduser'] = 'Name of the field containing usernames'; $string['auth_dbhost'] = 'The computer hosting the database server.'; $string['auth_dbname'] = 'Name of the database itself'; $string['auth_dbpass'] = 'Password matching the above username'; -$string['auth_dbpasstype'] = '

Specify the format that the password field is using. MD5 encryption is useful for connecting to other common web applications like PostNuke.

Use \'internal\' if you want to the external DB to manage usernames & email addresses, but Moodle to manage passwords. If you use \'internal\', you must provide a populated email address field in the external DB, and you must execute admin/cron.php regularly. Moodle will send an email to new users with a temporary password.

'; +$string['auth_dbpasstype'] = '

Specify the format that the password field is using. MD5 encryption is useful for connecting to other common web applications like PostNuke.

Use \'internal\' if you want to the external DB to manage usernames & email addresses, but Moodle to manage passwords. If you use \'internal\', you must provide a populated email address field in the external DB, and you must execute admin/cron.php regularly. Moodle will send an email to new users with a temporary password.

'; $string['auth_dbtable'] = 'Name of the table in the database'; $string['auth_dbtitle'] = 'Use an external database'; $string['auth_dbtype'] = 'The database type (See the ADOdb documentation for details)'; $string['auth_dbuser'] = 'Username with read access to the database'; +$string['auth_dbcantconnect'] ='Could not connect to the specified authentication database...'; +$string['auth_dbuserstoadd'] = 'User entries to add: $a'; +$string['auth_dbrevive'] = 'Revived user $a[0] id $a[1]'; +$string['auth_dbinsertuser'] ='inserted user $a[0] id $a[1]'; +$string['auth_dbinsertusererror'] = 'error inserting user $a'; +$string['auth_dbuserstoremove'] = 'User entries to remove: $a'; +$string['auth_dbusernotexist'] = 'Cannot update non-existent user: $a'; +$string['auth_dbhost_key'] = 'Host'; +$string['auth_dbtype_key'] = 'Database'; +$string['auth_dbname_key'] = 'DB Name'; +$string['auth_dbuser_key'] = 'DB User'; +$string['auth_dbpass_key'] = 'Password'; +$string['auth_dbtable_key'] = 'Table'; +$string['auth_dbfielduser_key'] = 'Username field'; +$string['auth_dbfieldpass_key'] = 'Password field'; +$string['auth_dbpasstype_key'] = 'Password format'; +$string['auth_dbchangepasswordurl_key'] = 'Password-change URL'; // Email plugin $string['auth_emaildescription'] = 'Email confirmation is the default authentication method. When the user signs up, choosing their own new username and password, a confirmation email is sent to the user\'s email address. This email contains a secure link to a page where the user can confirm their account. Future logins just check the username and password against the stored values in the Moodle database.'; $string['auth_emailtitle'] = 'Email-based self-registration'; +$string['auth_emailnoinsert'] = 'Could not add your record to the database!'; +$string['auth_emailnoemail'] = 'Tried to send you an email but failed!'; // FirstClass plugin $string['auth_fccreators'] = 'List of groups whose members are allowed to create new courses. Separate multiple groups with \';\'. Names must be spelled exactly as on FirstClass server. System is case-sensitive.'; @@ -57,6 +91,13 @@ $string['auth_fchost'] = 'The FirstClass server address. Use the IP number or DN $string['auth_fcpasswd'] = 'Password for the account above.'; $string['auth_fctitle'] = 'Use a FirstClass server'; $string['auth_fcuserid'] = 'Userid for FirstClass account with privilege \'Subadministrator\' set.'; +$string['auth_fchost_key'] = 'Host:'; +$string['auth_fcfppport_key'] = 'Port'; +$string['auth_fcuserid_key'] = 'User ID'; +$string['auth_fcpasswd_key'] = 'Password'; +$string['auth_fccreators_key'] = 'Creators'; +$string['auth_fcchangepasswordurl'] = 'Password-change URL'; +$string['auth_fcconnfail'] = 'Connection failed with Errno: $a[0] and Error String: $a[1]'; // Fieldlocks $string['auth_fieldlock'] = 'Lock value'; @@ -81,7 +122,7 @@ $string['auth_ldap_create_context'] = 'If you enable user creation with email co $string['auth_ldap_creators'] = 'List of groups whose members are allowed to create new courses. Separate multiple groups with \';\'. Usually something like \'cn=teachers,ou=staff,o=myorg\''; $string['auth_ldap_expiration_desc'] = 'Select No to disable expired password checking or LDAP to read passwordexpiration time directly from LDAP'; $string['auth_ldap_expiration_warning_desc'] = 'Number of days before password expiration warning is issued.'; -$string['auth_ldap_expireattr_desc'] = 'Optional: overrides ldap-attribute what stores password expiration time passwordExpirationTime'; +$string['auth_ldap_expireattr_desc'] = 'Optional: overrides ldap-attribute that stores password expiration time'; $string['auth_ldap_graceattr_desc'] = 'Optional: Overrides gracelogin attribute'; $string['auth_ldap_gracelogins_desc'] = 'Enable LDAP gracelogin support. After password has expired user can login until gracelogin count is 0. Enabling this setting displays grace login message if password is exprired.'; $string['auth_ldap_host_url'] = 'Specify LDAP host in URL-form like \'ldap://ldap.myorg.com/\' or \'ldaps://ldap.myorg.com/\' Separate multipleservers with \';\' to get failover support.'; @@ -107,6 +148,28 @@ $string['auth_ldapdescription'] = 'This method provides authentication against a wanted fields in Moodle. For following logins only the username and password are checked.'; +$string['auth_ldap_host_url_key'] = 'Host URL'; +$string['auth_ldap_version_key'] = 'Version'; +$string['auth_ldap_preventpassindb_key'] = 'Hide passwords'; +$string['auth_ldap_bind_dn_key'] = 'Distinguished Name'; +$string['auth_ldap_bind_pw_key'] = 'Password'; +$string['auth_ldap_user_type_key'] = 'User type'; +$string['auth_ldap_contexts_key'] = 'Contexts'; +$string['auth_ldap_search_sub_key'] = 'Search subcontexts'; +$string['auth_ldap_opt_deref_key'] = 'Dereference aliases'; +$string['auth_ldap_user_attribute_key'] = 'User attribute'; +$string['auth_ldap_memberattribute_key'] = 'Member attribute'; +$string['auth_ldap_objectclass_key'] = 'Object class'; +$string['auth_ldap_changepasswordurl_key'] = 'Password-change URL'; +$string['auth_ldap_expiration_key'] = 'Expiration'; +$string['auth_ldap_expiration_warning_key'] = 'Expiration warning'; +$string['auth_ldap_exprireattr_key'] = 'Expiration attribute'; +$string['auth_ldap_gracelogins_key'] = 'Grace logins'; +$string['auth_ldap_gracelogin_key'] = 'Grace login attribute'; +$string['auth_ldap_auth_user_create_key'] = 'Create users externally'; +$string['auth_ldap_create_context_key'] = 'Context for new users'; +$string['auth_ldap_creators_key'] = 'Creators'; + $string['auth_ldapextrafields'] = 'These fields are optional. You can choose to pre-fill some Moodle user fields with information from the LDAP fields that you specify here.

If you leave these fields blank, then nothing will be transferred from LDAP and Moodle defaults will be used instead.

In either case, the user will be able to edit all of these fields after they log in.

'; $string['auth_ldaptitle'] = 'Use an LDAP server'; $string['auth_ldapnotinstalled'] = 'Cannot use LDAP authentication. The PHP LDAP module is not installed.'; diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index 2fa79475eb1..a01d1627cf3 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -986,6 +986,7 @@ $string['noreplyname'] = 'Do not reply to this email'; $string['noresults'] = 'No results'; $string['normal'] = 'Normal'; $string['normalfilter'] = 'Normal search'; +$string['nosite'] = 'Could not find site-level course'; $string['nostatstodisplay'] = 'There is no available data to display, sorry.'; $string['nostudentsfound'] = 'No $a found'; $string['nostudentsingroup'] = 'There are no students in this group yet';