/** * Main function to generate the content * * @return void * @todo Define visibility */ public function main() { $this->content = $this->doc->header('Indexing Engine Statistics'); $this->content .= $this->doc->spacer(5); switch ($this->MOD_SETTINGS['function']) { case 'stat': $this->content .= $this->doc->section('Records', $this->doc->table($this->getRecordsNumbers()), 0, 1); $this->content .= $this->doc->spacer(15); $this->content .= $this->doc->section('index_phash TYPES', $this->doc->table($this->getPhashTypes()), 1); $this->content .= $this->doc->spacer(15); break; case 'externalDocs': $this->content .= $this->doc->section('External documents', $this->doc->table($this->getPhashExternalDocs()), 0, 1); $this->content .= $this->doc->spacer(15); break; case 'typo3pages': $this->content .= $this->doc->section('TYPO3 Pages', $this->doc->table($this->getPhashT3pages()), 0, 1); $this->content .= $this->doc->spacer(15); break; } $docHeaderButtons = $this->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content); $this->content = $this->doc->startPage('Indexing Engine Statistics'); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * [Describe function...] * * @return void * @todo Define visibility */ public function main() { $arrayBrowser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Lowlevel\\Utility\\ArrayBrowser'); $this->content = $this->doc->header($GLOBALS['LANG']->getLL('configuration', TRUE)); $this->content .= '<div id="lowlevel-config"> <label for="search_field">' . $GLOBALS['LANG']->getLL('enterSearchPhrase', TRUE) . '</label> <input type="text" id="search_field" name="search_field" value="' . htmlspecialchars($search_field) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' /> <input type="submit" name="search" id="search" value="' . $GLOBALS['LANG']->getLL('search', TRUE) . '" />'; $this->content .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"') . '<label for="checkRegexsearch">' . $GLOBALS['LANG']->getLL('useRegExp', TRUE) . '</label>'; $this->content .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck(0, 'SET[fixedLgd]', $this->MOD_SETTINGS['fixedLgd'], '', '', 'id="checkFixedLgd"') . '<label for="checkFixedLgd">' . $GLOBALS['LANG']->getLL('cropLines', TRUE) . '</label> </div>'; $this->content .= $this->doc->spacer(5); switch ($this->MOD_SETTINGS['function']) { case 0: $theVar = $GLOBALS['TYPO3_CONF_VARS']; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TYPO3_CONF_VARS'; break; case 1: foreach ($GLOBALS['TCA'] as $table => $config) { \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table); } $theVar = $GLOBALS['TCA']; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TCA'; break; case 2: $theVar = $GLOBALS['TCA_DESCR']; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TCA_DESCR'; break; case 3: $theVar = $GLOBALS['TYPO3_LOADED_EXT']; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TYPO3_LOADED_EXT'; break; case 4: $theVar = $GLOBALS['T3_SERVICES']; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$T3_SERVICES'; break; case 5: $theVar = $GLOBALS['TBE_MODULES']; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TBE_MODULES'; break; case 6: $theVar = $GLOBALS['TBE_MODULES_EXT']; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TBE_MODULES_EXT'; break; case 7: $theVar = $GLOBALS['TBE_STYLES']; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TBE_STYLES'; break; case 8: $theVar = $GLOBALS['BE_USER']->uc; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$BE_USER->uc'; break; case 9: $theVar = $GLOBALS['TYPO3_USER_SETTINGS']; \TYPO3\CMS\Core\Utility\GeneralUtility::naturalKeySortRecursive($theVar); $arrayBrowser->varName = '$TYPO3_USER_SETTINGS'; break; default: $theVar = array(); break; } // Update node: $update = 0; $node = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('node'); // If any plus-signs were clicked, it's registred. if (is_array($node)) { $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]); $update = 1; } if ($update) { $GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'], $this->MOD_SETTINGS); } $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]; $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch']; $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd']; $arrayBrowser->searchKeysToo = TRUE; $search_field = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('search_field'); // If any POST-vars are send, update the condition array if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('search') && trim($search_field)) { $arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array()); } // mask the encryption key to not show it as plaintext in the configuration module if ($theVar == $GLOBALS['TYPO3_CONF_VARS']) { $theVar['SYS']['encryptionKey'] = '***** (length: ' . strlen($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']) . ' characters)'; } $tree = $arrayBrowser->tree($theVar, '', ''); $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']]; $this->content .= $this->doc->sectionEnd(); // Variable name: if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('varname')) { $line = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_') ? \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_') : \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('varname'); // Write the line to extTables.php if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('writetoexttables')) { // change value to $GLOBALS $length = strpos($line, '['); $var = substr($line, 0, $length); $changedLine = '$GLOBALS[\'' . substr($line, 1, $length - 1) . '\']' . substr($line, $length); // load current extTables.php $extTables = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(PATH_typo3conf . TYPO3_extTableDef_script); if ($var === '$TCA') { // check if we are editing the TCA preg_match_all('/\\[\'([^\']+)\'\\]/', $line, $parts); if ($parts[1][1] !== 'ctrl') { // anything else than ctrl section requires to load TCA $loadTCA = 'TYPO3\\CMS\\Core\\Utility\\GeneralUtility::loadTCA(\'' . $parts[1][0] . '\');'; if (strpos($extTables, $loadTCA) === FALSE) { // check if the loadTCA statement is not already present in the file $changedLine = $loadTCA . LF . $changedLine; } } } // insert line in extTables.php $extTables = preg_replace('/<\\?php|\\?>/is', '', $extTables); $extTables = '<?php' . (empty($extTables) ? LF : '') . $extTables . $changedLine . LF . '?>'; $success = \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables); if ($success) { // show flash message $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('writeMessage', TRUE), TYPO3_extTableDef_script, '<br />', '<strong>' . nl2br($changedLine) . '</strong>'), \TYPO3\CMS\Core\Messaging\FlashMessage::OK); } else { // Error: show flash message $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('writeMessageFailed', TRUE), TYPO3_extTableDef_script), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); } $this->content .= $flashMessage->render(); } $this->content .= '<div id="lowlevel-config-var"> <strong>' . $GLOBALS['LANG']->getLL('variable', TRUE) . '</strong><br /> <input type="text" name="_" value="' . trim(htmlspecialchars($line)) . '" size="120" /><br/>'; if (TYPO3_extTableDef_script !== '' && ($this->MOD_SETTINGS['function'] === '1' || $this->MOD_SETTINGS['function'] === '4')) { // write only for $TCA and TBE_STYLES if TYPO3_extTableDef_script is defined $this->content .= '<br /><input type="submit" name="writetoexttables" value="' . $GLOBALS['LANG']->getLL('writeValue', TRUE) . '" /></div>'; } else { $this->content .= $GLOBALS['LANG']->getLL('copyPaste', TRUE) . LF . '</div>'; } } $this->content .= '<br /><table border="0" cellpadding="0" cellspacing="0" class="t3-tree t3-tree-config">'; $this->content .= '<tr> <th class="t3-row-header t3-tree-config-header">' . $label . '</th> </tr> <tr> <td>' . $tree . '</td> </tr> </table> '; // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu(), 'CONTENT' => $this->content); // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render('Configuration', $this->content); }