[TASK] Small clean up in the page tree code 49/19049/3
authorDmitry Dulepov <dmitry.dulepov@gmail.com>
Tue, 19 Mar 2013 14:35:21 +0000 (18:35 +0400)
committerBenjamin Mack <benni@typo3.org>
Fri, 22 Mar 2013 17:40:35 +0000 (18:40 +0100)
There are minor issues in the page tree code, which should be
cleaned up. This is a non-functionality change.

Change-Id: Ia4a27797293cb94d58927036ec33dd28a02d0961
Resolves: #46435
Releases: 6.0, 6.1
Reviewed-on: https://review.typo3.org/19049
Reviewed-by: Mattias Nilsson
Tested-by: Mattias Nilsson
Reviewed-by: Wouter Wolters
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack
typo3/sysext/backend/Classes/Tree/Pagetree/Commands.php

index c4d2346..d2cf30f 100644 (file)
@@ -208,6 +208,8 @@ class Commands {
                } elseif (count($data)) {
                        $tce->process_datamap();
                        $returnValues = $tce->substNEWwithIDs;
+               } else {
+                       $returnValues = array();
                }
                // check errors
                if (count($tce->errorLog)) {
@@ -253,9 +255,9 @@ class Commands {
                        if (self::$useNavTitle && trim($record['nav_title']) !== '') {
                                $text = $record['nav_title'];
                        }
-                       $path[] = $text;
+                       $path[] = htmlspecialchars($text);
                }
-               return htmlspecialchars('/' . implode('/', $path));
+               return '/' . implode('/', $path);
        }
 
        /**
@@ -277,13 +279,13 @@ class Commands {
         * @return string
         */
        static public function getDomainName($uid) {
-               $whereClause = $GLOBALS['TYPO3_DB']->quoteStr('pid=' . intval($uid) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_domain') . \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_domain'), 'sys_domain');
+               $whereClause = 'pid=' . intval($uid) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_domain') . \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_domain');
                $domain = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('domainName', 'sys_domain', $whereClause, '', 'sorting');
-               return htmlspecialchars($domain['domainName']);
+               return is_array($domain) ? htmlspecialchars($domain['domainName']) : '';
        }
 
        /**
-        * Creates a node with the given record information's
+        * Creates a node with the given record information
         *
         * @param array $record
         * @param integer $mountPoint
@@ -336,8 +338,9 @@ class Commands {
                $stat = '';
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
                        $_params = array('pages', $record['uid']);
+                       $fakeThis = NULL;
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
-                               $stat .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
+                               $stat .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $fakeThis);
                        }
                }
                $prefix .= htmlspecialchars(self::$addIdAsPrefix ? '[' . $record['uid'] . '] ' : '');