[CLEANUP] Cleanup ext:core/Database 02/33802/3
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 4 Nov 2014 20:18:19 +0000 (21:18 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 8 Nov 2014 21:38:49 +0000 (22:38 +0100)
* Add phpDoc to properties
* Add phpDoc to functions

Resolves: #62706
Releases: master
Change-Id: Id836e7a6e6110502769b48a7693315c42d79e28a
Reviewed-on: http://review.typo3.org/33802
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
12 files changed:
typo3/sysext/core/Classes/Controller/CommandLineController.php
typo3/sysext/core/Classes/Database/DatabaseConnection.php
typo3/sysext/core/Classes/Database/PdoHelper.php
typo3/sysext/core/Classes/Database/PostProcessQueryHookInterface.php
typo3/sysext/core/Classes/Database/PreProcessQueryHookInterface.php
typo3/sysext/core/Classes/Database/PreparedStatement.php
typo3/sysext/core/Classes/Database/QueryGenerator.php
typo3/sysext/core/Classes/Database/QueryView.php
typo3/sysext/core/Classes/Database/ReferenceIndex.php
typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
typo3/sysext/core/Classes/Database/SqlParser.php
typo3/sysext/core/Classes/Database/TableConfigurationPostProcessingHookInterface.php

index d15a595..8ddf7b7 100644 (file)
@@ -13,11 +13,7 @@ namespace TYPO3\CMS\Core\Controller;
  *
  * The TYPO3 project - inspiring people to share!
  */
-/**
- * Contains base class for TYPO3 cli scripts
- *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- */
+
 /**
  * TYPO3 cli script basis
  *
@@ -25,8 +21,9 @@ namespace TYPO3\CMS\Core\Controller;
  */
 class CommandLineController {
 
-       // Command line arguments, exploded into key => value-array pairs
        /**
+        * Command line arguments, exploded into key => value-array pairs
+        *
         * @var array
         */
        public $cli_args = array();
index e115bd3..54589c3 100644 (file)
@@ -59,27 +59,31 @@ class DatabaseConnection {
         */
        const OR_Constraint = 'OR';
 
-       // Set "TRUE" or "1" if you want database errors outputted. Set to "2" if you also want successful database actions outputted.
        /**
-        * @var bool
+        * Set "TRUE" or "1" if you want database errors outputted. Set to "2" if you also want successful database actions outputted.
+        *
+        * @var bool|int
         */
        public $debugOutput = FALSE;
 
-       // Internally: Set to last built query (not necessarily executed...)
        /**
+        * Internally: Set to last built query (not necessarily executed...)
+        *
         * @var string
         */
        public $debug_lastBuiltQuery = '';
 
-       // Set "TRUE" if you want the last built query to be stored in $debug_lastBuiltQuery independent of $this->debugOutput
        /**
+        * Set "TRUE" if you want the last built query to be stored in $debug_lastBuiltQuery independent of $this->debugOutput
+        *
         * @var bool
         */
        public $store_lastBuiltQuery = FALSE;
 
-       // Set this to 1 to get queries explained (devIPmask must match). Set the value to 2 to the same but disregarding the devIPmask.
-       // There is an alternative option to enable explain output in the admin panel under "TypoScript", which will produce much nicer output, but only works in FE.
        /**
+        * Set this to 1 to get queries explained (devIPmask must match). Set the value to 2 to the same but disregarding the devIPmask.
+        * There is an alternative option to enable explain output in the admin panel under "TypoScript", which will produce much nicer output, but only works in FE.
+        *
         * @var bool
         */
        public $explainOutput = 0;
@@ -148,8 +152,9 @@ class DatabaseConnection {
         */
        protected $link = NULL;
 
-       // Default character set, applies unless character set or collation are explicitly set
        /**
+        * Default character set, applies unless character set or collation are explicitly set
+        *
         * @var string
         */
        public $default_charset = 'utf8';
@@ -164,7 +169,6 @@ class DatabaseConnection {
         */
        protected $postProcessHookObjects = array();
 
-
        /**
         * Initialize the database connection
         *
index 8261ff6..ba50074 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Database;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
 /**
  * A helper class for handling PDO databases
  * Backport of FLOW3 class PdoHelper, last synced version: 3528
index d1395e8..85f0a0a 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Database;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
 /**
  * Interface for classes which hook into \TYPO3\CMS\Core\Database\DatabaseConnection
  * and do additional processing after a query has been executed.
@@ -20,6 +21,7 @@ namespace TYPO3\CMS\Core\Database;
  * @author Xavier Perseguers <typo3@perseguers.ch>
  */
 interface PostProcessQueryHookInterface {
+
        /**
         * Post-processor for the SELECTquery method.
         *
@@ -39,7 +41,7 @@ interface PostProcessQueryHookInterface {
         *
         * @param string $table Database table name
         * @param array $fieldsValues Field values as key => value pairs
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
+        * @param string|array $noQuoteFields List/array of keys NOT to quote
         * @param \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject
         * @return void
         */
@@ -51,7 +53,7 @@ interface PostProcessQueryHookInterface {
         * @param string $table Database table name
         * @param array $fields Field names
         * @param array $rows Table rows
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
+        * @param string|array $noQuoteFields List/array of keys NOT to quote
         * @param \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject
         * @return void
         */
@@ -63,7 +65,7 @@ interface PostProcessQueryHookInterface {
         * @param string $table Database table name
         * @param string $where WHERE clause
         * @param array $fieldsValues Field values as key => value pairs
-        * @param string/array $noQuoteFields List/array of keys NOT to quote
+        * @param string|array $noQuoteFields List/array of keys NOT to quote
         * @param \TYPO3\CMS\Core\Database\DatabaseConnection $parentObject
         * @return void
         */
index 6b68d71..9965ec6 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Database;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
 /**
  * Interface for classes which hook into \TYPO3\CMS\Core\Database\DatabaseConnection
  * and do additional processing before a query has been executed.
@@ -20,6 +21,7 @@ namespace TYPO3\CMS\Core\Database;
  * @author Xavier Perseguers <typo3@perseguers.ch>
  */
 interface PreProcessQueryHookInterface {
+
        /**
         * Pre-processor for the SELECTquery method.
         *
index 778000a..da6a9f7 100644 (file)
@@ -38,30 +38,35 @@ class PreparedStatement {
         * @var int
         */
        const PARAM_NULL = 0;
+
        /**
         * Represents the SQL INTEGER data type.
         *
         * @var int
         */
        const PARAM_INT = 1;
+
        /**
         * Represents the SQL CHAR, VARCHAR, or other string data type.
         *
         * @var int
         */
        const PARAM_STR = 2;
+
        /**
         * Represents a boolean data type.
         *
         * @var int
         */
        const PARAM_BOOL = 3;
+
        /**
         * Automatically detects underlying type
         *
         * @var int
         */
        const PARAM_AUTOTYPE = 4;
+
        /**
         * Specifies that the fetch method shall return each row as an array indexed by
         * column name as returned in the corresponding result set. If the result set
@@ -71,6 +76,7 @@ class PreparedStatement {
         * @var int
         */
        const FETCH_ASSOC = 2;
+
        /**
         * Specifies that the fetch method shall return each row as an array indexed by
         * column number as returned in the corresponding result set, starting at column 0.
@@ -78,6 +84,7 @@ class PreparedStatement {
         * @var int
         */
        const FETCH_NUM = 3;
+
        /**
         * Query to be executed.
         *
@@ -529,7 +536,6 @@ class PreparedStatement {
        public function setFetchMode($mode) {
                switch ($mode) {
                        case self::FETCH_ASSOC:
-
                        case self::FETCH_NUM:
                                $this->defaultFetchMode = $mode;
                                break;
index a65b88e..6a51433 100644 (file)
@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Core\Database;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Utility\IconUtility;
 
 /**
  * Class for generating front end for building queries
@@ -25,6 +27,9 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
  */
 class QueryGenerator {
 
+       /**
+        * @var array
+        */
        public $lang = array(
                'OR' => 'or',
                'AND' => 'and',
@@ -84,6 +89,9 @@ class QueryGenerator {
                )
        );
 
+       /**
+        * @var array
+        */
        public $compSQL = array(
                // Type = text  offset = 0
                '0' => '#FIELD# LIKE \'%#VALUE#%\'',
@@ -139,6 +147,9 @@ class QueryGenerator {
                '163' => '(#FIELD# & #VALUE#)=0'
        );
 
+       /**
+        * @var array
+        */
        public $comp_offsets = array(
                'text' => 0,
                'number' => 1,
@@ -151,31 +162,69 @@ class QueryGenerator {
                'binary' => 5
        );
 
+       /**
+        * @var string
+        */
        public $noWrap = ' nowrap';
 
-       // Form data name prefix
+       /**
+        * Form data name prefix
+        *
+        * @var string
+        */
        public $name;
 
-       // Table for the query
+       /**
+        * Table for the query
+        *
+        * @var string
+        */
        public $table;
 
-       // Field list
+       /**
+        * Field list
+        *
+        * @var string
+        */
        public $fieldList;
 
-       // Array of the fields possible
+       /**
+        * Array of the fields possible
+        *
+        * @var array
+        */
        public $fields = array();
 
+       /**
+        * @var array
+        */
        public $extFieldLists = array();
 
-       // The query config
+       /**
+        * The query config
+        *
+        * @var array
+        */
        public $queryConfig = array();
 
-       public $enablePrefix = 0;
+       /**
+        * @var bool
+        */
+       public $enablePrefix = FALSE;
 
-       public $enableQueryParts = 0;
+       /**
+        * @var bool
+        */
+       public $enableQueryParts = FALSE;
 
+       /**
+        * @var string
+        */
        public $extJSCODE = '';
 
+       /**
+        * @var string
+        */
        protected $formName = '';
 
        /**
@@ -186,9 +235,7 @@ class QueryGenerator {
        public function makeFieldList() {
                $fieldListArr = array();
                if (is_array($GLOBALS['TCA'][$this->table])) {
-                       foreach ($GLOBALS['TCA'][$this->table]['columns'] as $fN => $value) {
-                               $fieldListArr[] = $fN;
-                       }
+                       $fieldListArr = array_keys($GLOBALS['TCA'][$this->table]['columns']);
                        $fieldListArr[] = 'uid';
                        $fieldListArr[] = 'pid';
                        $fieldListArr[] = 'deleted';
@@ -209,12 +256,12 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Init function
         *
-        * @param       [type]          $name: ...
-        * @param       [type]          $table: ...
-        * @param       [type]          $fieldList: ...
-        * @return      [type]          ...
+        * @param string $name The name
+        * @param string $table The table name
+        * @param string $fieldList The field list
+        * @return void
         */
        public function init($name, $table, $fieldList = '') {
                // Analysing the fields in the table.
@@ -222,84 +269,78 @@ class QueryGenerator {
                        $this->name = $name;
                        $this->table = $table;
                        $this->fieldList = $fieldList ? $fieldList : $this->makeFieldList();
-                       $fieldArr = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->fieldList, TRUE);
-                       foreach ($fieldArr as $fN) {
-                               $fC = $GLOBALS['TCA'][$this->table]['columns'][$fN];
-                               $this->fields[$fN] = $fC['config'];
-                               $this->fields[$fN]['exclude'] = $fC['exclude'];
+                       $fieldArr = GeneralUtility::trimExplode(',', $this->fieldList, TRUE);
+                       foreach ($fieldArr as $fieldName) {
+                               $fC = $GLOBALS['TCA'][$this->table]['columns'][$fieldName];
+                               $this->fields[$fieldName] = $fC['config'];
+                               $this->fields[$fieldName]['exclude'] = $fC['exclude'];
                                if (is_array($fC) && $fC['label']) {
-                                       $this->fields[$fN]['label'] = rtrim(trim($GLOBALS['LANG']->sL($fC['label'])), ':');
-                                       switch ($this->fields[$fN]['type']) {
+                                       $this->fields[$fieldName]['label'] = rtrim(trim($GLOBALS['LANG']->sL($fC['label'])), ':');
+                                       switch ($this->fields[$fieldName]['type']) {
                                                case 'input':
-                                                       if (preg_match('/int|year/i', $this->fields[$fN]['eval'])) {
-                                                               $this->fields[$fN]['type'] = 'number';
-                                                       } elseif (preg_match('/time/i', $this->fields[$fN]['eval'])) {
-                                                               $this->fields[$fN]['type'] = 'time';
-                                                       } elseif (preg_match('/date/i', $this->fields[$fN]['eval'])) {
-                                                               $this->fields[$fN]['type'] = 'date';
+                                                       if (preg_match('/int|year/i', $this->fields[$fieldName]['eval'])) {
+                                                               $this->fields[$fieldName]['type'] = 'number';
+                                                       } elseif (preg_match('/time/i', $this->fields[$fieldName]['eval'])) {
+                                                               $this->fields[$fieldName]['type'] = 'time';
+                                                       } elseif (preg_match('/date/i', $this->fields[$fieldName]['eval'])) {
+                                                               $this->fields[$fieldName]['type'] = 'date';
                                                        } else {
-                                                               $this->fields[$fN]['type'] = 'text';
+                                                               $this->fields[$fieldName]['type'] = 'text';
                                                        }
                                                        break;
                                                case 'check':
-                                                       if (!$this->fields[$fN]['items']) {
-                                                               $this->fields[$fN]['type'] = 'boolean';
+                                                       if (!$this->fields[$fieldName]['items']) {
+                                                               $this->fields[$fieldName]['type'] = 'boolean';
                                                        } else {
-                                                               $this->fields[$fN]['type'] = 'binary';
+                                                               $this->fields[$fieldName]['type'] = 'binary';
                                                        }
                                                        break;
                                                case 'radio':
-                                                       $this->fields[$fN]['type'] = 'multiple';
+                                                       $this->fields[$fieldName]['type'] = 'multiple';
                                                        break;
                                                case 'select':
-                                                       $this->fields[$fN]['type'] = 'multiple';
-                                                       if ($this->fields[$fN]['foreign_table']) {
-                                                               $this->fields[$fN]['type'] = 'relation';
+                                                       $this->fields[$fieldName]['type'] = 'multiple';
+                                                       if ($this->fields[$fieldName]['foreign_table']) {
+                                                               $this->fields[$fieldName]['type'] = 'relation';
                                                        }
-                                                       if ($this->fields[$fN]['special']) {
-                                                               $this->fields[$fN]['type'] = 'text';
+                                                       if ($this->fields[$fieldName]['special']) {
+                                                               $this->fields[$fieldName]['type'] = 'text';
                                                        }
                                                        break;
                                                case 'group':
-                                                       $this->fields[$fN]['type'] = 'files';
-                                                       if ($this->fields[$fN]['internal_type'] == 'db') {
-                                                               $this->fields[$fN]['type'] = 'relation';
+                                                       $this->fields[$fieldName]['type'] = 'files';
+                                                       if ($this->fields[$fieldName]['internal_type'] == 'db') {
+                                                               $this->fields[$fieldName]['type'] = 'relation';
                                                        }
                                                        break;
                                                case 'user':
-
                                                case 'flex':
-
                                                case 'passthrough':
-
                                                case 'none':
-
                                                case 'text':
-
                                                default:
-                                                       $this->fields[$fN]['type'] = 'text';
+                                                       $this->fields[$fieldName]['type'] = 'text';
                                        }
                                } else {
-                                       $this->fields[$fN]['label'] = '[FIELD: ' . $fN . ']';
-                                       switch ($fN) {
+                                       $this->fields[$fieldName]['label'] = '[FIELD: ' . $fieldName . ']';
+                                       switch ($fieldName) {
                                                case 'pid':
-                                                       $this->fields[$fN]['type'] = 'relation';
-                                                       $this->fields[$fN]['allowed'] = 'pages';
+                                                       $this->fields[$fieldName]['type'] = 'relation';
+                                                       $this->fields[$fieldName]['allowed'] = 'pages';
                                                        break;
                                                case 'cruser_id':
-                                                       $this->fields[$fN]['type'] = 'relation';
-                                                       $this->fields[$fN]['allowed'] = 'be_users';
+                                                       $this->fields[$fieldName]['type'] = 'relation';
+                                                       $this->fields[$fieldName]['allowed'] = 'be_users';
                                                        break;
                                                case 'tstamp':
-
                                                case 'crdate':
-                                                       $this->fields[$fN]['type'] = 'time';
+                                                       $this->fields[$fieldName]['type'] = 'time';
                                                        break;
                                                case 'deleted':
-                                                       $this->fields[$fN]['type'] = 'boolean';
+                                                       $this->fields[$fieldName]['type'] = 'boolean';
                                                        break;
                                                default:
-                                                       $this->fields[$fN]['type'] = 'number';
+                                                       $this->fields[$fieldName]['type'] = 'number';
                                        }
                                }
                        }
@@ -343,33 +384,33 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Set and clean up external lists
         *
-        * @param       [type]          $name: ...
-        * @param       [type]          $list: ...
-        * @param       [type]          $force: ...
-        * @return      [type]          ...
+        * @param string $name The name
+        * @param string $list The list
+        * @param string $force
+        * @return void
         */
        public function setAndCleanUpExternalLists($name, $list, $force = '') {
-               $fields = array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $list . ',' . $force, TRUE));
+               $fields = array_unique(GeneralUtility::trimExplode(',', $list . ',' . $force, TRUE));
                $reList = array();
-               foreach ($fields as $fN) {
-                       if ($this->fields[$fN]) {
-                               $reList[] = $fN;
+               foreach ($fields as $fieldName) {
+                       if ($this->fields[$fieldName]) {
+                               $reList[] = $fieldName;
                        }
                }
                $this->extFieldLists[$name] = implode(',', $reList);
        }
 
        /**
-        * [Describe function...]
+        * Process data
         *
-        * @param       [type]          $qC: ...
-        * @return      [type]          ...
+        * @param string $qC Query config
+        * @return void
         */
        public function procesData($qC = '') {
                $this->queryConfig = $qC;
-               $POST = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
+               $POST = GeneralUtility::_POST();
                // If delete...
                if ($POST['qG_del']) {
                        // Initialize array to work on, save special parameters
@@ -465,13 +506,13 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Clean up query config
         *
-        * @param       [type]          $queryConfig: ...
-        * @return      [type]          ...
+        * @param array $queryConfig Query config
+        * @return array
         */
        public function cleanUpQueryConfig($queryConfig) {
-               // Since we dont traverse the array using numeric keys in the upcoming whileloop make sure it's fresh and clean before displaying
+               // Since we don't traverse the array using numeric keys in the upcoming while-loop make sure it's fresh and clean before displaying
                if (is_array($queryConfig)) {
                        ksort($queryConfig);
                } else {
@@ -485,14 +526,14 @@ class QueryGenerator {
                $arrCount = 0;
                foreach ($queryConfig as $key => $conf) {
                        if (substr($conf['type'], 0, 6) == 'FIELD_') {
-                               $fName = substr($conf['type'], 6);
-                               $fType = $this->fields[$fName]['type'];
+                               $fieldName = substr($conf['type'], 6);
+                               $fieldType = $this->fields[$fieldName]['type'];
                        } elseif ($conf['type'] == 'newlevel') {
-                               $fType = $conf['type'];
+                               $fieldType = $conf['type'];
                        } else {
-                               $fType = 'ignore';
+                               $fieldType = 'ignore';
                        }
-                       switch ($fType) {
+                       switch ($fieldType) {
                                case 'newlevel':
                                        if (!$queryConfig[$key]['nl']) {
                                                $queryConfig[$key]['nl'][0]['type'] = 'FIELD_';
@@ -505,10 +546,10 @@ class QueryGenerator {
                                case 'ignore':
 
                                default:
-                                       $verifiedName = $this->verifyType($fName);
+                                       $verifiedName = $this->verifyType($fieldName);
                                        $queryConfig[$key]['type'] = 'FIELD_' . $this->verifyType($verifiedName);
-                                       if ($conf['comparison'] >> 5 != $this->comp_offsets[$fType]) {
-                                               $conf['comparison'] = $this->comp_offsets[$fType] << 5;
+                                       if ($conf['comparison'] >> 5 != $this->comp_offsets[$fieldType]) {
+                                               $conf['comparison'] = $this->comp_offsets[$fieldType] << 5;
                                        }
                                        $queryConfig[$key]['comparison'] = $this->verifyComparison($conf['comparison'], $conf['negate'] ? 1 : 0);
                                        $queryConfig[$key]['inputValue'] = $this->cleanInputVal($queryConfig[$key]);
@@ -519,12 +560,12 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Get form elements
         *
-        * @param       [type]          $subLevel: ...
-        * @param       [type]          $queryConfig: ...
-        * @param       [type]          $parent: ...
-        * @return      [type]          ...
+        * @param int $subLevel
+        * @param string $queryConfig
+        * @param string $parent
+        * @return array
         */
        public function getFormElements($subLevel = 0, $queryConfig = '', $parent = '') {
                $codeArr = array();
@@ -539,22 +580,22 @@ class QueryGenerator {
                        $lineHTML = '';
                        $lineHTML .= $this->mkOperatorSelect($this->name . $subscript, $conf['operator'], $c, $conf['type'] != 'FIELD_');
                        if (substr($conf['type'], 0, 6) == 'FIELD_') {
-                               $fName = substr($conf['type'], 6);
-                               $this->fieldName = $fName;
-                               $fType = $this->fields[$fName]['type'];
-                               if ($conf['comparison'] >> 5 != $this->comp_offsets[$fType]) {
-                                       $conf['comparison'] = $this->comp_offsets[$fType] << 5;
+                               $fieldName = substr($conf['type'], 6);
+                               $this->fieldName = $fieldName;
+                               $fieldType = $this->fields[$fieldName]['type'];
+                               if ($conf['comparison'] >> 5 != $this->comp_offsets[$fieldType]) {
+                                       $conf['comparison'] = $this->comp_offsets[$fieldType] << 5;
                                }
                                //nasty nasty...
                                //make sure queryConfig contains _actual_ comparevalue.
                                //mkCompSelect don't care, but getQuery does.
                                $queryConfig[$key]['comparison'] += isset($conf['negate']) - $conf['comparison'] % 2;
                        } elseif ($conf['type'] == 'newlevel') {
-                               $fType = $conf['type'];
+                               $fieldType = $conf['type'];
                        } else {
-                               $fType = 'ignore';
+                               $fieldType = 'ignore';
                        }
-                       switch ($fType) {
+                       switch ($fieldType) {
                                case 'ignore':
                                        break;
                                case 'newlevel':
@@ -565,10 +606,10 @@ class QueryGenerator {
                                        $codeArr[$arrCount]['sub'] = $this->getFormElements($subLevel + 1, $queryConfig[$key]['nl'], $subscript . '[nl]');
                                        break;
                                case 'userdef':
-                                       $lineHTML .= $this->userDef($this->name . $subscript, $conf, $fName, $fType);
+                                       $lineHTML .= $this->userDef($this->name . $subscript, $conf, $fieldName, $fieldType);
                                        break;
                                case 'date':
-                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
+                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fieldName);
                                        $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
                                        $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
                                        if ($conf['comparison'] == 100 || $conf['comparison'] == 101) {
@@ -583,7 +624,7 @@ class QueryGenerator {
                                        }
                                        break;
                                case 'time':
-                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
+                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fieldName);
                                        $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
                                        $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
                                        if ($conf['comparison'] == 100 || $conf['comparison'] == 101) {
@@ -598,11 +639,9 @@ class QueryGenerator {
                                        }
                                        break;
                                case 'multiple':
-
                                case 'binary':
-
                                case 'relation':
-                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
+                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fieldName);
                                        $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
                                        $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
                                        if ($conf['comparison'] == 68 || $conf['comparison'] == 69 || $conf['comparison'] == 162 || $conf['comparison'] == 163) {
@@ -616,12 +655,12 @@ class QueryGenerator {
                                                $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '" style="vertical-align:top;" onChange="submit();">';
                                        }
                                        if ($conf['comparison'] != 66 && $conf['comparison'] != 67) {
-                                               $lineHTML .= $this->makeOptionList($fName, $conf, $this->table);
+                                               $lineHTML .= $this->makeOptionList($fieldName, $conf, $this->table);
                                                $lineHTML .= '</select>';
                                        }
                                        break;
                                case 'files':
-                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
+                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fieldName);
                                        $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
                                        $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
                                        if ($conf['comparison'] == 68 || $conf['comparison'] == 69) {
@@ -629,20 +668,20 @@ class QueryGenerator {
                                        } else {
                                                $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '" style="vertical-align:top;" onChange="submit();">';
                                        }
-                                       $lineHTML .= '<option value=""></option>' . $this->makeOptionList($fName, $conf, $this->table);
+                                       $lineHTML .= '<option value=""></option>' . $this->makeOptionList($fieldName, $conf, $this->table);
                                        $lineHTML .= '</select>';
                                        if ($conf['comparison'] == 66 || $conf['comparison'] == 67) {
                                                $lineHTML .= ' + <input type="text" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $this->name . $subscript . '[inputValue1]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
                                        }
                                        break;
                                case 'boolean':
-                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
+                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fieldName);
                                        $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
                                        $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
                                        $lineHTML .= '<input type="hidden" value="1" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
                                        break;
                                default:
-                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
+                                       $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fieldName);
                                        $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
                                        $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
                                        if ($conf['comparison'] == 37 || $conf['comparison'] == 36) {
@@ -653,20 +692,20 @@ class QueryGenerator {
                                                $lineHTML .= '<input type="text" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
                                        }
                        }
-                       if ($fType != 'ignore') {
+                       if ($fieldType != 'ignore') {
                                $lineHTML .= $this->updateIcon();
                                if ($loopcount) {
-                                       $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/garbage.gif', 'width="11" height="12"') . 'title="Remove condition" name="qG_del' . $subscript . '">';
+                                       $lineHTML .= '<input type="image" border="0" ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/garbage.gif', 'width="11" height="12"') . 'title="Remove condition" name="qG_del' . $subscript . '">';
                                }
-                               $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/add.gif', 'width="12" height="12"') . ' title="Add condition" name="qG_ins' . $subscript . '">';
+                               $lineHTML .= '<input type="image" border="0" ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/add.gif', 'width="12" height="12"') . ' title="Add condition" name="qG_ins' . $subscript . '">';
                                if ($c != 0) {
-                                       $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2up.gif', 'width="12" height="7"') . ' title="Move up" name="qG_up' . $subscript . '">';
+                                       $lineHTML .= '<input type="image" border="0" ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2up.gif', 'width="12" height="7"') . ' title="Move up" name="qG_up' . $subscript . '">';
                                }
-                               if ($c != 0 && $fType != 'newlevel') {
-                                       $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2right.gif', 'height="12" width="7"') . ' title="New level" name="qG_nl' . $subscript . '">';
+                               if ($c != 0 && $fieldType != 'newlevel') {
+                                       $lineHTML .= '<input type="image" border="0" ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2right.gif', 'height="12" width="7"') . ' title="New level" name="qG_nl' . $subscript . '">';
                                }
-                               if ($fType == 'newlevel') {
-                                       $lineHTML .= '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2left.gif', 'height="12" width="7"') . ' title="Collapse new level" name="qG_remnl' . $subscript . '">';
+                               if ($fieldType == 'newlevel') {
+                                       $lineHTML .= '<input type="image" border="0" ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2left.gif', 'height="12" width="7"') . ' title="Collapse new level" name="qG_remnl' . $subscript . '">';
                                }
                                $codeArr[$arrCount]['html'] = $lineHTML;
                                $codeArr[$arrCount]['query'] = $this->getQuerySingle($conf, $c > 0 ? 0 : 1);
@@ -680,22 +719,22 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Make option list
         *
-        * @param       [type]          $codeArr: ...
-        * @param       [type]          $l: ...
-        * @param       [type]          $table: ...
-        * @return      [type]          ...
+        * @param string $fieldName
+        * @param array $conf
+        * @param string $table
+        * @return string
         */
-       public function makeOptionList($fN, $conf, $table) {
+       public function makeOptionList($fieldName, $conf, $table) {
                $out = '';
-               $fieldSetup = $this->fields[$fN];
+               $fieldSetup = $this->fields[$fieldName];
                if ($fieldSetup['type'] == 'files') {
                        if ($conf['comparison'] == 66 || $conf['comparison'] == 67) {
                                $fileExtArray = explode(',', $fieldSetup['allowed']);
                                natcasesort($fileExtArray);
                                foreach ($fileExtArray as $fileExt) {
-                                       if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $fileExt)) {
+                                       if (GeneralUtility::inList($conf['inputValue'], $fileExt)) {
                                                $out .= '<option value="' . $fileExt . '" selected>.' . $fileExt . '</option>';
                                        } else {
                                                $out .= '<option value="' . $fileExt . '">.' . $fileExt . '</option>';
@@ -712,7 +751,7 @@ class QueryGenerator {
                        $d->close();
                        natcasesort($fileArray);
                        foreach ($fileArray as $fileName) {
-                               if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $fileName)) {
+                               if (GeneralUtility::inList($conf['inputValue'], $fileName)) {
                                        $out .= '<option value="' . $fileName . '" selected>' . $fileName . '</option>';
                                } else {
                                        $out .= '<option value="' . $fileName . '">' . $fileName . '</option>';
@@ -726,7 +765,7 @@ class QueryGenerator {
                                } else {
                                        $value = $val[0];
                                }
-                               if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $val[1])) {
+                               if (GeneralUtility::inList($conf['inputValue'], $val[1])) {
                                        $out .= '<option value="' . $val[1] . '" selected>' . $value . '</option>';
                                } else {
                                        $out .= '<option value="' . $val[1] . '">' . $value . '</option>';
@@ -740,7 +779,7 @@ class QueryGenerator {
                                } else {
                                        $value = $val[0];
                                }
-                               if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], pow(2, $key))) {
+                               if (GeneralUtility::inList($conf['inputValue'], pow(2, $key))) {
                                        $out .= '<option value="' . pow(2, $key) . '" selected>' . $value . '</option>';
                                } else {
                                        $out .= '<option value="' . pow(2, $key) . '">' . $value . '</option>';
@@ -755,7 +794,7 @@ class QueryGenerator {
                                        } else {
                                                $value = $val[0];
                                        }
-                                       if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $val[1])) {
+                                       if (GeneralUtility::inList($conf['inputValue'], $val[1])) {
                                                $out .= '<option value="' . $val[1] . '" selected>' . $value . '</option>';
                                        } else {
                                                $out .= '<option value="' . $val[1] . '">' . $value . '</option>';
@@ -766,18 +805,18 @@ class QueryGenerator {
                                $from_table_Arr = explode(',', $fieldSetup['allowed']);
                                $useTablePrefix = 1;
                                if (!$fieldSetup['prepend_tname']) {
-                                       $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fN, $table, BackendUtility::deleteClause($table), ($groupBy = ''), ($orderBy = ''), ($limit = ''));
+                                       $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fieldName, $table, BackendUtility::deleteClause($table), ($groupBy = ''), ($orderBy = ''), ($limit = ''));
                                        if ($checkres) {
                                                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($checkres)) {
-                                                       if (stristr($row[$fN], ',')) {
-                                                               $checkContent = explode(',', $row[$fN]);
+                                                       if (stristr($row[$fieldName], ',')) {
+                                                               $checkContent = explode(',', $row[$fieldName]);
                                                                foreach ($checkContent as $singleValue) {
                                                                        if (!stristr($singleValue, '_')) {
                                                                                $dontPrefixFirstTable = 1;
                                                                        }
                                                                }
                                                        } else {
-                                                               $singleValue = $row[$fN];
+                                                               $singleValue = $row[$fieldName];
                                                                if (strlen($singleValue) && !stristr($singleValue, '_')) {
                                                                        $dontPrefixFirstTable = 1;
                                                                }
@@ -880,7 +919,7 @@ class QueryGenerator {
                                }
                        }
                        foreach ($outArray as $key2 => $val2) {
-                               if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($conf['inputValue'], $key2)) {
+                               if (GeneralUtility::inList($conf['inputValue'], $key2)) {
                                        $out .= '<option value="' . $key2 . '" selected>[' . $key2 . '] ' . $val2 . '</option>';
                                } else {
                                        $out .= '<option value="' . $key2 . '">[' . $key2 . '] ' . $val2 . '</option>';
@@ -891,25 +930,25 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Print code array
         *
-        * @param       [type]          $codeArr: ...
-        * @param       [type]          $l: ...
-        * @return      [type]          ...
+        * @param array $codeArr
+        * @param int $recursionLevel
+        * @return string
         */
-       public function printCodeArray($codeArr, $l = 0) {
+       public function printCodeArray($codeArr, $recursionLevel = 0) {
                $line = '';
-               if ($l) {
+               $indent = '';
+               if ($recursionLevel) {
                        $indent = '<td style="vertical-align:top;"><img height="1" width="50"></td>';
                }
-               $lf = $l * 30;
                foreach ($codeArr as $k => $v) {
                        $line .= '<tr>' . $indent . '<td class="bgColor2" ' . $this->noWrap . '>' . $v['html'] . '</td></tr>';
                        if ($this->enableQueryParts) {
                                $line .= '<tr>' . $indent . '<td>' . $this->formatQ($v['query']) . '</td></tr>';
                        }
                        if (is_array($v['sub'])) {
-                               $line .= '<tr>' . $indent . '<td' . $this->noWrap . '>' . $this->printCodeArray($v['sub'], ($l + 1)) . '</td></tr>';
+                               $line .= '<tr>' . $indent . '<td' . $this->noWrap . '>' . $this->printCodeArray($v['sub'], ($recursionLevel + 1)) . '</td></tr>';
                        }
                }
                $out = '<table border="0" cellpadding="0" cellspacing="1">' . $line . '</table>';
@@ -917,23 +956,23 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Format query-string (output as HTML)
         *
-        * @param       [type]          $str: ...
-        * @return      [type]          ...
+        * @param string $str
+        * @return string
         */
        public function formatQ($str) {
                return '<font size="1" face="verdana" color="maroon"><i>' . htmlspecialchars($str) . '</i></font>';
        }
 
        /**
-        * [Describe function...]
+        * Make operator select
         *
-        * @param       [type]          $name: ...
-        * @param       [type]          $op: ...
-        * @param       [type]          $draw: ...
-        * @param       [type]          $submit: ...
-        * @return      [type]          ...
+        * @param string $name
+        * @param string $op
+        * @param bool $draw
+        * @param bool $submit
+        * @return string
         */
        public function mkOperatorSelect($name, $op, $draw, $submit) {
                if ($draw) {
@@ -950,12 +989,12 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Make type select
         *
-        * @param       [type]          $name: ...
-        * @param       [type]          $fieldName: ...
-        * @param       [type]          $prepend: ...
-        * @return      [type]          ...
+        * @param string $name
+        * @param string $fieldName
+        * @param string $prepend
+        * @return string
         */
        public function mkTypeSelect($name, $fieldName, $prepend = 'FIELD_') {
                $out = '<select name="' . $name . '" onChange="submit();">';
@@ -972,10 +1011,10 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Verify type
         *
-        * @param       [type]          $fieldName: ...
-        * @return      [type]          ...
+        * @param string $fieldName
+        * @return string
         */
        public function verifyType($fieldName) {
                $first = '';
@@ -991,11 +1030,11 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Verify comparison
         *
-        * @param       [type]          $comparison: ...
-        * @param       [type]          $neg: ...
-        * @return      [type]          ...
+        * @param string $comparison
+        * @param int $neg
+        * @return int
         */
        public function verifyComparison($comparison, $neg) {
                $compOffSet = $comparison >> 5;
@@ -1012,15 +1051,15 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Make field to input select
         *
-        * @param       [type]          $name: ...
-        * @param       [type]          $fieldName: ...
-        * @return      [type]          ...
+        * @param string $name
+        * @param string $fieldName
+        * @return string
         */
        public function mkFieldToInputSelect($name, $fieldName) {
                $out = '<input type="Text" value="' . htmlspecialchars($fieldName) . '" name="' . $name . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth() . '>' . $this->updateIcon();
-               $out .= '<a href="#" onClick="document.forms[0][\'' . $name . '\'].value=\'\';return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete', array('title' => 'Clear list')) . '</a>';
+               $out .= '<a href="#" onClick="document.forms[0][\'' . $name . '\'].value=\'\';return false;">' . IconUtility::getSpriteIcon('actions-edit-delete', array('title' => 'Clear list')) . '</a>';
                $out .= '<BR><select name="_fieldListDummy" size="5" onChange="document.forms[0][\'' . $name . '\'].value+=\',\'+this.value">';
                foreach ($this->fields as $key => $value) {
                        if (!$value['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $key)) {
@@ -1034,11 +1073,11 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Make table select
         *
-        * @param       [type]          $name: ...
-        * @param       [type]          $cur: ...
-        * @return      [type]          ...
+        * @param string $name
+        * @param string $cur
+        * @return string
         */
        public function mkTableSelect($name, $cur) {
                $out = '<select name="' . $name . '" onChange="submit();">';
@@ -1053,12 +1092,12 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Make comparison select
         *
-        * @param       [type]          $name: ...
-        * @param       [type]          $comparison: ...
-        * @param       [type]          $neg: ...
-        * @return      [type]          ...
+        * @param string $name
+        * @param string $comparison
+        * @param int $neg
+        * @return string
         */
        public function mkCompSelect($name, $comparison, $neg) {
                $compOffSet = $comparison >> 5;
@@ -1073,12 +1112,13 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Get subscript
         *
-        * @param       [type]          $arr: ...
-        * @return      [type]          ...
+        * @param array $arr
+        * @return array
         */
        public function getSubscript($arr) {
+               $retArr = array();
                while (is_array($arr)) {
                        reset($arr);
                        list($key, ) = each($arr);
@@ -1089,39 +1129,39 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Init user definition
         *
-        * @return      [type]          ...
+        * @return void
         */
        public function initUserDef() {
 
        }
 
        /**
-        * [Describe function...]
+        * User definition
         *
-        * @return      [type]          ...
+        * @return void
         */
        public function userDef() {
 
        }
 
        /**
-        * [Describe function...]
+        * User definition clean up
         *
-        * @param       [type]          $queryConfig: ...
-        * @return      [type]          ...
+        * @param array $queryConfig
+        * @return array
         */
        public function userDefCleanUp($queryConfig) {
                return $queryConfig;
        }
 
        /**
-        * [Describe function...]
+        * Get query
         *
-        * @param       [type]          $queryConfig: ...
-        * @param       [type]          $pad: ...
-        * @return      [type]          ...
+        * @param array $queryConfig
+        * @param string $pad
+        * @return string
         */
        public function getQuery($queryConfig, $pad = '') {
                $qs = '';
@@ -1134,7 +1174,7 @@ class QueryGenerator {
                                        $qs .= LF . $pad . trim($conf['operator']) . ' (' . $this->getQuery($queryConfig[$key]['nl'], ($pad . '   ')) . LF . $pad . ')';
                                        break;
                                case 'userdef':
-                                       $qs .= LF . $pad . getUserDefQuery($conf, $first);
+                                       $qs .= LF . $pad . $this->getUserDefQuery($conf, $first);
                                        break;
                                default:
                                        $qs .= LF . $pad . $this->getQuerySingle($conf, $first);
@@ -1145,11 +1185,11 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Get single query
         *
-        * @param       [type]          $conf: ...
-        * @param       [type]          $first: ...
-        * @return      [type]          ...
+        * @param array $conf
+        * @param bool $first
+        * @return string
         */
        public function getQuerySingle($conf, $first) {
                $qs = '';
@@ -1187,18 +1227,18 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Clear input value
         *
-        * @param       [type]          $conf: ...
-        * @param       [type]          $suffix: ...
-        * @return      [type]          ...
+        * @param array $conf
+        * @param string $suffix
+        * @return string
         */
        public function cleanInputVal($conf, $suffix = '') {
                if ($conf['comparison'] >> 5 == 0 || ($conf['comparison'] == 32 || $conf['comparison'] == 33 || $conf['comparison'] == 64 || $conf['comparison'] == 65 || $conf['comparison'] == 66 || $conf['comparison'] == 67 || $conf['comparison'] == 96 || $conf['comparison'] == 97)) {
                        $inputVal = $conf['inputValue' . $suffix];
                } elseif ($conf['comparison'] == 39 || $conf['comparison'] == 38) {
                        // in list:
-                       $inputVal = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $conf['inputValue' . $suffix]));
+                       $inputVal = implode(',', GeneralUtility::intExplode(',', $conf['inputValue' . $suffix]));
                } elseif ($conf['comparison'] == 68 || $conf['comparison'] == 69 || $conf['comparison'] == 162 || $conf['comparison'] == 163) {
                        // in list:
                        if (is_array($conf['inputValue' . $suffix])) {
@@ -1215,39 +1255,40 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Get user definition query
         *
-        * @param       [type]          $qcArr: ...
-        * @return      [type]          ...
+        * @param array $qcArr
+        * @param bool $first
+        * @return void
         */
-       public function getUserDefQuery($qcArr) {
+       public function getUserDefQuery($qcArr, $first) {
 
        }
 
        /**
-        * [Describe function...]
+        * Update icon
         *
-        * @return      [type]          ...
+        * @return string
         */
        public function updateIcon() {
-               return '<input type="image" border="0" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/refresh_n.gif', 'width="14" height="14"') . ' title="Update" name="just_update">';
+               return '<input type="image" border="0" ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/refresh_n.gif', 'width="14" height="14"') . ' title="Update" name="just_update">';
        }
 
        /**
-        * [Describe function...]
+        * Get label column
         *
-        * @return      [type]          ...
+        * @return string
         */
        public function getLabelCol() {
                return $GLOBALS['TCA'][$this->table]['ctrl']['label'];
        }
 
        /**
-        * [Describe function...]
+        * Make selector table
         *
-        * @param       [type]          $modSettings: ...
-        * @param       [type]          $enableList: ...
-        * @return      [type]          ...
+        * @param array $modSettings
+        * @param string $enableList
+        * @return string
         */
        public function makeSelectorTable($modSettings, $enableList = 'table,fields,query,group,order,limit') {
                $enableArr = explode(',', $enableList);
@@ -1270,7 +1311,7 @@ class QueryGenerator {
                        if (!$this->extFieldLists['queryLimit']) {
                                $this->extFieldLists['queryLimit'] = 100;
                        }
-                       $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->extFieldLists['queryLimit']);
+                       $parts = GeneralUtility::intExplode(',', $this->extFieldLists['queryLimit']);
                        if ($parts[1]) {
                                $this->limitBegin = $parts[0];
                                $this->limitLength = $parts[1];
@@ -1291,7 +1332,7 @@ class QueryGenerator {
                        // Query Generator:
                        $this->procesData($modSettings['queryConfig'] ? unserialize($modSettings['queryConfig']) : '');
                        $this->queryConfig = $this->cleanUpQueryConfig($this->queryConfig);
-                       $this->enableQueryParts = $modSettings['search_query_smallparts'];
+                       $this->enableQueryParts = (bool)$modSettings['search_query_smallparts'];
                        $codeArr = $this->getFormElements();
                        $queryCode = $this->printCodeArray($codeArr);
                        if (in_array('fields', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectFields']) {
@@ -1363,13 +1404,13 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Get tree list
         *
-        * @param       [type]          $qString: ...
-        * @param       [type]          $depth: ...
-        * @param       [type]          $begin: ...
-        * @param       [type]          $perms_clause: ...
-        * @return      [type]          ...
+        * @param int $id
+        * @param int $depth
+        * @param int $begin
+        * @param string $perms_clause
+        * @return string
         */
        public function getTreeList($id, $depth, $begin = 0, $perms_clause) {
                $depth = (int)$depth;
@@ -1399,13 +1440,13 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * Get select query
         *
-        * @param       [type]          $qString: ...
-        * @param       [type]          $fN: ...
-        * @return      [type]          ...
+        * @param string $qString
+        * @param string $fieldName
+        * @return bool|\mysqli_result|object
         */
-       public function getSelectQuery($qString = '', $fN = '') {
+       public function getSelectQuery($qString = '', $fieldName = '') {
                if (!$qString) {
                        $qString = $this->getQuery($this->queryConfig);
                }
@@ -1435,7 +1476,7 @@ class QueryGenerator {
        }
 
        /**
-        * [Describe function...]
+        * JavaScript bottom
         *
         * @param string $formname
         * @return string
index 824920b..2fd9161 100644 (file)
@@ -26,14 +26,34 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
  */
 class QueryView {
 
+       /**
+        * @var string
+        */
        public $storeList = 'search_query_smallparts,search_result_labels,labels_noprefix,show_deleted,queryConfig,queryTable,queryFields,queryLimit,queryOrder,queryOrderDesc,queryOrder2,queryOrder2Desc,queryGroup,search_query_makeQuery';
 
+       /**
+        * @var string
+        */
        public $downloadScript = 'index.php';
 
+       /**
+        * @var int
+        */
        public $formW = 48;
 
+       /**
+        * @var int
+        */
        public $noDownloadB = 0;
 
+       /**
+        * @var array
+        */
+       public $hookArray = array();
+
+       /**
+        * @var string
+        */
        protected $formName = '';
 
        /**
@@ -44,7 +64,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Get form
         *
         * @return string
         */
@@ -57,7 +77,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Make store control
         *
         * @return string
         */
@@ -91,7 +111,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Init store array
         *
         * @return array
         */
@@ -107,7 +127,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Clean store query configs
         *
         * @param array $storeQueryConfigs
         * @param array $storeArray
@@ -125,7 +145,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Add to store query configs
         *
         * @param array $storeQueryConfigs
         * @param int $index
@@ -141,7 +161,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Save query in action
         *
         * @param int $uid
         * @return int
@@ -183,7 +203,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Load store query configs
         *
         * @param array $storeQueryConfigs
         * @param int $storeIndex
@@ -201,7 +221,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Process store control
         *
         * @return string
         */
@@ -277,7 +297,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Query marker
         *
         * @return string
         */
@@ -337,10 +357,10 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Get query result code
         *
         * @param string $mQ
-        * @param pointer $res
+        * @param bool|\mysqli_result|object $res MySQLi result object / DBAL object
         * @param string $table
         * @return string
         */
@@ -417,7 +437,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * CSV values
         *
         * @param array $row
         * @param string $delim
@@ -437,7 +457,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Table wrap
         *
         * @param string $str
         * @return string
@@ -447,7 +467,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Search
         *
         * @return string
         */
@@ -493,7 +513,7 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Result row display
         *
         * @param array $row
         * @param array $conf
@@ -506,12 +526,12 @@ class QueryView {
                $SET = $GLOBALS['SOBE']->MOD_SETTINGS;
                $out = '<tr class="bgColor' . ($even ? '6' : '4') . '">';
                $even = !$even;
-               foreach ($row as $fN => $fV) {
-                       if (GeneralUtility::inList($SET['queryFields'], $fN) || !$SET['queryFields'] && $fN != 'pid' && $fN != 'deleted') {
+               foreach ($row as $fieldName => $fieldValue) {
+                       if (GeneralUtility::inList($SET['queryFields'], $fieldName) || !$SET['queryFields'] && $fieldName != 'pid' && $fieldName != 'deleted') {
                                if ($SET['search_result_labels']) {
-                                       $fVnew = $this->getProcessedValueExtra($table, $fN, $fV, $conf, '<br />');
+                                       $fVnew = $this->getProcessedValueExtra($table, $fieldName, $fieldValue, $conf, '<br />');
                                } else {
-                                       $fVnew = htmlspecialchars($fV);
+                                       $fVnew = htmlspecialchars($fieldValue);
                                }
                                $out .= '<td>' . $fVnew . '</td>';
                        }
@@ -549,19 +569,20 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Get processed value extra
         *
         * @param string $table
-        * @param string $fN
-        * @param string $fV
+        * @param string $fieldName
+        * @param string $fieldValue
         * @param array $conf Not used
         * @param string $splitString
         * @return string
         */
-       public function getProcessedValueExtra($table, $fN, $fV, $conf, $splitString) {
+       public function getProcessedValueExtra($table, $fieldName, $fieldValue, $conf, $splitString) {
+               $out = '';
                // Analysing the fields in the table.
                if (is_array($GLOBALS['TCA'][$table])) {
-                       $fC = $GLOBALS['TCA'][$table]['columns'][$fN];
+                       $fC = $GLOBALS['TCA'][$table]['columns'][$fieldName];
                        $fields = $fC['config'];
                        $fields['exclude'] = $fC['exclude'];
                        if (is_array($fC) && $fC['label']) {
@@ -604,21 +625,16 @@ class QueryView {
                                                }
                                                break;
                                        case 'user':
-
                                        case 'flex':
-
                                        case 'passthrough':
-
                                        case 'none':
-
                                        case 'text':
-
                                        default:
                                                $fields['type'] = 'text';
                                }
                        } else {
-                               $fields['label'] = '[FIELD: ' . $fN . ']';
-                               switch ($fN) {
+                               $fields['label'] = '[FIELD: ' . $fieldName . ']';
+                               switch ($fieldName) {
                                        case 'pid':
                                                $fields['type'] = 'relation';
                                                $fields['allowed'] = 'pages';
@@ -639,39 +655,36 @@ class QueryView {
                }
                switch ($fields['type']) {
                        case 'date':
-                               if ($fV != -1) {
-                                       $out = strftime('%e-%m-%Y', $fV);
+                               if ($fieldValue != -1) {
+                                       $out = strftime('%e-%m-%Y', $fieldValue);
                                }
                                break;
                        case 'time':
-                               if ($fV != -1) {
+                               if ($fieldValue != -1) {
                                        if ($splitString == '<br />') {
-                                               $out = strftime('%H:%M' . $splitString . '%e-%m-%Y', $fV);
+                                               $out = strftime('%H:%M' . $splitString . '%e-%m-%Y', $fieldValue);
                                        } else {
-                                               $out = strftime('%H:%M %e-%m-%Y', $fV);
+                                               $out = strftime('%H:%M %e-%m-%Y', $fieldValue);
                                        }
                                }
                                break;
                        case 'multiple':
-
                        case 'binary':
-
                        case 'relation':
-                               $out = $this->makeValueList($fN, $fV, $fields, $table, $splitString);
+                               $out = $this->makeValueList($fieldName, $fieldValue, $fields, $table, $splitString);
                                break;
                        case 'boolean':
-                               $out = $fV ? 'True' : 'False';
+                               $out = $fieldValue ? 'True' : 'False';
                                break;
                        case 'files':
-
                        default:
-                               $out = htmlspecialchars($fV);
+                               $out = htmlspecialchars($fieldValue);
                }
                return $out;
        }
 
        /**
-        * [Describe function...]
+        * Get tree list
         *
         * @param int $id
         * @param int $depth
@@ -707,16 +720,16 @@ class QueryView {
        }
 
        /**
-        * [Describe function...]
+        * Make value list
         *
-        * @param string $fN
-        * @param string $fV
+        * @param string $fieldName
+        * @param string $fieldValue
         * @param array $conf
         * @param string $table
         * @param string $splitString
         * @return string
         */
-       public function makeValueList($fN, $fV, $conf, $table, $splitString) {
+       public function makeValueList($fieldName, $fieldValue, $conf, $table, $splitString) {
                $fieldSetup = $conf;
                $out = '';
                if ($fieldSetup['type'] == 'files') {
@@ -730,7 +743,7 @@ class QueryView {
                        $d->close();
                        natcasesort($fileArray);
                        while (list(, $fileName) = each($fileArray)) {
-                               if (GeneralUtility::inList($fV, $fileName) || $fV == $fileName) {
+                               if (GeneralUtility::inList($fieldValue, $fileName) || $fieldValue == $fileName) {
                                        if (!$out) {
                                                $out = htmlspecialchars($fileName);
                                        } else {
@@ -746,7 +759,7 @@ class QueryView {
                                } else {
                                        $value = $val[0];
                                }
-                               if (GeneralUtility::inList($fV, $val[1]) || $fV == $val[1]) {
+                               if (GeneralUtility::inList($fieldValue, $val[1]) || $fieldValue == $val[1]) {
                                        if (!$out) {
                                                $out = htmlspecialchars($value);
                                        } else {
@@ -777,7 +790,7 @@ class QueryView {
                                        } else {
                                                $value = $val[0];
                                        }
-                                       if (GeneralUtility::inList($fV, $value) || $fV == $value) {
+                                       if (GeneralUtility::inList($fieldValue, $value) || $fieldValue == $value) {
                                                if (!$out) {
                                                        $out = htmlspecialchars($value);
                                                } else {
@@ -790,18 +803,18 @@ class QueryView {
                                $from_table_Arr = explode(',', $fieldSetup['allowed']);
                                $useTablePrefix = 1;
                                if (!$fieldSetup['prepend_tname']) {
-                                       $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fN, $table, 'uid ' . BackendUtility::deleteClause($table), ($groupBy = ''), ($orderBy = ''), ($limit = ''));
+                                       $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fieldName, $table, 'uid ' . BackendUtility::deleteClause($table), ($groupBy = ''), ($orderBy = ''), ($limit = ''));
                                        if ($checkres) {
                                                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($checkres)) {
-                                                       if (stristr($row[$fN], ',')) {
-                                                               $checkContent = explode(',', $row[$fN]);
+                                                       if (stristr($row[$fieldName], ',')) {
+                                                               $checkContent = explode(',', $row[$fieldName]);
                                                                foreach ($checkContent as $singleValue) {
                                                                        if (!stristr($singleValue, '_')) {
                                                                                $dontPrefixFirstTable = 1;
                                                                        }
                                                                }
                                                        } else {
-                                                               $singleValue = $row[$fN];
+                                                               $singleValue = $row[$fieldName];
                                                                if (strlen($singleValue) && !stristr($singleValue, '_')) {
                                                                        $dontPrefixFirstTable = 1;
                                                                }
@@ -882,7 +895,7 @@ class QueryView {
                                        foreach ($this->tableArray[$from_table] as $key => $val) {
                                                $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 1 ? 'on' : $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'];
                                                $prefixString = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 'on' ? '' : ' [' . $tablePrefix . $val['uid'] . '] ';
-                                               if (GeneralUtility::inList($fV, $tablePrefix . $val['uid']) || $fV == $tablePrefix . $val['uid']) {
+                                               if (GeneralUtility::inList($fieldValue, $tablePrefix . $val['uid']) || $fieldValue == $tablePrefix . $val['uid']) {
                                                        if ($useSelectLabels) {
                                                                if (!$out) {
                                                                        $out = htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
@@ -945,11 +958,11 @@ class QueryView {
                $tableHeader[] = '<th style="white-space:nowrap;"></th>';
                // Close header row
                $tableHeader[] = '</tr></thead>';
-               return implode($tableHeader, LF);
+               return implode(LF, $tableHeader);
        }
 
        /**
-        * [Describe function...]
+        * CSV row titles
         *
         * @param array $row
         * @param array $conf
@@ -959,19 +972,19 @@ class QueryView {
        public function csvRowTitles($row, $conf, $table) {
                $out = '';
                $SET = $GLOBALS['SOBE']->MOD_SETTINGS;
-               foreach ($row as $fN => $fV) {
-                       if (GeneralUtility::inList($SET['queryFields'], $fN) || !$SET['queryFields'] && $fN != 'pid') {
+               foreach ($row as $fieldName => $fieldValue) {
+                       if (GeneralUtility::inList($SET['queryFields'], $fieldName) || !$SET['queryFields'] && $fieldName != 'pid') {
                                if (!$out) {
                                        if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) {
-                                               $out = $GLOBALS['LANG']->sL($conf['columns'][$fN]['label'] ? $conf['columns'][$fN]['label'] : $fN, TRUE);
+                                               $out = $GLOBALS['LANG']->sL($conf['columns'][$fieldName]['label'] ? $conf['columns'][$fieldName]['label'] : $fieldName, TRUE);
                                        } else {
-                                               $out = $GLOBALS['LANG']->sL($fN, TRUE);
+                                               $out = $GLOBALS['LANG']->sL($fieldName, TRUE);
                                        }
                                } else {
                                        if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) {
-                                               $out .= ',' . $GLOBALS['LANG']->sL(($conf['columns'][$fN]['label'] ? $conf['columns'][$fN]['label'] : $fN), TRUE);
+                                               $out .= ',' . $GLOBALS['LANG']->sL(($conf['columns'][$fieldName]['label'] ? $conf['columns'][$fieldName]['label'] : $fieldName), TRUE);
                                        } else {
-                                               $out .= ',' . $GLOBALS['LANG']->sL($fN, TRUE);
+                                               $out .= ',' . $GLOBALS['LANG']->sL($fieldName, TRUE);
                                        }
                                }
                        }
index 29b6c1f..9d601d9 100644 (file)
@@ -61,8 +61,9 @@ class ReferenceIndex {
         */
        public $words = array();
 
-       // Number which we can increase if a change in the code means we will have to force a re-generation of the index.
        /**
+        * Number which we can increase if a change in the code means we will have to force a re-generation of the index.
+        *
         * @var int
         */
        public $hashVersion = 1;
index 4b2a25f..6721f52 100644 (file)
@@ -25,9 +25,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  * which are default for most TYPO3 installations. Soft References can also be userdefined.
  * The Soft Reference parsers are used by the system to find these references and process them accordingly in import/export actions and copy operations.
  *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-/**
  * Example of usage
  * Soft References:
  * if ($conf['softref'] && strlen($value))     {       // Check if a TCA configured field has softreferences defined (see TYPO3 Core API document)
@@ -72,13 +69,11 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  */
 class SoftReferenceIndex {
 
-       // External configuration
        /**
         * @var string
         */
        public $fileAdminDir = '';
 
-       // Internal:
        /**
         * @var string
         */
index 1f4b037..fc7cc68 100644 (file)
@@ -21,18 +21,24 @@ namespace TYPO3\CMS\Core\Database;
  */
 class SqlParser {
 
-       // Parser:
-       // Parsing error string
+       /**
+        * Parsing error string
+        *
+        * @var string
+        */
        public $parse_error = '';
 
-       // Last stop keyword used.
+       /**
+        * Last stop keyword used.
+        *
+        * @var string
+        */
        public $lastStopKeyWord = '';
 
        /**
         * Default constructor
         */
-       public function __construct() {
-       }
+       public function __construct() {}
 
        /*************************************
         *
@@ -495,7 +501,6 @@ class SqlParser {
                                                        }
                                                        break;
                                                case 'DROP':
-
                                                case 'RENAME':
                                                        $result['FIELD'] = $fieldKey;
                                                        break;
@@ -511,9 +516,7 @@ class SqlParser {
                                                        }
                                                        break;
                                                case 'ADDKEY':
-
                                                case 'ADDPRIMARYKEY':
-
                                                case 'ADDUNIQUE':
                                                        $result['KEY'] = $fieldKey;
                                                        $result['fields'] = $this->getValue($parseString, '_LIST', 'INDEX');
@@ -1643,13 +1646,10 @@ class SqlParser {
                                $query .= ' ' . $components['newField'] . ' ' . $this->compileFieldCfg($components['definition']);
                                break;
                        case 'DROP':
-
                        case 'DROPKEY':
                                break;
                        case 'ADDKEY':
-
                        case 'ADDPRIMARYKEY':
-
                        case 'ADDUNIQUE':
                                $query .= ' (' . implode(',', $components['fields']) . ')';
                                break;
index f9db771..2925f03 100644 (file)
@@ -13,12 +13,14 @@ namespace TYPO3\CMS\Core\Database;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
 /**
  * interface for classes with hook for postprocessing extTables after loading
  *
  * @author Steffen Ritter <steffen.ritter@typo3.org>
  */
 interface TableConfigurationPostProcessingHookInterface {
+
        /**
         * Function which may process data created / registered by extTables
         * scripts (f.e. modifying TCA data of all extensions)