From 5281a22070b8b426ddc6e09fce7da6a21345ad69 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 19 Sep 2004 13:39:46 +0000 Subject: [PATCH] - Usability improvement: made the status messages use foo rather than "foo". --- modules/user.module | 20 ++++++++++---------- modules/user/user.module | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/user.module b/modules/user.module index 161d3607398..d0c6dcf15b6 100644 --- a/modules/user.module +++ b/modules/user.module @@ -179,13 +179,13 @@ function user_validate_name($name) { if (ereg(' ', $name)) return t('The username cannot contain multiple spaces in a row.'); if (ereg('[^ [:alnum:]@_.-]', $name)) return t('The username contains an illegal character.'); if (ereg('@', $name) && !eregi('@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$', $name)) return t('The username is not a valid authentication ID.'); - if (strlen($name) > 56) return t('The username "%name" is too long: it must be less than 56 characters.', array('%name' => $name)); + if (strlen($name) > 56) return t('The username %name is too long: it must be less than 56 characters.', array('%name' => "$name")); } function user_validate_mail($mail) { if (!$mail) return t('You must enter an e-mail address.'); if (!valid_email_address($mail)) { - return t('The e-mail address "%mail" is not valid.', array('%mail' => $mail)); + return t('The e-mail address %mail is not valid.', array('%mail' => "$mail")); } } @@ -871,7 +871,7 @@ function user_pass($edit = array()) { } else if ($edit['mail']) { $account = user_load(array('mail' => $edit['mail'], 'status' => 1)); - if (!$account) form_set_error('name', t('Sorry. The e-mail address %e-mail is not recognized.', array('%e-mail' => ''. $edit['mail'] .''))); + if (!$account) form_set_error('name', t('Sorry. The e-mail address %email is not recognized.', array('%email' => ''. $edit['mail'] .''))); } if ($account) { @@ -889,11 +889,11 @@ function user_pass($edit = array()) { $mail_success = user_mail($account->mail, $subject, $body, $headers); if ($mail_success) { - watchdog('user', t('Password mailed to %name at %e-mail.', array('%name' => "$account->name" , '%e-mail' => "$account->mail"))); + watchdog('user', t('Password mailed to %name at %email.', array('%name' => "$account->name" , '%email' => "$account->mail"))); return t('Your password and further instructions have been sent to your e-mail address.'); } else { - watchdog('error', t('Error mailing password to %name at %e-mail.', array('%name' => "$account->name", '%e-mail' => "$account->mail"))); + watchdog('error', t('Error mailing password to %name at %email.', array('%name' => "$account->name", '%email' => "$account->mail"))); return t('Unable to send mail. Please contact the site admin.'); } } @@ -926,7 +926,7 @@ function user_register($edit = array()) { // TODO: Is this necessary? Won't session_write() replicate this? unset($edit['session']); $account = user_save('', array_merge(array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)), $edit)); - watchdog('user', t('New user: %name %e-mail.', array('%name' => ''. $edit['name'] .'', '%e-mail' => '<'. $edit['mail'] .'>')), l(t('edit'), 'user/'. $account->uid .'/edit')); + watchdog('user', t('New user: %name %email.', array('%name' => ''. $edit['name'] .'', '%email' => '<'. $edit['mail'] .'>')), l(t('edit'), 'user/'. $account->uid .'/edit')); $variables = array('%username' => $edit['name'], '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $edit['mail'], '%date' => format_date(time()), '%login_uri' => url('user', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE)); @@ -1030,10 +1030,10 @@ function user_edit_validate($uid, &$edit) { form_set_error('mail', $error); } else if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) { - form_set_error('mail', t('The e-mail address %e-mail is already taken.', array('%e-mail' => ''. $edit['mail'] .''))); + form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => ''. $edit['mail'] .''))); } else if (user_deny('mail', $edit['mail'])) { - form_set_error('mail', t('The e-mail address %e-mail has been denied access.', array('%e-mail' => ''. $edit['mail'] .''))); + form_set_error('mail', t('The e-mail address %email has been denied access.', array('%email' => ''. $edit['mail'] .''))); } // Validate the roles @@ -1250,7 +1250,7 @@ function user_admin_create($edit = array()) { user_module_invoke('validate', $edit, $edit, 'account'); if (!form_get_errors()) { - watchdog('user', t('New user: %name %e-mail.', array('%name' => ''. $edit['name'] .'', '%e-mail' => '<'. $edit['mail'] .'>'))); + watchdog('user', t('New user: %name %email.', array('%name' => ''. $edit['name'] .'', '%email' => '<'. $edit['mail'] .'>'))); user_save('', array('name' => $edit['name'], 'pass' => $edit['pass'], 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => $edit['roles'], 'status' => 1)); @@ -1568,7 +1568,7 @@ function user_help($section) { case 'admin/user/account/create': return t('This web page allows the administrators to register a new users by hand. Note that you cannot have a user where either the e-mail address or the username match another user in the system.'); case 'admin/user/configure/access': - return t('Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on e-mail rules, for the username mask click on name rules.', array('%e-mail' => url('admin/user/configure/access/mail'), '%username' => url('admin/user/configure/access/user'))); + return t('Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on e-mail rules, for the username mask click on name rules.', array('%email' => url('admin/user/configure/access/mail'), '%username' => url('admin/user/configure/access/user'))); case 'admin/user/configure/access/mail': return t('Setup and test the e-mail access rules. The access function checks if you match a deny and not an allow. If you match only a deny then it is denied. Any other case, such as both a deny and an allow pattern matching, allows the pattern.'); case 'admin/user/configure/access/user': diff --git a/modules/user/user.module b/modules/user/user.module index 161d3607398..d0c6dcf15b6 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -179,13 +179,13 @@ function user_validate_name($name) { if (ereg(' ', $name)) return t('The username cannot contain multiple spaces in a row.'); if (ereg('[^ [:alnum:]@_.-]', $name)) return t('The username contains an illegal character.'); if (ereg('@', $name) && !eregi('@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$', $name)) return t('The username is not a valid authentication ID.'); - if (strlen($name) > 56) return t('The username "%name" is too long: it must be less than 56 characters.', array('%name' => $name)); + if (strlen($name) > 56) return t('The username %name is too long: it must be less than 56 characters.', array('%name' => "$name")); } function user_validate_mail($mail) { if (!$mail) return t('You must enter an e-mail address.'); if (!valid_email_address($mail)) { - return t('The e-mail address "%mail" is not valid.', array('%mail' => $mail)); + return t('The e-mail address %mail is not valid.', array('%mail' => "$mail")); } } @@ -871,7 +871,7 @@ function user_pass($edit = array()) { } else if ($edit['mail']) { $account = user_load(array('mail' => $edit['mail'], 'status' => 1)); - if (!$account) form_set_error('name', t('Sorry. The e-mail address %e-mail is not recognized.', array('%e-mail' => ''. $edit['mail'] .''))); + if (!$account) form_set_error('name', t('Sorry. The e-mail address %email is not recognized.', array('%email' => ''. $edit['mail'] .''))); } if ($account) { @@ -889,11 +889,11 @@ function user_pass($edit = array()) { $mail_success = user_mail($account->mail, $subject, $body, $headers); if ($mail_success) { - watchdog('user', t('Password mailed to %name at %e-mail.', array('%name' => "$account->name" , '%e-mail' => "$account->mail"))); + watchdog('user', t('Password mailed to %name at %email.', array('%name' => "$account->name" , '%email' => "$account->mail"))); return t('Your password and further instructions have been sent to your e-mail address.'); } else { - watchdog('error', t('Error mailing password to %name at %e-mail.', array('%name' => "$account->name", '%e-mail' => "$account->mail"))); + watchdog('error', t('Error mailing password to %name at %email.', array('%name' => "$account->name", '%email' => "$account->mail"))); return t('Unable to send mail. Please contact the site admin.'); } } @@ -926,7 +926,7 @@ function user_register($edit = array()) { // TODO: Is this necessary? Won't session_write() replicate this? unset($edit['session']); $account = user_save('', array_merge(array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)), $edit)); - watchdog('user', t('New user: %name %e-mail.', array('%name' => ''. $edit['name'] .'', '%e-mail' => '<'. $edit['mail'] .'>')), l(t('edit'), 'user/'. $account->uid .'/edit')); + watchdog('user', t('New user: %name %email.', array('%name' => ''. $edit['name'] .'', '%email' => '<'. $edit['mail'] .'>')), l(t('edit'), 'user/'. $account->uid .'/edit')); $variables = array('%username' => $edit['name'], '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $edit['mail'], '%date' => format_date(time()), '%login_uri' => url('user', NULL, NULL, TRUE), '%edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE)); @@ -1030,10 +1030,10 @@ function user_edit_validate($uid, &$edit) { form_set_error('mail', $error); } else if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) { - form_set_error('mail', t('The e-mail address %e-mail is already taken.', array('%e-mail' => ''. $edit['mail'] .''))); + form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => ''. $edit['mail'] .''))); } else if (user_deny('mail', $edit['mail'])) { - form_set_error('mail', t('The e-mail address %e-mail has been denied access.', array('%e-mail' => ''. $edit['mail'] .''))); + form_set_error('mail', t('The e-mail address %email has been denied access.', array('%email' => ''. $edit['mail'] .''))); } // Validate the roles @@ -1250,7 +1250,7 @@ function user_admin_create($edit = array()) { user_module_invoke('validate', $edit, $edit, 'account'); if (!form_get_errors()) { - watchdog('user', t('New user: %name %e-mail.', array('%name' => ''. $edit['name'] .'', '%e-mail' => '<'. $edit['mail'] .'>'))); + watchdog('user', t('New user: %name %email.', array('%name' => ''. $edit['name'] .'', '%email' => '<'. $edit['mail'] .'>'))); user_save('', array('name' => $edit['name'], 'pass' => $edit['pass'], 'init' => $edit['mail'], 'mail' => $edit['mail'], 'roles' => $edit['roles'], 'status' => 1)); @@ -1568,7 +1568,7 @@ function user_help($section) { case 'admin/user/account/create': return t('This web page allows the administrators to register a new users by hand. Note that you cannot have a user where either the e-mail address or the username match another user in the system.'); case 'admin/user/configure/access': - return t('Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on e-mail rules, for the username mask click on name rules.', array('%e-mail' => url('admin/user/configure/access/mail'), '%username' => url('admin/user/configure/access/user'))); + return t('Access rules allow Drupal administrators to choose usernames and e-mail address that are prevented from using drupal. To enter the mask for e-mail addresses click on e-mail rules, for the username mask click on name rules.', array('%email' => url('admin/user/configure/access/mail'), '%username' => url('admin/user/configure/access/user'))); case 'admin/user/configure/access/mail': return t('Setup and test the e-mail access rules. The access function checks if you match a deny and not an allow. If you match only a deny then it is denied. Any other case, such as both a deny and an allow pattern matching, allows the pattern.'); case 'admin/user/configure/access/user':