cvs: pear /LiveUser_Admin/Storage SQL.php

From: Date: Tue, 14 Dec 2004 23:40:18 +0000
Subject: cvs: pear /LiveUser_Admin/Storage SQL.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-27399@lists.php.net to get a copy of this message
lsmith Tue Dec 14 18:40:18 2004 EDT Modified files: /pear/LiveUser_Admin/Storage SQL.php Log: - beautifications in for the last fixes http://cvs.php.net/diff.php/pear/LiveUser_Admin/Storage/SQL.php?r1=1.7&r2=1.8&ty=u Index: pear/LiveUser_Admin/Storage/SQL.php diff -u pear/LiveUser_Admin/Storage/SQL.php:1.7 pear/LiveUser_Admin/Storage/SQL.php:1.8 --- pear/LiveUser_Admin/Storage/SQL.php:1.7 Tue Dec 14 12:20:28 2004 +++ pear/LiveUser_Admin/Storage/SQL.php Tue Dec 14 18:40:03 2004 @@ -43,7 +43,7 @@ * * @author Lukas Smith <smith@backendmedia.com> * @author Bjoern Kraus <krausbn@php.net> - * @version $Id: SQL.php,v 1.7 2004/12/14 17:20:28 dufuz Exp $ + * @version $Id: SQL.php,v 1.8 2004/12/14 23:40:03 lsmith Exp $ * @package LiveUser * @category authentication */ @@ -290,28 +290,30 @@ foreach ($filters as $field => $value) { // find type for fields with naming like [tablename].[fieldname] - if (preg_match('/^'.$this->prefix.'([^.]+)\.(.+)$/', $field, $match)) { - $tmp_field = $this->alias[$match[2]]; - $tmp_table_field = $this->prefix.$match[1].'.'.$tmp_field; + if (preg_match('/^('.$this->prefix.'[^.]+\.)(.+)$/', $field, $match) && + isset($this->fields[$match[2]]) + ) { + $type = $this->fields[$match[2]]; + $tmp_field = $match[1].$this->alias[$match[2]]; + } elseif (isset($this->fields[$field])) { + $type = $this->fields[$field]; + $tmp_field = $this->alias[$field]; } else { - $tmp_table_field = $tmp_field = $this->alias[$field]; - } - if (!isset($this->fields[$tmp_field])) { $this->_stack->push( LIVEUSER_ADMIN_ERROR_QUERY_BUILDER, 'exception', array('reason' => 'field could not be mapped to a type :'.$field) ); return false; } - $type = $this->fields[$tmp_field]; + if (is_array($value)) { if (isset($value['value'])) { - $where[] = $tmp_table_field. ' ' . $value['op'] . ' ' .$this->quote($value['value'], $type); + $where[] = $tmp_field. ' ' . $value['op'] . ' ' .$this->quote($value['value'], $type); } else { - $where[] = $tmp_table_field.' IN ('.$this->implodeArray($value, $type).')'; + $where[] = $tmp_field.' IN ('.$this->implodeArray($value, $type).')'; } } else { - $where[] = $tmp_table_field.' = '.$this->quote($value, $type); + $where[] = $tmp_field.' = '.$this->quote($value, $type); } } foreach ($joinfilters as $field => $value) {

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