Actions
Bug #20529
closedstdWrap for TypoSrcrip-select parameters
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-05-29
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
4.3
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
The select function doesn't allow stdWrap for several parameters. So the have to be hardcoded in TS.
I changed function getQuery in class.tslib_content.php so that all parameters in the defined array $stdWrapAllowedValues are parsed through stdWrap.
Now im'm not quite sure, which parameters kann be added there, adding the sql-statements (where, andwhere, join) brakes down the function but what's about begin, languageField, orderBy, groupBy?
function getQuery($table, $conf, $returnQueryArray=FALSE) {
$stdWrapAllowedValues = Array('pidInList.','uidInList.','recursive.','min.','max.');
foreach ($conf as $k => $v) {
if (in_array($k,$stdWrapAllowedValues) || in_array($k.'.',$stdWrapAllowedValues)) {
preg_match('/(.*?)\./',$k,$r);
$conf[$r[1]] = trim($this->stdWrap($conf[$r[1]],$conf[$k]));
}
}
// Handle recursive function for the pidInList
if (isset($conf['recursive'])) {
$conf['recursive'] = intval($conf['recursive']);
if ($conf['recursive'] > 0) {
foreach (explode(',', $conf['pidInList']) as $value) {
$pidList .= $value . ',' . $this->getTreeList($value, $conf['recursive']);
}
$conf['pidInList'] = trim($pidList, ',');
}
}
if (!strcmp($conf['pidInList'],'')) {
$conf['pidInList'] = 'this';
}
$queryParts = $this->getWhere($table,$conf,TRUE);
// Fields:
$queryParts['SELECT'] = $conf['selectFields'] ? $conf['selectFields'] : '*';
// Setting LIMIT:
if ($conf['max'] || $conf['begin']) {
$error=0;
// Finding the total number of records, if used:
if (strstr(strtolower($conf['begin'].$conf['max']),'total')) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $table, $queryParts['WHERE'], $queryParts['GROUPBY']);
if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
$GLOBALS['TT']->setTSlogMessage($error);
} else {
$row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
$conf['max'] = str_ireplace('total', $row[0], $conf['max']);
$conf['begin'] = str_ireplace('total', $row[0], $conf['begin']);
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
if (!$error) {
$conf['begin'] = t3lib_div::intInRange(ceil($this->calc($conf['begin'])),0);
$conf['max'] = t3lib_div::intInRange(ceil($this->calc($conf['max'])),0);
if ($conf['begin'] && !$conf['max']) {
$conf['max'] = 100000;
}
if ($conf['begin'] && $conf['max']) {
$queryParts['LIMIT'] = $conf['begin'].','.$conf['max'];
} elseif (!$conf['begin'] && $conf['max']) {
$queryParts['LIMIT'] = $conf['max'];
}
}
}
(issue imported from #M11220)
Files
Actions