![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Pear Pear programming, this is a very complex subject as with using pear with php can be a difficult task for some, so lets talk pear. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| dufuz Fri May 25 22:38:30 2007 UTC Modified files: /pearweb/include pear-database-user.php Log: Mostly cosmetics but also always pass registered field when we are fetching only one field from the user table http://cvs.php.net/viewvc.cgi/pearwe...&diff_format=u Index: pearweb/include/pear-database-user.php diff -u pearweb/include/pear-database-user.php:1.11 pearweb/include/pear-database-user.php:1.12 --- pearweb/include/pear-database-user.php:1.11 Wed May 23 05:00:46 2007 +++ pearweb/include/pear-database-user.php Fri May 25 22:38:30 2007 @@ -174,14 +174,15 @@ $handle = strpos($user, '@') ? 'email' : 'handle'; if ($field === null) { - if ($registered === 'any') { - $row = $dbh->getRow('SELECT * FROM users WHERE ' . $handle . ' = ?', - array($user), DB_FETCHMODE_ASSOC); - } else { - $registered = $registered === true ? '1' : '0'; - $row = $dbh->getRow('SELECT * FROM users WHERE registered = ? AND ' . $handle . ' = ?', - array($registered, $user), DB_FETCHMODE_ASSOC); + $sql = 'SELECT * FROM users WHERE ' . $handle . ' = ?'; + $data = array($user); + if ($registered !== 'any') { + $sql.= ' AND registered = ?'; + $data[] = $registered === true ? '1' : '0'; } + + $row = $dbh->getRow($sql, $data, DB_FETCHMODE_ASSOC); + if ($hidePassword) { unset($row['password']); } @@ -192,9 +193,14 @@ return null; } - return $dbh->getRow('SELECT ! FROM users WHERE handle = ?', - array($field, $user), DB_FETCHMODE_ASSOC); + $sql = 'SELECT ! FROM users WHERE handle = ?'; + $data = array($field, $user); + if ($registered !== 'any') { + $sql.= ' AND registered = ?'; + $data[] = $registered === true ? '1' : '0'; + } + return $dbh->getRow($sql, $data, DB_FETCHMODE_ASSOC); } // }}} @@ -234,11 +240,6 @@ * During most of this method's operation, PEAR's error handling * is set to PEAR_ERROR_RETURN. * - * But, during the DB_storage::set() phase error handling is set to - * PEAR_ERROR_CALLBACK the report_warning() function. So, if an - * error happens a warning message is printed AND the incomplete - * user information is removed. - * * @param array $data Information about the user * @param boolean $md5ed true if the password has been hashed already * @param boolean $automatic true if this is an automatic account request @@ -405,6 +406,10 @@ { global $dbh; + if (!isset($data['handle'])) { + return false; + } + $fields = array( 'name', 'email', @@ -419,7 +424,9 @@ 'password', ); - if ($admin) $fields[] = 'registered'; + if ($admin) { + $fields[] = 'registered'; + } $info = user::info($data['handle'], null, 'any'); // In case a active value isn't passed in $active = isset($info['active']) ? $info['active'] : true; | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: cvs, include, peardatabaseuserphp, pearweb |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cvs: pearweb /include pear-database-category.php | Greg Beaver | Pear | 0 | 05-27-2007 7:46 PM |
| cvs: pearweb /include pear-rest.php | Greg Beaver | Pear | 0 | 05-27-2007 7:46 PM |
| cvs: pearweb /include pear-database-package.php /public_html account-request-newpackage.php | Arnaud Limbourg | Pear | 0 | 05-27-2007 7:46 PM |
| cvs: pearweb /include pear-database-package.php | Mark Wiesemann | Pear | 0 | 05-20-2007 7:42 PM |
| cvs: pearweb /include pear-database-user.php | Greg Beaver | Pear | 0 | 05-20-2007 7:42 PM |
| Featured Websites | ||||
|