TYPO3 CMS  TYPO3_7-6
DatabaseRecordList.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
20 class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList
21 {
32  public function makeSearchString($table, $currentPid = -1)
33  {
34  // Make query, only if table is valid and a search string is actually defined:
35  if ($GLOBALS['TCA'][$table] && $this->searchString) {
36  // Initialize field array:
37  $sfields = [];
38  $or = '';
39  // add the uid only if input is numeric, cast to int
40  if (is_numeric($this->searchString)) {
41  $queryPart = ' AND (uid=' . (int)$this->searchString . ' OR ';
42  } else {
43  $queryPart = ' AND (';
44  }
45  if ($GLOBALS['TYPO3_DB']->runningADOdbDriver('oci8')) {
46  foreach ($GLOBALS['TCA'][$table]['columns'] as $fieldName => $info) {
47  if ($GLOBALS['TYPO3_DB']->cache_fieldType[$table][$fieldName]['metaType'] === 'B') {
48  } elseif ($info['config']['type'] === 'text' || $info['config']['type'] === 'input' && !preg_match('/date|time|int/', $info['config']['eval'])) {
49  $queryPart .= $or . $fieldName . ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table) . '%\'';
50  $or = ' OR ';
51  }
52  }
53  } else {
54  // Traverse the configured columns and add all columns that can be searched
55  foreach ($GLOBALS['TCA'][$table]['columns'] as $fieldName => $info) {
56  if ($info['config']['type'] === 'text' || $info['config']['type'] === 'input' && !preg_match('/date|time|int/', $info['config']['eval'])) {
57  $sfields[] = $fieldName;
58  }
59  }
60  // If search-fields were defined (and there always are) we create the query:
61  if (!empty($sfields)) {
62  $like = ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table) . '%\'';
63  // Free-text
64  $queryPart .= implode(($like . ' OR '), $sfields) . $like;
65  }
66  }
67  // Return query:
68  return $queryPart . ')';
69  }
70  }
71 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']