Project

General

Profile

Bug #23103 » 15001_core_v3.diff

Administrator Admin, 2010-07-20 07:57

View differences:

t3lib/class.t3lib_db.php (working copy)
$queryParts = array();
foreach($searchWords as $sw) {
$like = ' LIKE \'%' . $this->quoteStr($sw, $table) . '%\'';
$like = ' LIKE \'%' . $this->escapeStrForLike($this->quoteStr($sw, $table), $table) . '%\'';
$queryParts[] = $table . '.' . implode($like . ' OR ' . $table . '.', $fields) . $like;
}
$query = '(' . implode(') AND (', $queryParts) . ')';
typo3/class.db_list.inc (working copy)
* @return string Returns part of WHERE-clause for searching, if applicable.
*/
function makeSearchString($table) {
global $TCA;
$queryPart = '';
// Make query, only if table is valid and a search string is actually defined:
if ($TCA[$table] && $this->searchString) {
if ($GLOBALS['TCA'][$table] && $this->searchString) {
// Loading full table description - we need to traverse fields:
t3lib_div::loadTCA($table);
......
$sfields[]='uid'; // Adding "uid" by default.
// Traverse the configured columns and add all columns that can be searched:
foreach($TCA[$table]['columns'] as $fieldName => $info) {
foreach ($GLOBALS['TCA'][$table]['columns'] as $fieldName => $info) {
if ($info['config']['type']=='text' || ($info['config']['type']=='input' && !preg_match('/date|time|int/',$info['config']['eval']))) {
$sfields[]=$fieldName;
}
}
// If search-fields were defined (and there always are) we create the query:
if (count($sfields)) {
$like = ' LIKE \'%'.$GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table).'%\''; // Free-text searching...
$queryPart = ' AND ('.implode($like.' OR ',$sfields).$like.')';
// Return query:
return $queryPart;
// If search-fields were defined, we create the query:
if (count($sfields)) {
$query = $GLOBALS['TYPO3_DB']->searchQuery(array($this->searchString), $sfields, $table);
if (strlen($query) > 0) {
$queryPart = ' AND (' . $query . ')';
}
}
}
// Return query:
return $queryPart;
}
/**
(2-2/4)