8e5abb6675d8511ef963b784ec6fb5946da448ed
2 /***************************************************************
5 * (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Module: Database integrity check
30 * This module lets you check if all pages and the records relate properly to each other
32 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
33 * @coauthor Jo Hasenau <info@cybercraft.de>
36 * [CLASS/FUNCTION INDEX of SCRIPT]
40 * 89: class SC_mod_tools_dbint_index
41 * 105: function init()
42 * 119: function jumpToUrl(URL)
43 * 139: function menuConfig()
44 * 226: function main()
45 * 270: function printContent()
46 * 281: function func_default()
48 * SECTION: Functionality implementation
49 * 314: function func_refindex()
50 * 344: function func_search()
51 * 386: function func_tree()
52 * 409: function func_records()
53 * 507: function func_relations()
54 * 558: function func_filesearch()
55 * 607: function findFile($basedir,$pattern,&$matching_files,$depth)
58 * (This index is automatically created/updated by the extension "extdeveval")
65 require ($BACK_PATH.'init.php');
66 require ($BACK_PATH.'template.php');
68 $GLOBALS['LANG']->includeLLFile('EXT:lowlevel/dbint/locallang.xml');
69 $BE_USER->modAccess($MCONF,1);
77 * Script class for the DB int module
79 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
81 * @subpackage tx_lowlevel
83 class SC_mod_tools_dbint_index
{
86 var $MOD_MENU = array();
87 var $MOD_SETTINGS = array();
90 * document template object
99 protected $formName = 'queryform';
108 global $LANG,$BACK_PATH;
109 $this->MCONF
= $GLOBALS['MCONF'];
113 $this->doc
= t3lib_div
::makeInstance('template');
114 $this->doc
->backPath
= $BACK_PATH;
115 $this->doc
->setModuleTemplate('templates/dbint.html');
116 $this->doc
->form
='<form action="" method="post" name="'.$this->formName
.'">';
119 $this->doc
->JScode
= '
120 <script language="javascript" type="text/javascript">
122 function jumpToUrl(URL) {
123 window.location.href = URL;
127 $this->doc
->table_TABLE
= '<table border="0" cellspacing="0" cellpadding="0" class="typo3-dblist" style="width:400px!important;">
128 <colgroup><col width="24"><col width="300"><col width="76"></colgroup>';
130 $this->doc
->tableLayout
= array (
132 'defCol' => array('<td class="t3-row-header"><img src="' . $this->doc
->backPath
. 'clear.gif" width="10" height="1" alt="" /></td><td valign="top" class="t3-row-header"><strong>', '</strong></td>')
135 '0' => array('<td valign="top">','</td>'),
136 '1' => array('<td valign="top">','</td>'),
137 'defCol' => array('<td><img src="' . $this->doc
->backPath
. 'clear.gif" width="15" height="1" alt="" /></td><td valign="top">', '</td>')
147 function menuConfig() {
151 // If array, then it's a selector box menu
152 // If empty string it's just a variable, that'll be saved.
153 // Values NOT in this array will not be saved in the settings-array for the module.
154 $this->MOD_MENU
= array(
156 0 => $GLOBALS['LANG']->getLL('menu', true),
157 'records' => $GLOBALS['LANG']->getLL('recordStatistics', true),
158 'relations' => $GLOBALS['LANG']->getLL('databaseRelations', true),
159 'search' => $GLOBALS['LANG']->getLL('fullSearch', true),
160 'filesearch' => $GLOBALS['LANG']->getLL('findFilename', true),
161 'refindex' => $GLOBALS['LANG']->getLL('manageRefIndex', true),
164 'raw' => $GLOBALS['LANG']->getLL('rawSearch', true),
165 'query' => $GLOBALS['LANG']->getLL('advancedQuery', true)
168 'search_query_smallparts' => '',
169 'search_result_labels' => '',
170 'labels_noprefix' => '',
171 'options_sortlabel' => '',
172 'show_deleted' => '',
174 'queryConfig' => '', // Current query
175 'queryTable' => '', // Current table
176 'queryFields' => '', // Current tableFields
177 'queryLimit' => '', // Current limit
178 'queryOrder' => '', // Current Order field
179 'queryOrderDesc' => '', // Current Order field descending flag
180 'queryOrder2' => '', // Current Order2 field
181 'queryOrder2Desc' => '', // Current Order2 field descending flag
182 'queryGroup' => '', // Current Group field
184 'storeArray' => '', // Used to store the available Query config memory banks
185 'storeQueryConfigs' => '', // Used to store the available Query configs in memory
187 'search_query_makeQuery' => array(
188 'all' => $GLOBALS['LANG']->getLL('selectRecords', true),
189 'count' => $GLOBALS['LANG']->getLL('countResults', true),
190 'explain' => $GLOBALS['LANG']->getLL('explainQuery', true),
191 'csv' => $GLOBALS['LANG']->getLL('csvExport', true),
192 'xml' => $GLOBALS['LANG']->getLL('xmlExport', true)
198 $OLD_MOD_SETTINGS = t3lib_BEfunc
::getModuleData($this->MOD_MENU
,'', $this->MCONF
['name'], 'ses');
199 $this->MOD_SETTINGS
= t3lib_BEfunc
::getModuleData($this->MOD_MENU
, t3lib_div
::_GP('SET'), $this->MCONF
['name'], 'ses');
201 if (t3lib_div
::_GP('queryConfig')) {
202 $qA = t3lib_div
::_GP('queryConfig');
203 $this->MOD_SETTINGS
= t3lib_BEfunc
::getModuleData($this->MOD_MENU
, array('queryConfig'=>serialize($qA)), $this->MCONF
['name'], 'ses');
205 $addConditionCheck = t3lib_div
::_GP('qG_ins');
206 foreach ($OLD_MOD_SETTINGS as $key=>$val) {
207 if (substr($key, 0, 5)=='query' && $this->MOD_SETTINGS
[$key]!=$val && $key!='queryLimit' && $key!='use_listview') {
208 $setLimitToStart = 1;
209 if ($key == 'queryTable' && !$addConditionCheck) {
210 $this->MOD_SETTINGS
['queryConfig'] = '';
213 if ($key=='queryTable' && $this->MOD_SETTINGS
[$key]!=$val) {
214 $this->MOD_SETTINGS
['queryFields'] = '';
217 if ($setLimitToStart) {
218 $currentLimit = explode(',',$this->MOD_SETTINGS
['queryLimit']);
219 if ($currentLimit[1]) {
220 $this->MOD_SETTINGS
['queryLimit']='0,'.$currentLimit[1];
222 $this->MOD_SETTINGS
['queryLimit']='0';
224 $this->MOD_SETTINGS
= t3lib_BEfunc
::getModuleData($this->MOD_MENU
, $this->MOD_SETTINGS
, $this->MCONF
['name'], 'ses');
234 global $BE_USER,$LANG;
237 if (!$GLOBALS['BE_USER']->userTS
['mod.']['dbint.']['disableTopMenu']) {
238 $this->menu
= t3lib_BEfunc
::getFuncMenu(0,'SET[function]',$this->MOD_SETTINGS
['function'],$this->MOD_MENU
['function']);
241 switch($this->MOD_SETTINGS
['function']) {
243 $this->func_search();
246 $this->func_records();
249 $this->func_relations();
252 $this->func_filesearch();
255 $this->func_refindex();
258 $this->func_default();
262 // Setting up the buttons and markers for docheader
263 $docHeaderButtons = $this->getButtons();
265 'CSH' => $docHeaderButtons['csh'],
266 'FUNC_MENU' => $this->getFuncMenu(),
267 'CONTENT' => $this->content
270 // Build the <body> for the module
271 $this->content
= $this->doc
->moduleBody($this->pageinfo
, $docHeaderButtons, $markers);
272 // Renders the module page
273 $this->content
= $this->doc
->render(
274 $GLOBALS['LANG']->getLL('title'),
284 function printContent() {
289 * Create the panel of buttons for submitting the form or otherwise perform operations.
291 * @return array all available buttons as an assoc. array
293 protected function getButtons() {
300 //$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
303 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
304 $buttons['shortcut'] = $this->doc
->makeShortcutIcon('','function,search,search_query_makeQuery',$this->MCONF
['name']);
310 * Create the function menu
312 * @return string HTML of the function menu
314 protected function getFuncMenu() {
315 if (!$GLOBALS['BE_USER']->userTS
['mod.']['dbint.']['disableTopMenu']) {
316 $funcMenu = t3lib_BEfunc
::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS
['function'], $this->MOD_MENU
['function']);
326 function func_default() {
327 $this->content
.= $this->doc
->header($GLOBALS['LANG']->getLL('title'));
329 $content = '<dl class="t3-overview-list">';
331 $availableModFuncs = array('records', 'relations', 'search', 'filesearch', 'refindex');
332 foreach ($availableModFuncs as $modFunc) {
333 $link = 'index.php?SET[function]=' . $modFunc;
334 $title = $GLOBALS['LANG']->getLL($modFunc);
335 $description = $GLOBALS['LANG']->getLL($modFunc . '_description');
337 <dt><a href="' . $link . '">' . $title . '</a></dt>
338 <dd>' . $description . '</dd>
343 $this->content
.= $content;
353 /****************************
355 * Functionality implementation
357 ****************************/
360 * Check and update reference index!
364 function func_refindex() {
365 global $TYPO3_DB,$TCA;
367 if (t3lib_div
::_GP('_update') || t3lib_div
::_GP('_check')) {
368 $testOnly = t3lib_div
::_GP('_check')?
TRUE:FALSE;
370 // Call the functionality
371 $refIndexObj = t3lib_div
::makeInstance('t3lib_refindex');
372 list($headerContent,$bodyContent) = $refIndexObj->updateIndex($testOnly);
375 $this->content
.=$this->doc
->section($headerContent,str_replace(LF
,'<br/>',$bodyContent),0,1);
379 $content = '<p>' . $GLOBALS['LANG']->getLL('referenceIndex_description') . '</p><br />';
380 $content .= '<input type="submit" name="_check" value="' . $GLOBALS['LANG']->getLL('referenceIndex_buttonCheck') . '" /> <input type="submit" name="_update" value="' . $GLOBALS['LANG']->getLL('referenceIndex_buttonUpdate') . '" /><br /><br />';
381 $content .= '<h3>' . $GLOBALS['LANG']->getLL('checkScript_headline') . '</h3>';
382 $content.= '<p>' . $GLOBALS['LANG']->getLL('checkScript') . '</p>';
383 $content.= '<h4>' . $GLOBALS['LANG']->getLL('checkScript_check_description') . '</h4>' .
384 '<code>php ' . PATH_typo3
. 'cli_dispatch.phpsh lowlevel_refindex -c</code><br />';
385 $content.= '<h4>' . $GLOBALS['LANG']->getLL('checkScript_update_description') . '</h4>' .
386 '<code>php ' . PATH_typo3
. 'cli_dispatch.phpsh lowlevel_refindex -e</code><br /><br />';
387 $content.= '<div class="typo3-message message-information"><div class="message-body">' . $GLOBALS['LANG']->getLL('checkScript_information') . '</div></div>';
388 $content.= '<p>' . $GLOBALS['LANG']->getLL('checkScript_moreDetails') . '<br /><a href="' . $GLOBALS['BACK_PATH'] . 'sysext/lowlevel/HOWTO_clean_up_TYPO3_installations.txt" target="_new">' . PATH_typo3
. 'sysext/lowlevel/HOWTO_clean_up_TYPO3_installations.txt</a></p>';
390 $this->content
.= $this->doc
->section($GLOBALS['LANG']->getLL('updateRefIndex'), $content, false, true);
394 * Search (Full / Advanced)
398 function func_search() {
401 $fullsearch = t3lib_div
::makeInstance('t3lib_fullsearch');
402 $fullsearch->setFormName($this->formName
);
403 $this->content
.= $this->doc
->header($GLOBALS['LANG']->getLL('search'));
404 $this->content
.= $this->doc
->spacer(5);
407 if (!$GLOBALS['BE_USER']->userTS
['mod.']['dbint.']['disableTopMenu']) {
408 $menu2 = t3lib_BEfunc
::getFuncMenu(0, 'SET[search]', $this->MOD_SETTINGS
['search'], $this->MOD_MENU
['search']);
410 if ($this->MOD_SETTINGS
['search']=='query' && !$GLOBALS['BE_USER']->userTS
['mod.']['dbint.']['disableTopMenu']) {
411 $menu2 .= t3lib_BEfunc
::getFuncMenu(0, 'SET[search_query_makeQuery]', $this->MOD_SETTINGS
['search_query_makeQuery'], $this->MOD_MENU
['search_query_makeQuery']) . '<br />';
413 if (!$GLOBALS['BE_USER']->userTS
['mod.']['dbint.']['disableTopCheckboxes'] && $this->MOD_SETTINGS
['search']=='query') {
414 $menu2 .= t3lib_BEfunc
::getFuncCheck($GLOBALS['SOBE']->id
, 'SET[search_query_smallparts]', $this->MOD_SETTINGS
['search_query_smallparts'], '', '', 'id="checkSearch_query_smallparts"') . ' <label for="checkSearch_query_smallparts">' . $GLOBALS['LANG']->getLL('showSQL') . '</label><br />';
415 $menu2 .= t3lib_BEfunc
::getFuncCheck($GLOBALS['SOBE']->id
, 'SET[search_result_labels]', $this->MOD_SETTINGS
['search_result_labels'], '', '', 'id="checkSearch_result_labels"') . ' <label for="checkSearch_result_labels">' . $GLOBALS['LANG']->getLL('useFormattedStrings') . '</label><br />';
416 $menu2 .= t3lib_BEfunc
::getFuncCheck($GLOBALS['SOBE']->id
, 'SET[labels_noprefix]', $this->MOD_SETTINGS
['labels_noprefix'], '', '', 'id="checkLabels_noprefix"') . ' <label for="checkLabels_noprefix">' . $GLOBALS['LANG']->getLL('dontUseOrigValues') . '</label><br />';
417 $menu2 .= t3lib_BEfunc
::getFuncCheck($GLOBALS['SOBE']->id
, 'SET[options_sortlabel]', $this->MOD_SETTINGS
['options_sortlabel'], '', '', 'id="checkOptions_sortlabel"') . ' <label for="checkOptions_sortlabel">' . $GLOBALS['LANG']->getLL('sortOptions') . '</label><br />';
418 $menu2 .= t3lib_BEfunc
::getFuncCheck($GLOBALS['SOBE']->id
, 'SET[show_deleted]', $this->MOD_SETTINGS
['show_deleted'], '', '', 'id="checkShow_deleted"') . ' <label for="checkShow_deleted">' . $GLOBALS['LANG']->getLL('showDeleted') . '</label>';
421 $this->content
.= $this->doc
->section('',$menu2).$this->doc
->spacer(10);
423 switch($this->MOD_SETTINGS
['search']) {
425 $this->content
.=$fullsearch->queryMaker();
429 $this->content
.=$this->doc
->section($GLOBALS['LANG']->getLL('searchOptions'), $fullsearch->form(), false, true);
430 $this->content
.=$this->doc
->section($GLOBALS['LANG']->getLL('result'), $fullsearch->search(), false, true);
441 function func_records() {
442 global $LANG,$TCA,$BACK_PATH,$PAGES_TYPES;
444 $admin = t3lib_div
::makeInstance('t3lib_admin');
445 $admin->genTree_makeHTML
= 0;
446 $admin->backPath
= $BACK_PATH;
447 $admin->genTree(0,'');
449 $this->content
.= $this->doc
->header($GLOBALS['LANG']->getLL('records'));
450 $this->content
.= $this->doc
->spacer(5);
454 $codeArr['tableheader'] = array('', $GLOBALS['LANG']->getLL('count'));
456 $codeArr[$i][]='<img' . t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/i/pages.gif','width="18" height="16"') . ' hspace="4" align="top" alt="" />';
457 $codeArr[$i][]=$GLOBALS['LANG']->getLL('total_pages');
458 $codeArr[$i][]=count($admin->page_idArray
);
460 if (t3lib_extMgm
::isLoaded('cms')) {
461 $codeArr[$i][]='<img' . t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/hidden_page.gif','width="18" height="16"') . ' hspace="4" align="top">';
462 $codeArr[$i][]=$GLOBALS['LANG']->getLL('hidden_pages');
463 $codeArr[$i][]=$admin->recStat
['hidden'];
466 $codeArr[$i][]='<img' . t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/deleted_page.gif','width="18" height="16"') . ' hspace="4" align="top">';
467 $codeArr[$i][]=$GLOBALS['LANG']->getLL('deleted_pages');
468 $codeArr[$i][]=$admin->recStat
['deleted'];
470 $this->content
.=$this->doc
->section($GLOBALS['LANG']->getLL('pages'), $this->doc
->table($codeArr), false, true);
474 $codeArr['tableheader'] = array($GLOBALS['LANG']->getLL('doktype_value'), $GLOBALS['LANG']->getLL('count'));
475 $doktype= $TCA['pages']['columns']['doktype']['config']['items'];
476 if (is_array($doktype)) {
477 foreach ($doktype as $n => $setup) {
478 if ($setup[1]!='--div--') {
479 $codeArr[$n][] = '<img' . t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/i/' . ($PAGES_TYPES[$setup[1]]['icon'] ?
$PAGES_TYPES[$setup[1]]['icon'] : $PAGES_TYPES['default']['icon']), 'width="18" height="16"') . ' hspace="4" align="top">';
480 $codeArr[$n][] = $GLOBALS['LANG']->sL($setup[0]) . ' (' . $setup[1] . ')';
481 $codeArr[$n][] = intval($admin->recStat
[doktype
][$setup[1]]);
484 $this->content
.=$this->doc
->section($GLOBALS['LANG']->getLL('doktype'), $this->doc
->table($codeArr), false, true);
487 // Tables and lost records
488 $id_list = '-1,0,' . implode(',', array_keys($admin->page_idArray
));
489 $id_list = rtrim($id_list, ',');
490 $admin->lostRecords($id_list);
492 if ($admin->fixLostRecord(t3lib_div
::_GET('fixLostRecords_table'), t3lib_div
::_GET('fixLostRecords_uid'))) {
493 $admin = t3lib_div
::makeInstance('t3lib_admin');
494 $admin->backPath
= $BACK_PATH;
495 $admin->genTree(0,'');
496 $id_list = '-1,0,' . implode(',', array_keys($admin->page_idArray
));
497 $id_list = rtrim($id_list, ',');
498 $admin->lostRecords($id_list);
501 $this->doc
->table_TABLE
= '<table border="0" cellspacing="0" cellpadding="0" class="typo3-dblist" style="width:700px!important;">';
504 $codeArr['tableheader'] = array(
505 $GLOBALS['LANG']->getLL('label'),
506 $GLOBALS['LANG']->getLL('tablename'),
507 $GLOBALS['LANG']->getLL('total_lost'),
511 $countArr = $admin->countRecords($id_list);
512 if (is_array($TCA)) {
514 foreach ($TCA as $t => $value) {
515 if ($TCA[$t]['ctrl']['hideTable']) {
518 $codeArr[$t][]=t3lib_iconWorks
::getSpriteIconForRecord($t, array());
519 $codeArr[$t][]=$LANG->sL($TCA[$t]['ctrl']['title']);
522 if ($countArr['all'][$t]) {
523 $theNumberOfRe = intval($countArr['non_deleted'][$t]).'/'.(intval($countArr['all'][$t])-intval($countArr['non_deleted'][$t]));
527 $codeArr[$t][]=$theNumberOfRe;
530 if (is_array($admin->lRecords
[$t])) {
531 foreach ($admin->lRecords
[$t] as $data) {
532 if (!t3lib_div
::inList($admin->lostPagesList
,$data[pid
])) {
533 $lr.= '<nobr><strong><a href="index.php?SET[function]=records&fixLostRecords_table=' . $t . '&fixLostRecords_uid=' . $data[uid
] . '"><img src="' . $BACK_PATH . 'gfx/required_h.gif" width="10" hspace="3" height="10" border="0" align="top" title="' . $GLOBALS['LANG']->getLL('fixLostRecord') . '"></a>uid:' . $data[uid
] . ', pid:' . $data[pid
] . ', ' . t3lib_div
::fixed_lgd_cs(strip_tags($data[title
]), 20) . '</strong></nobr><br>';
535 $lr.= '<nobr><img src="' . $BACK_PATH . 'clear.gif" width="16" height="1" border="0"><font color="Gray">uid:' . $data[uid
] . ', pid:' . $data[pid
] . ', ' . t3lib_div
::fixed_lgd_cs(strip_tags($data[title
]), 20) . '</font></nobr><br>';
541 $this->content
.=$this->doc
->section($GLOBALS['LANG']->getLL('tables'), $this->doc
->table($codeArr), false, true);
546 * Show list references
550 function func_relations() {
551 global $LANG,$BACK_PATH;
553 $this->content
.= $this->doc
->header($GLOBALS['LANG']->getLL('relations'));
554 $this->content
.= $this->doc
->spacer(5);
556 $admin = t3lib_div
::makeInstance('t3lib_admin');
557 $admin->genTree_makeHTML
=0;
558 $admin->backPath
= $BACK_PATH;
560 $fkey_arrays = $admin->getGroupFields('');
561 $admin->selectNonEmptyRecordsWithFkeys($fkey_arrays);
564 $fileTest = $admin->testFileRefs();
567 if (is_array($fileTest['noReferences'])) {
568 foreach ($fileTest['noReferences'] as $val) {
569 $code.='<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong></nobr><br>';
572 $this->content
.=$this->doc
->section($GLOBALS['LANG']->getLL('files_no_ref'), $code, true, true);
575 if (is_array($fileTest['moreReferences'])) {
576 foreach ($fileTest['moreReferences'] as $val) {
577 $code.='<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong>: ' . $val[2] . ' ' . $GLOBALS['LANG']->getLL('references') . '</nobr><br>' . $val[3] . '<br><br>';
580 $this->content
.=$this->doc
->section($GLOBALS['LANG']->getLL('files_many_ref'),$code, true, true);
583 if (is_array($fileTest['noFile'])) {
584 ksort($fileTest['noFile']);
585 foreach ($fileTest['noFile'] as $val) {
586 $code.='<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong> ' . $GLOBALS['LANG']->getLL('isMissing') . ' </nobr><br>' . $GLOBALS['LANG']->getLL('referencedFrom') . $val[2] . '<br><br>';
589 $this->content
.= $this->doc
->section($GLOBALS['LANG']->getLL('files_no_file'), $code, true, true);
590 $this->content
.= $this->doc
->section($GLOBALS['LANG']->getLL('select_db'), $admin->testDBRefs($admin->checkSelectDBRefs
), true, true);
591 $this->content
.= $this->doc
->section($GLOBALS['LANG']->getLL('group_db'), $admin->testDBRefs($admin->checkGroupDBRefs
), true, true);
595 * Searching for files with a specific pattern
599 function func_filesearch() {
600 $pattern = t3lib_div
::_GP('pattern');
601 $pcontent = $GLOBALS['LANG']->getLL('enterRegexPattern') . ' <input type="text" name="pattern" value="' . htmlspecialchars($pattern ?
$pattern : $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern']) . '"> <input type="submit" name="' . $GLOBALS['LANG']->getLL('SearchButton') . '">';
602 $this->content
.= $this->doc
->section($GLOBALS['LANG']->getLL('pattern'), $pcontent, false, true);
604 if (strcmp($pattern,'')) {
605 $dirs = t3lib_div
::get_dirs(PATH_site
);
609 foreach ($dirs as $key => $value) {
610 $matching_files=array();
612 if (!t3lib_div
::inList('typo3,typo3conf,tslib,media,t3lib',$value)) {
613 $info = $this->findFile(PATH_site
.$value.'/',$pattern,$matching_files,$depth);
615 if (is_array($info)) {
616 $lines[]='<hr><strong>' . $value . '/</strong> ' . $GLOBALS['LANG']->getLL('beingChecked');
617 $lines[]=$GLOBALS['LANG']->getLL('directories') . ' ' . $info[0];
618 if ($info[2]) $lines[]='<span class="typo3-red">' . $GLOBALS['LANG']->getLL('directoriesTooDeep') . ' ' . $depth . '</span>';
619 $lines[]=$GLOBALS['LANG']->getLL('files') . ' ' . $info[1];
620 $lines[]=$GLOBALS['LANG']->getLL('matchingFiles') . '<br><nobr><span class="typo3-red">' . implode('<br>', $matching_files) . '</span></nobr>';
622 $lines[]=$GLOBALS['TBE_TEMPLATE']->dfw('<hr><strong>' . $value . '/</strong> ' . $GLOBALS['LANG']->getLL('notChecked'));
626 $this->content
.=$this->doc
->section($GLOBALS['LANG']->getLL('searchingForFilenames'), implode('<br>', $lines), false, true);
631 * Searching for filename pattern recursively in the specified dir.
633 * @param string Base directory
634 * @param string Match pattern
635 * @param array Array of matching files, passed by reference
636 * @param integer Depth to recurse
637 * @return array Array with various information about the search result
638 * @see func_filesearch()
640 function findFile($basedir,$pattern,&$matching_files,$depth) {
646 $files = t3lib_div
::getFilesInDir($basedir,'',1);
647 if (is_array($files)) {
648 $files_searched+
=count($files);
649 foreach ($files as $value) {
650 if (preg_match('/'.$pattern.'/i',basename($value))) $matching_files[]=substr($value,strlen(PATH_site
));
657 $dirs = t3lib_div
::get_dirs($basedir);
658 if (is_array($dirs)) {
659 $dirs_searched+
=count($dirs);
661 foreach ($dirs as $value) {
662 $inf= $this->findFile($basedir.$value.'/',$pattern,$matching_files,$depth-1);
663 $dirs_searched+
=$inf[0];
664 $files_searched+
=$inf[1];
669 $dirs = t3lib_div
::get_dirs($basedir);
670 if (is_array($dirs) && count($dirs)) {
671 $dirs_error=1; // Means error - there were further subdirs!
675 return array($dirs_searched,$files_searched,$dirs_error);
680 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE
]['XCLASS']['ext/lowlevel/dbint/index.php'])) {
681 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE
]['XCLASS']['ext/lowlevel/dbint/index.php']);
687 $SOBE = t3lib_div
::makeInstance('SC_mod_tools_dbint_index');
690 $SOBE->printContent();