|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 /** 00028 * Class used in module tools/dbint (advanced search) and which may hold code specific for that module 00029 * However the class has a general principle in it which may be used in the web/export module. 00030 * 00031 * $Id: class.t3lib_fullsearch.php 10161 2011-01-20 14:54:34Z baschny $ 00032 * 00033 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00034 * @coauthor Jo Hasenau <info@cybercraft.de> 00035 */ 00036 /** 00037 * [CLASS/FUNCTION INDEX of SCRIPT] 00038 * 00039 * 00040 * 00041 * 88: class t3lib_fullsearch 00042 * 103: function form() 00043 * 117: function makeStoreControl() 00044 * 156: function initStoreArray() 00045 * 176: function cleanStoreQueryConfigs($storeQueryConfigs,$storeArray) 00046 * 193: function addToStoreQueryConfigs($storeQueryConfigs,$index) 00047 * 209: function saveQueryInAction($uid) 00048 * 256: function loadStoreQueryConfigs($storeQueryConfigs,$storeIndex,$writeArray) 00049 * 272: function procesStoreControl() 00050 * 344: function queryMaker() 00051 * 414: function getQueryResultCode($mQ,$res,$table) 00052 * 534: function csvValues($row, $delim=',', $quote='"', $conf=array(), $table='') 00053 * 550: function tableWrap($str) 00054 * 559: function search() 00055 * 614: function resultRowDisplay($row,$conf,$table) 00056 * 662: function getProcessedValueExtra($table, $fN, $fV, $conf, $splitString) 00057 * 781: function getTreeList($id, $depth, $begin = 0, $perms_clause) 00058 * 818: function makeValueList($fN, $fV, $conf, $table, $splitString) 00059 * 1028: function resultRowTitles($row,$conf,$table) 00060 * 1058: function csvRowTitles($row, $conf, $table) 00061 * 00062 * TOTAL FUNCTIONS: 19 00063 * (This index is automatically created/updated by the extension "extdeveval") 00064 * 00065 */ 00066 00067 00068 /** 00069 * Class used in module tools/dbint (advanced search) and which may hold code specific for that module 00070 * However the class has a general principle in it which may be used in the web/export module. 00071 * 00072 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00073 * @package TYPO3 00074 * @subpackage t3lib 00075 */ 00076 class t3lib_fullsearch { 00077 var $storeList = 'search_query_smallparts,search_result_labels,labels_noprefix,show_deleted,queryConfig,queryTable,queryFields,queryLimit,queryOrder,queryOrderDesc,queryOrder2,queryOrder2Desc,queryGroup,search_query_makeQuery'; 00078 var $downloadScript = 'index.php'; 00079 var $formW = 48; 00080 var $noDownloadB = 0; 00081 00082 protected $formName = ''; 00083 00084 /** 00085 * constructor 00086 */ 00087 public function __construct() { 00088 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_t3lib_fullsearch.xml'); 00089 } 00090 00091 00092 /** 00093 * [Describe function...] 00094 * 00095 * @return [type] ... 00096 */ 00097 function form() { 00098 $out = ' 00099 Search Word:<BR> 00100 <input type="text" name="SET[sword]" value="' . htmlspecialchars($GLOBALS['SOBE']->MOD_SETTINGS['sword']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '><input type="submit" name="submit" value="Search All Records"> 00101 '; 00102 00103 return $out; 00104 } 00105 00106 /** 00107 * [Describe function...] 00108 * 00109 * @return [type] ... 00110 */ 00111 function makeStoreControl() { 00112 // Load/Save 00113 $storeArray = $this->initStoreArray(); 00114 $cur = ''; 00115 00116 // Store Array: 00117 $opt = array(); 00118 foreach ($storeArray as $k => $v) { 00119 $opt[] = '<option value="' . $k . '"' . (!strcmp($cur, $v) ? ' selected' : '') . '>' . htmlspecialchars($v) . '</option>'; 00120 } 00121 00122 // Actions: 00123 if (t3lib_extMgm::isLoaded('sys_action') && $GLOBALS['BE_USER']->isAdmin()) { 00124 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_action', 'type=2', '', 'title'); 00125 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { 00126 $opt[] = '<option value="0">__Save to Action:__</option>'; 00127 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00128 $opt[] = '<option value="-' . $row['uid'] . '"' . (!strcmp($cur, '-' . $row['uid']) ? ' selected' : '') . '>' . htmlspecialchars($row['title'] . ' [' . $row['uid'] . ']') . '</option>'; 00129 } 00130 } 00131 $GLOBALS['TYPO3_DB']->sql_free_result($res); 00132 } 00133 00134 $TDparams = ' nowrap="nowrap" class="bgColor4"'; 00135 $tmpCode = ' 00136 <table border="0" cellpadding="3" cellspacing="1"> 00137 <tr' . $TDparams . '><td><select name="storeControl[STORE]" onChange="document.forms[0][\'storeControl[title]\'].value= this.options[this.selectedIndex].value!=0 ? this.options[this.selectedIndex].text : \'\';">' . implode(LF, $opt) . '</select><input type="submit" name="storeControl[LOAD]" value="Load"></td></tr> 00138 <tr' . $TDparams . '><td nowrap><input name="storeControl[title]" value="" type="text" max="80"' . $GLOBALS['SOBE']->doc->formWidth() . '><input type="submit" name="storeControl[SAVE]" value="Save" onClick="if (document.forms[0][\'storeControl[STORE]\'].options[document.forms[0][\'storeControl[STORE]\'].selectedIndex].value<0) return confirm(\'Are you sure you want to overwrite the existing query in this action?\');"><input type="submit" name="storeControl[REMOVE]" value="Remove"></td></tr> 00139 </table> 00140 '; 00141 return $tmpCode; 00142 } 00143 00144 /** 00145 * [Describe function...] 00146 * 00147 * @return [type] ... 00148 */ 00149 function initStoreArray() { 00150 $storeArray = array( 00151 '0' => '[New]' 00152 ); 00153 00154 $savedStoreArray = unserialize($GLOBALS['SOBE']->MOD_SETTINGS['storeArray']); 00155 00156 if (is_array($savedStoreArray)) { 00157 $storeArray = array_merge($storeArray, $savedStoreArray); 00158 } 00159 return $storeArray; 00160 } 00161 00162 /** 00163 * [Describe function...] 00164 * 00165 * @param [type] $storeQueryConfigs: ... 00166 * @param [type] $storeArray: ... 00167 * @return [type] ... 00168 */ 00169 function cleanStoreQueryConfigs($storeQueryConfigs, $storeArray) { 00170 if (is_array($storeQueryConfigs)) { 00171 foreach ($storeQueryConfigs as $k => $v) { 00172 if (!isset($storeArray[$k])) { 00173 unset($storeQueryConfigs[$k]); 00174 } 00175 } 00176 } 00177 return $storeQueryConfigs; 00178 } 00179 00180 /** 00181 * [Describe function...] 00182 * 00183 * @param [type] $storeQueryConfigs: ... 00184 * @param [type] $index: ... 00185 * @return [type] ... 00186 */ 00187 function addToStoreQueryConfigs($storeQueryConfigs, $index) { 00188 $keyArr = explode(',', $this->storeList); 00189 $storeQueryConfigs[$index] = array(); 00190 foreach ($keyArr as $k) { 00191 $storeQueryConfigs[$index][$k] = $GLOBALS['SOBE']->MOD_SETTINGS[$k]; 00192 } 00193 return $storeQueryConfigs; 00194 } 00195 00196 /** 00197 * [Describe function...] 00198 * 00199 * @param [type] $uid: ... 00200 * @return [type] ... 00201 */ 00202 function saveQueryInAction($uid) { 00203 if (t3lib_extMgm::isLoaded('sys_action')) { 00204 $keyArr = explode(',', $this->storeList); 00205 $saveArr = array(); 00206 foreach ($keyArr as $k) { 00207 $saveArr[$k] = $GLOBALS['SOBE']->MOD_SETTINGS[$k]; 00208 } 00209 00210 $qOK = 0; 00211 // Show query 00212 if ($saveArr['queryTable']) { 00213 /* @var t3lib_queryGenerator */ 00214 $qGen = t3lib_div::makeInstance('t3lib_queryGenerator'); 00215 $qGen->init('queryConfig', $saveArr['queryTable']); 00216 $qGen->makeSelectorTable($saveArr); 00217 00218 $qGen->enablePrefix = 1; 00219 $qString = $qGen->getQuery($qGen->queryConfig); 00220 $qCount = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', $qGen->table, $qString . t3lib_BEfunc::deleteClause($qGen->table)); 00221 $qSelect = $qGen->getSelectQuery($qString); 00222 00223 $res = @$GLOBALS['TYPO3_DB']->sql_query($qCount); 00224 if (!$GLOBALS['TYPO3_DB']->sql_error()) { 00225 $GLOBALS['TYPO3_DB']->sql_free_result($res); 00226 $dA = array(); 00227 $dA['t2_data'] = serialize(array( 00228 'qC' => $saveArr, 00229 'qCount' => $qCount, 00230 'qSelect' => $qSelect, 00231 'qString' => $qString 00232 )); 00233 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_action', 'uid=' . intval($uid), $dA); 00234 $qOK = 1; 00235 } 00236 } 00237 00238 return $qOK; 00239 } 00240 } 00241 00242 /** 00243 * [Describe function...] 00244 * 00245 * @param [type] $storeQueryConfigs: ... 00246 * @param [type] $storeIndex: ... 00247 * @param [type] $writeArray: ... 00248 * @return [type] ... 00249 */ 00250 function loadStoreQueryConfigs($storeQueryConfigs, $storeIndex, $writeArray) { 00251 if ($storeQueryConfigs[$storeIndex]) { 00252 $keyArr = explode(',', $this->storeList); 00253 foreach ($keyArr as $k) { 00254 $writeArray[$k] = $storeQueryConfigs[$storeIndex][$k]; 00255 } 00256 } 00257 return $writeArray; 00258 } 00259 00260 /** 00261 * [Describe function...] 00262 * 00263 * @return [type] ... 00264 */ 00265 function procesStoreControl() { 00266 $storeArray = $this->initStoreArray(); 00267 $storeQueryConfigs = unserialize($GLOBALS['SOBE']->MOD_SETTINGS['storeQueryConfigs']); 00268 00269 $storeControl = t3lib_div::_GP('storeControl'); 00270 $storeIndex = intval($storeControl['STORE']); 00271 $saveStoreArray = 0; 00272 $writeArray = array(); 00273 if (is_array($storeControl)) { 00274 $msg = ''; 00275 if ($storeControl['LOAD']) { 00276 if ($storeIndex > 0) { 00277 $writeArray = $this->loadStoreQueryConfigs($storeQueryConfigs, $storeIndex, $writeArray); 00278 $saveStoreArray = 1; 00279 $flashMessage = t3lib_div::makeInstance( 00280 't3lib_FlashMessage', 00281 sprintf($GLOBALS['LANG']->getLL('query_loaded'), htmlspecialchars($storeArray[$storeIndex])) 00282 ); 00283 } elseif ($storeIndex < 0 && t3lib_extMgm::isLoaded('sys_action')) { 00284 $actionRecord = t3lib_BEfunc::getRecord('sys_action', abs($storeIndex)); 00285 if (is_array($actionRecord)) { 00286 $dA = unserialize($actionRecord['t2_data']); 00287 $dbSC = array(); 00288 if (is_array($dA['qC'])) { 00289 $dbSC[0] = $dA['qC']; 00290 } 00291 $writeArray = $this->loadStoreQueryConfigs($dbSC, '0', $writeArray); 00292 $saveStoreArray = 1; 00293 00294 $flashMessage = t3lib_div::makeInstance( 00295 't3lib_FlashMessage', 00296 sprintf($GLOBALS['LANG']->getLL('query_from_action_loaded'), htmlspecialchars($actionRecord['title'])) 00297 ); 00298 } 00299 } 00300 } elseif ($storeControl['SAVE']) { 00301 if ($storeIndex < 0) { 00302 $qOK = $this->saveQueryInAction(abs($storeIndex)); 00303 if ($qOK) { 00304 $flashMessage = t3lib_div::makeInstance( 00305 't3lib_FlashMessage', 00306 $GLOBALS['LANG']->getLL('query_saved') 00307 ); 00308 } else { 00309 $flashMessage = t3lib_div::makeInstance( 00310 't3lib_FlashMessage', 00311 $GLOBALS['LANG']->getLL('query_notsaved'), 00312 '', 00313 t3lib_FlashMessage::ERROR 00314 ); 00315 } 00316 } else { 00317 if (trim($storeControl['title'])) { 00318 if ($storeIndex > 0) { 00319 $storeArray[$storeIndex] = $storeControl['title']; 00320 } else { 00321 $storeArray[] = $storeControl['title']; 00322 end($storeArray); 00323 $storeIndex = key($storeArray); 00324 } 00325 $storeQueryConfigs = $this->addToStoreQueryConfigs($storeQueryConfigs, $storeIndex); 00326 $saveStoreArray = 1; 00327 $flashMessage = t3lib_div::makeInstance( 00328 't3lib_FlashMessage', 00329 $GLOBALS['LANG']->getLL('query_saved') 00330 ); 00331 } 00332 } 00333 } elseif ($storeControl['REMOVE']) { 00334 if ($storeIndex > 0) { 00335 $flashMessage = t3lib_div::makeInstance( 00336 't3lib_FlashMessage', 00337 sprintf($GLOBALS['LANG']->getLL('query_removed'), htmlspecialchars($storeArray[$storeControl['STORE']])) 00338 ); 00339 unset($storeArray[$storeControl['STORE']]); // Removing 00340 $saveStoreArray = 1; 00341 } 00342 } 00343 if ($flashMessage) { 00344 $msg = $flashMessage->render(); 00345 } 00346 } 00347 if ($saveStoreArray) { 00348 unset($storeArray[0]); // making sure, index 0 is not set! 00349 $writeArray['storeArray'] = serialize($storeArray); 00350 $writeArray['storeQueryConfigs'] = serialize($this->cleanStoreQueryConfigs($storeQueryConfigs, $storeArray)); 00351 $GLOBALS['SOBE']->MOD_SETTINGS = t3lib_BEfunc::getModuleData($GLOBALS['SOBE']->MOD_MENU, $writeArray, $GLOBALS['SOBE']->MCONF['name'], 'ses'); 00352 } 00353 return $msg; 00354 } 00355 00356 /** 00357 * [Describe function...] 00358 * 00359 * @return [type] ... 00360 */ 00361 function queryMaker() { 00362 global $TCA; 00363 00364 if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3lib_fullsearch'])) { 00365 $this->hookArray = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3lib_fullsearch']; 00366 } 00367 $msg = $this->procesStoreControl(); 00368 00369 if (!$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableStoreControl']) { 00370 $output .= $GLOBALS['SOBE']->doc->section('Load/Save Query', $this->makeStoreControl(), 0, 1); 00371 if ($msg) { 00372 $output .= '<br />' . $msg; 00373 } 00374 $output .= $GLOBALS['SOBE']->doc->spacer(20); 00375 } 00376 00377 00378 // Query Maker: 00379 $qGen = t3lib_div::makeInstance('t3lib_queryGenerator'); 00380 $qGen->init('queryConfig', $GLOBALS['SOBE']->MOD_SETTINGS['queryTable']); 00381 if ($this->formName) { 00382 $qGen->setFormName($this->formName); 00383 } 00384 $tmpCode = $qGen->makeSelectorTable($GLOBALS['SOBE']->MOD_SETTINGS); 00385 $output .= $GLOBALS['SOBE']->doc->section('Make query', $tmpCode, 0, 1); 00386 00387 $mQ = $GLOBALS['SOBE']->MOD_SETTINGS['search_query_makeQuery']; 00388 00389 // Make form elements: 00390 if ($qGen->table && is_array($TCA[$qGen->table])) { 00391 if ($mQ) { 00392 // Show query 00393 $qGen->enablePrefix = 1; 00394 $qString = $qGen->getQuery($qGen->queryConfig); 00395 // debug($qGen->queryConfig); 00396 00397 switch ($mQ) { 00398 case 'count': 00399 $qExplain = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', $qGen->table, $qString . t3lib_BEfunc::deleteClause($qGen->table)); 00400 break; 00401 default: 00402 $qExplain = $qGen->getSelectQuery($qString); 00403 if ($mQ == 'explain') { 00404 $qExplain = 'EXPLAIN ' . $qExplain; 00405 } 00406 break; 00407 } 00408 00409 if (!$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableShowSQLQuery']) { 00410 $output .= $GLOBALS['SOBE']->doc->section('SQL query', $this->tableWrap(htmlspecialchars($qExplain)), 0, 1); 00411 } 00412 00413 $res = @$GLOBALS['TYPO3_DB']->sql_query($qExplain); 00414 if ($GLOBALS['TYPO3_DB']->sql_error()) { 00415 $out .= '<BR><strong>Error:</strong><BR><font color="red"><strong>' . $GLOBALS['TYPO3_DB']->sql_error() . '</strong></font>'; 00416 $output .= $GLOBALS['SOBE']->doc->section('SQL error', $out, 0, 1); 00417 } else { 00418 $cPR = $this->getQueryResultCode($mQ, $res, $qGen->table); 00419 $GLOBALS['TYPO3_DB']->sql_free_result($res); 00420 $output .= $GLOBALS['SOBE']->doc->section($cPR['header'], $cPR['content'], 0, 1); 00421 } 00422 } 00423 } 00424 return $output; 00425 } 00426 00427 /** 00428 * [Describe function...] 00429 * 00430 * @param [type] $mQ: ... 00431 * @param [type] $res: ... 00432 * @param [type] $table: ... 00433 * @return [type] ... 00434 */ 00435 function getQueryResultCode($mQ, $res, $table) { 00436 global $TCA; 00437 $output = ''; 00438 $cPR = array(); 00439 switch ($mQ) { 00440 case 'count': 00441 $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res); 00442 $cPR['header'] = 'Count'; 00443 $cPR['content'] = '<BR><strong>' . $row[0] . '</strong> records selected.'; 00444 break; 00445 case 'all': 00446 $rowArr = array(); 00447 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00448 $rowArr[] = $this->resultRowDisplay($row, $TCA[$table], $table); 00449 $lrow = $row; 00450 } 00451 if (is_array($this->hookArray['beforeResultTable'])) { 00452 foreach ($this->hookArray['beforeResultTable'] as $_funcRef) { 00453 $out .= t3lib_div::callUserFunction($_funcRef, $GLOBALS['SOBE']->MOD_SETTINGS, $this); 00454 } 00455 } 00456 if (count($rowArr)) { 00457 $out .= '<table border="0" cellpadding="2" cellspacing="1" width="100%">' . $this->resultRowTitles($lrow, $TCA[$table], $table) . implode(LF, $rowArr) . '</table>'; 00458 } 00459 if (!$out) { 00460 $out = '<em>No rows selected!</em>'; 00461 } 00462 $cPR['header'] = 'Result'; 00463 $cPR['content'] = $out; 00464 break; 00465 case 'csv': 00466 $rowArr = array(); 00467 $first = 1; 00468 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00469 if ($first) { 00470 $rowArr[] = $this->csvValues(array_keys($row), ',', ''); 00471 $first = 0; 00472 } 00473 $rowArr[] = $this->csvValues($row, ',', '"', $TCA[$table], $table); 00474 } 00475 if (count($rowArr)) { 00476 $out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea(implode(LF, $rowArr)) . '</textarea>'; 00477 if (!$this->noDownloadB) { 00478 $out .= '<BR><input type="submit" name="download_file" value="Click to download file" onClick="window.location.href=\'' . $this->downloadScript . '\';">'; // document.forms[0].target=\'_blank\'; 00479 } 00480 // Downloads file: 00481 if (t3lib_div::_GP('download_file')) { 00482 $filename = 'TYPO3_' . $table . '_export_' . date('dmy-Hi') . '.csv'; 00483 $mimeType = 'application/octet-stream'; 00484 header('Content-Type: ' . $mimeType); 00485 header('Content-Disposition: attachment; filename=' . $filename); 00486 echo implode(CRLF, $rowArr); 00487 exit; 00488 } 00489 } 00490 if (!$out) { 00491 $out = '<em>No rows selected!</em>'; 00492 } 00493 $cPR['header'] = 'Result'; 00494 $cPR['content'] = $out; 00495 break; 00496 case 'xml': 00497 $xmlObj = t3lib_div::makeInstance('t3lib_xml', 'typo3_export'); 00498 $xmlObj->includeNonEmptyValues = 1; 00499 $xmlObj->renderHeader(); 00500 $first = 1; 00501 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00502 if ($first) { 00503 $xmlObj->setRecFields($table, implode(',', array_keys($row))); 00504 $first = 0; 00505 } 00506 $valueArray = $row; 00507 if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) { 00508 foreach ($valueArray as $key => $val) { 00509 $valueArray[$key] = $this->getProcessedValueExtra($table, $key, $val, array(), ','); 00510 } 00511 } 00512 $xmlObj->addRecord($table, $valueArray); 00513 } 00514 $xmlObj->renderFooter(); 00515 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { 00516 $xmlData = $xmlObj->getResult(); 00517 $out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea($xmlData) . '</textarea>'; 00518 if (!$this->noDownloadB) { 00519 $out .= '<BR><input type="submit" name="download_file" value="Click to download file" onClick="window.location.href=\'' . $this->downloadScript . '\';">'; // document.forms[0].target=\'_blank\'; 00520 } 00521 // Downloads file: 00522 if (t3lib_div::_GP('download_file')) { 00523 $filename = 'TYPO3_' . $table . '_export_' . date('dmy-Hi') . '.xml'; 00524 $mimeType = 'application/octet-stream'; 00525 header('Content-Type: ' . $mimeType); 00526 header('Content-Disposition: attachment; filename=' . $filename); 00527 echo $xmlData; 00528 exit; 00529 } 00530 } 00531 if (!$out) { 00532 $out = '<em>No rows selected!</em>'; 00533 } 00534 $cPR['header'] = 'Result'; 00535 $cPR['content'] = $out; 00536 break; 00537 case 'explain': 00538 default: 00539 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00540 $out .= '<br />' . t3lib_utility_Debug::viewArray($row); 00541 } 00542 $cPR['header'] = 'Explain SQL query'; 00543 $cPR['content'] = $out; 00544 break; 00545 } 00546 return $cPR; 00547 } 00548 00549 /** 00550 * [Describe function...] 00551 * 00552 * @param [type] $row: ... 00553 * @param [type] $delim: ... 00554 * @param [type] $quote: ... 00555 * @param [type] $conf: ... 00556 * @param [type] $table: ... 00557 * @return [type] ... 00558 */ 00559 function csvValues($row, $delim = ',', $quote = '"', $conf = array(), $table = '') { 00560 $valueArray = $row; 00561 if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels'] && $table) { 00562 foreach ($valueArray as $key => $val) { 00563 $valueArray[$key] = $this->getProcessedValueExtra($table, $key, $val, $conf, ';'); 00564 } 00565 } 00566 return t3lib_div::csvValues($valueArray, $delim, $quote); 00567 } 00568 00569 /** 00570 * [Describe function...] 00571 * 00572 * @param [type] $str: ... 00573 * @return [type] ... 00574 */ 00575 function tableWrap($str) { 00576 return '<table border="0" cellpadding="10" cellspacing="0" class="bgColor4"><tr><td nowrap><pre>' . $str . '</pre></td></tr></table>'; 00577 } 00578 00579 /** 00580 * [Describe function...] 00581 * 00582 * @return [type] ... 00583 */ 00584 function search() { 00585 global $TCA; 00586 $SET = $GLOBALS['SOBE']->MOD_SETTINGS; 00587 $swords = $SET['sword']; 00588 00589 $limit = 200; 00590 $showAlways = 0; 00591 if ($swords) { 00592 foreach ($TCA as $table => $value) { 00593 // Get fields list 00594 t3lib_div::loadTCA($table); 00595 $conf = $TCA[$table]; 00596 00597 // avoid querying tables with no columns 00598 if (empty($conf['columns'])) { 00599 continue; 00600 } 00601 00602 $list = array_keys($conf['columns']); 00603 // Get query 00604 $qp = $GLOBALS['TYPO3_DB']->searchQuery(array($swords), $list, $table); 00605 00606 // Count: 00607 $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $table, $qp . t3lib_BEfunc::deleteClause($table)); 00608 if ($count || $showAlways) { 00609 // Output header: 00610 $out .= '<strong>TABLE:</strong> ' . $GLOBALS['LANG']->sL($conf['ctrl']['title']) . '<BR>'; 00611 $out .= '<strong>Results:</strong> ' . $count . '<BR>'; 00612 00613 // Show to limit 00614 if ($count) { 00615 $rowArr = array(); 00616 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,' . $conf['ctrl']['label'], $table, $qp . t3lib_BEfunc::deleteClause($table), '', '', $limit); 00617 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00618 $rowArr[] = $this->resultRowDisplay($row, $conf, $table); 00619 $lrow = $row; 00620 } 00621 $GLOBALS['TYPO3_DB']->sql_free_result($res); 00622 $out .= '<table border="0" cellpadding="2" cellspacing="1">' . $this->resultRowTitles($lrow, $conf, $table) . implode(LF, $rowArr) . '</table>'; 00623 } 00624 $out .= '<HR>'; 00625 } 00626 } 00627 } 00628 return $out; 00629 } 00630 00631 /** 00632 * [Describe function...] 00633 * 00634 * @param [type] $row: ... 00635 * @param [type] $conf: ... 00636 * @param [type] $table: ... 00637 * @return [type] ... 00638 */ 00639 function resultRowDisplay($row, $conf, $table) { 00640 static $even = FALSE; 00641 $tce = t3lib_div::makeInstance('t3lib_TCEmain'); 00642 $SET = $GLOBALS['SOBE']->MOD_SETTINGS; 00643 $out = '<tr class="bgColor' . ($even ? '6' : '4') . '">'; 00644 $even = !$even; 00645 foreach ($row as $fN => $fV) { 00646 if (t3lib_div::inList($SET['queryFields'], $fN) || (!$SET['queryFields'] && $fN != 'pid' && $fN != 'deleted')) { 00647 if ($SET['search_result_labels']) { 00648 $fVnew = $this->getProcessedValueExtra($table, $fN, $fV, $conf, '<br />'); 00649 } else { 00650 $fVnew = htmlspecialchars($fV); 00651 } 00652 $out .= '<td>' . $fVnew . '</td>'; 00653 } 00654 } 00655 $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; 00656 $out .= '<td nowrap>'; 00657 if (!$row['deleted']) { 00658 $out .= '<a href="#" onClick="top.launchView(\'' . $table . '\',' . $row['uid'] . ',\'' . $GLOBALS['BACK_PATH'] . '\');return false;">' . t3lib_iconWorks::getSpriteIcon('status-dialog-information') . '</a>'; 00659 $out .= '<a href="#" onClick="' . t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], t3lib_div::getIndpEnv('REQUEST_URI') . t3lib_div::implodeArrayForUrl('SET', (array) t3lib_div::_POST('SET'))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>'; 00660 } else { 00661 $out .= '<a href="' . t3lib_div::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', 00662 array( 00663 'cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 00664 'redirect' => t3lib_div::linkThisScript(array()))) . t3lib_BEfunc::getUrlToken('tceAction') . '">'; 00665 $out .= t3lib_iconWorks::getSpriteIcon('actions-edit-restore', array('title' => 'undelete only')) . '</a>'; 00666 $out .= '<a href="' . t3lib_div::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', 00667 array( 00668 'cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 00669 'redirect' => t3lib_div::linkThisUrl('alt_doc.php', 00670 array( 00671 'edit[' . $table . '][' . $row['uid'] . ']' => 'edit', 00672 'returnUrl' => t3lib_div::linkThisScript(array()) 00673 ) 00674 ) 00675 ) 00676 ) . t3lib_BEfunc::getUrlToken('tceAction') . '">'; 00677 $out .= t3lib_iconWorks::getSpriteIcon('actions-edit-restore-edit', array('title' => 'undelete and edit')) . '</a>'; 00678 } 00679 $_params = array($table => $row); 00680 if (is_array($this->hookArray['additionalButtons'])) { 00681 foreach ($this->hookArray['additionalButtons'] as $_funcRef) { 00682 $out .= t3lib_div::callUserFunction($_funcRef, $_params, $this); 00683 } 00684 } 00685 $out .= '</td> 00686 </tr> 00687 '; 00688 return $out; 00689 } 00690 00691 /** 00692 * [Describe function...] 00693 * 00694 * @param [type] $table: ... 00695 * @param [type] $fN: ... 00696 * @param [type] $fV: ... 00697 * @param [type] $conf: ... 00698 * @param [type] $splitString: ... 00699 * @return [type] ... 00700 */ 00701 function getProcessedValueExtra($table, $fN, $fV, $conf, $splitString) { 00702 global $TCA; 00703 // Analysing the fields in the table. 00704 if (is_array($TCA[$table])) { 00705 t3lib_div::loadTCA($table); 00706 $fC = $TCA[$table]['columns'][$fN]; 00707 $fields = $fC['config']; 00708 $fields['exclude'] = $fC['exclude']; 00709 if (is_array($fC) && $fC['label']) { 00710 $fields['label'] = preg_replace('/:$/', '', trim($GLOBALS['LANG']->sL($fC['label']))); 00711 00712 switch ($fields['type']) { 00713 case 'input': 00714 if (preg_match('/int|year/i', $fields['eval'])) { 00715 $fields['type'] = 'number'; 00716 } elseif (preg_match('/time/i', $fields['eval'])) { 00717 $fields['type'] = 'time'; 00718 } elseif (preg_match('/date/i', $fields['eval'])) { 00719 $fields['type'] = 'date'; 00720 } else { 00721 $fields['type'] = 'text'; 00722 } 00723 break; 00724 case 'check': 00725 if (!$fields['items']) { 00726 $fields['type'] = 'boolean'; 00727 } else { 00728 $fields['type'] = 'binary'; 00729 } 00730 break; 00731 case 'radio': 00732 $fields['type'] = 'multiple'; 00733 break; 00734 case 'select': 00735 $fields['type'] = 'multiple'; 00736 if ($fields['foreign_table']) { 00737 $fields['type'] = 'relation'; 00738 } 00739 if ($fields['special']) { 00740 $fields['type'] = 'text'; 00741 } 00742 break; 00743 case 'group': 00744 $fields['type'] = 'files'; 00745 if ($fields['internal_type'] == 'db') { 00746 $fields['type'] = 'relation'; 00747 } 00748 break; 00749 case 'user': 00750 case 'flex': 00751 case 'passthrough': 00752 case 'none': 00753 case 'text': 00754 default: 00755 $fields['type'] = 'text'; 00756 break; 00757 } 00758 } else { 00759 $fields['label'] = '[FIELD: ' . $fN . ']'; 00760 switch ($fN) { 00761 case 'pid': 00762 $fields['type'] = 'relation'; 00763 $fields['allowed'] = 'pages'; 00764 break; 00765 case 'cruser_id': 00766 $fields['type'] = 'relation'; 00767 $fields['allowed'] = 'be_users'; 00768 break; 00769 case 'tstamp': 00770 case 'crdate': 00771 $fields['type'] = 'time'; 00772 break; 00773 default: 00774 $fields['type'] = 'number'; 00775 break; 00776 } 00777 } 00778 } 00779 00780 switch ($fields['type']) { 00781 case 'date': 00782 if ($fV != -1) { 00783 $out = strftime('%e-%m-%Y', $fV); 00784 } 00785 break; 00786 case 'time': 00787 if ($fV != -1) { 00788 if ($splitString == '<br />') { 00789 $out = strftime('%H:%M' . $splitString . '%e-%m-%Y', $fV); 00790 } else { 00791 $out = strftime('%H:%M %e-%m-%Y', $fV); 00792 } 00793 } 00794 break; 00795 case 'multiple': 00796 case 'binary': 00797 case 'relation': 00798 $out = $this->makeValueList($fN, $fV, $fields, $table, $splitString); 00799 break; 00800 case 'boolean': 00801 $out = $fV ? 'True' : 'False'; 00802 break; 00803 case 'files': 00804 default: 00805 $out = htmlspecialchars($fV); 00806 break; 00807 } 00808 return $out; 00809 } 00810 00811 /* 00812 * [Describe function...] 00813 * 00814 * @param [type] $qString: ... 00815 * @param [type] $depth: ... 00816 * @param [type] $begin: ... 00817 * @param [type] $perms_clause: ... 00818 * @return [type] ... 00819 */ 00820 function getTreeList($id, $depth, $begin = 0, $perms_clause) { 00821 $depth = intval($depth); 00822 $begin = intval($begin); 00823 $id = intval($id); 00824 if ($begin == 0) { 00825 $theList = $id; 00826 } else { 00827 $theList = ''; 00828 } 00829 if ($id && $depth > 0) { 00830 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00831 'uid', 00832 'pages', 00833 'pid=' . $id . ' ' . t3lib_BEfunc::deleteClause('pages') . ' AND ' . $perms_clause 00834 ); 00835 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00836 if ($begin <= 0) { 00837 $theList .= ',' . $row['uid']; 00838 } 00839 if ($depth > 1) { 00840 $theList .= $this->getTreeList($row['uid'], $depth - 1, $begin - 1, $perms_clause); 00841 } 00842 } 00843 $GLOBALS['TYPO3_DB']->sql_free_result($res); 00844 } 00845 return $theList; 00846 } 00847 00848 /** 00849 * [Describe function...] 00850 * 00851 * @param [type] $fN: ... 00852 * @param [type] $fV: ... 00853 * @param [type] $conf: ... 00854 * @param [type] $table: ... 00855 * @param [type] $splitString: ... 00856 * @return [type] ... 00857 */ 00858 function makeValueList($fN, $fV, $conf, $table, $splitString) { 00859 $fieldSetup = $conf; 00860 $out = ''; 00861 if ($fieldSetup['type'] == 'files') { 00862 $d = dir(PATH_site . $fieldSetup['uploadfolder']); 00863 while (FALSE !== ($entry = $d->read())) { 00864 if ($entry == '.' || $entry == '..') { 00865 continue; 00866 } 00867 $fileArray[] = $entry; 00868 } 00869 $d->close(); 00870 natcasesort($fileArray); 00871 while (list(, $fileName) = each($fileArray)) { 00872 if (t3lib_div::inList($fV, $fileName) || $fV == $fileName) { 00873 if (!$out) { 00874 $out = htmlspecialchars($fileName); 00875 } else { 00876 $out .= $splitString . htmlspecialchars($fileName); 00877 } 00878 } 00879 } 00880 } 00881 if ($fieldSetup['type'] == 'multiple') { 00882 foreach ($fieldSetup['items'] as $key => $val) { 00883 if (substr($val[0], 0, 4) == 'LLL:') { 00884 $value = $GLOBALS['LANG']->sL($val[0]); 00885 } else { 00886 $value = $val[0]; 00887 } 00888 if (t3lib_div::inList($fV, $val[1]) || $fV == $val[1]) { 00889 if (!$out) { 00890 $out = htmlspecialchars($value); 00891 } else { 00892 $out .= $splitString . htmlspecialchars($value); 00893 } 00894 } 00895 } 00896 } 00897 if ($fieldSetup['type'] == 'binary') { 00898 foreach ($fieldSetup['items'] as $Key => $val) { 00899 if (substr($val[0], 0, 4) == 'LLL:') { 00900 $value = $GLOBALS['LANG']->sL($val[0]); 00901 } else { 00902 $value = $val[0]; 00903 } 00904 if (!$out) { 00905 $out = htmlspecialchars($value); 00906 } else { 00907 $out .= $splitString . htmlspecialchars($value); 00908 } 00909 } 00910 } 00911 if ($fieldSetup['type'] == 'relation') { 00912 if ($fieldSetup['items']) { 00913 foreach ($fieldSetup['items'] as $key => $val) { 00914 if (substr($val[0], 0, 4) == 'LLL:') { 00915 $value = $GLOBALS['LANG']->sL($val[0]); 00916 } else { 00917 $value = $val[0]; 00918 } 00919 if (t3lib_div::inList($fV, $value) || $fV == $value) { 00920 if (!$out) { 00921 $out = htmlspecialchars($value); 00922 } else { 00923 $out .= $splitString . htmlspecialchars($value); 00924 } 00925 } 00926 } 00927 } 00928 global $TCA; 00929 if (stristr($fieldSetup['allowed'], ',')) { 00930 $from_table_Arr = explode(',', $fieldSetup['allowed']); 00931 $useTablePrefix = 1; 00932 if (!$fieldSetup['prepend_tname']) { 00933 $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fN, $table, 'uid ' . t3lib_BEfunc::deleteClause($table), $groupBy = '', $orderBy = '', $limit = ''); 00934 if ($checkres) { 00935 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($checkres)) { 00936 if (stristr($row[$fN], ',')) { 00937 $checkContent = explode(',', $row[$fN]); 00938 foreach ($checkContent as $singleValue) { 00939 if (!stristr($singleValue, '_')) { 00940 $dontPrefixFirstTable = 1; 00941 } 00942 } 00943 } else { 00944 $singleValue = $row[$fN]; 00945 if (strlen($singleValue) && !stristr($singleValue, '_')) { 00946 $dontPrefixFirstTable = 1; 00947 } 00948 } 00949 } 00950 $GLOBALS['TYPO3_DB']->sql_free_result($checkres); 00951 } 00952 } 00953 } else { 00954 $from_table_Arr[0] = $fieldSetup['allowed']; 00955 } 00956 if ($fieldSetup['prepend_tname']) { 00957 $useTablePrefix = 1; 00958 } 00959 if ($fieldSetup['foreign_table']) { 00960 $from_table_Arr[0] = $fieldSetup['foreign_table']; 00961 } 00962 $counter = 0; 00963 foreach ($from_table_Arr as $from_table) { 00964 if (($useTablePrefix && !$dontPrefixFirstTable && $counter != 1) || $counter == 1) { 00965 $tablePrefix = $from_table . '_'; 00966 } 00967 $counter = 1; 00968 if (is_array($TCA[$from_table])) { 00969 t3lib_div::loadTCA($from_table); 00970 $labelField = $TCA[$from_table]['ctrl']['label']; 00971 $altLabelField = $TCA[$from_table]['ctrl']['label_alt']; 00972 if ($TCA[$from_table]['columns'][$labelField]['config']['items']) { 00973 reset($TCA[$from_table]['columns'][$labelField]['config']['items']); 00974 while (list(, $labelArray) = each($TCA[$from_table]['columns'][$labelField]['config']['items'])) { 00975 if (substr($labelArray[0], 0, 4) == 'LLL:') { 00976 $labelFieldSelect[$labelArray[1]] = $GLOBALS['LANG']->sL($labelArray[0]); 00977 } else { 00978 $labelFieldSelect[$labelArray[1]] = $labelArray[0]; 00979 } 00980 } 00981 $useSelectLabels = 1; 00982 } 00983 if ($TCA[$from_table]['columns'][$altLabelField]['config']['items']) { 00984 reset($TCA[$from_table]['columns'][$altLabelField]['config']['items']); 00985 foreach ($TCA[$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) { 00986 if (substr($altLabelArray[0], 0, 4) == 'LLL:') { 00987 $altLabelFieldSelect[$altLabelArray[1]] = $GLOBALS['LANG']->sL($altLabelArray[0]); 00988 } else { 00989 $altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0]; 00990 } 00991 } 00992 $useAltSelectLabels = 1; 00993 } 00994 $altLabelFieldSelect = $altLabelField ? ',' . $altLabelField : ''; 00995 $select_fields = 'uid,' . $labelField . $altLabelFieldSelect; 00996 if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) { 00997 $webMounts = $GLOBALS['BE_USER']->returnWebmounts(); 00998 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); 00999 $webMountPageTree = ''; 01000 foreach ($webMounts as $key => $val) { 01001 if ($webMountPageTree) { 01002 $webMountPageTreePrefix = ','; 01003 } 01004 $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, $begin = 0, $perms_clause); 01005 } 01006 if ($from_table == 'pages') { 01007 $where_clause = 'uid IN (' . $webMountPageTree . ') ' . t3lib_BEfunc::deleteClause($from_table) . ' AND ' . $perms_clause; 01008 } else { 01009 $where_clause = 'pid IN (' . $webMountPageTree . ') ' . t3lib_BEfunc::deleteClause($from_table); 01010 } 01011 } else { 01012 $where_clause = 'uid' . t3lib_BEfunc::deleteClause($from_table); 01013 } 01014 $orderBy = 'uid'; 01015 if (!$this->tableArray[$from_table]) { 01016 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy, $limit = ''); 01017 $this->tableArray[$from_table] = array(); 01018 } 01019 if ($res) { 01020 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 01021 $this->tableArray[$from_table][] = $row; 01022 } 01023 $GLOBALS['TYPO3_DB']->sql_free_result($res); 01024 } 01025 reset($this->tableArray[$from_table]); 01026 foreach ($this->tableArray[$from_table] as $key => $val) { 01027 $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 1 ? 'on' : 01028 $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix']; 01029 $prefixString = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 'on' ? '' : ' [' . $tablePrefix . $val['uid'] . '] '; 01030 if (t3lib_div::inList($fV, $tablePrefix . $val['uid']) || $fV == $tablePrefix . $val['uid']) { 01031 if ($useSelectLabels) { 01032 if (!$out) { 01033 $out = htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]); 01034 } else { 01035 $out .= $splitString . htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]); 01036 } 01037 } elseif ($val[$labelField]) { 01038 if (!$out) { 01039 $out = htmlspecialchars($prefixString . $val[$labelField]); 01040 } else { 01041 $out .= $splitString . htmlspecialchars($prefixString . $val[$labelField]); 01042 } 01043 } elseif ($useAltSelectLabels) { 01044 if (!$out) { 01045 $out = htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]); 01046 } else { 01047 $out .= $splitString . htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]); 01048 } 01049 } else { 01050 if (!$out) { 01051 $out = htmlspecialchars($prefixString . $val[$altLabelField]); 01052 } else { 01053 $out .= $splitString . htmlspecialchars($prefixString . $val[$altLabelField]); 01054 } 01055 } 01056 } 01057 } 01058 } 01059 } 01060 } 01061 return $out; 01062 } 01063 01064 /** 01065 * Render table header 01066 * 01067 * @param array row: Table columns 01068 * @param array conf: Table TCA 01069 * @param string table: Table name 01070 * @return string HTML of table header 01071 */ 01072 function resultRowTitles($row, $conf, $table) { 01073 $SET = $GLOBALS['SOBE']->MOD_SETTINGS; 01074 01075 $tableHeader = array(); 01076 01077 // Start header row 01078 $tableHeader[] = '<thead><tr class="bgColor5">'; 01079 01080 // Iterate over given columns 01081 foreach ($row as $fieldName => $fieldValue) { 01082 if (t3lib_div::inList($SET['queryFields'], $fieldName) || (!$SET['queryFields'] && $fieldName != 'pid' && $fieldName != 'deleted')) { 01083 $THparams = (strlen($fieldValue) < 50) ? ' style="white-space:nowrap;"' : ''; 01084 01085 if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) { 01086 $title = $GLOBALS['LANG']->sL($conf['columns'][$fieldName]['label'] ? $conf['columns'][$fieldName]['label'] : $fieldName, 1); 01087 } else { 01088 $title = $GLOBALS['LANG']->sL($fieldName, 1); 01089 } 01090 01091 $tableHeader[] = '<th' . $THparams . '>' . $title . '</th>'; 01092 } 01093 } 01094 01095 // Add empty icon column 01096 $tableHeader[] = '<th style="white-space:nowrap;"></th>'; 01097 // Close header row 01098 $tableHeader[] = '</tr></thead>'; 01099 01100 return implode($tableHeader, LF); 01101 } 01102 01103 /** 01104 * [Describe function...] 01105 * 01106 * @param [type] $row: ... 01107 * @param [type] $conf: ... 01108 * @param [type] $table: ... 01109 * @return [type] ... 01110 */ 01111 function csvRowTitles($row, $conf, $table) { 01112 $out = ''; 01113 $SET = $GLOBALS['SOBE']->MOD_SETTINGS; 01114 foreach ($row as $fN => $fV) { 01115 if (t3lib_div::inList($SET['queryFields'], $fN) || (!$SET['queryFields'] && $fN != 'pid')) { 01116 if (!$out) { 01117 if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) { 01118 $out = $GLOBALS['LANG']->sL($conf['columns'][$fN]['label'] ? $conf['columns'][$fN]['label'] : $fN, 1); 01119 } else { 01120 $out = $GLOBALS['LANG']->sL($fN, 1); 01121 } 01122 } else { 01123 if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) { 01124 $out .= ',' . $GLOBALS['LANG']->sL($conf['columns'][$fN]['label'] ? $conf['columns'][$fN]['label'] : $fN, 1); 01125 } else { 01126 $out .= ',' . $GLOBALS['LANG']->sL($fN, 1); 01127 } 01128 } 01129 } 01130 } 01131 return $out; 01132 } 01133 01134 /** 01135 * Sets the current name of the input form. 01136 * 01137 * @param string $formName: The name of the form. 01138 * @return void 01139 */ 01140 public function setFormName($formName) { 01141 $this->formName = trim($formName); 01142 } 01143 } 01144 01145 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_fullsearch.php'])) { 01146 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_fullsearch.php']); 01147 } 01148 ?>
1.8.0