cvs: pear /Perm_LiveUser/Auth/Container DB.php MDB.php MDB2.php

From: Date: Mon, 05 Jul 2004 06:27:11 +0000
Subject: cvs: pear /Perm_LiveUser/Auth/Container DB.php MDB.php MDB2.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-21519@lists.php.net to get a copy of this message
dufuz Mon Jul 5 02:27:11 2004 EDT Modified files: /pear/Perm_LiveUser/Auth/Container DB.php MDB2.php MDB.php Log: Moved sql in _readUserData and it now takes fewer lines. Addes the password part if requested, else it stays as is. http://cvs.php.net/diff.php/pear/Perm_LiveUser/Auth/Container/DB.php?r1=1.58&r2=1.59&ty=u Index: pear/Perm_LiveUser/Auth/Container/DB.php diff -u pear/Perm_LiveUser/Auth/Container/DB.php:1.58 pear/Perm_LiveUser/Auth/Container/DB.php:1.59 --- pear/Perm_LiveUser/Auth/Container/DB.php:1.58 Mon Jul 5 02:22:41 2004 +++ pear/Perm_LiveUser/Auth/Container/DB.php Mon Jul 5 02:27:11 2004 @@ -44,7 +44,7 @@ * 'allowDuplicateHandles' => 1); * * @author Markus Wolff <wolff@21st.de> - * @version $Id: DB.php,v 1.58 2004/07/05 06:22:41 dufuz Exp $ + * @version $Id: DB.php,v 1.59 2004/07/05 06:27:11 dufuz Exp $ * @package LiveUser * @category authentication */ @@ -220,19 +220,16 @@ } } } + + // Setting the default sql query. + $sql = 'SELECT ' . implode(',', $fields) . ' + FROM ' . $this->authTable.' + WHERE ' . $this->authTableCols['required']['handle'] . '=' . $this->dbc->quoteSmart($handle); if ($passwd !== false) { // If $passwd is set, try to find the first user with the given // handle and password. - $sql = 'SELECT ' . implode(',', $fields) . ' - FROM ' . $this->authTable.' - WHERE ' . $this->authTableCols['required']['handle'] . '=' . $this->dbc->quoteSmart($handle) . ' - AND ' . $this->authTableCols['required']['passwd'] . '=' . $this->dbc->quoteSmart($this->encryptPW($passwd)); - } else { - // If only $handle is set, try to find the first matching user - $sql = 'SELECT ' . implode(',', $fields).' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle'] . '=' . $this->dbc->quoteSmart($handle); + $sql .= 'AND ' . $this->authTableCols['required']['passwd'] . '=' . $this->dbc->quoteSmart($this->encryptPW($passwd)); } // Query database http://cvs.php.net/diff.php/pear/Perm_LiveUser/Auth/Container/MDB2.php?r1=1.18&r2=1.19&ty=u Index: pear/Perm_LiveUser/Auth/Container/MDB2.php diff -u pear/Perm_LiveUser/Auth/Container/MDB2.php:1.18 pear/Perm_LiveUser/Auth/Container/MDB2.php:1.19 --- pear/Perm_LiveUser/Auth/Container/MDB2.php:1.18 Mon Jul 5 02:22:41 2004 +++ pear/Perm_LiveUser/Auth/Container/MDB2.php Mon Jul 5 02:27:11 2004 @@ -48,7 +48,7 @@ * 'allowDuplicateHandles' => 1); * * @author Markus Wolff <wolff@21st.de> - * @version $Id: MDB2.php,v 1.18 2004/07/05 06:22:41 dufuz Exp $ + * @version $Id: MDB2.php,v 1.19 2004/07/05 06:27:11 dufuz Exp $ * @package LiveUser * @category authentication */ @@ -234,18 +234,15 @@ } } + // Setting the default sql query. + $sql = 'SELECT ' . implode(',', $fields) . ' + FROM ' . $this->authTable . ' + WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->quote($handle, $this->authTableCols['handle']['type']); + if ($passwd !== false) { // If $passwd is set, try to find the first user with the given // handle and password. - $sql = 'SELECT ' . implode(',', $fields) . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->quote($handle, $this->authTableCols['handle']['type']).' - AND ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->quote($this->encryptPW($passwd), $this->authTableCols['passwd']['type']); - } else { - // If only $handle is set, try to find the first matching user - $sql = 'SELECT ' . implode(',', $fields).' - FROM ' . $this->authTable.' - WHERE ' . $this->authTableCols['required']['handle']['name'].'='.$this->dbc->quote($handle, $this->authTableCols['handle']['type']); + $sql .= 'AND ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->quote($this->encryptPW($passwd), $this->authTableCols['passwd']['type']); } // Query database http://cvs.php.net/diff.php/pear/Perm_LiveUser/Auth/Container/MDB.php?r1=1.38&r2=1.39&ty=u Index: pear/Perm_LiveUser/Auth/Container/MDB.php diff -u pear/Perm_LiveUser/Auth/Container/MDB.php:1.38 pear/Perm_LiveUser/Auth/Container/MDB.php:1.39 --- pear/Perm_LiveUser/Auth/Container/MDB.php:1.38 Mon Jul 5 02:22:41 2004 +++ pear/Perm_LiveUser/Auth/Container/MDB.php Mon Jul 5 02:27:11 2004 @@ -45,7 +45,7 @@ * 'allowDuplicateHandles' => 1); * * @author Markus Wolff <wolff@21st.de> - * @version $Id: MDB.php,v 1.38 2004/07/05 06:22:41 dufuz Exp $ + * @version $Id: MDB.php,v 1.39 2004/07/05 06:27:11 dufuz Exp $ * @package LiveUser * @category authentication */ @@ -232,19 +232,16 @@ } } } + + // Setting the default query. + $sql = 'SELECT ' . implode(',', $fields) . ' + FROM ' . $this->authTable . ' + WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['handle']['type'], $handle); if ($passwd !== false) { // If $passwd is set, try to find the first user with the given // handle and password. - $sql = 'SELECT ' . implode(',', $fields) . ' - FROM ' . $this->authTable . ' - WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['handle']['type'], $handle).' - AND ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->getValue($this->authTableCols['passwd']['type'], $this->encryptPW($passwd)); - } else { - // If only $handle is set, try to find the first matching user - $sql = 'SELECT ' . implode(',', $fields).' - FROM ' . $this->authTable.' - WHERE ' . $this->authTableCols['required']['handle']['name'] . '=' . $this->dbc->getValue($this->authTableCols['handle']['type'], $handle); + $sql .= 'AND ' . $this->authTableCols['required']['passwd']['name'] . '=' . $this->dbc->getValue($this->authTableCols['passwd']['type'], $this->encryptPW($passwd)); } // Query database

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