Project

General

Profile

Actions

Bug #20529

closed

stdWrap for TypoSrcrip-select parameters

Added by David Bruchmann almost 15 years ago. Updated about 13 years ago.

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

bug_11220.diff (935 Bytes) bug_11220.diff Administrator Admin, 2009-05-29 16:17
bug_11220_2.diff (7.57 KB) bug_11220_2.diff Administrator Admin, 2009-05-30 16:36
bug_11220_3.diff (7.95 KB) bug_11220_3.diff Administrator Admin, 2009-05-30 19:44
bug_11220_4.diff (7.93 KB) bug_11220_4.diff Administrator Admin, 2009-05-30 20:55
bug_11220_5.diff (7.94 KB) bug_11220_5.diff Administrator Admin, 2009-05-31 19:54
bug_11220_6.diff (8.13 KB) bug_11220_6.diff Administrator Admin, 2009-05-31 21:33
bug_11220_8.diff (8.23 KB) bug_11220_8.diff Administrator Admin, 2009-06-07 20:49

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Feature #20508: Enable stdWrap on select properties groupBy and orderByClosedOliver Hader2009-05-26

Actions
Is duplicate of TYPO3 Core - Feature #24089: Optimize stdWrap usage for tslib_contentClosedSusanne Moog2010-11-17

Actions
Actions

Also available in: Atom PDF