From 07b9cf46a3208cfd4890f1585920edb3ab4b92da Mon Sep 17 00:00:00 2001 From: cybercraft <info@cybercraft.de> Date: Mon, 1 Aug 2011 22:17:59 +0200 Subject: [PATCH] [FEATURE] Add stdWrap to each of the properties of TypoScript "select" 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 --- .../sysext/cms/tslib/class.tslib_content.php | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/typo3/sysext/cms/tslib/class.tslib_content.php b/typo3/sysext/cms/tslib/class.tslib_content.php index af076350deb6..700fbbc0e149 100644 --- a/typo3/sysext/cms/tslib/class.tslib_content.php +++ b/typo3/sysext/cms/tslib/class.tslib_content.php @@ -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: -- GitLab