Project

General

Profile

Feature #16994 » 4-0-4.diff

Administrator Admin, 2007-02-16 10:35

View differences:

class.t3lib_befunc.php 2007-02-16 09:51:24.000000000 +0100
// rootLevel = -1 is not handled 'properly' here - it goes as if it was rootLevel = 1 (that is pid=0)
$wgolParts = $GLOBALS['TYPO3_DB']->splitGroupOrderLimit($fTWHERE);
// retrieve all necessary tables from the where-clause
$tablesArr = array($foreign_table);
$allTables = $wgolParts['WHERE'];
// regex to remove everything between quotes
$quotesRegex = "/'(.*?)'/U";
$allTables = preg_replace($quotesRegex, '', $allTables);
// regex to retrieve the table-names
$tableRegex = "/(\w+)\./";
preg_match_all($tableRegex, $allTables, $matches);
if (!$rootLevel && $foreign_table != 'pages') {
$tablesArr[] = 'pages';
}
$tablesArr = array_unique(array_merge($tablesArr, $matches[1]));
$tables = implode(',', $tablesArr);
if ($rootLevel) {
$queryParts = array(
'SELECT' => t3lib_BEfunc::getCommonSelectFields($foreign_table,$foreign_table.'.'),
'FROM' => $foreign_table,
'FROM' => $tables,
'WHERE' => $foreign_table.'.pid=0 '.
t3lib_BEfunc::deleteClause($foreign_table).' '.
$wgolParts['WHERE'],
......
if ($foreign_table!='pages') {
$queryParts = array(
'SELECT' => t3lib_BEfunc::getCommonSelectFields($foreign_table,$foreign_table.'.'),
'FROM' => $foreign_table.',pages',
'FROM' => $tables,
'WHERE' => 'pages.uid='.$foreign_table.'.pid
AND pages.deleted=0 '.
t3lib_BEfunc::deleteClause($foreign_table).
......
} else {
$queryParts = array(
'SELECT' => t3lib_BEfunc::getCommonSelectFields($foreign_table,$foreign_table.'.'),
'FROM' => 'pages',
'FROM' => $tables,
'WHERE' => 'pages.deleted=0
AND '.$pageClause.' '.
$wgolParts['WHERE'],
(2-2/4)