[!!!][TASK] Rewrite install tool
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Database / QueryGenerator.php
index 436dca4..0c425a8 100644 (file)
@@ -4,7 +4,7 @@ namespace TYPO3\CMS\Core\Database;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2001-2011 Christian Jul Jensen (christian@typo3.com)
+ *  (c) 2001-2013 Christian Jul Jensen (christian@typo3.com)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -38,8 +38,6 @@ namespace TYPO3\CMS\Core\Database;
  *
  * @author Christian Jul Jensen <christian@typo3.com>
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage t3lib
  */
 class QueryGenerator {
 
@@ -244,7 +242,6 @@ class QueryGenerator {
        public function makeFieldList() {
                $fieldListArr = array();
                if (is_array($GLOBALS['TCA'][$this->table])) {
-                       \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($this->table);
                        foreach ($GLOBALS['TCA'][$this->table]['columns'] as $fN => $value) {
                                $fieldListArr[] = $fN;
                        }
@@ -279,7 +276,6 @@ class QueryGenerator {
        public function init($name, $table, $fieldList = '') {
                // Analysing the fields in the table.
                if (is_array($GLOBALS['TCA'][$table])) {
-                       \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
                        $this->name = $name;
                        $this->table = $table;
                        $this->fieldList = $fieldList ? $fieldList : $this->makeFieldList();
@@ -439,13 +435,15 @@ class QueryGenerator {
                if ($POST['qG_del']) {
                        // Initialize array to work on, save special parameters
                        $ssArr = $this->getSubscript($POST['qG_del']);
-                       $workArr =& $this->queryConfig;
-                       for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
-                               $workArr =& $workArr[$ssArr[$i]];
+                       $workArr = &$this->queryConfig;
+                       $ssArrSize = sizeof($ssArr) - 1;
+                       for ($i = 0; $i < $ssArrSize; $i++) {
+                               $workArr = &$workArr[$ssArr[$i]];
                        }
                        // Delete the entry and move the other entries
                        unset($workArr[$ssArr[$i]]);
-                       for ($j = $ssArr[$i]; $j < sizeof($workArr); $j++) {
+                       $workArrSize = sizeof($workArr);
+                       for ($j = $ssArr[$i]; $j < $workArrSize; $j++) {
                                $workArr[$j] = $workArr[$j + 1];
                                unset($workArr[$j + 1]);
                        }
@@ -454,12 +452,14 @@ class QueryGenerator {
                if ($POST['qG_ins']) {
                        // Initialize array to work on, save special parameters
                        $ssArr = $this->getSubscript($POST['qG_ins']);
-                       $workArr =& $this->queryConfig;
-                       for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
-                               $workArr =& $workArr[$ssArr[$i]];
+                       $workArr = &$this->queryConfig;
+                       $ssArrSize = sizeof($ssArr) - 1;
+                       for ($i = 0; $i < $ssArrSize; $i++) {
+                               $workArr = &$workArr[$ssArr[$i]];
                        }
                        // Move all entries above position where new entry is to be inserted
-                       for ($j = sizeof($workArr); $j > $ssArr[$i]; $j--) {
+                       $workArrSize = sizeof($workArr);
+                       for ($j = $workArrSize; $j > $ssArr[$i]; $j--) {
                                $workArr[$j] = $workArr[$j - 1];
                        }
                        // Clear new entry position
@@ -470,9 +470,10 @@ class QueryGenerator {
                if ($POST['qG_up']) {
                        // Initialize array to work on
                        $ssArr = $this->getSubscript($POST['qG_up']);
-                       $workArr =& $this->queryConfig;
-                       for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
-                               $workArr =& $workArr[$ssArr[$i]];
+                       $workArr = &$this->queryConfig;
+                       $ssArrSize = sizeof($ssArr) - 1;
+                       for ($i = 0; $i < $ssArrSize; $i++) {
+                               $workArr = &$workArr[$ssArr[$i]];
                        }
                        // Swap entries
                        $qG_tmp = $workArr[$ssArr[$i]];
@@ -483,9 +484,10 @@ class QueryGenerator {
                if ($POST['qG_nl']) {
                        // Initialize array to work on
                        $ssArr = $this->getSubscript($POST['qG_nl']);
-                       $workArr =& $this->queryConfig;
-                       for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
-                               $workArr =& $workArr[$ssArr[$i]];
+                       $workArr = &$this->queryConfig;
+                       $ssArraySize = sizeof($ssArr) - 1;
+                       for ($i = 0; $i < $ssArraySize; $i++) {
+                               $workArr = &$workArr[$ssArr[$i]];
                        }
                        // Do stuff:
                        $tempEl = $workArr[$ssArr[$i]];
@@ -503,9 +505,10 @@ class QueryGenerator {
                if ($POST['qG_remnl']) {
                        // Initialize array to work on
                        $ssArr = $this->getSubscript($POST['qG_remnl']);
-                       $workArr =& $this->queryConfig;
-                       for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
-                               $workArr =& $workArr[$ssArr[$i]];
+                       $workArr = &$this->queryConfig;
+                       $ssArrSize = sizeof($ssArr) - 1;
+                       for ($i = 0; $i < $ssArrSize; $i++) {
+                               $workArr = &$workArr[$ssArr[$i]];
                        }
                        // Do stuff:
                        $tempEl = $workArr[$ssArr[$i]];
@@ -866,7 +869,6 @@ class QueryGenerator {
                                }
                                $counter = 1;
                                if (is_array($GLOBALS['TCA'][$from_table])) {
-                                       \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($from_table);
                                        $labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
                                        $altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
                                        if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
@@ -1528,7 +1530,7 @@ class QueryGenerator {
                $out = '';
                if ($this->extJSCODE) {
                        $out .= '
-                       <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . '../t3lib/jsfunc.evalfield.js"></script>
+                       <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'js/jsfunc.evalfield.js"></script>
                        <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'jsfunc.tbe_editor.js"></script>
                        <script language="javascript" type="text/javascript">
                                TBE_EDITOR.formname = "' . $formname . '";