Added feature #15783: Improve ExtJS skin: Tabs
[Packages/TYPO3.CMS.git] / typo3 / view_help.php
old mode 100755 (executable)
new mode 100644 (file)
index 2a0137f..e066649
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  * See Inside TYPO3 for details.
  *
  * $Id$
- * Revised for TYPO3 3.7 5/2004 by Kasper Skaarhoj
+ * Revised for TYPO3 3.7 5/2004 by Kasper Skårhøj
  * XHTML-trans compliant
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
 require('init.php');
 require('template.php');
 $LANG->includeLLFile('EXT:lang/locallang_view_help.xml');
-require_once(PATH_t3lib.'class.t3lib_loadmodules.php');
-require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
 
 
 /**
  * Extension of the parse_html class.
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -115,7 +113,7 @@ class local_t3lib_parsehtml extends t3lib_parsehtml {
 /**
  * Script Class for rendering the Context Sensitive Help documents, either the single display in the small pop-up window or the full-table view in the larger window.
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -149,6 +147,10 @@ class SC_view_help {
 
                        // Setting GPvars:
                $this->tfID = t3lib_div::_GP('tfID');
+                       // Sanitizes the tfID using whitelisting.
+               if (!preg_match('/^[a-zA-Z0-9_\-\.\*]*$/', $this->tfID)) {
+                       $this->tfID = '';
+               }
                if (!$this->tfID) {
                        if (($this->ffID = t3lib_div::_GP('ffID'))) {
                                $this->ffID = unserialize(base64_decode($this->ffID));
@@ -174,7 +176,6 @@ class SC_view_help {
                global $BE_USER,$LANG,$TCA_DESCR,$TCA,$TBE_TEMPLATE;
 
                        // Start HTML output accumulation:
-               $TBE_TEMPLATE->docType = 'xhtml_trans';
                $TBE_TEMPLATE->divClass = 'typo3-view-help';
                $this->content.= $TBE_TEMPLATE->startPage($LANG->getLL('title'));
 
@@ -301,21 +302,20 @@ class SC_view_help {
                $output = '';
                $output.= '
 
-                       <h1>'.$LANG->getLL('manual_title',1).'</h1>
-                       <p>'.t3lib_BEfunc::TYPO3_copyRightNotice().'</p>';
+                       <h1>'.$LANG->getLL('manual_title',1).'</h1>';
 
                $output.= '
 
-                       <h1>'.$LANG->getLL('introduction',1).'</h1>
+                       <h2>'.$LANG->getLL('introduction',1).'</h2>
                        <p>'.$LANG->getLL('description',1).'</p>';
 
                $output.= '
 
-                       <h1>'.$LANG->getLL('TOC',1).'</h1>'.
+                       <h2>'.$LANG->getLL('TOC',1).'</h2>'.
                        $this->render_TOC_makeTocList($tocArray);
 
                if (!$this->renderALL)  {
-               $output.= '
+                       $output.= '
                                <br/>
                                <p class="c-nav"><a href="view_help.php?renderALL=1">'.$LANG->getLL('full_manual',1).'</a></p>';
                }
@@ -323,7 +323,7 @@ class SC_view_help {
                if ($this->renderALL)   {
                        $output.= '
 
-                               <h1>'.$LANG->getLL('full_manual_chapters',1).'</h1>'.
+                               <h2>'.$LANG->getLL('full_manual_chapters',1).'</h2>'.
                                implode('
 
 
@@ -331,6 +331,8 @@ class SC_view_help {
                                ',$outputSections);
                }
 
+               $output .= '<hr /><p class="manual-title">'.t3lib_BEfunc::TYPO3_copyRightNotice().'</p>';
+
                return $output;
        }
 
@@ -432,8 +434,7 @@ class SC_view_help {
                        $parts[0] = ''; // Reserved for header of table
 
                                // Traverse table columns as listed in TCA_DESCR
-                       reset($TCA_DESCR[$table]['columns']);
-                       while(list($field) = each($TCA_DESCR[$table]['columns']))       {
+                       foreach ($TCA_DESCR[$table]['columns'] as $field => $value) {
 
                                $fieldValue = isset($TCA[$table]) && strcmp($field,'') ? $TCA[$table]['columns'][$field] : array();
 
@@ -446,7 +447,9 @@ class SC_view_help {
                                }
                        }
 
-                       if (!strcmp($parts,'')) unset($parts[0]);
+                       if (!$parts[0]) {
+                               unset($parts[0]);
+                       }
                        $output.= implode('<br />',$parts);
                }
 
@@ -533,8 +536,8 @@ class SC_view_help {
        function make_seeAlso($value,$anchorTable='')   {
                global $TCA,$BE_USER,$TCA_DESCR;
 
-                       // Split references by comma, vert.line or linebreak
-               $items = split(',|'.chr(10),$value);
+                       // Split references by comma or linebreak
+               $items = preg_split('/[,' . LF . ']/', $value);
                $lines = array();
 
                foreach($items as $val) {
@@ -584,7 +587,7 @@ class SC_view_help {
                        // Splitting:
                $imgArray = t3lib_div::trimExplode(',', $images, 1);
                if (count($imgArray))   {
-                       $descrArray = explode(chr(10),$descr,count($imgArray));
+                       $descrArray = explode(LF,$descr,count($imgArray));
 
                        foreach($imgArray as $k => $image)      {
                                $descr = $descrArray[$k];
@@ -617,11 +620,11 @@ class SC_view_help {
        function headerLine($str,$type=0)       {
                switch($type)   {
                        case 1:
-                               $str='<h3>'.htmlspecialchars($str).'</h3>
+                               $str = '<h2 class="t3-row-header">' . htmlspecialchars($str) . '</h2>
                                ';
                        break;
                        case 0:
-                               $str='<h4 class="uppercase">'.htmlspecialchars($str).'</h4>
+                               $str = '<h3 class="divider">' . htmlspecialchars($str) . '</h3>
                                ';
                        break;
                }
@@ -719,7 +722,7 @@ class SC_view_help {
 
                        $tableName = is_array($TCA_DESCR[$table]['columns']['']) && $TCA_DESCR[$table]['columns']['']['alttitle'] ?
                                                        $TCA_DESCR[$table]['columns']['']['alttitle'] :
-                                                       (isset($TCA[$table]) ? $TCA[$table]['ctrl']['title'] : ereg_replace('^_MOD_','',$table));
+                                                       (isset($TCA[$table]) ? $TCA[$table]['ctrl']['title'] : preg_replace('/^_MOD_/','',$table));
                        $fieldName = is_array($TCA_DESCR[$table]['columns'][$field]) && $TCA_DESCR[$table]['columns'][$field]['alttitle'] ?
                                                        $TCA_DESCR[$table]['columns'][$field]['alttitle'] :
                                                        (isset($TCA[$table])&&isset($TCA[$table]['columns'][$field]) ? $TCA[$table]['columns'][$field]['label'] : $field);
@@ -743,7 +746,7 @@ class SC_view_help {
 
                        // Create label:
                $labelStr = $LANG->sL($tableName).
-                                       ($field ? $mergeToken.ereg_replace(':$','', trim($LANG->sL($fieldName))):'');
+                                       ($field ? $mergeToken.rtrim(trim($LANG->sL($fieldName)), ':'):'');
 
                return $labelStr;
        }
@@ -766,7 +769,7 @@ class SC_view_help {
 
        /**
         * Creates glossary index in $this->glossaryWords
-        * Glossary is cached in cache_hash table and so will be updated only when cache is cleared.
+        * Glossary is cached in cache_hash cache and so will be updated only when cache is cleared.
         *
         * @return      void
         */
@@ -793,8 +796,7 @@ class SC_view_help {
                                        if (is_array($TCA_DESCR[$cshKey]['columns']))   {
 
                                                        // Traverse table columns as listed in TCA_DESCR
-                                               reset($TCA_DESCR[$cshKey]['columns']);
-                                               while(list($field,$data) = each($TCA_DESCR[$cshKey]['columns']))        {
+                                               foreach ($TCA_DESCR[$cshKey]['columns'] as $field => $data) {
                                                        if ($field)     {
                                                                $this->glossaryWords[$cshKey.'.'.$field] = array(
                                                                        'title' => trim($data['alttitle'] ? $data['alttitle'] : $cshKey),
@@ -831,7 +833,7 @@ class SC_view_help {
         */
        function substituteGlossaryWords($code) {
                $htmlParser = t3lib_div::makeInstance('local_t3lib_parsehtml');
-               $htmlParser->pObj = &$this;
+               $htmlParser->pObj = $this;
                $code = $htmlParser->HTMLcleaner($code, array(), 1);
 
                return $code;
@@ -871,19 +873,17 @@ class SC_view_help {
 }
 
 
-// Include extension?
+
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/view_help.php'])    {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/view_help.php']);
 }
 
 
 
-
-
-
 // Make instance:
 $SOBE = t3lib_div::makeInstance('SC_view_help');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
+
 ?>
\ No newline at end of file