summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2007-01-11 03:27:05 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2007-01-11 03:27:05 +0000
commitdea04b3d19f3f2a25a5b1fb8c78aec5f315e5b1c (patch)
tree352061de496cf37c838d7aabefe78ee56cc60c60 /modules
parent36cd6b2b21a61cc73d837bcac22b163a39ef5e44 (diff)
downloadbrdo-dea04b3d19f3f2a25a5b1fb8c78aec5f315e5b1c.tar.gz
brdo-dea04b3d19f3f2a25a5b1fb8c78aec5f315e5b1c.tar.bz2
#108339: Tiny performance improvement in user.module (ereg to strpos)
Diffstat (limited to 'modules')
-rw-r--r--modules/user/user.module4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index dde3049db..64adbdc00 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -242,7 +242,7 @@ function user_validate_name($name) {
if (!strlen($name)) return t('You must enter a username.');
if (substr($name, 0, 1) == ' ') return t('The username cannot begin with a space.');
if (substr($name, -1) == ' ') return t('The username cannot end with a space.');
- if (ereg(' ', $name)) return t('The username cannot contain multiple spaces in a row.');
+ if (strpos($name, ' ') !== FALSE) return t('The username cannot contain multiple spaces in a row.');
if (ereg("[^\x80-\xF7 [:alnum:]@_.-]", $name)) return t('The username contains an illegal character.');
if (preg_match('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
'\x{AD}'. // Soft-hyphen
@@ -256,7 +256,7 @@ function user_validate_name($name) {
$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 (strpos($name, '@') !== FALSE && !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) > USERNAME_MAX_LENGTH) return t('The username %name is too long: it must be %max characters or less.', array('%name' => $name, '%max' => USERNAME_MAX_LENGTH));
}