[BUGFIX] t3lib_BEfunc::getViewDomain() returns wrong or no domain
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_fullsearch.php
index 66bbf95..27d9acd 100644 (file)
  * Class used in module tools/dbint (advanced search) and which may hold code specific for that module
  * However the class has a general principle in it which may be used in the web/export module.
  *
- * $Id$
- *
  * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @coauthor   Jo Hasenau <info@cybercraft.de>
  */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   88: class t3lib_fullsearch
- *  103:        function form()
- *  117:        function makeStoreControl()
- *  156:        function initStoreArray()
- *  176:        function cleanStoreQueryConfigs($storeQueryConfigs,$storeArray)
- *  193:        function addToStoreQueryConfigs($storeQueryConfigs,$index)
- *  209:        function saveQueryInAction($uid)
- *  256:        function loadStoreQueryConfigs($storeQueryConfigs,$storeIndex,$writeArray)
- *  272:        function procesStoreControl()
- *  344:        function queryMaker()
- *  414:        function getQueryResultCode($mQ,$res,$table)
- *  534:        function csvValues($row, $delim=',', $quote='"', $conf=array(), $table='')
- *  550:        function tableWrap($str)
- *  559:        function search()
- *  614:        function resultRowDisplay($row,$conf,$table)
- *  662:        function getProcessedValueExtra($table, $fN, $fV, $conf, $splitString)
- *  781:        function getTreeList($id, $depth, $begin = 0, $perms_clause)
- *  818:        function makeValueList($fN, $fV, $conf, $table, $splitString)
- * 1028:        function resultRowTitles($row,$conf,$table)
- * 1058:        function csvRowTitles($row, $conf, $table)
- *
- * TOTAL FUNCTIONS: 19
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
 
 
 /**
@@ -359,8 +327,6 @@ class t3lib_fullsearch {
         * @return      [type]          ...
         */
        function queryMaker() {
-               global $TCA;
-
                $output = '';
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3lib_fullsearch'])) {
                        $this->hookArray = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3lib_fullsearch'];
@@ -388,7 +354,7 @@ class t3lib_fullsearch {
                $mQ = $GLOBALS['SOBE']->MOD_SETTINGS['search_query_makeQuery'];
 
                        // Make form elements:
-               if ($qGen->table && is_array($TCA[$qGen->table])) {
+               if ($qGen->table && is_array($GLOBALS['TCA'][$qGen->table])) {
                        if ($mQ) {
                                        // Show query
                                $qGen->enablePrefix = 1;
@@ -434,7 +400,6 @@ class t3lib_fullsearch {
         * @return      [type]          ...
         */
        function getQueryResultCode($mQ, $res, $table) {
-               global $TCA;
                $out = '';
                $cPR = array();
                switch ($mQ) {
@@ -446,7 +411,7 @@ class t3lib_fullsearch {
                        case 'all':
                                $rowArr = array();
                                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                                       $rowArr[] = $this->resultRowDisplay($row, $TCA[$table], $table);
+                                       $rowArr[] = $this->resultRowDisplay($row, $GLOBALS['TCA'][$table], $table);
                                        $lrow = $row;
                                }
                                if (is_array($this->hookArray['beforeResultTable'])) {
@@ -455,7 +420,8 @@ class t3lib_fullsearch {
                                        }
                                }
                                if (count($rowArr)) {
-                                       $out .= '<table border="0" cellpadding="2" cellspacing="1" width="100%">' . $this->resultRowTitles($lrow, $TCA[$table], $table) . implode(LF, $rowArr) . '</table>';
+                                       $out .= '<table border="0" cellpadding="2" cellspacing="1" width="100%">' .
+                                                       $this->resultRowTitles($lrow, $GLOBALS['TCA'][$table], $table) . implode(LF, $rowArr) . '</table>';
                                }
                                if (!$out) {
                                        $out = '<em>No rows selected!</em>';
@@ -471,7 +437,7 @@ class t3lib_fullsearch {
                                                $rowArr[] = $this->csvValues(array_keys($row), ',', '');
                                                $first = 0;
                                        }
-                                       $rowArr[] = $this->csvValues($row, ',', '"', $TCA[$table], $table);
+                                       $rowArr[] = $this->csvValues($row, ',', '"', $GLOBALS['TCA'][$table], $table);
                                }
                                if (count($rowArr)) {
                                        $out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea(implode(LF, $rowArr)) . '</textarea>';
@@ -583,7 +549,6 @@ class t3lib_fullsearch {
         * @return      [type]          ...
         */
        function search() {
-               global $TCA;
                $SET = $GLOBALS['SOBE']->MOD_SETTINGS;
                $swords = $SET['sword'];
 
@@ -591,10 +556,10 @@ class t3lib_fullsearch {
                $limit = 200;
                $showAlways = 0;
                if ($swords) {
-                       foreach ($TCA as $table => $value) {
+                       foreach ($GLOBALS['TCA'] as $table => $value) {
                                        // Get fields list
                                t3lib_div::loadTCA($table);
-                               $conf = $TCA[$table];
+                               $conf = $GLOBALS['TCA'][$table];
 
                                        // avoid querying tables with no columns
                                if (empty($conf['columns'])) {
@@ -701,11 +666,10 @@ class t3lib_fullsearch {
         * @return      [type]          ...
         */
        function getProcessedValueExtra($table, $fN, $fV, $conf, $splitString) {
-               global $TCA;
                        // Analysing the fields in the table.
-               if (is_array($TCA[$table])) {
+               if (is_array($GLOBALS['TCA'][$table])) {
                        t3lib_div::loadTCA($table);
-                       $fC = $TCA[$table]['columns'][$fN];
+                       $fC = $GLOBALS['TCA'][$table]['columns'][$fN];
                        $fields = $fC['config'];
                        $fields['exclude'] = $fC['exclude'];
                        if (is_array($fC) && $fC['label']) {
@@ -927,7 +891,6 @@ class t3lib_fullsearch {
                                        }
                                }
                        }
-                       global $TCA;
                        if (stristr($fieldSetup['allowed'], ',')) {
                                $from_table_Arr = explode(',', $fieldSetup['allowed']);
                                $useTablePrefix = 1;
@@ -967,13 +930,12 @@ class t3lib_fullsearch {
                                        $tablePrefix = $from_table . '_';
                                }
                                $counter = 1;
-                               if (is_array($TCA[$from_table])) {
+                               if (is_array($GLOBALS['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']) {
-                                               reset($TCA[$from_table]['columns'][$labelField]['config']['items']);
-                                               while (list(, $labelArray) = each($TCA[$from_table]['columns'][$labelField]['config']['items'])) {
+                                       $labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
+                                       $altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
+                                       if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
+                                               foreach ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items'] as $labelArray) {
                                                        if (substr($labelArray[0], 0, 4) == 'LLL:') {
                                                                $labelFieldSelect[$labelArray[1]] = $GLOBALS['LANG']->sL($labelArray[0]);
                                                        } else {
@@ -982,9 +944,8 @@ class t3lib_fullsearch {
                                                }
                                                $useSelectLabels = 1;
                                        }
-                                       if ($TCA[$from_table]['columns'][$altLabelField]['config']['items']) {
-                                               reset($TCA[$from_table]['columns'][$altLabelField]['config']['items']);
-                                               foreach ($TCA[$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) {
+                                       if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) {
+                                               foreach ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) {
                                                        if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
                                                                $altLabelFieldSelect[$altLabelArray[1]] = $GLOBALS['LANG']->sL($altLabelArray[0]);
                                                        } else {
@@ -1024,7 +985,6 @@ class t3lib_fullsearch {
                                                }
                                                $GLOBALS['TYPO3_DB']->sql_free_result($res);
                                        }
-                                       reset($this->tableArray[$from_table]);
                                        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'];
@@ -1147,4 +1107,4 @@ class t3lib_fullsearch {
 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_fullsearch.php'])) {
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_fullsearch.php']);
 }
-?>
+?>
\ No newline at end of file