Index: t3lib/class.t3lib_querygenerator.php =================================================================== --- t3lib/class.t3lib_querygenerator.php (revision 9100) +++ t3lib/class.t3lib_querygenerator.php (revision ) @@ -1,29 +1,29 @@ 'or', 'AND' => 'and', 'comparison' => array( - // Type = text offset = 0 + // Type = text offset = 0 '0_' => 'contains', '1_' => 'does not contain', '2_' => 'starts with', @@ -109,7 +100,7 @@ '5_' => 'does not end with', '6_' => 'equals', '7_' => 'does not equal', - // Type = number , offset = 32 + // Type = number , offset = 32 '32_' => 'equals', '33_' => 'does not equal', '34_' => 'is greater than', @@ -221,46 +212,49 @@ 'boolean' => 4, 'binary' => 5 ); - var $noWrap=' nowrap'; + var $noWrap = ' nowrap'; - var $name; // Form data name prefix + var $name; // Form data name prefix - var $table; // table for the query + var $table; // table for the query - var $fieldList; // field list + var $fieldList; // field list - var $fields = array(); // Array of the fields possible + var $fields = array(); // Array of the fields possible var $extFieldLists = array(); - var $queryConfig=array(); // The query config + var $queryConfig = array(); // The query config - var $enablePrefix=0; + var $enablePrefix = 0; var $enableQueryParts = 0; - var $extJSCODE=''; + var $extJSCODE = ''; protected $formName = ''; - - - - - /** * @return [type] ... */ - function makeFieldList() { + function makeFieldList() { global $TCA; $fieldListArr = array(); - if (is_array($TCA[$this->table])) { + if (is_array($TCA[$this->table])) { t3lib_div::loadTCA($this->table); foreach ($TCA[$this->table]['columns'] as $fN => $value) { - $fieldListArr[]=$fN; + $fieldListArr[] = $fN; } - $fieldListArr[]='uid'; + $fieldListArr[] = 'uid'; - $fieldListArr[]='pid'; + $fieldListArr[] = 'pid'; - $fieldListArr[]='deleted'; + $fieldListArr[] = 'deleted'; - if ($TCA[$this->table]['ctrl']['tstamp']) $fieldListArr[]=$TCA[$this->table]['ctrl']['tstamp']; - if ($TCA[$this->table]['ctrl']['crdate']) $fieldListArr[]=$TCA[$this->table]['ctrl']['crdate']; - if ($TCA[$this->table]['ctrl']['cruser_id']) $fieldListArr[]=$TCA[$this->table]['ctrl']['cruser_id']; - if ($TCA[$this->table]['ctrl']['sortby']) $fieldListArr[]=$TCA[$this->table]['ctrl']['sortby']; + if ($TCA[$this->table]['ctrl']['tstamp']) { + $fieldListArr[] = $TCA[$this->table]['ctrl']['tstamp']; - } + } + if ($TCA[$this->table]['ctrl']['crdate']) { + $fieldListArr[] = $TCA[$this->table]['ctrl']['crdate']; + } + if ($TCA[$this->table]['ctrl']['cruser_id']) { + $fieldListArr[] = $TCA[$this->table]['ctrl']['cruser_id']; + } + if ($TCA[$this->table]['ctrl']['sortby']) { + $fieldListArr[] = $TCA[$this->table]['ctrl']['sortby']; + } + } - return implode(',',$fieldListArr); + return implode(',', $fieldListArr); } /** @@ -271,91 +265,91 @@ * @param [type] $fieldList: ... * @return [type] ... */ - function init($name,$table,$fieldList='') { + function init($name, $table, $fieldList = '') { global $TCA; // Analysing the fields in the table. - if (is_array($TCA[$table])) { + if (is_array($TCA[$table])) { t3lib_div::loadTCA($table); $this->name = $name; $this->table = $table; $this->fieldList = $fieldList ? $fieldList : $this->makeFieldList(); - $fieldArr = t3lib_div::trimExplode(',',$this->fieldList,1); + $fieldArr = t3lib_div::trimExplode(',', $this->fieldList, 1); foreach ($fieldArr as $fN) { $fC = $TCA[$this->table]['columns'][$fN]; $this->fields[$fN] = $fC['config']; $this->fields[$fN]['exclude'] = $fC['exclude']; - if (is_array($fC) && $fC['label']) { + if (is_array($fC) && $fC['label']) { $this->fields[$fN]['label'] = rtrim(trim($GLOBALS['LANG']->sL($fC['label'])), ':'); - switch ($this->fields[$fN]['type']) { + switch ($this->fields[$fN]['type']) { case 'input': - if (preg_match('/int|year/i', $this->fields[$fN]['eval'])) { + if (preg_match('/int|year/i', $this->fields[$fN]['eval'])) { - $this->fields[$fN]['type']='number'; + $this->fields[$fN]['type'] = 'number'; - } elseif (preg_match('/time/i', $this->fields[$fN]['eval'])) { + } elseif (preg_match('/time/i', $this->fields[$fN]['eval'])) { $this->fields[$fN]['type'] = 'time'; - } elseif (preg_match('/date/i', $this->fields[$fN]['eval'])) { + } elseif (preg_match('/date/i', $this->fields[$fN]['eval'])) { - $this->fields[$fN]['type']='date'; + $this->fields[$fN]['type'] = 'date'; } else { - $this->fields[$fN]['type']='text'; + $this->fields[$fN]['type'] = 'text'; } - break; + break; case 'check': - if (!$this->fields[$fN]['items']) { + if (!$this->fields[$fN]['items']) { $this->fields[$fN]['type'] = 'boolean'; } else { $this->fields[$fN]['type'] = 'binary'; } - break; + break; case 'radio': $this->fields[$fN]['type'] = 'multiple'; - break; + break; case 'select': $this->fields[$fN]['type'] = 'multiple'; - if ($this->fields[$fN]['foreign_table']) { + if ($this->fields[$fN]['foreign_table']) { $this->fields[$fN]['type'] = 'relation'; } - if ($this->fields[$fN]['special']) { + if ($this->fields[$fN]['special']) { $this->fields[$fN]['type'] = 'text'; } - break; + break; case 'group': $this->fields[$fN]['type'] = 'files'; - if ($this->fields[$fN]['internal_type'] == 'db') { + if ($this->fields[$fN]['internal_type'] == 'db') { $this->fields[$fN]['type'] = 'relation'; } - break; + break; case 'user': case 'flex': case 'passthrough': case 'none': case 'text': default: - $this->fields[$fN]['type']='text'; + $this->fields[$fN]['type'] = 'text'; - break; + break; } } else { - $this->fields[$fN]['label']='[FIELD: '.$fN.']'; + $this->fields[$fN]['label'] = '[FIELD: ' . $fN . ']'; - switch ($fN) { + switch ($fN) { case 'pid': $this->fields[$fN]['type'] = 'relation'; $this->fields[$fN]['allowed'] = 'pages'; - break; + break; case 'cruser_id': $this->fields[$fN]['type'] = 'relation'; $this->fields[$fN]['allowed'] = 'be_users'; - break; + break; case 'tstamp': case 'crdate': $this->fields[$fN]['type'] = 'time'; - break; + break; case 'deleted': $this->fields[$fN]['type'] = 'boolean'; - break; + break; default: $this->fields[$fN]['type'] = 'number'; - break; + break; } } } @@ -407,13 +401,15 @@ * @param [type] $force: ... * @return [type] ... */ - function setAndCleanUpExternalLists($name,$list,$force='') { + function setAndCleanUpExternalLists($name, $list, $force = '') { - $fields = array_unique(t3lib_div::trimExplode(',',$list.','.$force,1)); + $fields = array_unique(t3lib_div::trimExplode(',', $list . ',' . $force, 1)); - $reList=array(); + $reList = array(); foreach ($fields as $fN) { - if ($this->fields[$fN]) $reList[]=$fN; + if ($this->fields[$fN]) { + $reList[] = $fN; - } + } + } - $this->extFieldLists[$name]=implode(',',$reList); + $this->extFieldLists[$name] = implode(',', $reList); } /** @@ -422,71 +418,71 @@ * @param [type] $qC: ... * @return [type] ... */ - function procesData($qC='') { + function procesData($qC = '') { $this->queryConfig = $qC; $POST = t3lib_div::_POST(); - // if delete... + // if delete... - if($POST['qG_del']) { + if ($POST['qG_del']) { - //initialize array to work on, save special parameters + //initialize array to work on, save special parameters $ssArr = $this->getSubscript($POST['qG_del']); $workArr =& $this->queryConfig; - for($i=0;$igetSubscript($POST['qG_ins']); $workArr =& $this->queryConfig; - for($i=0;$i$ssArr[$i];$j--) { + for ($j = sizeof($workArr); $j > $ssArr[$i]; $j--) { - $workArr[$j] = $workArr[$j-1]; + $workArr[$j] = $workArr[$j - 1]; } - //clear new entry position + //clear new entry position - unset($workArr[$ssArr[$i]+1]); + unset($workArr[$ssArr[$i] + 1]); - $workArr[$ssArr[$i]+1]['type'] = 'FIELD_'; + $workArr[$ssArr[$i] + 1]['type'] = 'FIELD_'; } - // if move up... + // if move up... - if($POST['qG_up']) { + if ($POST['qG_up']) { - //initialize array to work on + //initialize array to work on $ssArr = $this->getSubscript($POST['qG_up']); $workArr =& $this->queryConfig; - for($i=0;$igetSubscript($POST['qG_nl']); $workArr =& $this->queryConfig; - for($i=0;$i 'newlevel', 'operator' => $tempEl['operator'], 'nl' => array($tempEl) @@ -495,25 +491,25 @@ } } - // if collapse level... + // if collapse level... - if($POST['qG_remnl']) { + if ($POST['qG_remnl']) { - //initialize array to work on + //initialize array to work on $ssArr = $this->getSubscript($POST['qG_remnl']); $workArr =& $this->queryConfig; - for($i=0;$i'FIELD_'); + if (!$queryConfig[0] || !$queryConfig[0]['type']) { + $queryConfig[0] = array('type' => 'FIELD_'); - } + } + } // Traverse: - $c=0; + $c = 0; - $arrCount=0; + $arrCount = 0; foreach ($queryConfig as $key => $conf) { - if(substr($conf['type'],0,6)=='FIELD_') { + if (substr($conf['type'], 0, 6) == 'FIELD_') { - $fName = substr($conf['type'],6); + $fName = substr($conf['type'], 6); $fType = $this->fields[$fName]['type']; - } elseif($conf['type']=='newlevel') { + } elseif ($conf['type'] == 'newlevel') { $fType = $conf['type']; } else { $fType = 'ignore'; } -// debug($fType); + // debug($fType); - switch($fType) { + switch ($fType) { case 'newlevel': - if(!$queryConfig[$key]['nl']) $queryConfig[$key]['nl'][0]['type'] = 'FIELD_'; + if (!$queryConfig[$key]['nl']) { + $queryConfig[$key]['nl'][0]['type'] = 'FIELD_'; + } - $queryConfig[$key]['nl']=$this->cleanUpQueryConfig($queryConfig[$key]['nl']); + $queryConfig[$key]['nl'] = $this->cleanUpQueryConfig($queryConfig[$key]['nl']); - break; + break; case 'userdef': - $queryConfig[$key]=$this->userDefCleanUp($queryConfig[$key]); + $queryConfig[$key] = $this->userDefCleanUp($queryConfig[$key]); - break; + break; case 'ignore': default: -// debug($queryConfig[$key]); + // debug($queryConfig[$key]); - $verifiedName=$this->verifyType($fName); + $verifiedName = $this->verifyType($fName); - $queryConfig[$key]['type']='FIELD_'.$this->verifyType($verifiedName); + $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[$fType]) { + $conf['comparison'] = $this->comp_offsets[$fType] << 5; + } - $queryConfig[$key]['comparison']=$this->verifyComparison($conf['comparison'],$conf['negate']?1:0); + $queryConfig[$key]['comparison'] = $this->verifyComparison($conf['comparison'], $conf['negate'] ? 1 : 0); - $queryConfig[$key]['inputValue']=$this->cleanInputVal($queryConfig[$key]); + $queryConfig[$key]['inputValue'] = $this->cleanInputVal($queryConfig[$key]); - $queryConfig[$key]['inputValue1']=$this->cleanInputVal($queryConfig[$key],1); + $queryConfig[$key]['inputValue1'] = $this->cleanInputVal($queryConfig[$key], 1); -// debug($queryConfig[$key]); - break; + // debug($queryConfig[$key]); + break; } } return $queryConfig; @@ -581,145 +583,153 @@ * @param [type] $parent: ... * @return [type] ... */ - function getFormElements($subLevel=0,$queryConfig='',$parent='') { + function getFormElements($subLevel = 0, $queryConfig = '', $parent = '') { - $codeArr=array(); + $codeArr = array(); - if (!is_array($queryConfig)) $queryConfig=$this->queryConfig; + if (!is_array($queryConfig)) { + $queryConfig = $this->queryConfig; + } - $c=0; + $c = 0; - $arrCount=0; + $arrCount = 0; $loopcount = 0; foreach ($queryConfig as $key => $conf) { - $subscript = $parent.'['.$key.']'; + $subscript = $parent . '[' . $key . ']'; $lineHTML = ''; - $lineHTML.=$this->mkOperatorSelect($this->name.$subscript,$conf['operator'],$c,($conf['type']!='FIELD_')); + $lineHTML .= $this->mkOperatorSelect($this->name . $subscript, $conf['operator'], $c, ($conf['type'] != 'FIELD_')); - if(substr($conf['type'],0,6)=='FIELD_') { + if (substr($conf['type'], 0, 6) == 'FIELD_') { - $fName = substr($conf['type'],6); + $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; + if ($conf['comparison'] >> 5 != $this->comp_offsets[$fType]) { + $conf['comparison'] = $this->comp_offsets[$fType] << 5; + } - //nasty nasty... - //make sure queryConfig contains _actual_ comparevalue. - //mkCompSelect don't care, but getQuery does. + //nasty nasty... + //make sure queryConfig contains _actual_ comparevalue. + //mkCompSelect don't care, but getQuery does. - $queryConfig[$key]['comparison'] += (isset($conf['negate'])-($conf['comparison']%2)); + $queryConfig[$key]['comparison'] += (isset($conf['negate']) - ($conf['comparison'] % 2)); - } elseif($conf['type']=='newlevel') { + } elseif ($conf['type'] == 'newlevel') { $fType = $conf['type']; } else { $fType = 'ignore'; } - switch($fType) { + switch ($fType) { case 'ignore': - break; + break; case 'newlevel': - if(!$queryConfig[$key]['nl']) $queryConfig[$key]['nl'][0]['type'] = 'FIELD_'; + if (!$queryConfig[$key]['nl']) { + $queryConfig[$key]['nl'][0]['type'] = 'FIELD_'; + } - $lineHTML.=''; + $lineHTML .= ''; - $codeArr[$arrCount]['sub'] = $this->getFormElements($subLevel+1,$queryConfig[$key]['nl'],$subscript.'[nl]'); + $codeArr[$arrCount]['sub'] = $this->getFormElements($subLevel + 1, $queryConfig[$key]['nl'], $subscript . '[nl]'); - break; + break; case 'userdef': - $lineHTML.=$this->userDef($this->name.$subscript,$conf,$fName,$fType); + $lineHTML .= $this->userDef($this->name . $subscript, $conf, $fName, $fType); - break; + break; case 'date': - $lineHTML.=$this->mkTypeSelect($this->name.$subscript.'[type]',$fName); + $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName); - $lineHTML.=$this->mkCompSelect($this->name.$subscript.'[comparison]',$conf['comparison'],$conf['negate']?1:0); + $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0); - $lineHTML.=''; + $lineHTML .= ''; - if ($conf['comparison']==100 || $conf['comparison']==101) { // between + if ($conf['comparison'] == 100 || $conf['comparison'] == 101) { // between - $lineHTML.='formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue]\', \'date\', \'\', 0,0);">'; + $lineHTML .= 'formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'date\', \'\', 0,0);">'; - $lineHTML.='formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue1]\', \'date\', \'\', 0,0);">'; + $lineHTML .= 'formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue1]\', \'date\', \'\', 0,0);">'; - $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue]", "date", "", 0,0);'; + $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "date", "", 0,0);'; - $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue1]", "date", "", 0,0);'; + $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue1]", "date", "", 0,0);'; } else { - $lineHTML.='formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue]\', \'date\', \'\', 0,0);">'; + $lineHTML .= 'formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'date\', \'\', 0,0);">'; - $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue]", "date", "", 0,0);'; + $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "date", "", 0,0);'; } - break; + break; case 'time': - $lineHTML.=$this->mkTypeSelect($this->name.$subscript.'[type]', $fName); + $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName); - $lineHTML.=$this->mkCompSelect($this->name.$subscript.'[comparison]', $conf['comparison'], $conf['negate']?1:0); + $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0); - $lineHTML.=''; + $lineHTML .= ''; - if ($conf['comparison']==100 || $conf['comparison']==101) { // between: + if ($conf['comparison'] == 100 || $conf['comparison'] == 101) { // between: - $lineHTML.='formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue]\', \'datetime\', \'\', 0,0);">'; + $lineHTML .= 'formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'datetime\', \'\', 0,0);">'; - $lineHTML.='formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue1]\', \'datetime\', \'\', 0,0);">'; + $lineHTML .= 'formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue1]\', \'datetime\', \'\', 0,0);">'; - $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue]", "datetime", "", 0,0);'; + $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "datetime", "", 0,0);'; - $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue1]", "datetime", "", 0,0);'; + $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue1]", "datetime", "", 0,0);'; } else { - $lineHTML.='formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue]\', \'datetime\', \'\', 0,0);">'; + $lineHTML .= 'formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'datetime\', \'\', 0,0);">'; - $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue]", "datetime", "", 0,0);'; + $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "datetime", "", 0,0);'; } - break; + break; case 'multiple': case 'binary': case 'relation': - $lineHTML.=$this->mkTypeSelect($this->name.$subscript.'[type]', $fName); + $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName); - $lineHTML.=$this->mkCompSelect($this->name.$subscript.'[comparison]', $conf['comparison'], $conf['negate']?1:0); + $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0); - $lineHTML.=''; + $lineHTML .= ''; - if ($conf['comparison']==68 || $conf['comparison']==69 || $conf['comparison']==162 || $conf['comparison']==163) { + if ($conf['comparison'] == 68 || $conf['comparison'] == 69 || $conf['comparison'] == 162 || $conf['comparison'] == 163) { - $lineHTML.=''; - } elseif ($conf['comparison']==66 || $conf['comparison']==67) { + } elseif ($conf['comparison'] == 66 || $conf['comparison'] == 67) { - if (is_array($conf['inputValue'])) { + if (is_array($conf['inputValue'])) { $conf['inputValue'] = implode(',', $conf['inputValue']); } - $lineHTML.= 'formWidth(10).'>'; + $lineHTML .= 'formWidth(10) . '>'; } else { - $lineHTML.= ''; } - if ($conf['comparison']!=66 && $conf['comparison']!=67) { + if ($conf['comparison'] != 66 && $conf['comparison'] != 67) { - $lineHTML.= $this->makeOptionList($fName, $conf, $this->table); + $lineHTML .= $this->makeOptionList($fName, $conf, $this->table); - $lineHTML.= ''; + $lineHTML .= ''; } - break; + break; case 'files': - $lineHTML.= $this->mkTypeSelect($this->name.$subscript.'[type]', $fName); + $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName); - $lineHTML.= $this->mkCompSelect($this->name.$subscript.'[comparison]', $conf['comparison'], $conf['negate']?1:0); + $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0); - $lineHTML.= ''; + $lineHTML .= ''; - if ($conf['comparison']==68 || $conf['comparison']==69) { + if ($conf['comparison'] == 68 || $conf['comparison'] == 69) { - $lineHTML .= ''; } else { - $lineHTML .= ''; } - $lineHTML .= ''.$this->makeOptionList($fName, $conf, $this->table); + $lineHTML .= '' . $this->makeOptionList($fName, $conf, $this->table); $lineHTML .= ''; - if ($conf['comparison']==66 || $conf['comparison']==67) { + if ($conf['comparison'] == 66 || $conf['comparison'] == 67) { - $lineHTML .= ' + formWidth(10).'>'; + $lineHTML .= ' + formWidth(10) . '>'; } - break; + break; case 'boolean': - $lineHTML .= $this->mkTypeSelect($this->name.$subscript.'[type]', $fName); + $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName); - $lineHTML .= $this->mkCompSelect($this->name.$subscript.'[comparison]', $conf['comparison'], $conf['negate']?1:0); + $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0); - $lineHTML .= ''; + $lineHTML .= ''; - $lineHTML .= 'formWidth(10).'>'; + $lineHTML .= 'formWidth(10) . '>'; - break; + break; default: - $lineHTML .= $this->mkTypeSelect($this->name.$subscript.'[type]', $fName); + $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName); - $lineHTML .= $this->mkCompSelect($this->name.$subscript.'[comparison]', $conf['comparison'], $conf['negate']?1:0); + $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0); - $lineHTML .= ''; + $lineHTML .= ''; - if ($conf['comparison']==37 || $conf['comparison']==36) { // between: + if ($conf['comparison'] == 37 || $conf['comparison'] == 36) { // between: - $lineHTML.='formWidth(5).'> + $lineHTML .= 'formWidth(5) . '> - formWidth(5).'>'; // onChange='submit();' + formWidth(5) . '>'; // onChange='submit();' } else { - $lineHTML.='formWidth(10).'>'; // onChange="submit();" + $lineHTML .= 'formWidth(10) . '>'; // onChange="submit();" } - break; + break; } - if($fType != 'ignore') { + if ($fType != 'ignore') { $lineHTML .= $this->updateIcon(); - if ($loopcount) { + if ($loopcount) { - $lineHTML .= ''; + $lineHTML .= ''; } - $lineHTML .= ''; + $lineHTML .= ''; - if($c!=0) $lineHTML.= ''; + if ($c != 0) { + $lineHTML .= ''; + } - if($c!=0 && $fType!='newlevel') { + if ($c != 0 && $fType != 'newlevel') { - $lineHTML.= ''; + $lineHTML .= ''; } - if($fType=='newlevel') { + if ($fType == 'newlevel') { - $lineHTML.= ''; + $lineHTML .= ''; } $codeArr[$arrCount]['html'] = $lineHTML; - $codeArr[$arrCount]['query'] = $this->getQuerySingle($conf,$c>0?0:1); + $codeArr[$arrCount]['query'] = $this->getQuerySingle($conf, $c > 0 ? 0 : 1); $arrCount++; $c++; } @@ -738,98 +748,98 @@ * @param [type] $table: ... * @return [type] ... */ - function makeOptionList($fN, $conf, $table) { + function makeOptionList($fN, $conf, $table) { $fieldSetup = $this->fields[$fN]; - if ($fieldSetup['type']=='files') { + if ($fieldSetup['type'] == 'files') { - if ($conf['comparison']==66 || $conf['comparison']==67) { + if ($conf['comparison'] == 66 || $conf['comparison'] == 67) { $fileExtArray = explode(',', $fieldSetup['allowed']); natcasesort($fileExtArray); - foreach ($fileExtArray as $fileExt) { + foreach ($fileExtArray as $fileExt) { - if (t3lib_div::inList($conf['inputValue'], $fileExt)) { + if (t3lib_div::inList($conf['inputValue'], $fileExt)) { - $out .= ''; + $out .= ''; } else { - $out .= ''; + $out .= ''; } } } $d = dir(PATH_site . $fieldSetup['uploadfolder']); - while (false !== ($entry=$d->read())) { + while (false !== ($entry = $d->read())) { - if ($entry=='.' || $entry=='..') { + if ($entry == '.' || $entry == '..') { continue; } $fileArray[] = $entry; } $d->close(); natcasesort($fileArray); - foreach ($fileArray as $fileName) { + foreach ($fileArray as $fileName) { - if (t3lib_div::inList($conf['inputValue'], $fileName)) { + if (t3lib_div::inList($conf['inputValue'], $fileName)) { - $out .= ''; + $out .= ''; } else { - $out .= ''; + $out .= ''; } } } - if ($fieldSetup['type']=='multiple') { + if ($fieldSetup['type'] == 'multiple') { - foreach ($fieldSetup['items'] as $key=>$val) { + foreach ($fieldSetup['items'] as $key => $val) { - if (substr($val[0], 0, 4) == 'LLL:') { + if (substr($val[0], 0, 4) == 'LLL:') { $value = $GLOBALS['LANG']->sL($val[0]); } else { $value = $val[0]; } - if (t3lib_div::inList($conf['inputValue'], $val[1])) { + if (t3lib_div::inList($conf['inputValue'], $val[1])) { - $out .= ''; + $out .= ''; } else { - $out .= ''; + $out .= ''; } } } - if ($fieldSetup['type']=='binary') { + if ($fieldSetup['type'] == 'binary') { - foreach ($fieldSetup['items'] as $key=>$val) { + foreach ($fieldSetup['items'] as $key => $val) { - if (substr($val[0], 0, 4)=='LLL:') { + if (substr($val[0], 0, 4) == 'LLL:') { $value = $GLOBALS['LANG']->sL($val[0]); } else { $value = $val[0]; } - if (t3lib_div::inList($conf['inputValue'], pow(2, $key))) { + if (t3lib_div::inList($conf['inputValue'], pow(2, $key))) { - $out .= ''; + $out .= ''; } else { - $out .= ''; + $out .= ''; } } } - if ($fieldSetup['type']=='relation') { + if ($fieldSetup['type'] == 'relation') { - if ($fieldSetup['items']) { + if ($fieldSetup['items']) { - foreach ($fieldSetup['items'] as $key=>$val) { + foreach ($fieldSetup['items'] as $key => $val) { - if (substr($val[0], 0, 4) == 'LLL:') { + if (substr($val[0], 0, 4) == 'LLL:') { $value = $GLOBALS['LANG']->sL($val[0]); } else { $value = $val[0]; } - if (t3lib_div::inList($conf['inputValue'], $val[1])) { + if (t3lib_div::inList($conf['inputValue'], $val[1])) { - $out .= ''; + $out .= ''; } else { - $out .= ''; + $out .= ''; } } } global $TCA; - if (stristr($fieldSetup['allowed'], ',')) { + if (stristr($fieldSetup['allowed'], ',')) { $from_table_Arr = explode(',', $fieldSetup['allowed']); $useTablePrefix = 1; - if (!$fieldSetup['prepend_tname']) { + if (!$fieldSetup['prepend_tname']) { $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fN, $table, t3lib_BEfunc::deleteClause($table), $groupBy = '', $orderBy = '', $limit = ''); - if ($checkres) { + if ($checkres) { - while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($checkres)) { + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($checkres)) { - if (stristr($row[$fN], ',')) { + if (stristr($row[$fN], ',')) { $checkContent = explode(',', $row[$fN]); - foreach ($checkContent as $singleValue) { + foreach ($checkContent as $singleValue) { - if (!stristr($singleValue, '_')) { + if (!stristr($singleValue, '_')) { $dontPrefixFirstTable = 1; } } } else { $singleValue = $row[$fN]; - if (strlen($singleValue) && !stristr($singleValue, '_')) { + if (strlen($singleValue) && !stristr($singleValue, '_')) { $dontPrefixFirstTable = 1; } } @@ -839,26 +849,26 @@ } else { $from_table_Arr[0] = $fieldSetup['allowed']; } - if ($fieldSetup['prepend_tname']) { + if ($fieldSetup['prepend_tname']) { $useTablePrefix = 1; } - if ($fieldSetup['foreign_table']) { + if ($fieldSetup['foreign_table']) { $from_table_Arr[0] = $fieldSetup['foreign_table']; } $counter = 0; $webMountPageTree = ''; - while (list(, $from_table) = each($from_table_Arr)) { + while (list(, $from_table) = each($from_table_Arr)) { - if (($useTablePrefix && !$dontPrefixFirstTable && $counter!=1) || $counter==1) { + if (($useTablePrefix && !$dontPrefixFirstTable && $counter != 1) || $counter == 1) { - $tablePrefix = $from_table.'_'; + $tablePrefix = $from_table . '_'; } $counter = 1; - if (is_array($TCA[$from_table])) { + if (is_array($TCA[$from_table])) { t3lib_div::loadTCA($from_table); $labelField = $TCA[$from_table]['ctrl']['label']; $altLabelField = $TCA[$from_table]['ctrl']['label_alt']; - if ($TCA[$from_table]['columns'][$labelField]['config']['items']) { + if ($TCA[$from_table]['columns'][$labelField]['config']['items']) { - foreach ($TCA[$from_table]['columns'][$labelField]['config']['items'] as $labelArray) { + foreach ($TCA[$from_table]['columns'][$labelField]['config']['items'] as $labelArray) { - if (substr($labelArray[0], 0, 4) == 'LLL:') { + if (substr($labelArray[0], 0, 4) == 'LLL:') { $labelFieldSelect[$labelArray[1]] = $GLOBALS['LANG']->sL($labelArray[0]); } else { $labelFieldSelect[$labelArray[1]] = $labelArray[0]; @@ -866,9 +876,9 @@ } $useSelectLabels = 1; } - if ($TCA[$from_table]['columns'][$altLabelField]['config']['items']) { + if ($TCA[$from_table]['columns'][$altLabelField]['config']['items']) { - foreach ($TCA[$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) { + foreach ($TCA[$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) { - if (substr($altLabelArray[0], 0, 4) == 'LLL:') { + if (substr($altLabelArray[0], 0, 4) == 'LLL:') { $altLabelFieldSelect[$altLabelArray[1]] = $GLOBALS['LANG']->sL($altLabelArray[0]); } else { $altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0]; @@ -876,64 +886,64 @@ } $useAltSelectLabels = 1; } - $altLabelFieldSelect = $altLabelField ? ','.$altLabelField : ''; + $altLabelFieldSelect = $altLabelField ? ',' . $altLabelField : ''; - $select_fields = 'uid,'.$labelField.$altLabelFieldSelect; + $select_fields = 'uid,' . $labelField . $altLabelFieldSelect; - if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) { + if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) { $webMounts = $GLOBALS['BE_USER']->returnWebmounts(); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); - foreach ($webMounts as $key => $val) { + foreach ($webMounts as $key => $val) { - if ($webMountPageTree) { + if ($webMountPageTree) { $webMountPageTreePrefix = ','; } - $webMountPageTree .= $webMountPageTreePrefix.$this->getTreeList($val, 999, $begin = 0, $perms_clause); + $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, $begin = 0, $perms_clause); } - if ($from_table=='pages') { + if ($from_table == 'pages') { - $where_clause = 'uid IN ('.$webMountPageTree.') '; + $where_clause = 'uid IN (' . $webMountPageTree . ') '; - if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) { + if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) { - $where_clause .= t3lib_BEfunc::deleteClause($from_table).' AND'.$perms_clause; + $where_clause .= t3lib_BEfunc::deleteClause($from_table) . ' AND' . $perms_clause; } } else { - $where_clause = 'pid IN ('.$webMountPageTree.') '; + $where_clause = 'pid IN (' . $webMountPageTree . ') '; - if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) { + if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) { $where_clause .= t3lib_BEfunc::deleteClause($from_table); } } } else { $where_clause = 'uid'; - if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) { + if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) { $where_clause .= t3lib_BEfunc::deleteClause($from_table); } } $orderBy = 'uid'; - if (!$this->tableArray[$from_table]) { + if (!$this->tableArray[$from_table]) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy, $limit = ''); } - if ($res) { + if ($res) { - while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $this->tableArray[$from_table][] = $row; } } - foreach ($this->tableArray[$from_table] as $key=>$val) { + foreach ($this->tableArray[$from_table] as $key => $val) { - if ($useSelectLabels) { + if ($useSelectLabels) { - $outArray[$tablePrefix.$val['uid']] = htmlspecialchars($labelFieldSelect[$val[$labelField]]); + $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($labelFieldSelect[$val[$labelField]]); - } elseif ($val[$labelField]) { + } elseif ($val[$labelField]) { - $outArray[$tablePrefix.$val['uid']] = htmlspecialchars($val[$labelField]); + $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($val[$labelField]); - } elseif ($useAltSelectLabels) { + } elseif ($useAltSelectLabels) { - $outArray[$tablePrefix.$val['uid']] = htmlspecialchars($altLabelFieldSelect[$val[$altLabelField]]); + $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($altLabelFieldSelect[$val[$altLabelField]]); } else { - $outArray[$tablePrefix.$val['uid']] = htmlspecialchars($val[$altLabelField]); + $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($val[$altLabelField]); } } - if ($GLOBALS['SOBE']->MOD_SETTINGS['options_sortlabel'] && is_array($outArray)) { + if ($GLOBALS['SOBE']->MOD_SETTINGS['options_sortlabel'] && is_array($outArray)) { natcasesort($outArray); } } } - foreach ($outArray as $key2 => $val2) { + foreach ($outArray as $key2 => $val2) { - if (t3lib_div::inList($conf['inputValue'], $key2)) { + if (t3lib_div::inList($conf['inputValue'], $key2)) { - $out .= ''; + $out .= ''; } else { - $out .= ''; + $out .= ''; } } } @@ -941,26 +951,30 @@ } - /** - * [Describe function...] - * - * @param [type] $codeArr: ... - * @param [type] $l: ... - * @return [type] ... - */ + /** + * [Describe function...] + * + * @param [type] $codeArr: ... + * @param [type] $l: ... + * @return [type] ... + */ - function printCodeArray($codeArr,$l=0) { + function printCodeArray($codeArr, $l = 0) { - $line=''; + $line = ''; - if ($l) $indent=''; + if ($l) { + $indent = ''; + } - $lf=$l*30; + $lf = $l * 30; - $bgColor = t3lib_div::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor2,$lf,$lf,$lf); + $bgColor = t3lib_div::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor2, $lf, $lf, $lf); foreach ($codeArr as $k => $v) { - $line.= ''.$indent.'noWrap.'>'.$v['html'].''; + $line .= '' . $indent . 'noWrap . '>' . $v['html'] . ''; - if ($this->enableQueryParts) {$line.= ''.$indent.''.$this->formatQ($v['query']).'';} + if ($this->enableQueryParts) { + $line .= '' . $indent . '' . $this->formatQ($v['query']) . ''; + } - if (is_array($v['sub'])) { + if (is_array($v['sub'])) { - $line.= ''.$indent.'noWrap.'>'.$this->printCodeArray($v['sub'],$l+1).''; + $line .= '' . $indent . 'noWrap . '>' . $this->printCodeArray($v['sub'], $l + 1) . ''; } } - $out=''.$line.'
'; + $out = '' . $line . '
'; return $out; } @@ -970,7 +984,7 @@ * @param [type] $str: ... * @return [type] ... */ - function formatQ($str) { + function formatQ($str) { return '' . htmlspecialchars($str) . ''; } @@ -983,15 +997,15 @@ * @param [type] $submit: ... * @return [type] ... */ - function mkOperatorSelect($name,$op,$draw,$submit) { + function mkOperatorSelect($name, $op, $draw, $submit) { - if ($draw) { + if ($draw) { - $out=''; // - $out.=''; + $out .= ''; - $out.=''; + $out .= ''; - $out.=''; + $out .= ''; } else { - $out.=''; + $out .= ''; - $out.=''; + $out .= ''; } return $out; @@ -1005,17 +1019,17 @@ * @param [type] $prepend: ... * @return [type] ... */ - function mkTypeSelect($name,$fieldName,$prepend='FIELD_') { + function mkTypeSelect($name, $fieldName, $prepend = 'FIELD_') { - $out=''; - $out.=''; + $out .= ''; foreach ($this->fields as $key => $value) { if (!$value['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $key)) { $label = $this->fields[$key]['label']; $label_alt = $this->fields[$key]['label_alt']; - $out .= ''; + $out .= ''; } } - $out.=''; + $out .= ''; return $out; } @@ -1025,12 +1039,16 @@ * @param [type] $fieldName: ... * @return [type] ... */ - function verifyType($fieldName) { + function verifyType($fieldName) { $first = ''; foreach ($this->fields as $key => $value) { - if (!$first) $first = $key; - if ($key==$fieldName) return $key; + if (!$first) { + $first = $key; - } + } + if ($key == $fieldName) { + return $key; + } + } return $first; } @@ -1041,12 +1059,14 @@ * @param [type] $neg: ... * @return [type] ... */ - function verifyComparison($comparison,$neg) { + function verifyComparison($comparison, $neg) { $compOffSet = $comparison >> 5; - $first=-1; + $first = -1; - for($i=32*$compOffSet+$neg;$i<32*($compOffSet+1);$i+=2) { + for ($i = 32 * $compOffSet + $neg; $i < 32 * ($compOffSet + 1); $i += 2) { - if ($first==-1) $first = $i; + if ($first == -1) { + $first = $i; + } - if (($i >> 1)==($comparison >> 1)) { + if (($i >> 1) == ($comparison >> 1)) { return $i; } } @@ -1060,18 +1080,18 @@ * @param [type] $fieldName: ... * @return [type] ... */ - function mkFieldToInputSelect($name,$fieldName) { + function mkFieldToInputSelect($name, $fieldName) { - $out='formWidth().'>'.$this->updateIcon(); + $out = 'formWidth() . '>' . $this->updateIcon(); - $out.='' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => 'Clear list')) . ''; + $out .= '' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => 'Clear list')) . ''; - $out.='
'; foreach ($this->fields as $key => $value) { if (!$value['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $key)) { $label = $this->fields[$key]['label']; $label_alt = $this->fields[$key]['label_alt']; - $out .= ''; + $out .= ''; } } - $out.=''; + $out .= ''; return $out; } @@ -1082,16 +1102,16 @@ * @param [type] $cur: ... * @return [type] ... */ - function mkTableSelect($name,$cur) { + function mkTableSelect($name, $cur) { global $TCA; - $out=''; - $out.=''; + $out .= ''; foreach ($TCA as $tN => $value) { - if ($GLOBALS['BE_USER']->check('tables_select',$tN)) { + if ($GLOBALS['BE_USER']->check('tables_select', $tN)) { - $out.=''; + $out .= ''; } } - $out.=''; + $out .= ''; return $out; } @@ -1103,15 +1123,15 @@ * @param [type] $neg: ... * @return [type] ... */ - function mkCompSelect($name,$comparison,$neg) { + function mkCompSelect($name, $comparison, $neg) { $compOffSet = $comparison >> 5; - $out=''; - for($i=32*$compOffSet+$neg;$i<32*($compOffSet+1);$i+=2) { + for ($i = 32 * $compOffSet + $neg; $i < 32 * ($compOffSet + 1); $i += 2) { - if($this->lang['comparison'][$i.'_']) { + if ($this->lang['comparison'][$i . '_']) { - $out.=''; + $out .= ''; } } - $out.=''; + $out .= ''; return $out; } @@ -1122,9 +1142,9 @@ * @return [type] ... */ function getSubscript($arr) { - while(is_array($arr)) { + while (is_array($arr)) { reset($arr); - list($key,)=each($arr); + list($key,) = each($arr); $retArr[] = $key; $arr = $arr[$key]; } @@ -1136,7 +1156,7 @@ * * @return [type] ... */ - function initUserDef() { + function initUserDef() { } @@ -1145,7 +1165,7 @@ * * @return [type] ... */ - function userDef() { + function userDef() { } /** @@ -1154,7 +1174,7 @@ * @param [type] $queryConfig: ... * @return [type] ... */ - function userDefCleanUp($queryConfig) { + function userDefCleanUp($queryConfig) { return $queryConfig; } @@ -1165,24 +1185,24 @@ * @param [type] $pad: ... * @return [type] ... */ - function getQuery ($queryConfig,$pad='') { + function getQuery($queryConfig, $pad = '') { $qs = ''; // Since we don't traverse the array using numeric keys in the upcoming whileloop make sure it's fresh and clean ksort($queryConfig); - $first=1; + $first = 1; foreach ($queryConfig as $key => $conf) { - switch($conf['type']) { + switch ($conf['type']) { case 'newlevel': - $qs.=LF.$pad.trim($conf['operator']).' ('.$this->getQuery($queryConfig[$key]['nl'],$pad.' ').LF.$pad.')'; + $qs .= LF . $pad . trim($conf['operator']) . ' (' . $this->getQuery($queryConfig[$key]['nl'], $pad . ' ') . LF . $pad . ')'; - break; + break; case 'userdef': - $qs.=LF.$pad.getUserDefQuery($conf,$first); + $qs .= LF . $pad . getUserDefQuery($conf, $first); - break; + break; default: - $qs.=LF.$pad.$this->getQuerySingle($conf,$first); + $qs .= LF . $pad . $this->getQuerySingle($conf, $first); - break; + break; } - $first=0; + $first = 0; } return $qs; } @@ -1194,34 +1214,34 @@ * @param [type] $first: ... * @return [type] ... */ - function getQuerySingle($conf,$first) { + function getQuerySingle($conf, $first) { - $prefix = $this->enablePrefix ? $this->table.'.' : ''; + $prefix = $this->enablePrefix ? $this->table . '.' : ''; - if (!$first) { + if (!$first) { // Is it OK to insert the AND operator if none is set? - $qs .= trim(($conf['operator'] ? $conf['operator'] : 'AND')).' '; + $qs .= trim(($conf['operator'] ? $conf['operator'] : 'AND')) . ' '; } - $qsTmp = str_replace('#FIELD#', $prefix.trim(substr($conf['type'],6)), $this->compSQL[$conf['comparison']]); + $qsTmp = str_replace('#FIELD#', $prefix . trim(substr($conf['type'], 6)), $this->compSQL[$conf['comparison']]); $inputVal = $this->cleanInputVal($conf); - if ($conf['comparison']==68 || $conf['comparison']==69) { + if ($conf['comparison'] == 68 || $conf['comparison'] == 69) { $inputVal = explode(',', $inputVal); - foreach ($inputVal as $key => $fileName) { + foreach ($inputVal as $key => $fileName) { - $inputVal[$key] = "'".$fileName."'"; + $inputVal[$key] = "'" . $fileName . "'"; } $inputVal = implode(',', $inputVal); $qsTmp = str_replace('#VALUE#', $inputVal, $qsTmp); - } elseif ($conf['comparison']==162 || $conf['comparison']==163) { + } elseif ($conf['comparison'] == 162 || $conf['comparison'] == 163) { $inputValArray = explode(',', $inputVal); $inputVal = 0; - foreach ($inputValArray as $key=>$fileName) { + foreach ($inputValArray as $key => $fileName) { $inputVal += intval($fileName); } $qsTmp = str_replace('#VALUE#', $inputVal, $qsTmp); } else { - $qsTmp = str_replace('#VALUE#', $GLOBALS['TYPO3_DB']->quoteStr($inputVal,$this->table), $qsTmp); + $qsTmp = str_replace('#VALUE#', $GLOBALS['TYPO3_DB']->quoteStr($inputVal, $this->table), $qsTmp); } - if ($conf['comparison']==37 || $conf['comparison']==36 || $conf['comparison']==66 || $conf['comparison']==67 || $conf['comparison']==100 || $conf['comparison']==101) { // between: + if ($conf['comparison'] == 37 || $conf['comparison'] == 36 || $conf['comparison'] == 66 || $conf['comparison'] == 67 || $conf['comparison'] == 100 || $conf['comparison'] == 101) { // between: - $inputVal = $this->cleanInputVal($conf,'1'); + $inputVal = $this->cleanInputVal($conf, '1'); - $qsTmp = str_replace('#VALUE1#', $GLOBALS['TYPO3_DB']->quoteStr($inputVal,$this->table), $qsTmp); + $qsTmp = str_replace('#VALUE1#', $GLOBALS['TYPO3_DB']->quoteStr($inputVal, $this->table), $qsTmp); } $qs .= trim($qsTmp); return $qs; @@ -1234,21 +1254,21 @@ * @param [type] $suffix: ... * @return [type] ... */ - function cleanInputVal($conf,$suffix='') { + 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)) { + 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]; + $inputVal = $conf['inputValue' . $suffix]; - } elseif ($conf['comparison']==39 || $conf['comparison']==38) { // in list: + } elseif ($conf['comparison'] == 39 || $conf['comparison'] == 38) { // in list: - $inputVal = implode(',',t3lib_div::intExplode(',',$conf['inputValue'.$suffix])); + $inputVal = implode(',', t3lib_div::intExplode(',', $conf['inputValue' . $suffix])); - } elseif ($conf['comparison']==68 || $conf['comparison']==69 || $conf['comparison']==162 || $conf['comparison']==163) { // in list: + } elseif ($conf['comparison'] == 68 || $conf['comparison'] == 69 || $conf['comparison'] == 162 || $conf['comparison'] == 163) { // in list: - if (is_array($conf['inputValue'.$suffix])) { + if (is_array($conf['inputValue' . $suffix])) { - $inputVal = implode(',', $conf['inputValue'.$suffix]); + $inputVal = implode(',', $conf['inputValue' . $suffix]); - } elseif ($conf['inputValue'.$suffix]) { + } elseif ($conf['inputValue' . $suffix]) { - $inputVal = $conf['inputValue'.$suffix]; + $inputVal = $conf['inputValue' . $suffix]; } else { $inputVal = 0; } } else { - $inputVal = doubleval($conf['inputValue'.$suffix]); + $inputVal = doubleval($conf['inputValue' . $suffix]); } return $inputVal; } @@ -1259,7 +1279,7 @@ * @param [type] $qcArr: ... * @return [type] ... */ - function getUserDefQuery ($qcArr) { + function getUserDefQuery($qcArr) { } /** @@ -1267,8 +1287,8 @@ * * @return [type] ... */ - function updateIcon() { + function updateIcon() { - return ''; + return ''; } /** @@ -1276,7 +1296,7 @@ * * @return [type] ... */ - function getLabelCol() { + function getLabelCol() { global $TCA; return $TCA[$this->table]['ctrl']['label']; } @@ -1288,125 +1308,129 @@ * @param [type] $enableList: ... * @return [type] ... */ - function makeSelectorTable($modSettings,$enableList='table,fields,query,group,order,limit') { + function makeSelectorTable($modSettings, $enableList = 'table,fields,query,group,order,limit') { - $enableArr=explode(',',$enableList); + $enableArr = explode(',', $enableList); // Make output $TDparams = ' class="bgColor5" nowrap'; - if (in_array('table',$enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectATable']) { + if (in_array('table', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectATable']) { - $out=' + $out = ' - Select a table: + Select a table: - '.$this->mkTableSelect('SET[queryTable]',$this->table).' + ' . $this->mkTableSelect('SET[queryTable]', $this->table) . ' '; } - if ($this->table) { + if ($this->table) { // Init fields: - $this->setAndCleanUpExternalLists('queryFields',$modSettings['queryFields'],'uid,'.$this->getLabelCol()); + $this->setAndCleanUpExternalLists('queryFields', $modSettings['queryFields'], 'uid,' . $this->getLabelCol()); - $this->setAndCleanUpExternalLists('queryGroup',$modSettings['queryGroup']); + $this->setAndCleanUpExternalLists('queryGroup', $modSettings['queryGroup']); - $this->setAndCleanUpExternalLists('queryOrder',$modSettings['queryOrder'].','.$modSettings['queryOrder2']); + $this->setAndCleanUpExternalLists('queryOrder', $modSettings['queryOrder'] . ',' . $modSettings['queryOrder2']); // Limit: - $this->extFieldLists['queryLimit']=$modSettings['queryLimit']; + $this->extFieldLists['queryLimit'] = $modSettings['queryLimit']; - if (!$this->extFieldLists['queryLimit']) $this->extFieldLists['queryLimit']=100; + if (!$this->extFieldLists['queryLimit']) { + $this->extFieldLists['queryLimit'] = 100; + } - $parts = t3lib_div::intExplode(',',$this->extFieldLists['queryLimit']); + $parts = t3lib_div::intExplode(',', $this->extFieldLists['queryLimit']); - if ($parts[1]) { + if ($parts[1]) { $this->limitBegin = $parts[0]; $this->limitLength = $parts[1]; } else { $this->limitLength = $this->extFieldLists['queryLimit']; } - $this->extFieldLists['queryLimit'] = implode(',',array_slice($parts,0,2)); + $this->extFieldLists['queryLimit'] = implode(',', array_slice($parts, 0, 2)); // Insert Descending parts - if ($this->extFieldLists['queryOrder']) { + if ($this->extFieldLists['queryOrder']) { - $descParts = explode(',',$modSettings['queryOrderDesc'].','.$modSettings['queryOrder2Desc']); + $descParts = explode(',', $modSettings['queryOrderDesc'] . ',' . $modSettings['queryOrder2Desc']); - $orderParts = explode(',',$this->extFieldLists['queryOrder']); + $orderParts = explode(',', $this->extFieldLists['queryOrder']); - $reList=array(); + $reList = array(); foreach ($orderParts as $kk => $vv) { - $reList[]=$vv.($descParts[$kk]?' DESC':''); + $reList[] = $vv . ($descParts[$kk] ? ' DESC' : ''); } - $this->extFieldLists['queryOrder_SQL'] = implode(',',$reList); + $this->extFieldLists['queryOrder_SQL'] = implode(',', $reList); } // Query Generator: $this->procesData($modSettings['queryConfig'] ? unserialize($modSettings['queryConfig']) : ''); - // debug($this->queryConfig); + // debug($this->queryConfig); $this->queryConfig = $this->cleanUpQueryConfig($this->queryConfig); - // debug($this->queryConfig); + // debug($this->queryConfig); $this->enableQueryParts = $modSettings['search_query_smallparts']; - $codeArr=$this->getFormElements(); + $codeArr = $this->getFormElements(); - $queryCode=$this->printCodeArray($codeArr); + $queryCode = $this->printCodeArray($codeArr); - if (in_array('fields',$enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectFields']) { + if (in_array('fields', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectFields']) { - $out.=' + $out .= ' - Select fields: + Select fields: - '.$this->mkFieldToInputSelect('SET[queryFields]',$this->extFieldLists['queryFields']).' + ' . $this->mkFieldToInputSelect('SET[queryFields]', $this->extFieldLists['queryFields']) . ' '; } - if (in_array('query',$enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableMakeQuery']) { + if (in_array('query', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableMakeQuery']) { - $out.=' + $out .= ' - Make Query: + Make Query: - '.$queryCode.' + ' . $queryCode . ' '; } - if (in_array('group',$enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableGroupBy']) { + if (in_array('group', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableGroupBy']) { - $out.=' + $out .= ' - Group By: + Group By: - '.$this->mkTypeSelect('SET[queryGroup]',$this->extFieldLists['queryGroup'],'').' + ' . $this->mkTypeSelect('SET[queryGroup]', $this->extFieldLists['queryGroup'], '') . ' '; } - if (in_array('order',$enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableOrderBy']) { + if (in_array('order', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableOrderBy']) { - $orderByArr = explode(',',$this->extFieldLists['queryOrder']); + $orderByArr = explode(',', $this->extFieldLists['queryOrder']); - // debug($orderByArr); + // debug($orderByArr); - $orderBy=''; + $orderBy = ''; - $orderBy.=$this->mkTypeSelect('SET[queryOrder]',$orderByArr[0],''). + $orderBy .= $this->mkTypeSelect('SET[queryOrder]', $orderByArr[0], '') . - ' '.t3lib_BEfunc::getFuncCheck($GLOBALS['SOBE']->id,'SET[queryOrderDesc]',$modSettings['queryOrderDesc'],'','','id="checkQueryOrderDesc"').' '; + ' ' . t3lib_BEfunc::getFuncCheck($GLOBALS['SOBE']->id, 'SET[queryOrderDesc]', $modSettings['queryOrderDesc'], '', '', 'id="checkQueryOrderDesc"') . ' '; - if ($orderByArr[0]) { + if ($orderByArr[0]) { - $orderBy.= '
'.$this->mkTypeSelect('SET[queryOrder2]',$orderByArr[1],''). + $orderBy .= '
' . $this->mkTypeSelect('SET[queryOrder2]', $orderByArr[1], '') . - ' '.t3lib_BEfunc::getFuncCheck($GLOBALS['SOBE']->id,'SET[queryOrder2Desc]',$modSettings['queryOrder2Desc'],'','','id="checkQueryOrder2Desc"').' '; + ' ' . t3lib_BEfunc::getFuncCheck($GLOBALS['SOBE']->id, 'SET[queryOrder2Desc]', $modSettings['queryOrder2Desc'], '', '', 'id="checkQueryOrder2Desc"') . ' '; } - $out.=' + $out .= ' - Order By: + Order By: - '.$orderBy.' + ' . $orderBy . ' '; } - if (in_array('limit',$enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableLimit']) { + if (in_array('limit', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableLimit']) { - $limit = 'formWidth(10).'>'.$this->updateIcon(); + $limit = 'formWidth(10) . '>' . $this->updateIcon(); - $prevLimit = ($this->limitBegin-$this->limitLength) < 0 ? 0 : + $prevLimit = ($this->limitBegin - $this->limitLength) < 0 ? 0 : - $this->limitBegin-$this->limitLength; + $this->limitBegin - $this->limitLength; - if ($this->limitBegin) { + if ($this->limitBegin) { - $prevButton = 'limitLength.'";document.forms[0].submit();\'>'; + $prevButton = 'limitLength . '";document.forms[0].submit();\'>'; } - if (!$this->limitLength) { + if (!$this->limitLength) { $this->limitLength = 100; } $nextLimit = $this->limitBegin + $this->limitLength; - if ($nextLimit < 0) $nextLimit = 0; + if ($nextLimit < 0) { + $nextLimit = 0; + } - if ($nextLimit) { + if ($nextLimit) { - $nextButton = 'limitLength.'";document.forms[0].submit();\'>'; + $nextButton = 'limitLength . '";document.forms[0].submit();\'>'; } $numberButtons = ''; $numberButtons .= ''; $numberButtons .= ''; $numberButtons .= ''; - $out.=' + $out .= ' - Limit: + Limit: - '.$limit.$prevButton.$nextButton.' '.$numberButtons.' + ' . $limit . $prevButton . $nextButton . ' ' . $numberButtons . ' '; } } - $out=''.$out.'
'; + $out = '' . $out . '
'; - $out.=$this->JSbottom($this->formName); + $out .= $this->JSbottom($this->formName); return $out; } @@ -1419,27 +1443,27 @@ * @param [type] $perms_clause: ... * @return [type] ... */ - function getTreeList($id, $depth, $begin=0, $perms_clause) { + function getTreeList($id, $depth, $begin = 0, $perms_clause) { $depth = intval($depth); $begin = intval($begin); $id = intval($id); - if ($begin==0) { + if ($begin == 0) { $theList = $id; } else { $theList = ''; } - if ($id && $depth > 0) { + if ($id && $depth > 0) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'uid', 'pages', - 'pid='.$id.' '.t3lib_BEfunc::deleteClause('pages').' AND '.$perms_clause + 'pid=' . $id . ' ' . t3lib_BEfunc::deleteClause('pages') . ' AND ' . $perms_clause ); - while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { - if ($begin <= 0) { + if ($begin <= 0) { - $theList .= ','.$row['uid']; + $theList .= ',' . $row['uid']; } - if ($depth > 1) { + if ($depth > 1) { - $theList .= $this->getTreeList($row['uid'], $depth-1, $begin-1, $perms_clause); + $theList .= $this->getTreeList($row['uid'], $depth - 1, $begin - 1, $perms_clause); } } } @@ -1453,39 +1477,41 @@ * @param [type] $fN: ... * @return [type] ... */ - function getSelectQuery($qString = '', $fN = '') { + function getSelectQuery($qString = '', $fN = '') { - if (!$qString) $qString = $this->getQuery($this->queryConfig); + if (!$qString) { + $qString = $this->getQuery($this->queryConfig); + } - $qString = '('.$qString.')'; + $qString = '(' . $qString . ')'; if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) { $webMounts = $GLOBALS['BE_USER']->returnWebmounts(); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $webMountPageTree = ''; - foreach($webMounts as $key => $val) { + foreach ($webMounts as $key => $val) { if ($webMountPageTree) { $webMountPageTreePrefix = ','; - } + } - $webMountPageTree .= $webMountPageTreePrefix.$this->getTreeList($val, 999, $begin = 0, $perms_clause); + $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, $begin = 0, $perms_clause); } if ($this->table == 'pages') { - $qString .= ' AND uid IN ('.$webMountPageTree.')'; + $qString .= ' AND uid IN (' . $webMountPageTree . ')'; } else { - $qString .= ' AND pid IN ('.$webMountPageTree.')'; + $qString .= ' AND pid IN (' . $webMountPageTree . ')'; } } $fieldlist = $this->extFieldLists['queryFields'] . - ',pid' . - ($GLOBALS['TCA'][$this->table]['ctrl']['delete'] ? ',' . $GLOBALS['TCA'][$this->table]['ctrl']['delete'] : ''); + ',pid' . + ($GLOBALS['TCA'][$this->table]['ctrl']['delete'] ? ',' . $GLOBALS['TCA'][$this->table]['ctrl']['delete'] : ''); - if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) { + if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) { $qString .= t3lib_BEfunc::deleteClause($this->table); } $query = $GLOBALS['TYPO3_DB']->SELECTquery( - $fieldlist, - $this->table, - $qString, - trim($this->extFieldLists['queryGroup']), - $this->extFieldLists['queryOrder'] ? trim($this->extFieldLists['queryOrder_SQL']) : '', - $this->extFieldLists['queryLimit'] - ); + $fieldlist, + $this->table, + $qString, + trim($this->extFieldLists['queryGroup']), + $this->extFieldLists['queryOrder'] ? trim($this->extFieldLists['queryOrder_SQL']) : '', + $this->extFieldLists['queryLimit'] + ); return $query; } @@ -1495,16 +1521,16 @@ * @param [type] $formname: ... * @return [type] ... */ - function JSbottom($formname) { + function JSbottom($formname) { - if ($this->extJSCODE) { + if ($this->extJSCODE) { - $out.=' + $out .= ' - + - + '; return $out; } @@ -1522,7 +1548,7 @@ } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_querygenerator.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_querygenerator.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_querygenerator.php']); }