Only changes to function indexes, comments and stripping of trailing whitespace in...
[Packages/TYPO3.CMS.git] / typo3 / wizard_tsconfig.php
index 314a7f5..03dae3c 100755 (executable)
@@ -1,22 +1,22 @@
 <?php
 /***************************************************************
 *  Copyright notice
-*  
+*
 *  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
 *  All rights reserved
 *
-*  This script is part of the TYPO3 project. The TYPO3 project is 
+*  This script is part of the TYPO3 project. The TYPO3 project is
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
-* 
+*
 *  The GNU General Public License can be found at
 *  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license 
+*  A copy is found in the textfile GPL.txt and important notices to the license
 *  from the author is found in LICENSE.txt distributed with these scripts.
 *
-* 
+*
 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -24,9 +24,9 @@
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
-/** 
+/**
  * Wizard for inserting TSconfig in form fields. (page,user or TS)
- * 
+ *
  * $Id$
  * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
  * XHTML compliant
  *
  *
  *
- *   94: class ext_TSparser extends t3lib_tsparser_ext 
- *  100:     function makeHtmlspecialchars($P) 
+ *   94: class ext_TSparser extends t3lib_tsparser_ext
+ *  102:     function makeHtmlspecialchars($P)
  *
  *
- *  121: class SC_wizard_tsconfig 
- *  143:     function init()   
- *  250:     function main()   
- *  277:     function printContent()   
- *  288:     function browseTSprop($mode,$show)        
+ *  123: class SC_wizard_tsconfig
+ *  145:     function init()
+ *  252:     function main()
+ *  279:     function printContent()
+ *  290:     function browseTSprop($mode,$show)
  *
  *              SECTION: Module functions
- *  375:     function getObjTree()     
- *  406:     function setObj(&$objTree,$strArr,$params)        
- *  426:     function revertFromSpecialChars($str)     
- *  439:     function doLink($params)  
- *  452:     function removePointerObjects($objArray)  
- *  471:     function linkToObj($str,$uid,$objString='')       
- *  484:     function printTable($table,$objString,$objTree)   
- *  565:     function linkProperty($str,$propertyVal,$prefix,$datatype)        
+ *  376:     function getObjTree()
+ *  406:     function setObj(&$objTree,$strArr,$params)
+ *  426:     function revertFromSpecialChars($str)
+ *  439:     function doLink($params)
+ *  452:     function removePointerObjects($objArray)
+ *  471:     function linkToObj($str,$uid,$objString='')
+ *  484:     function printTable($table,$objString,$objTree)
+ *  565:     function linkProperty($str,$propertyVal,$prefix,$datatype)
  *
  * TOTAL FUNCTIONS: 13
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
 
+
 
 $BACK_PATH='';
 require ('init.php');
@@ -75,7 +75,7 @@ require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');
 
 
 
-       
+
 
 
 
@@ -86,7 +86,7 @@ require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');
 
 /**
  * TypoScript parser extension class.
- * 
+ *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
@@ -94,6 +94,8 @@ require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');
 class ext_TSparser extends t3lib_tsparser_ext {
 
        /**
+        * Pass through of incoming value for link.
+        *
         * @param       array           P array
         * @return      string          The "_LINK" key value, straight away.
         */
@@ -113,7 +115,7 @@ class ext_TSparser extends t3lib_tsparser_ext {
 
 /**
  * Script Class for rendering the TSconfig/TypoScript property browser.
- * 
+ *
  * @author     Kasper Skaarhoj <kasper@typo3.com>
  * @package TYPO3
  * @subpackage core
@@ -137,8 +139,8 @@ class SC_wizard_tsconfig {
 
        /**
         * Initialization of the class
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function init() {
                global $LANG,$BACK_PATH;
@@ -162,7 +164,7 @@ class SC_wizard_tsconfig {
                        $update.= '
                        window.opener.'.$v;
                }
-               
+
                        // Init the document table object:
                $this->doc = t3lib_div::makeInstance('mediumDoc');
                $this->doc->docType = 'xhtml_trans';
@@ -176,7 +178,7 @@ class SC_wizard_tsconfig {
                        A:active {text-decoration: bold; color: '.$this->doc->hoverColor.';}
                        A:hover {color: '.$this->doc->bgColor2.'}
                ';
-               
+
                $this->doc->JScode.=$this->doc->wrapScriptTags('
                        function checkReference()       {       //
                                if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) {
@@ -236,23 +238,23 @@ class SC_wizard_tsconfig {
                                document.location = "'.t3lib_div::linkThisScript(array('show'=>'','objString'=>'')).'&show="+show+"&objString="+objString;
                        }
                ');
-               
-                       
-                       // Start the page:              
+
+
+                       // Start the page:
                $this->content.=$this->doc->startPage($LANG->getLL('tsprop'));
        }
 
        /**
         * Main function, rendering the content of the TypoScript property browser, including links to online resources
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function main() {
                global $LANG;
 
                        // Adding module content:
                $this->content.=$this->doc->section($LANG->getLL('tsprop'),$this->browseTSprop($this->mode,$this->show),0,1);
-               
+
                        // Adding link to TSref:
                if ($this->mode=='tsref')       {
                        $this->content.=$this->doc->section($LANG->getLL('tsprop_TSref'),'
@@ -271,36 +273,35 @@ class SC_wizard_tsconfig {
 
        /**
         * Outputting the accumulated content to screen
-        * 
-        * @return      void            
+        *
+        * @return      void
         */
        function printContent() {
                echo $this->content;
        }
-       
+
        /**
         * Create the content of the module:
-        * 
+        *
         * @param       string          Object string
         * @param       integer         Pointing to an entry in static_tsconfig_help to show.
         * @return      string          HTML
         */
        function browseTSprop($mode,$show)      {
                global $LANG;
-               
+
                        // Get object tree:
                $objTree = $this->getObjTree();
-               
+
                        // Show single element, if show is set.
                $out='';
                if ($show)      {
                                // Get the entry data:
-                       $query='SELECT * FROM static_tsconfig_help WHERE uid='.intval($show);
-                       $res = mysql(TYPO3_db,$query);
-                       $rec=mysql_fetch_assoc($res);
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_tsconfig_help', 'uid='.intval($show));
+                       $rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
                        $table = unserialize($rec['appdata']);
                        $obj_string = strtr($this->objString,'()','[]');        // Title:
-                       
+
                                // Title and description:
                        $out.='<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>''))).'" class="typo3-goBack">'.
                                        '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/goback.gif','width="14" height="14"').' alt="" />'.
@@ -308,11 +309,11 @@ class SC_wizard_tsconfig {
                                        '</a><br />';
                        if ($rec['title'])      $out.= '<strong>'.htmlspecialchars($rec['title']).': </strong>';
                        if ($rec['description'])        $out.= nl2br(htmlspecialchars(trim($rec['description']))).'<br />';
-                       
+
                                // Printing the content:
                        $out.= '<br />'.$this->printTable($table, $obj_string, $objTree[$mode.'.']);
                        $out.='<hr />';
-       
+
                                // Printing the "mixer-field":
                        if (!$this->onlyProperty)       {
                                $links=array();
@@ -324,9 +325,9 @@ class SC_wizard_tsconfig {
                                $out.='<br /><strong>'.implode('&nbsp; | &nbsp;',$links).'</strong>';
                                $out.='<hr />';
                        }
-               } 
-       
-       
+               }
+
+
                        // SECTION: Showing property tree:
                $tmpl = t3lib_div::makeInstance('ext_TSparser');
                $tmpl->tt_track = 0;    // Do not log time-performance information
@@ -336,11 +337,11 @@ class SC_wizard_tsconfig {
                $tmpl->ext_expandAllNotes=1;
                $tmpl->ext_noPMicons=1;
                $tmpl->ext_noSpecialCharsOnLabels=1;
-       
+
                if (is_array($objTree[$mode.'.']))      {
                        $out.='
 
-               
+
                        <!--
                                TSconfig, object tree:
                        -->
@@ -350,7 +351,7 @@ class SC_wizard_tsconfig {
                                        </tr>
                                </table>';
                }
-               
+
                return $out;
        }
 
@@ -368,17 +369,16 @@ class SC_wizard_tsconfig {
 
        /**
         * Create object tree from static_tsconfig_help table
-        * 
+        *
         * @return      array           Object tree.
         * @access private
         */
        function getObjTree()   {
                $hash = md5('WIZARD_TSCONFIG-objTree');
-       
-               $query='SELECT uid,obj_string,title FROM static_tsconfig_help';
-               $res = mysql(TYPO3_db,$query);
                $objTree=array();
-               while($rec=mysql_fetch_assoc($res))     {
+
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,obj_string,title', 'static_tsconfig_help', '');
+               while($rec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
                        $rec['obj_string'] = $this->revertFromSpecialChars($rec['obj_string']);
                        $p = explode(';',$rec['obj_string']);
                        while(list(,$v)=each($p))       {
@@ -395,11 +395,11 @@ class SC_wizard_tsconfig {
        /**
         * Sets the information from a static_tsconfig_help record in the object array.
         * Makes recursive calls.
-        * 
+        *
         * @param       array           Object tree array, passed by value!
         * @param       array           Array of elements from object path (?)
         * @param       array           Array with record and something else (?)
-        * @return      void            
+        * @return      void
         * @access private
         * @see getObjTree()
         */
@@ -415,10 +415,10 @@ class SC_wizard_tsconfig {
                        $objTree[$key]['_LINK']=$this->doLink($params);
                }
        }
-       
+
        /**
         * Converts &gt; and &lt; to > and <
-        * 
+        *
         * @param       string          Input string
         * @return      string          Output string
         * @access private
@@ -427,11 +427,11 @@ class SC_wizard_tsconfig {
                $str = str_replace('&gt;','>',$str);
                $str = str_replace('&lt;','<',$str);
                return $str;
-       }       
+       }
 
        /**
         * Creates a link based on input params array:
-        * 
+        *
         * @param       array           Parameters
         * @return      string          The link.
         * @access private
@@ -444,7 +444,7 @@ class SC_wizard_tsconfig {
 
        /**
         * Remove pointer strings from an array
-        * 
+        *
         * @param       array           Input array
         * @return      array           Modified input array
         * @access private
@@ -462,7 +462,7 @@ class SC_wizard_tsconfig {
 
        /**
         * Linking string to object by UID
-        * 
+        *
         * @param       string          String to link
         * @param       integer         UID of a static_tsconfig_help record.
         * @param       string          Title string for that record!
@@ -475,7 +475,7 @@ class SC_wizard_tsconfig {
 
        /**
         * Creates a table of properties:
-        * 
+        *
         * @param       array           Array with properties for the current object path
         * @param       string          Object path
         * @param       array           Object tree
@@ -483,7 +483,7 @@ class SC_wizard_tsconfig {
         */
        function printTable($table,$objString,$objTree) {
                if (is_array($table['rows']))   {
-               
+
                                // Initialize:
                        $lines=array();
 
@@ -513,24 +513,24 @@ class SC_wizard_tsconfig {
                                        $lP2[$k] = $this->linkProperty($lStr,$lStr,$objString,$row['datatype']);
                                }
                                $linkedProperties=implode('<hr />',$lP2);
-                               
+
                                        // Data type:
                                $dataType = $row['datatype'];
-                                       
+
                                        // Generally "->[something]"
                                $reg=array();
                                ereg('->[[:alnum:]_]*',$dataType,$reg);
                                if ($reg[0] && is_array($objTree[$reg[0]]))     {
                                        $dataType = str_replace($reg[0],'<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>$objTree[$reg[0]][0]['uid'],'objString'=>$objString.'.'.$lP[0]))).'">'.htmlspecialchars($reg[0]).'</a>',$dataType);
                                }
-                               
+
                                        // stdWrap
                                if (!strstr($dataType,'->stdWrap') && strstr(strip_tags($dataType),'stdWrap'))  {
                                                // Potential problem can be that "stdWrap" is substituted inside another A-tag. So maybe we should even check if there is already a <A>-tag present and if so, not make a substitution?
                                        $dataType = str_replace('stdWrap','<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('show'=>$objTree['->stdWrap'][0]['uid'],'objString'=>$objString.'.'.$lP[0]))).'">stdWrap</a>',$dataType);
                                }
-       
-                       
+
+
                                $lines[]='
                                        <tr class="bgColor4">
                                                <td valign="top" class="bgColor4-20"><strong>'.$linkedProperties.'</strong></td>
@@ -543,7 +543,7 @@ class SC_wizard_tsconfig {
                        return '
 
 
-               
+
                        <!--
                                TSconfig, attribute selector:
                        -->
@@ -555,7 +555,7 @@ class SC_wizard_tsconfig {
 
        /**
         * Creates a link on a property.
-        * 
+        *
         * @param       string          String to link
         * @param       string          Property value.
         * @param       string          Object path prefix to value
@@ -564,14 +564,14 @@ class SC_wizard_tsconfig {
         */
        function linkProperty($str,$propertyVal,$prefix,$datatype)      {
                $out='';
-               
+
                        // Setting preset value:
                if (strstr($datatype,'boolean'))        {
                        $propertyVal.='=1';     // add preset "=1" to boolean values.
                } else {
                        $propertyVal.='=';      // add preset "="
                }
-       
+
                        // Adding mixer features; The plus icon:
                if(!$this->onlyProperty)        {
                        $aOnClick = 'document.editform.mixer.value=unescape(\'  '.rawurlencode($propertyVal).'\')+\'\n\'+document.editform.mixer.value; return false;';
@@ -580,11 +580,11 @@ class SC_wizard_tsconfig {
                                        '</a>';
                        $propertyVal = $prefix.'.'.$propertyVal;
                }
-               
+
                        // Wrap string:
                $aOnClick = 'setValue(unescape(\''.rawurlencode($propertyVal).'\')); return false;';
                $out.= '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$str.'</a>';
-               
+
                        // Return link:
                return $out;
        }