Project

General

Profile

Bug #24772 ยป 17267.diff

Administrator Admin, 2011-01-24 14:55

View differences:

t3lib/search/class.t3lib_search_livesearch.php (working copy)
* @param array $fieldsToSearchWithin User right based visible fields where we can search within.
* @return string
*/
protected function makeQuerySearchByTable($tableName, $fieldsToSearchWithin) {
protected function makeQuerySearchByTable($tableName, array $fieldsToSearchWithin) {
// free text search
$queryLikeStatement = ' LIKE \'%' . $this->getQueryString($tableName) . '%\'';
$queryPart = ' AND (' . implode($queryLikeStatement . ' OR ', $fieldsToSearchWithin) . $queryLikeStatement . ')';
$integerFieldsToSearchWithin = array();
$queryEqualStatement = '';
if (is_numeric($this->getQueryString($tableName))) {
$queryEqualStatement = ' = \'' . $this->getQueryString($tableName) . '\'';
}
if ($uidPos = array_search('uid', $fieldsToSearchWithin)) {
$integerFieldsToSearchWithin[] = 'uid';
unset($fieldsToSearchWithin[$uidPos]);
}
if ($uidPos = array_search('pid', $fieldsToSearchWithin)) {
$integerFieldsToSearchWithin[] = 'pid';
unset($fieldsToSearchWithin[$uidPos]);
}
$queryPart = ' AND (';
if (count($integerFieldsToSearchWithin) && $queryEqualStatement !== '') {
$queryPart .= implode($queryEqualStatement . ' OR ', $integerFieldsToSearchWithin) . $queryEqualStatement . ' OR ';
}
$queryPart .= implode($queryLikeStatement . ' OR ', $fieldsToSearchWithin) . $queryLikeStatement . ')';
$queryPart .= t3lib_BEfunc::deleteClause($tableName);
$queryPart .= t3lib_BEfunc::versioningPlaceholderClause($tableName);
    (1-1/1)