cvs: pear /Auth/Container MDB.php

From: Date: Tue, 29 Jul 2003 00:09:02 +0000
Subject: cvs: pear /Auth/Container MDB.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-11801@lists.php.net to get a copy of this message
quipo Mon Jul 28 20:09:02 2003 EDT Modified files: /pear/Auth/Container MDB.php Log: sync with DB container Index: pear/Auth/Container/MDB.php diff -u pear/Auth/Container/MDB.php:1.9 pear/Auth/Container/MDB.php:1.10 --- pear/Auth/Container/MDB.php:1.9 Sun Jul 20 15:59:41 2003 +++ pear/Auth/Container/MDB.php Mon Jul 28 20:09:01 2003 @@ -16,7 +16,7 @@ // | Author: Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: MDB.php,v 1.9 2003/07/20 19:59:41 quipo Exp $ +// $Id: MDB.php,v 1.10 2003/07/29 00:09:01 quipo Exp $ // require_once 'Auth/Container.php'; @@ -30,7 +30,7 @@ * * @author Lorenzo Alberton <l.alberton@quipo.it> * @package Auth - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ class Auth_Container_MDB extends Auth_Container { @@ -189,6 +189,15 @@ $this->options[$key] = $value; } } + + // Include additional fields if they exist + if (!empty($this->options['db_fields'])) { + if (is_array($this->options['db_fields'])) { + $this->options['db_fields'] = join($this->options['db_fields'], ', '); + } + $this->options['db_fields'] = ', ' . $this->options['db_fields']; + } + } // }}} @@ -215,16 +224,15 @@ return PEAR::raiseError($err->getMessage(), $err->getCode()); } - // Include additional fields if they exist - $cols = ''; - if (!empty($this->options['db_fields'])) { - $cols = ',' . $this->options['db_fields']; + // Find if db_fileds contains a *, i so assume all col are selected + if (strstr($this->options['db_fields'], '*')) { + $sql_from = '*'; + } else{ + $sql_from = $this->options['usernamecol'] . ', '. $this->options['passwordcol'] . $this->options['db_fields']; } $query = sprintf("SELECT %s FROM %s WHERE %s = %s", - $this->options['usernamecol'] . ', ' - . $this->options['passwordcol'] - . $cols, + $sql_from, $this->options['table'], $this->options['usernamecol'], $this->db->getTextValue($username) @@ -236,7 +244,7 @@ return PEAR::raiseError($res->getMessage(), $res->getCode()); } if (!is_array($res)) { - $this->activeUser = ""; + $this->activeUser = ''; return false; } if ($this->verifyPassword(trim($password), @@ -270,8 +278,15 @@ $retVal = array(); + // Find if db_fileds contains a *, i so assume all col are selected + if (strstr($this->options['db_fields'], '*')) { + $sql_from = '*'; + } else{ + $sql_from = $this->options['db_fields']; + } + $query = sprintf('SELECT %s FROM %s', - (empty($this->options['db_fields']) ? '*' : $this->options['db_fields']), + $sql_from, $this->options['table'] );

« previous php.pear.cvs (#11801) next »