Cleanup #14405: Rename test cases from *_testcase to *Test: Rename test files in...
[Packages/TYPO3.CMS.git] / typo3 / view_help.php
index 29b8fb5..782ac87 100644 (file)
@@ -77,8 +77,6 @@
 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');
 
 
 /**
@@ -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);
                }
 
@@ -534,7 +537,7 @@ class SC_view_help {
                global $TCA,$BE_USER,$TCA_DESCR;
 
                        // Split references by comma or linebreak
-               $items = preg_split('/[,' . chr(10) . ']/', $value);
+               $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];
@@ -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;