00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 unset($MCONF);
00052 require ('conf.php');
00053 require ($BACK_PATH.'init.php');
00054 require ($BACK_PATH.'template.php');
00055 $GLOBALS['LANG']->includeLLFile('EXT:lowlevel/config/locallang.xml');
00056
00057 $BE_USER->modAccess($MCONF,1);
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 class SC_mod_tools_config_index {
00073
00074 var $MCONF = array();
00075 var $MOD_MENU = array();
00076 var $MOD_SETTINGS = array();
00077
00078
00079
00080
00081
00082
00083 var $doc;
00084
00085 var $include_once = array();
00086 var $content;
00087
00088
00089
00090
00091
00092
00093
00094
00095 function init() {
00096 global $BACK_PATH;
00097
00098 $this->MCONF = $GLOBALS['MCONF'];
00099
00100 $this->menuConfig();
00101
00102 $this->doc = t3lib_div::makeInstance('template');
00103 $this->doc->backPath = $BACK_PATH;
00104 $this->doc->setModuleTemplate('templates/config.html');
00105
00106
00107 $this->doc->JScode = '
00108 <script language="javascript" type="text/javascript">
00109 script_ended = 0;
00110 function jumpToUrl(URL) {
00111 window.location.href = URL;
00112 }
00113 </script>
00114 ';
00115
00116 $this->doc->form = '<form action="" method="post">';
00117 }
00118
00119
00120
00121
00122
00123
00124 function menuConfig() {
00125 global $TYPO3_CONF_VARS;
00126
00127
00128
00129
00130
00131 $this->MOD_MENU = array(
00132 'function' => array(
00133 0 => $GLOBALS['LANG']->getLL('typo3ConfVars', true),
00134 1 => $GLOBALS['LANG']->getLL('tca', true),
00135 2 => $GLOBALS['LANG']->getLL('tcaDescr', true),
00136 3 => $GLOBALS['LANG']->getLL('loadedExt', true),
00137 4 => $GLOBALS['LANG']->getLL('t3services', true),
00138 5 => $GLOBALS['LANG']->getLL('tbemodules', true),
00139 6 => $GLOBALS['LANG']->getLL('tbemodulesext', true),
00140 7 => $GLOBALS['LANG']->getLL('tbeStyles', true),
00141 8 => $GLOBALS['LANG']->getLL('beUser', true),
00142 9 => $GLOBALS['LANG']->getLL('usersettings', true),
00143 ),
00144 'regexsearch' => '',
00145 'fixedLgd' => ''
00146 );
00147
00148
00149 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00150 }
00151
00152
00153
00154
00155
00156
00157 function main() {
00158
00159 $arrayBrowser = t3lib_div::makeInstance('t3lib_arrayBrowser');
00160
00161 $this->content= $this->doc->header($GLOBALS['LANG']->getLL('configuration', true));
00162 $this->content.= $this->doc->spacer(5);
00163
00164 $this->content .= '<div id="lowlevel-config">
00165 <label for="search_field">' . $GLOBALS['LANG']->getLL('enterSearchPhrase', true) . '</label>
00166 <input type="text" id="search_field" name="search_field" value="' . htmlspecialchars($search_field) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />
00167 <input type="submit" name="search" id="search" value="' . $GLOBALS['LANG']->getLL('search', true) . '" />';
00168 $this->content .= t3lib_BEfunc::getFuncCheck(0,'SET[regexsearch]',$this->MOD_SETTINGS['regexsearch'],'','','id="checkRegexsearch"') .
00169 '<label for="checkRegexsearch">' . $GLOBALS['LANG']->getLL('useRegExp', true) . '</label>';
00170
00171 $this->content.= t3lib_BEfunc::getFuncCheck(0, 'SET[fixedLgd]', $this->MOD_SETTINGS['fixedLgd'], '', '', 'id="checkFixedLgd"') .
00172 '<label for="checkFixedLgd">' . $GLOBALS['LANG']->getLL('cropLines', true) . '</label>
00173 </div>';
00174
00175 $this->content.= $this->doc->spacer(5);
00176
00177 switch($this->MOD_SETTINGS['function']) {
00178 case 0:
00179 $theVar = $GLOBALS['TYPO3_CONF_VARS'];
00180 $arrayBrowser->varName = '$TYPO3_CONF_VARS';
00181 break;
00182 case 1:
00183 foreach ($GLOBALS['TCA'] as $table => $config) {
00184 t3lib_div::loadTCA($table);
00185 }
00186 $theVar = $GLOBALS['TCA'];
00187 $arrayBrowser->varName = '$TCA';
00188 break;
00189 case 2:
00190 $theVar = $GLOBALS['TCA_DESCR'];
00191 $arrayBrowser->varName = '$TCA_DESCR';
00192 break;
00193 case 3:
00194 $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
00195 $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
00196 break;
00197 case 4:
00198 $theVar = $GLOBALS['T3_SERVICES'];
00199 $arrayBrowser->varName = '$T3_SERVICES';
00200 break;
00201 case 5:
00202 $theVar = $GLOBALS['TBE_MODULES'];
00203 $arrayBrowser->varName = '$TBE_MODULES';
00204 break;
00205 case 6:
00206 $theVar = $GLOBALS['TBE_MODULES_EXT'];
00207 $arrayBrowser->varName = '$TBE_MODULES_EXT';
00208 break;
00209 case 7:
00210 $theVar = $GLOBALS['TBE_STYLES'];
00211 $arrayBrowser->varName = '$TBE_STYLES';
00212 break;
00213 case 8:
00214 $theVar = $GLOBALS['BE_USER']->uc;
00215 $arrayBrowser->varName = '$BE_USER->uc';
00216 break;
00217 case 9:
00218 $theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
00219 $arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
00220 break;
00221 default:
00222 $theVar = array();
00223 break;
00224 }
00225
00226
00227
00228 $update = 0;
00229 $node = t3lib_div::_GET('node');
00230 if (is_array($node)) {
00231 $this->MOD_SETTINGS['node_'.$this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_'.$this->MOD_SETTINGS['function']]);
00232 $update = 1;
00233 }
00234 if ($update) {
00235 $GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'],$this->MOD_SETTINGS);
00236 }
00237
00238 $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_'.$this->MOD_SETTINGS['function']];
00239 $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
00240 $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
00241 $arrayBrowser->searchKeysToo = TRUE;
00242
00243
00244 $search_field = t3lib_div::_GP('search_field');
00245 if (t3lib_div::_POST('search') && trim($search_field)) {
00246 $arrayBrowser->depthKeys=$arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
00247 }
00248
00249 $tree = $arrayBrowser->tree($theVar, '', '');
00250
00251 $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
00252 $this->content.= $this->doc->sectionEnd();
00253
00254
00255 if (t3lib_div::_GP('varname')) {
00256 $line = t3lib_div::_GP('_') ? t3lib_div::_GP('_') : t3lib_div::_GP('varname');
00257 if (t3lib_div::_GP('writetoexttables')) {
00258
00259 $length = strpos($line, '[');
00260 $var = substr($line, 0, $length);
00261 $changedLine = '$GLOBALS[\'' . substr($line, 1, $length - 1) . '\']' . substr($line, $length);
00262
00263 $extTables = t3lib_div::getURL(PATH_typo3conf . TYPO3_extTableDef_script);
00264 $extTables = '<?php' . preg_replace('/<\?php|\?>/is', '', $extTables) . $changedLine . LF . '?>';
00265 $success = t3lib_div::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables);
00266 if ($success) {
00267
00268 $flashMessage = t3lib_div::makeInstance(
00269 't3lib_FlashMessage',
00270 '',
00271 sprintf($GLOBALS['LANG']->getLL('writeMessage', TRUE), TYPO3_extTableDef_script, '<br />', '<strong>' . $changedLine . '</strong>'),
00272 t3lib_FlashMessage::OK
00273 );
00274 } else {
00275
00276 $flashMessage = t3lib_div::makeInstance(
00277 't3lib_FlashMessage',
00278 '',
00279 sprintf($GLOBALS['LANG']->getLL('writeMessageFailed', TRUE), TYPO3_extTableDef_script),
00280 t3lib_FlashMessage::ERROR
00281 );
00282 }
00283 $this->content .= $flashMessage->render();
00284 }
00285 $this->content .= '<div id="lowlevel-config-var">
00286 <strong>' . $GLOBALS['LANG']->getLL('variable', TRUE) . '</strong><br />
00287 <input type="text" name="_" value="'.trim(htmlspecialchars($line)).'" size="120" /><br/>';
00288
00289 if (TYPO3_extTableDef_script !== '' && ($this->MOD_SETTINGS['function'] === '1' || $this->MOD_SETTINGS['function'] === '4')) {
00290
00291 $this->content .= '<br /><input type="submit" name="writetoexttables" value="' .
00292 $GLOBALS['LANG']->getLL('writeValue', TRUE) . '" /></div>';
00293 } else {
00294 $this->content .= $GLOBALS['LANG']->getLL('copyPaste', TRUE) . LF . '</div>';
00295 }
00296
00297 }
00298
00299 $this->content.= '<br /><table border="0" cellpadding="0" cellspacing="0" class="t3-tree t3-tree-config">';
00300 $this->content.= '<tr>
00301 <th class="t3-row-header t3-tree-config-header">' . $label . '</th>
00302 </tr>
00303 <tr>
00304 <td>' . $tree . '</td>
00305 </tr>
00306 </table>
00307 ';
00308
00309
00310
00311 $docHeaderButtons = $this->getButtons();
00312 $markers = array(
00313 'CSH' => $docHeaderButtons['csh'],
00314 'FUNC_MENU' => $this->getFuncMenu(),
00315 'CONTENT' => $this->content
00316 );
00317
00318
00319 $this->content = $this->doc->startPage('Configuration');
00320
00321 $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00322 $this->content.= $this->doc->endPage();
00323 $this->content = $this->doc->insertStylesAndJS($this->content);
00324 }
00325
00326
00327
00328
00329
00330
00331 function printContent() {
00332 echo $this->content;
00333 }
00334
00335
00336
00337
00338
00339
00340 protected function getButtons() {
00341
00342 $buttons = array(
00343 'csh' => '',
00344 'shortcut' => ''
00345 );
00346
00347
00348
00349
00350 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
00351 $buttons['shortcut'] = $this->doc->makeShortcutIcon('','function',$this->MCONF['name']);
00352 }
00353 return $buttons;
00354 }
00355
00356
00357
00358
00359
00360
00361 protected function getFuncMenu() {
00362 $funcMenu = t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
00363 return $funcMenu;
00364 }
00365 }
00366
00367
00368 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/config/index.php']) {
00369 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/config/index.php']);
00370 }
00371
00372
00373
00374
00375
00376 $SOBE = t3lib_div::makeInstance('SC_mod_tools_config_index');
00377 $SOBE->init();
00378 $SOBE->main();
00379 $SOBE->printContent();
00380 ?>