index.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2010 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  * Module: Config
00029  *
00030  * This module lets you view the config variables around TYPO3.
00031  *
00032  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00033  */
00034 /**
00035  * [CLASS/FUNCTION INDEX of SCRIPT]
00036  *
00037  *
00038  *
00039  *   72: class SC_mod_tools_config_index
00040  *   89:     function init()
00041  *  103:     function jumpToUrl(URL)
00042  *  117:     function menuConfig()
00043  *  144:     function main()
00044  *  268:     function printContent()
00045  *
00046  * TOTAL FUNCTIONS: 5
00047  * (This index is automatically created/updated by the extension "extdeveval")
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  * Script class for the Config module
00067  *
00068  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00069  * @package TYPO3
00070  * @subpackage tx_lowlevel
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      * document template object
00080      *
00081      * @var noDoc
00082      */
00083     var $doc;
00084 
00085     var $include_once = array();
00086     var $content;
00087 
00088 
00089 
00090     /**
00091      * Initialization
00092      *
00093      * @return  void
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                 // JavaScript
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      * Menu Configuration
00121      *
00122      * @return  void
00123      */
00124     function menuConfig()   {
00125         global $TYPO3_CONF_VARS;
00126 
00127             // MENU-ITEMS:
00128             // If array, then it's a selector box menu
00129             // If empty string it's just a variable, that'll be saved.
00130             // Values NOT in this array will not be saved in the settings-array for the module.
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             // CLEANSE SETTINGS
00149         $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
00150     }
00151 
00152     /**
00153      * [Describe function...]
00154      *
00155      * @return  [type]      ...
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             // Update node:
00228         $update = 0;
00229         $node = t3lib_div::_GET('node');
00230         if (is_array($node))    {       // If any plus-signs were clicked, it's registred.
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))  {       // If any POST-vars are send, update the condition array
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             // Variable name:
00255         if (t3lib_div::_GP('varname'))  {
00256             $line = t3lib_div::_GP('_') ? t3lib_div::_GP('_') : t3lib_div::_GP('varname');
00257             if (t3lib_div::_GP('writetoexttables')) { // Write the line to extTables.php
00258                     // change value to $GLOBALS
00259                 $length = strpos($line, '[');
00260                 $var = substr($line, 0, $length);
00261                 $changedLine = '$GLOBALS[\'' . substr($line, 1, $length - 1) . '\']' . substr($line, $length);
00262                     // insert line  in extTables.php
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                         // show flash message
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                     // Error: show flash message
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                     // write only for $TCA and TBE_STYLES if  TYPO3_extTableDef_script is defined
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             // Setting up the buttons and markers for docheader
00311         $docHeaderButtons = $this->getButtons();
00312         $markers = array(
00313             'CSH' => $docHeaderButtons['csh'],
00314             'FUNC_MENU' => $this->getFuncMenu(),
00315             'CONTENT' => $this->content
00316         );
00317 
00318             // Build the <body> for the module
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      * Print output to browser
00328      *
00329      * @return  void
00330      */
00331     function printContent() {
00332         echo $this->content;
00333     }
00334 
00335     /**
00336      * Create the panel of buttons for submitting the form or otherwise perform operations.
00337      *
00338      * @return  array   all available buttons as an assoc. array
00339      */
00340     protected function getButtons() {
00341 
00342         $buttons = array(
00343             'csh' => '',
00344             'shortcut' => ''
00345         );
00346             // CSH
00347         //$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
00348 
00349             // Shortcut
00350         if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
00351             $buttons['shortcut'] = $this->doc->makeShortcutIcon('','function',$this->MCONF['name']);
00352         }
00353         return $buttons;
00354     }
00355 
00356     /**
00357      * Create the function menu
00358      *
00359      * @return  string  HTML of the function menu
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 // Make instance:
00376 $SOBE = t3lib_div::makeInstance('SC_mod_tools_config_index');
00377 $SOBE->init();
00378 $SOBE->main();
00379 $SOBE->printContent();
00380 ?>

Generated on Sat Sep 4 04:17:08 2010 for TYPO3 API by  doxygen 1.4.7