Index: t3lib/class.t3lib_sqlengine.php
===================================================================
--- t3lib/class.t3lib_sqlengine.php	(revision 9008)
+++ t3lib/class.t3lib_sqlengine.php	(revision )
@@ -1,29 +1,29 @@
 <?php
 /***************************************************************
-*  Copyright notice
-*
-*  (c) 2004-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
+ *  Copyright notice
+ *
+ *  (c) 2004-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
 /**
  * PHP SQL engine
  * EXPERIMENTAL!
@@ -39,46 +39,46 @@
  *
  *
  *  104: class t3lib_sqlengine extends t3lib_sqlparser
- *  126:     function init($config, &$pObj)
+ *  126:	 function init($config, &$pObj)
- *  134:     function resetStatusVars()
+ *  134:	 function resetStatusVars()
- *  150:     function processAccordingToConfig(&$value,$fInfo)
+ *  150:	 function processAccordingToConfig(&$value,$fInfo)
  *
- *              SECTION: SQL queries
+ *			  SECTION: SQL queries
- *  205:     function exec_INSERTquery($table,$fields_values)
+ *  205:	 function exec_INSERTquery($table,$fields_values)
- *  273:     function exec_UPDATEquery($table,$where,$fields_values)
+ *  273:	 function exec_UPDATEquery($table,$where,$fields_values)
- *  332:     function exec_DELETEquery($table,$where)
+ *  332:	 function exec_DELETEquery($table,$where)
- *  383:     function exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit)
+ *  383:	 function exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit)
- *  426:     function sql_query($query)
+ *  426:	 function sql_query($query)
- *  437:     function sql_error()
+ *  437:	 function sql_error()
- *  446:     function sql_insert_id()
+ *  446:	 function sql_insert_id()
- *  455:     function sql_affected_rows()
+ *  455:	 function sql_affected_rows()
- *  465:     function quoteStr($str)
+ *  465:	 function quoteStr($str)
  *
- *              SECTION: SQL admin functions
+ *			  SECTION: SQL admin functions
- *  490:     function admin_get_tables()
+ *  490:	 function admin_get_tables()
- *  501:     function admin_get_fields($tableName)
+ *  501:	 function admin_get_fields($tableName)
- *  512:     function admin_get_keys($tableName)
+ *  512:	 function admin_get_keys($tableName)
- *  523:     function admin_query($query)
+ *  523:	 function admin_query($query)
  *
- *              SECTION: Data Source I/O
+ *			  SECTION: Data Source I/O
- *  548:     function readDataSource($table)
+ *  548:	 function readDataSource($table)
- *  560:     function saveDataSource($table)
+ *  560:	 function saveDataSource($table)
  *
- *              SECTION: SQL engine functions (PHP simulation of SQL) - still experimental
+ *			  SECTION: SQL engine functions (PHP simulation of SQL) - still experimental
- *  590:     function selectFromData($table,$where)
+ *  590:	 function selectFromData($table,$where)
- *  628:     function select_evalSingle($table,$config,&$itemKeys)
+ *  628:	 function select_evalSingle($table,$config,&$itemKeys)
- *  747:     function getResultSet($keys, $table, $fieldList)
+ *  747:	 function getResultSet($keys, $table, $fieldList)
  *
- *              SECTION: Debugging
+ *			  SECTION: Debugging
- *  790:     function debug_printResultSet($array)
+ *  790:	 function debug_printResultSet($array)
  *
  *
  *  829: class t3lib_sqlengine_resultobj
- *  843:     function sql_num_rows()
+ *  843:	 function sql_num_rows()
- *  852:     function sql_fetch_assoc()
+ *  852:	 function sql_fetch_assoc()
- *  863:     function sql_fetch_row()
+ *  863:	 function sql_fetch_row()
- *  881:     function sql_data_seek($pointer)
+ *  881:	 function sql_data_seek($pointer)
- *  894:     function sql_field_type()
+ *  894:	 function sql_field_type()
  *
  * TOTAL FUNCTIONS: 27
  * (This index is automatically created/updated by the extension "extdeveval")
@@ -86,12 +86,6 @@
  */
 
 
-
-
-
-
-
-
 /**
  * PHP SQL engine / server
  * Basically this is trying to emulation SQL record selection by PHP, thus allowing SQL queries into alternative data storages managed by PHP.
@@ -104,16 +98,15 @@
 class t3lib_sqlengine extends t3lib_sqlparser {
 
 		// array with data records: [table name][num.index] = records
-	var $data = array();						// Data source storage
+	var $data = array(); // Data source storage
 
 
 		// Internal, SQL Status vars:
-	var $errorStatus = '';						// Set with error message of last operation
+	var $errorStatus = ''; // Set with error message of last operation
-	var $lastInsertedId = 0;					// Set with last inserted unique ID
+	var $lastInsertedId = 0; // Set with last inserted unique ID
-	var $lastAffectedRows = 0;					// Set with last number of affected rows.
+	var $lastAffectedRows = 0; // Set with last number of affected rows.
 
 
-
 	/**
 	 * Constrcutor
 	 */
@@ -137,7 +130,7 @@
 	 *
 	 * @return	void
 	 */
-	function resetStatusVars()	{
+	function resetStatusVars() {
 		$this->errorStatus = '';
 		$this->lastInsertedId = 0;
 		$this->lastAffectedRows = 0;
@@ -153,47 +146,42 @@
 	 * @param	array		$fInfo Field configuration data
 	 * @return	mixed		The processed input value
 	 */
-	function processAccordingToConfig(&$value,$fInfo)	{
+	function processAccordingToConfig(&$value, $fInfo) {
 		$options = $this->parseFieldDef($fInfo['Type']);
 
-		switch(strtolower($options['fieldType']))	{
+		switch (strtolower($options['fieldType'])) {
 			case 'int':
 			case 'smallint':
 			case 'tinyint':
 			case 'mediumint':
 				$value = intval($value);
-				if ($options['featureIndex']['UNSIGNED'])	{
+				if ($options['featureIndex']['UNSIGNED']) {
-					$value = t3lib_div::intInRange($value,0);
+					$value = t3lib_div::intInRange($value, 0);
 				}
 			break;
 			case 'double':
-				$value = (double)$value;
+				$value = (double) $value;
 			break;
 			case 'varchar':
 			case 'char':
-				$value = substr($value,0,trim($options['value']));
+				$value = substr($value, 0, trim($options['value']));
 			break;
 			case 'text':
 			case 'blob':
-				$value = substr($value,0,65536);
+				$value = substr($value, 0, 65536);
 			break;
 			case 'tinytext':
 			case 'tinyblob':
-				$value = substr($value,0,256);
+				$value = substr($value, 0, 256);
 			break;
 			case 'mediumtext':
 			case 'mediumblob':
-				// ??
+					// ??
 			break;
 		}
 	}
 
 
-
-
-
-
-
 	/********************************
 	 *
 	 * SQL queries
@@ -208,7 +196,7 @@
 	 * @param	array		Field values as key=>value pairs.
 	 * @return	boolean		TRUE on success and FALSE on failure (error is set internally)
 	 */
-	function exec_INSERTquery($table,$fields_values)	{
+	function exec_INSERTquery($table, $fields_values) {
 
 			// Initialize
 		$this->resetStatusVars();
@@ -217,39 +205,41 @@
 		$this->readDataSource($table);
 
 			// If data source is set:
-		if (is_array($this->data[$table]))	{
+		if (is_array($this->data[$table])) {
 
-			$fieldInformation = $this->admin_get_fields($table);		// Should cache this...!
+			$fieldInformation = $this->admin_get_fields($table); // Should cache this...!
 
 				// Looking for unique keys:
 			$saveArray = array();
-			foreach($fieldInformation as $fInfo)	{
+			foreach ($fieldInformation as $fInfo) {
 
 					// Field name:
 				$fN = $fInfo['Field'];
 
 					// Set value:
-// FIXME $options not defined
+					// FIXME $options not defined
 				$saveArray[$fN] = isset($fields_values[$fN]) ? $fields_values[$fN] : $options['Default'];
 
 					// Process value:
 				$this->processAccordingToConfig($saveArray[$fN], $fInfo);
 
 					// If an auto increment field is found, find the largest current uid:
-				if ($fInfo['Extra'] == 'auto_increment')	{
+				if ($fInfo['Extra'] == 'auto_increment') {
 
 						// Get all UIDs:
 					$uidArray = array();
-					foreach($this->data[$table] as $r)	{
+					foreach ($this->data[$table] as $r) {
 						$uidArray[] = $r[$fN];
 					}
 
 						// If current value is blank or already in array, we create a new:
-					if (!$saveArray[$fN] || in_array(intval($saveArray[$fN]), $uidArray))	{
+					if (!$saveArray[$fN] || in_array(intval($saveArray[$fN]), $uidArray)) {
-						if (count($uidArray))	{
+						if (count($uidArray)) {
-							$saveArray[$fN] = max($uidArray)+1;
+							$saveArray[$fN] = max($uidArray) + 1;
-						} else $saveArray[$fN] = 1;
+						} else {
+							$saveArray[$fN] = 1;
-					}
+						}
+					}
 
 						// Update "last inserted id":
 					$this->lastInsertedId = $saveArray[$fN];
@@ -263,7 +253,9 @@
 			$this->saveDataSource($table);
 
 			return TRUE;
-		} else $this->errorStatus = 'No data loaded.';
+		} else {
+			$this->errorStatus = 'No data loaded.';
+		}
 
 		return FALSE;
 	}
@@ -276,7 +268,7 @@
 	 * @param	array		Field values as key=>value pairs.
 	 * @return	boolean		TRUE on success and FALSE on failure (error is set internally)
 	 */
-	function exec_UPDATEquery($table,$where,$fields_values)	{
+	function exec_UPDATEquery($table, $where, $fields_values) {
 
 			// Initialize:
 		$this->resetStatusVars();
@@ -285,45 +277,49 @@
 		$this->readDataSource($table);
 
 			// If anything is there:
-		if (is_array($this->data[$table]))	{
+		if (is_array($this->data[$table])) {
 
 				// Parse WHERE clause:
 			$where = $this->parseWhereClause($where);
 
-			if (is_array($where))	{
+			if (is_array($where)) {
 
 					// Field information
-				$fieldInformation = $this->admin_get_fields($table);		// Should cache this...!
+				$fieldInformation = $this->admin_get_fields($table); // Should cache this...!
 
 					// Traverse fields to update:
-				foreach($fields_values as $fName => $fValue)	{
+				foreach ($fields_values as $fName => $fValue) {
-					$this->processAccordingToConfig($fields_values[$fName],$fieldInformation[$fName]);
+					$this->processAccordingToConfig($fields_values[$fName], $fieldInformation[$fName]);
 				}
 
 					// Do query, returns array with keys to the data array of the result:
-				$itemKeys = $this->selectFromData($table,$where);
+				$itemKeys = $this->selectFromData($table, $where);
 
 					// Set "last affected rows":
 				$this->lastAffectedRows = count($itemKeys);
 
 					// Update rows:
-				if ($this->lastAffectedRows)	{
+				if ($this->lastAffectedRows) {
 						// Traverse result set here:
-					foreach($itemKeys as $dataArrayKey)	{
+					foreach ($itemKeys as $dataArrayKey) {
 
 							// Traverse fields to update:
-						foreach($fields_values as $fName => $fValue)	{
+						foreach ($fields_values as $fName => $fValue) {
 							$this->data[$table][$dataArrayKey][$fName] = $fValue;
 						}
 					}
 
-					// Save data source
+						// Save data source
 					$this->saveDataSource($table);
 				}
 
 				return TRUE;
-			} else $this->errorStatus = 'WHERE clause contained errors: '.$where;
-		} else $this->errorStatus = 'No data loaded.';
+			} else {
+				$this->errorStatus = 'WHERE clause contained errors: ' . $where;
+			}
+		} else {
+			$this->errorStatus = 'No data loaded.';
+		}
 
 		return FALSE;
 	}
@@ -335,7 +331,7 @@
 	 * @param	string		WHERE clause
 	 * @return	boolean		TRUE on success and FALSE on failure (error is set internally)
 	 */
-	function exec_DELETEquery($table,$where)	{
+	function exec_DELETEquery($table, $where) {
 
 			// Initialize:
 		$this->resetStatusVars();
@@ -344,23 +340,23 @@
 		$this->readDataSource($table);
 
 			// If anything is there:
-		if (is_array($this->data[$table]))	{
+		if (is_array($this->data[$table])) {
 
 				// Parse WHERE clause:
 			$where = $this->parseWhereClause($where);
 
-			if (is_array($where))	{
+			if (is_array($where)) {
 
 					// Do query, returns array with keys to the data array of the result:
-				$itemKeys = $this->selectFromData($table,$where);
+				$itemKeys = $this->selectFromData($table, $where);
 
 					// Set "last affected rows":
 				$this->lastAffectedRows = count($itemKeys);
 
 					// Remove rows:
-				if ($this->lastAffectedRows)	{
+				if ($this->lastAffectedRows) {
 						// Traverse result set:
-					foreach($itemKeys as $dataArrayKey)	{
+					foreach ($itemKeys as $dataArrayKey) {
 						unset($this->data[$table][$dataArrayKey]);
 					}
 
@@ -369,8 +365,12 @@
 				}
 
 				return TRUE;
-			} else $this->errorStatus = 'WHERE clause contained errors: '.$where;
-		} else $this->errorStatus = 'No data loaded.';
+			} else {
+				$this->errorStatus = 'WHERE clause contained errors: ' . $where;
+			}
+		} else {
+			$this->errorStatus = 'No data loaded.';
+		}
 
 		return FALSE;
 	}
@@ -386,14 +386,14 @@
 	 * @param	string		Optional LIMIT value ([begin,]max), if none, supply blank string.
 	 * @return	object		Returns result object, but if errors, returns false
 	 */
-	function exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit)	{
+	function exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy, $orderBy, $limit) {
 
 			// Initialize:
 		$this->resetStatusVars();
 
 			// Create result object
 		$sqlObj = t3lib_div::makeInstance('t3lib_sqlengine_resultobj');
-		$sqlObj->result = array();	// Empty result as a beginning
+		$sqlObj->result = array(); // Empty result as a beginning
 
 			// Get table list:
 		$tableArray = $this->parseFromTables($from_table);
@@ -403,22 +403,26 @@
 		$this->readDataSource($table);
 
 			// If anything is there:
-		if (is_array($this->data[$table]))	{
+		if (is_array($this->data[$table])) {
 
 				// Parse WHERE clause:
 			$where = $this->parseWhereClause($where_clause);
-			if (is_array($where))	{
+			if (is_array($where)) {
 
 					// Do query, returns array with keys to the data array of the result:
-				$itemKeys = $this->selectFromData($table,$where);
+				$itemKeys = $this->selectFromData($table, $where);
 
 					// Finally, read the result rows into this variable:
-				$sqlObj->result = $this->getResultSet($itemKeys,$table,'*');
+				$sqlObj->result = $this->getResultSet($itemKeys, $table, '*');
 					// Reset and return result:
 				reset($sqlObj->result);
 				return $sqlObj;
-			} else $this->errorStatus = 'WHERE clause contained errors: '.$where;
-		}  else $this->errorStatus = 'No data loaded: '.$this->errorStatus;
+			} else {
+				$this->errorStatus = 'WHERE clause contained errors: ' . $where;
+			}
+		} else {
+			$this->errorStatus = 'No data loaded: ' . $this->errorStatus;
+		}
 
 		return FALSE;
 	}
@@ -429,7 +433,7 @@
 	 * @param	string		Query to execute
 	 * @return	object		Result object or false if error
 	 */
-	function sql_query($query)	{
+	function sql_query($query) {
 		$res = t3lib_div::makeInstance('t3lib_sqlengine_resultobj');
 		$res->result = array();
 		return $res;
@@ -440,7 +444,7 @@
 	 *
 	 * @return	string		Error message, if any
 	 */
-	function sql_error()	{
+	function sql_error() {
 		return $this->errorStatus;
 	}
 
@@ -468,19 +472,11 @@
 	 * @param	string		Input String
 	 * @return	string		String, with quotes escaped
 	 */
-	function quoteStr($str)	{
+	function quoteStr($str) {
 		return addslashes($str);
 	}
 
 
-
-
-
-
-
-
-
-
 	/**************************************
 	 *
 	 * SQL admin functions
@@ -494,7 +490,7 @@
 	 * @return	array		Tables in an array (tablename is in both key and value)
 	 * @todo	Should return table details in value! see t3lib_db::admin_get_tables()
 	 */
-	function admin_get_tables()	{
+	function admin_get_tables() {
 		$whichTables = array();
 		return $whichTables;
 	}
@@ -505,7 +501,7 @@
 	 * @param	string		Table name
 	 * @return	array		Field information in an associative array with fieldname => field row
 	 */
-	function admin_get_fields($tableName)	{
+	function admin_get_fields($tableName) {
 		$output = array();
 		return $output;
 	}
@@ -516,7 +512,7 @@
 	 * @param	string		Table name
 	 * @return	array		Key information in a numeric array
 	 */
-	function admin_get_keys($tableName)	{
+	function admin_get_keys($tableName) {
 		$output = array();
 		return $output;
 	}
@@ -527,17 +523,11 @@
 	 * @param	string		Query to execute
 	 * @return	pointer		Result pointer
 	 */
-	function admin_query($query)	{
+	function admin_query($query) {
 		return $this->sql_query($query);
 	}
 
 
-
-
-
-
-
-
 	/********************************
 	 *
 	 * Data Source I/O
@@ -552,7 +542,7 @@
 	 * @return	void
 	 * @todo	Table locking tools?
 	 */
-	function readDataSource($table)	{
+	function readDataSource($table) {
 		$this->data[$table] = array();
 	}
 
@@ -564,22 +554,11 @@
 	 * @return	void
 	 * @todo	Table locking tools?
 	 */
-	function saveDataSource($table)	{
+	function saveDataSource($table) {
 		debug($this->data[$table]);
 	}
 
 
-
-
-
-
-
-
-
-
-
-
-
 	/********************************
 	 *
 	 * SQL engine functions (PHP simulation of SQL) - still experimental
@@ -594,26 +573,29 @@
 	 * @param	array		Where clause parsed into array
 	 * @return	array		Array of keys pointing to result rows in $this->data[$table]
 	 */
-	function selectFromData($table,$where)	{
+	function selectFromData($table, $where) {
 
 		$output = array();
-		if (is_array($this->data[$table]))	{
+		if (is_array($this->data[$table])) {
 
 				// All keys:
 			$OR_index = 0;
+			$itemKeys = array();
 
-			foreach($where as $config)	{
+			foreach ($where as $config) {
 
-				if (strtoupper($config['operator'])=='OR')	{
+				if (strtoupper($config['operator']) == 'OR') {
 					$OR_index++;
 				}
 
-				if (!isset($itemKeys[$OR_index]))	$itemKeys[$OR_index] = array_keys($this->data[$table]);
+				if (!isset($itemKeys[$OR_index])) {
+					$itemKeys[$OR_index] = array_keys($this->data[$table]);
+				}
 
-				$this->select_evalSingle($table,$config,$itemKeys[$OR_index]);
+				$this->select_evalSingle($table, $config, $itemKeys[$OR_index]);
 			}
 
-			foreach($itemKeys as $uidKeys)	{
+			foreach ($itemKeys as $uidKeys) {
 				$output = array_merge($output, $uidKeys);
 			}
 			$output = array_unique($output);
@@ -632,14 +614,14 @@
 	 * @return	void		Data array passed by reference
 	 * @see selectFromData()
 	 */
-	function select_evalSingle($table,$config,&$itemKeys)	{
+	function select_evalSingle($table, $config, &$itemKeys) {
-		$neg = preg_match('/^AND[[:space:]]+NOT$/',trim($config['operator']));
+		$neg = preg_match('/^AND[[:space:]]+NOT$/', trim($config['operator']));
 
-		if (is_array($config['sub']))	{
+		if (is_array($config['sub'])) {
-			$subSelKeys = $this->selectFromData($table,$config['sub']);
+			$subSelKeys = $this->selectFromData($table, $config['sub']);
-			if ($neg)	{
+			if ($neg) {
-				foreach($itemKeys as $kk => $vv)	{
+				foreach ($itemKeys as $kk => $vv) {
-					if (in_array($vv,$subSelKeys))	{
+					if (in_array($vv, $subSelKeys)) {
 						unset($itemKeys[$kk]);
 					}
 				}
@@ -647,40 +629,40 @@
 				$itemKeys = array_intersect($itemKeys, $subSelKeys);
 			}
 		} else {
-			$comp = strtoupper(str_replace(array(' ',TAB,CR,LF),'',$config['comparator']));
+			$comp = strtoupper(str_replace(array(' ', TAB, CR, LF), '', $config['comparator']));
 			$mod = strtoupper($config['modifier']);
-			switch($comp)	{
+			switch ($comp) {
 				case 'NOTLIKE':
 				case 'LIKE':
 					$like_value = strtolower($config['value'][0]);
-					if (substr($like_value,0,1)=='%')	{
+					if (substr($like_value, 0, 1) == '%') {
 						$wildCard_begin = TRUE;
-						$like_value = substr($like_value,1);
+						$like_value = substr($like_value, 1);
 					}
-					if (substr($like_value,-1)=='%')	{
+					if (substr($like_value, -1) == '%') {
 						$wildCard_end = TRUE;
-						$like_value = substr($like_value,0,-1);
+						$like_value = substr($like_value, 0, -1);
 					}
 				break;
 				case 'NOTIN':
 				case 'IN':
 					$in_valueArray = array();
-					foreach($config['value'] as $vParts)	{
+					foreach ($config['value'] as $vParts) {
-						$in_valueArray[] = (string)$vParts[0];
+						$in_valueArray[] = (string) $vParts[0];
 					}
 				break;
 			}
 
-			foreach($itemKeys as $kk => $v)	{
+			foreach ($itemKeys as $kk => $v) {
 				$field_value = $this->data[$table][$v][$config['field']];
 
 					// Calculate it:
-				if ($config['calc']=='&')	{
+				if ($config['calc'] == '&') {
-					$field_value&=intval($config['calc_value']);
+					$field_value &= intval($config['calc_value']);
 				}
 
 					// Compare it:
-				switch($comp)	{
+				switch ($comp) {
 					case '<=':
 						$bool = $field_value <= $config['value'][0];
 					break;
@@ -694,30 +676,34 @@
 						$bool = $field_value > $config['value'][0];
 					break;
 					case '=':
-						$bool = !strcmp($field_value,$config['value'][0]);
+						$bool = !strcmp($field_value, $config['value'][0]);
 					break;
 					case '!=':
-						$bool = strcmp($field_value,$config['value'][0]);
+						$bool = strcmp($field_value, $config['value'][0]);
 					break;
 					case 'NOTIN':
 					case 'IN':
-						$bool = in_array((string)$field_value, $in_valueArray);
+						$bool = in_array((string) $field_value, $in_valueArray);
-						if ($comp=='NOTIN')	$bool = !$bool;
+						if ($comp == 'NOTIN') {
+							$bool = !$bool;
+						}
 					break;
 					case 'NOTLIKE':
 					case 'LIKE':
-						if (!strlen($like_value))	{
+						if (!strlen($like_value)) {
 							$bool = TRUE;
-						} elseif ($wildCard_begin && !$wildCard_end)	{
+						} elseif ($wildCard_begin && !$wildCard_end) {
-							$bool = !strcmp(substr(strtolower($field_value),-strlen($like_value)),$like_value);
+							$bool = !strcmp(substr(strtolower($field_value), -strlen($like_value)), $like_value);
-						} elseif (!$wildCard_begin && $wildCard_end)	{
+						} elseif (!$wildCard_begin && $wildCard_end) {
-							$bool = !strcmp(substr(strtolower($field_value),0,strlen($like_value)),$like_value);
+							$bool = !strcmp(substr(strtolower($field_value), 0, strlen($like_value)), $like_value);
-						} elseif ($wildCard_begin && $wildCard_end)	{
+						} elseif ($wildCard_begin && $wildCard_end) {
-							$bool = strstr($field_value,$like_value);
+							$bool = strstr($field_value, $like_value);
 						} else {
-							$bool = !strcmp(strtolower($field_value),$like_value);
+							$bool = !strcmp(strtolower($field_value), $like_value);
 						}
-						if ($comp=='NOTLIKE')	$bool = !$bool;
+						if ($comp == 'NOTLIKE') {
+							$bool = !$bool;
+						}
 					break;
 					default:
 						$bool = $field_value ? TRUE : FALSE;
@@ -725,10 +711,12 @@
 				}
 
 					// General negation:
-				if ($neg)	$bool = !$bool;
+				if ($neg) {
+					$bool = !$bool;
+				}
 
 					// Modify?
-				switch($mod)	{
+				switch ($mod) {
 					case 'NOT':
 					case '!':
 						$bool = !$bool;
@@ -736,7 +724,7 @@
 				}
 
 					// Action:
-				if (!$bool)	{
+				if (!$bool) {
 					unset($itemKeys[$kk]);
 				}
 			}
@@ -751,15 +739,15 @@
 	 * @param	string		Fieldlist (commaseparated)
 	 * @return	array		Result array with "rows"
 	 */
-	function getResultSet($keys, $table, $fieldList)	{
+	function getResultSet($keys, $table, $fieldList) {
-		$fields = t3lib_div::trimExplode(',',$fieldList);
+		$fields = t3lib_div::trimExplode(',', $fieldList);
 
 		$output = array();
-		foreach($keys as $kValue)	{
+		foreach ($keys as $kValue) {
-			if ($fieldList=='*')	{
+			if ($fieldList == '*') {
 				$output[$kValue] = $this->data[$table][$kValue];
 			} else {
-				foreach($fields as $fieldName)	{
+				foreach ($fields as $fieldName) {
 					$output[$kValue][$fieldName] = $this->data[$table][$kValue][$fieldName];
 				}
 			}
@@ -769,19 +757,6 @@
 	}
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 	/*************************
 	 *
 	 * Debugging
@@ -794,36 +769,38 @@
 	 * @param	array		Result set array (array of rows)
 	 * @return	string		HTML table
 	 */
-	function debug_printResultSet($array)	{
+	function debug_printResultSet($array) {
 
-		if (count($array))	{
+		if (count($array)) {
-			$tRows=array();
+			$tRows = array();
 			$fields = array_keys(current($array));
-					$tCell[]='
+			$tCell[] = '
 							<td>IDX</td>';
-				foreach($fields as $fieldName)	{
+			foreach ($fields as $fieldName) {
-					$tCell[]='
+				$tCell[] = '
-							<td>'.htmlspecialchars($fieldName).'</td>';
+							<td>' . htmlspecialchars($fieldName) . '</td>';
-				}
+			}
-				$tRows[]='<tr>'.implode('',$tCell).'</tr>';
+			$tRows[] = '<tr>' . implode('', $tCell) . '</tr>';
 
 
-			foreach($array as $index => $rec)	{
+			foreach ($array as $index => $rec) {
 
-				$tCell=array();
+				$tCell = array();
-				$tCell[]='
+				$tCell[] = '
-						<td>'.htmlspecialchars($index).'</td>';
+						<td>' . htmlspecialchars($index) . '</td>';
-				foreach($fields as $fieldName)	{
+				foreach ($fields as $fieldName) {
-					$tCell[]='
+					$tCell[] = '
-							<td>'.htmlspecialchars($rec[$fieldName]).'</td>';
+							<td>' . htmlspecialchars($rec[$fieldName]) . '</td>';
 				}
-				$tRows[]='<tr>'.implode('',$tCell).'</tr>';
+				$tRows[] = '<tr>' . implode('', $tCell) . '</tr>';
 			}
 
-			return '<table border="1">'.implode('',$tRows).'</table>';
+			return '<table border="1">' . implode('', $tRows) . '</table>';
-		} else 'Empty resultset';
+		} else {
+			'Empty resultset';
-	}
-}
+		}
+	}
+}
 
 
 /**
@@ -853,7 +830,7 @@
 	 *
 	 * @return	integer
 	 */
-	function sql_num_rows()	{
+	function sql_num_rows() {
 		return count($this->result);
 	}
 
@@ -862,7 +839,7 @@
 	 *
 	 * @return	array		Associative array
 	 */
-	function sql_fetch_assoc()	{
+	function sql_fetch_assoc() {
 		$row = current($this->result);
 		next($this->result);
 		return $row;
@@ -873,13 +850,13 @@
 	 *
 	 * @return	array		Numerical array
 	 */
-	function sql_fetch_row()	{
+	function sql_fetch_row() {
 		$resultRow = $this->sql_fetch_assoc();
 
-		if (is_array($resultRow))	{
+		if (is_array($resultRow)) {
 			$numArray = array();
-			foreach($resultRow as $value)	{
+			foreach ($resultRow as $value) {
-				$numArray[]=$value;
+				$numArray[] = $value;
 			}
 			return $numArray;
 		}
@@ -891,9 +868,9 @@
 	 * @param	integer		Position pointer.
 	 * @return	boolean		Returns true on success
 	 */
-	function sql_data_seek($pointer)	{
+	function sql_data_seek($pointer) {
 		reset($this->result);
-		for ($a=0;$a<$pointer;$a++)	{
+		for ($a = 0; $a < $pointer; $a++) {
 			next($this->result);
 		}
 		return TRUE;
@@ -904,14 +881,13 @@
 	 *
 	 * @return	string		Blank string, not supported (it seems)
 	 */
-	function sql_field_type()	{
+	function sql_field_type() {
 		return '';
 	}
 }
 
 
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_sqlengine.php'])	{
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_sqlengine.php']) {
 	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_sqlengine.php']);
 }
 
