Fixed bug #11136: Validation issue: End tag for "br" omitted, but OMITTAG NO was...
[Packages/TYPO3.CMS.git] / typo3 / sysext / lowlevel / config / index.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
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.
13 *
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.
18 *
19 *
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.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Module: Config
29 *
30 * This module lets you view the config variables around TYPO3.
31 *
32 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
33 */
34 /**
35 * [CLASS/FUNCTION INDEX of SCRIPT]
36 *
37 *
38 *
39 * 72: class SC_mod_tools_config_index
40 * 89: function init()
41 * 103: function jumpToUrl(URL)
42 * 117: function menuConfig()
43 * 144: function main()
44 * 268: function printContent()
45 *
46 * TOTAL FUNCTIONS: 5
47 * (This index is automatically created/updated by the extension "extdeveval")
48 *
49 */
50
51 unset($MCONF);
52 require ('conf.php');
53 require ($BACK_PATH.'init.php');
54 require ($BACK_PATH.'template.php');
55 $GLOBALS['LANG']->includeLLFile('EXT:lowlevel/config/locallang.xml');
56 require_once (PATH_t3lib.'class.t3lib_arraybrowser.php');
57
58 $BE_USER->modAccess($MCONF,1);
59
60
61
62
63
64
65
66 /**
67 * Script class for the Config module
68 *
69 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
70 * @package TYPO3
71 * @subpackage tx_lowlevel
72 */
73 class SC_mod_tools_config_index {
74
75 var $MCONF = array();
76 var $MOD_MENU = array();
77 var $MOD_SETTINGS = array();
78
79 /**
80 * document template object
81 *
82 * @var noDoc
83 */
84 var $doc;
85
86 var $include_once = array();
87 var $content;
88
89
90
91 /**
92 * Initialization
93 *
94 * @return void
95 */
96 function init() {
97 global $BACK_PATH;
98
99 $this->MCONF = $GLOBALS['MCONF'];
100
101 $this->menuConfig();
102
103 $this->doc = t3lib_div::makeInstance('template');
104 $this->doc->backPath = $BACK_PATH;
105 $this->doc->setModuleTemplate('templates/config.html');
106
107 // JavaScript
108 $this->doc->JScode = '
109 <script language="javascript" type="text/javascript">
110 script_ended = 0;
111 function jumpToUrl(URL) {
112 window.location.href = URL;
113 }
114 </script>
115 ';
116
117 $this->doc->form = '<form action="" method="post">';
118 }
119
120 /**
121 * Menu Configuration
122 *
123 * @return void
124 */
125 function menuConfig() {
126 global $TYPO3_CONF_VARS;
127
128 // MENU-ITEMS:
129 // If array, then it's a selector box menu
130 // If empty string it's just a variable, that'll be saved.
131 // Values NOT in this array will not be saved in the settings-array for the module.
132 $this->MOD_MENU = array(
133 'function' => array(
134 0 => $GLOBALS['LANG']->getLL('typo3ConfVars', true),
135 1 => $GLOBALS['LANG']->getLL('tca', true),
136 2 => $GLOBALS['LANG']->getLL('tcaDescr', true),
137 3 => $GLOBALS['LANG']->getLL('loadedExt', true),
138 4 => $GLOBALS['LANG']->getLL('t3services', true),
139 5 => $GLOBALS['LANG']->getLL('tbemodules', true),
140 6 => $GLOBALS['LANG']->getLL('tbemodulesext', true),
141 7 => $GLOBALS['LANG']->getLL('tbeStyles', true),
142 8 => $GLOBALS['LANG']->getLL('beUser', true),
143 ),
144 'regexsearch' => '',
145 'fixedLgd' => ''
146 );
147
148 // CLEANSE SETTINGS
149 $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
150 }
151
152 /**
153 * [Describe function...]
154 *
155 * @return [type] ...
156 */
157 function main() {
158
159 $arrayBrowser = t3lib_div::makeInstance('t3lib_arrayBrowser');
160
161 $this->content= $this->doc->header($GLOBALS['LANG']->getLL('configuration', true));
162 $this->content.= $this->doc->spacer(5);
163
164 $this->content .= '<div id="lowlevel-config">
165 <label for="search_field">' . $GLOBALS['LANG']->getLL('enterSearchPhrase', true) . '</label>
166 <input type="text" id="search_field" name="search_field" value="'.htmlspecialchars($search_field).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).'>
167 <input type="submit" name="search" id="search" value="' . $GLOBALS['LANG']->getLL('search', true) . '" />';
168 $this->content .= t3lib_BEfunc::getFuncCheck(0,'SET[regexsearch]',$this->MOD_SETTINGS['regexsearch'],'','','id="checkRegexsearch"') .
169 '<label for="checkRegexsearch">' . $GLOBALS['LANG']->getLL('useRegExp', true) . '</label>';
170
171 $this->content.= t3lib_BEfunc::getFuncCheck(0, 'SET[fixedLgd]', $this->MOD_SETTINGS['fixedLgd'], '', '', 'id="checkFixedLgd"') .
172 '<label for="checkFixedLgd">' . $GLOBALS['LANG']->getLL('cropLines', true) . '</label>
173 </div>';
174
175 $this->content.= $this->doc->spacer(5);
176
177 switch($this->MOD_SETTINGS['function']) {
178 case 0:
179 $theVar = $GLOBALS['TYPO3_CONF_VARS'];
180 $arrayBrowser->varName = '$TYPO3_CONF_VARS';
181 break;
182 case 1:
183 foreach ($GLOBALS['TCA'] as $table => $config) {
184 t3lib_div::loadTCA($table);
185 }
186 $theVar = $GLOBALS['TCA'];
187 $arrayBrowser->varName = '$TCA';
188 break;
189 case 2:
190 $theVar = $GLOBALS['TCA_DESCR'];
191 $arrayBrowser->varName = '$TCA_DESCR';
192 break;
193 case 3:
194 $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
195 $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
196 break;
197 case 4:
198 $theVar = $GLOBALS['T3_SERVICES'];
199 $arrayBrowser->varName = '$T3_SERVICES';
200 break;
201 case 5:
202 $theVar = $GLOBALS['TBE_MODULES'];
203 $arrayBrowser->varName = '$TBE_MODULES';
204 break;
205 case 6:
206 $theVar = $GLOBALS['TBE_MODULES_EXT'];
207 $arrayBrowser->varName = '$TBE_MODULES_EXT';
208 break;
209 case 7:
210 $theVar = $GLOBALS['TBE_STYLES'];
211 $arrayBrowser->varName = '$TBE_STYLES';
212 break;
213 case 8:
214 $theVar = $GLOBALS['BE_USER']->uc;
215 $arrayBrowser->varName = '$BE_USER->uc';
216 break;
217 default:
218 $theVar = array();
219 break;
220 }
221
222
223 // Update node:
224 $update = 0;
225 $node = t3lib_div::_GET('node');
226 if (is_array($node)) { // If any plus-signs were clicked, it's registred.
227 $this->MOD_SETTINGS['node_'.$this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_'.$this->MOD_SETTINGS['function']]);
228 $update = 1;
229 }
230 if ($update) {
231 $GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'],$this->MOD_SETTINGS);
232 }
233
234 $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_'.$this->MOD_SETTINGS['function']];
235 $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
236 $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
237 $arrayBrowser->searchKeysToo = TRUE;
238
239
240 $search_field = t3lib_div::_GP('search_field');
241 if (t3lib_div::_POST('search') && trim($search_field)) { // If any POST-vars are send, update the condition array
242 $arrayBrowser->depthKeys=$arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
243 }
244
245 $tree = $arrayBrowser->tree($theVar, '', '');
246
247 $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
248 $this->content.= $this->doc->sectionEnd();
249
250 // Variable name:
251 if (t3lib_div::_GP('varname')) {
252 $this->content .= '<div id="lowlevel-config-var">
253 <strong>' . $GLOBALS['LANG']->getLL('variable', true) . '</strong><br />
254 <input type="text" name="_" value="' . trim(htmlspecialchars(t3lib_div::_GP('varname'))) . '" size="120" /><br />
255 ' . $GLOBALS['LANG']->getLL('copyPaste', true) . '
256 </div>
257 ';
258 }
259
260 $this->content.= '<br /><table border="0" cellpadding="1" cellspacing="0">';
261 $this->content.= '<tr>
262 <td><img src="clear.gif" width="1" height="1" alt="" /></td>
263 <td class="bgColor2">
264 <table border="0" cellpadding="0" cellspacing="0" class="bgColor5" width="100%"><tr><td nowrap="nowrap"><b>'.$label.'</b></td></tr></table>
265 </td>
266 </tr>';
267 $this->content.='<tr>
268 <td></td>
269 <td class="bgColor2">
270 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" width="100%"><tr><td nowrap="nowrap">'.$tree.'</td></tr></table>' .
271 '<img src="clear.gif" width="465" height="1" alt="" /></td>
272 </tr>
273 </table>
274 ';
275
276
277 // Setting up the buttons and markers for docheader
278 $docHeaderButtons = $this->getButtons();
279 $markers = array(
280 'CSH' => $docHeaderButtons['csh'],
281 'FUNC_MENU' => $this->getFuncMenu(),
282 'CONTENT' => $this->content
283 );
284
285 // Build the <body> for the module
286 $this->content = $this->doc->startPage('Configuration');
287
288 $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
289 $this->content.= $this->doc->endPage();
290 $this->content = $this->doc->insertStylesAndJS($this->content);
291 }
292
293 /**
294 * Print output to browser
295 *
296 * @return void
297 */
298 function printContent() {
299 echo $this->content;
300 }
301
302 /**
303 * Create the panel of buttons for submitting the form or otherwise perform operations.
304 *
305 * @return array all available buttons as an assoc. array
306 */
307 protected function getButtons() {
308
309 $buttons = array(
310 'csh' => '',
311 'shortcut' => ''
312 );
313 // CSH
314 //$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
315
316 // Shortcut
317 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
318 $buttons['shortcut'] = $this->doc->makeShortcutIcon('','function',$this->MCONF['name']);
319 }
320 return $buttons;
321 }
322
323 /**
324 * Create the function menu
325 *
326 * @return string HTML of the function menu
327 */
328 protected function getFuncMenu() {
329 $funcMenu = t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
330 return $funcMenu;
331 }
332 }
333
334
335 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/config/index.php']) {
336 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lowlevel/config/index.php']);
337 }
338
339
340
341
342 // Make instance:
343 $SOBE = t3lib_div::makeInstance('SC_mod_tools_config_index');
344 $SOBE->init();
345 $SOBE->main();
346 $SOBE->printContent();
347 ?>