[FEATURE] Add stdWrap to each of the properties of TypoScript "select"
authorcybercraft <info@cybercraft.de>
Mon, 1 Aug 2011 20:17:59 +0000 (22:17 +0200)
committerOliver Hader <oliver@typo3.org>
Tue, 2 Aug 2011 14:43:08 +0000 (16:43 +0200)
Change-Id: I5ee1be24a0c7f68cb0833823e9217db87742ab1d
Resolves: #18822
Releases: 4.6
Reviewed-on: http://review.typo3.org/3995
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny
Reviewed-by: Xavier Perseguers
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/cms/tslib/class.tslib_content.php

index af07635..700fbbc 100644 (file)
@@ -7359,6 +7359,23 @@ class tslib_cObj {
         */
        function getQuery($table, $conf, $returnQueryArray = FALSE) {
 
+                       // Resolve stdWrap in these properties first
+               $properties = array(
+                       'pidInList', 'uidInList', 'languageField', 'selectFields', 'max', 'begin', 'groupBy', 'orderBy', 'join', 'leftjoin', 'rightjoin'
+               );
+               foreach ($properties as $property) {
+                       $conf[$property] = isset($conf[$property . '.'])
+                                       ? trim($this->stdWrap($conf[$property], $conf[$property . '.']))
+                                       : trim($conf[$property]);
+                       if (!$conf[$property]) {
+                               unset($conf[$property]);
+                       }
+                       if (isset($conf[$property . '.'])) {
+                                       // stdWrapping already done, so remove the sub-array
+                               unset($conf[$property . '.']);
+                       }
+               }
+
                        // Handle PDO-style named parameter markers first
                $queryMarkers = $this->getQueryMarkers($table, $conf);
 
@@ -7375,14 +7392,12 @@ class tslib_cObj {
                }
 
                        // Construct WHERE clause:
-               $conf['pidInList'] = isset($conf['pidInList.'])
-                       ? trim($this->stdWrap($conf['pidInList'], $conf['pidInList.']))
-                       : trim($conf['pidInList']);
 
                        // Handle recursive function for the pidInList
                if (isset($conf['recursive'])) {
                        $conf['recursive'] = intval($conf['recursive']);
                        if ($conf['recursive'] > 0) {
+                               $pidList = '';
                                foreach (explode(',', $conf['pidInList']) as $value) {
                                        if ($value === 'this') {
                                                $value = $GLOBALS['TSFE']->id;
@@ -7437,11 +7452,11 @@ class tslib_cObj {
                                // Setting up tablejoins:
                        $joinPart = '';
                        if ($conf['join']) {
-                               $joinPart = 'JOIN ' . trim($conf['join']);
+                               $joinPart = 'JOIN ' . $conf['join'];
                        } elseif ($conf['leftjoin']) {
-                               $joinPart = 'LEFT OUTER JOIN ' . trim($conf['leftjoin']);
+                               $joinPart = 'LEFT OUTER JOIN ' . $conf['leftjoin'];
                        } elseif ($conf['rightjoin']) {
-                               $joinPart = 'RIGHT OUTER JOIN ' . trim($conf['rightjoin']);
+                               $joinPart = 'RIGHT OUTER JOIN ' . $conf['rightjoin'];
                        }
 
                                // Compile and return query: