diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-05-21 18:07:23 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-05-21 18:07:23 +0000 |
commit | 35acfc18499e355c02732b37d616b1451b4c0ca7 (patch) | |
tree | 652ba947080fe1e48f28a7459704b12a92324b41 /modules/user.module | |
parent | 5bceb07008ff601273e2dc2857e329c409446c4e (diff) | |
download | brdo-35acfc18499e355c02732b37d616b1451b4c0ca7.tar.gz brdo-35acfc18499e355c02732b37d616b1451b4c0ca7.tar.bz2 |
- Patch #7723 by Roderik: added strtolower()s to make PostgreSQL behave like MySQL and to be more 'forgiving' for users logging in on a PostgreSQL powered Drupal site.
Diffstat (limited to 'modules/user.module')
-rw-r--r-- | modules/user.module | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/user.module b/modules/user.module index af3025893..d244ae975 100644 --- a/modules/user.module +++ b/modules/user.module @@ -34,7 +34,7 @@ function user_load($array = array()) { $query .= "u.$key = '". md5($value) ."' AND "; } else { - $query .= "u.$key = '". check_query($value) ."' AND "; + $query .= "LOWER(u.$key) = '". strtolower(check_query($value)) ."' AND "; } } $result = db_query_range("SELECT u.* FROM {users} u WHERE $query u.status < 3", 0, 1); @@ -379,10 +379,10 @@ function user_file_download($file) { function user_search($keys) { $find = array(); - // Replace wildcards with mysql wildcards + // Replace wildcards with (MySQL/PostgreSQL wildcards $keys = str_replace("*", "%", $keys); - $result = db_query_range("SELECT * FROM {users} WHERE name LIKE '%%%s%%'", $keys, 0, 20); + $result = db_query_range("SELECT * FROM {users} WHERE LOWER(name) LIKE '%%%s%%'", strtolower($keys), 0, 20); while ($account = db_fetch_object($result)) { $find[] = array("title" => $account->name, "link" => (strstr(request_uri(), "admin") ? url("admin/user/edit/$account->uid") : url("user/view/$account->uid")), 'user' => $account->name); } @@ -828,11 +828,11 @@ function user_pass($edit = array()) { global $base_url; if ($edit['name']) { - $account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND name = '%s'", $edit['name'])); + $account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND LOWER(name) = '%s'", strtolower($edit['name']))); if (!$account) $error = t("Sorry. The username <i>%s</i> is not recognized.", array("%s" => $edit['name'])); } else if ($edit['mail']) { - $account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND mail = '%s'", $edit['mail'])); + $account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND LOWER(mail) = '%s'", strtolower($edit['mail']))); if (!$account) $error = t("Sorry. The e-mail address <i>%s</i> is not recognized.", array("%s" => $edit['mail'])); } if ($account) { |