Added feature #15783: Improve ExtJS skin: Tabs
[Packages/TYPO3.CMS.git] / typo3 / view_help.php
index 6476ee5..e066649 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2009 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));
@@ -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 = preg_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;
        }
@@ -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;