[horde] changes to sql.php to be able to take user and password
fields asparameters
Ilya
mail at krel.org
Mon Sep 2 21:26:35 PDT 2002
file attached
-------------- next part --------------
16a17,20
> * 'userf' The name of user field in the auth table in 'database'.
> * Defaults to 'user_uid'.
> * 'passf' The name of the password field in auth table in 'database'.
> * Defaults to 'user_pass'.
109,111c113,115
< $query = 'SELECT user_uid FROM ' . $this->_params['table'];
< $query .= ' WHERE user_uid = ' . $this->_db->quote($userID);
< $query .= ' AND user_pass = ' . $this->_db->quote(md5($credentials['password']));
---
> $query = 'SELECT ' . $this->_params['userf'] . ' FROM ' . $this->_params['table'];
> $query .= ' WHERE ' . $this->_params['userf'] . ' = ' . $this->_db->quote($userID);
> $query .= ' AND ' . $this->_params['passf'] . ' = ' . $this->_db->quote(md5($credentials['password']));
147c151
< $query = 'INSERT INTO ' . $this->_params['table'] . ' (user_uid, user_pass) ';
---
> $query = 'INSERT INTO ' . $this->_params['table'] . ' (' . $this->_params['userf'] . ', ' . $this->_params['passf'] . ') ';
177,179c181,183
< $query = 'UPDATE ' . $this->_params['table'] . ' SET user_uid = ' . $this->_db->quote($newID);
< $query .= ', user_pass = ' . $this->_db->quote(md5($credentials['password']));
< $query .= ' WHERE user_uid = ' . $this->_db->quote($oldID);
---
> $query = 'UPDATE ' . $this->_params['table'] . ' SET ' . $this->_params['userf'] . ' = ' . $this->_db->quote($newID);
> $query .= ', ' . $this->_params['passf'] . ' = ' . $this->_db->quote(md5($credentials['password']));
> $query .= ' WHERE ' . $this->_params['userf'] . ' = ' . $this->_db->quote($oldID);
207c211
< $query .= ' WHERE user_uid = ' . $this->_db->quote($userID);
---
> $query .= ' WHERE ' . $this->_params['userf'] . ' = ' . $this->_db->quote($userID);
232c236
< $query = 'SELECT user_uid from ' . $this->_params['table'];
---
> $query = 'SELECT ' . $this->_params['userf'] . ' from ' . $this->_params['table'];
278a283,288
> }
> if (!array_key_exists('userf', $this->_params)) {
> $this->_params['userf'] = 'user_uid';
> }
> if (!array_key_exists('passf', $this->_params)) {
> $this->_params['passf'] = 'user_pass';
More information about the horde
mailing list