TYPO3 CMS  TYPO3_6-2
DatabaseRecordList.php
Go to the documentation of this file.
1 <?php
3 
28 class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList {
29 
40  public function makeSearchString($table) {
41  // Make query, only if table is valid and a search string is actually defined:
42  if ($GLOBALS['TCA'][$table] && $this->searchString) {
43  // Initialize field array:
44  $sfields = array();
45  $or = '';
46  // add the uid only if input is numeric, cast to int
47  if (is_numeric($this->searchString)) {
48  $queryPart = ' AND (uid=' . (int)$this->searchString . ' OR ';
49  } else {
50  $queryPart = ' AND (';
51  }
52  if ($GLOBALS['TYPO3_DB']->runningADOdbDriver('oci8')) {
53  foreach ($GLOBALS['TCA'][$table]['columns'] as $fieldName => $info) {
54  if ($GLOBALS['TYPO3_DB']->cache_fieldType[$table][$fieldName]['metaType'] === 'B') {
55 
56  } elseif ($info['config']['type'] === 'text' || $info['config']['type'] === 'input' && !preg_match('/date|time|int/', $info['config']['eval'])) {
57  $queryPart .= $or . $fieldName . ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table) . '%\'';
58  $or = ' OR ';
59  }
60  }
61  } else {
62  // Traverse the configured columns and add all columns that can be searched
63  foreach ($GLOBALS['TCA'][$table]['columns'] as $fieldName => $info) {
64  if ($info['config']['type'] === 'text' || $info['config']['type'] === 'input' && !preg_match('/date|time|int/', $info['config']['eval'])) {
65  $sfields[] = $fieldName;
66  }
67  }
68  // If search-fields were defined (and there always are) we create the query:
69  if (count($sfields)) {
70  $like = ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table) . '%\'';
71  // Free-text
72  $queryPart .= implode(($like . ' OR '), $sfields) . $like;
73  }
74  }
75  // Return query:
76  return $queryPart . ')';
77  }
78  }
79 
80 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]