/**
  * Returns the pages TSconfig array based on the currect ->rootLine
  *
  * @return array
  * @todo Define visibility
  */
 public function getPagesTSconfig()
 {
     if (!is_array($this->pagesTSconfig)) {
         $TSdataArray = array();
         // Setting default configuration:
         $TSdataArray[] = $this->TYPO3_CONF_VARS['BE']['defaultPageTSconfig'];
         foreach ($this->rootLine as $k => $v) {
             $TSdataArray[] = $v['TSconfig'];
         }
         // Parsing the user TS (or getting from cache)
         $TSdataArray = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines_array($TSdataArray);
         $userTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
         $hash = md5('pageTS:' . $userTS);
         $cachedContent = $this->sys_page->getHash($hash);
         if (isset($cachedContent)) {
             $this->pagesTSconfig = unserialize($cachedContent);
         } else {
             $parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
             $parseObj->parse($userTS);
             $this->pagesTSconfig = $parseObj->setup;
             $this->sys_page->storeHash($hash, serialize($this->pagesTSconfig), 'PAGES_TSconfig');
         }
     }
     return $this->pagesTSconfig;
 }
示例#2
0
 /**
  * Returns the Page TSconfig for page with id, $id
  *
  * @param $id integer Page uid for which to create Page TSconfig
  * @param $rootLine array If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated
  * @param boolean $returnPartArray If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser.
  * @return array Page TSconfig
  * @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
  */
 public static function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = FALSE)
 {
     static $pagesTSconfig_cache = array();
     $id = (int) $id;
     if ($returnPartArray === FALSE && $rootLine === NULL && isset($pagesTSconfig_cache[$id])) {
         return $pagesTSconfig_cache[$id];
     } else {
         $TSconfig = array();
         if (!is_array($rootLine)) {
             $useCacheForCurrentPageId = TRUE;
             $rootLine = self::BEgetRootLine($id, '', TRUE);
         } else {
             $useCacheForCurrentPageId = FALSE;
         }
         // Order correctly
         ksort($rootLine);
         $TSdataArray = array();
         // Setting default configuration
         $TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];
         foreach ($rootLine as $k => $v) {
             $TSdataArray['uid_' . $v['uid']] = $v['TSconfig'];
         }
         $TSdataArray = static::emitGetPagesTSconfigPreIncludeSignal($TSdataArray, $id, $rootLine, $returnPartArray);
         $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray);
         if ($returnPartArray) {
             return $TSdataArray;
         }
         // Parsing the page TS-Config
         $pageTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
         /* @var $parseObj \TYPO3\CMS\Backend\Configuration\TsConfigParser */
         $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Configuration\\TsConfigParser');
         $res = $parseObj->parseTSconfig($pageTS, 'PAGES', $id, $rootLine);
         if ($res) {
             $TSconfig = $res['TSconfig'];
         }
         // Get User TSconfig overlay
         $userTSconfig = $GLOBALS['BE_USER']->userTS['page.'];
         if (is_array($userTSconfig)) {
             \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($TSconfig, $userTSconfig);
         }
         if ($useCacheForCurrentPageId) {
             $pagesTSconfig_cache[$id] = $TSconfig;
         }
     }
     return $TSconfig;
 }
示例#3
0
 /**
  * Returns the category TSconfig array based on the currect->rootLine
  *
  * @todo Make recursiv category TS merging
  * @return array
  */
 public function getTyposcriptConfig()
 {
     if (!is_array($this->categoryTSconfig)) {
         $tSdataArray[] = $this->tsConfig;
         $tSdataArray = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines_array($tSdataArray);
         $categoryTs = implode(chr(10) . '[GLOBAL]' . chr(10), $tSdataArray);
         /**
          * Typoscript parser
          *
          * @var \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser $parseObj
          */
         $parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
         $parseObj->parse($categoryTs);
         $this->categoryTSconfig = $parseObj->setup;
     }
     return $this->categoryTSconfig;
 }
 /**
  * Loads Page TSconfig until the outermost template record and parses the configuration - if TSFE.constants object path is found it is merged with the default data in here!
  *
  * @param array $constArray Constants array, default input.
  * @return array Constants array, modified
  * @todo Apply caching to the parsed Page TSconfig. This is done in the other similar functions for both frontend and backend. However, since this functions works for BOTH frontend and backend we will have to either write our own local caching function or (more likely) detect if we are in FE or BE and use caching functions accordingly. Not having caching affects mostly the backend modules inside the "Template" module since the overhead in the frontend is only seen when TypoScript templates are parsed anyways (after which point they are cached anyways...)
  * @todo Define visibility
  */
 public function mergeConstantsFromPageTSconfig($constArray)
 {
     $TSdataArray = array();
     // Setting default configuration:
     $TSdataArray[] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];
     for ($a = 0; $a <= $this->outermostRootlineIndexWithTemplate; $a++) {
         $TSdataArray[] = $this->absoluteRootLine[$a]['TSconfig'];
     }
     // Parsing the user TS (or getting from cache)
     $TSdataArray = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines_array($TSdataArray);
     $userTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
     /** @var $parseObj \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser */
     $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
     $parseObj->parse($userTS);
     if (is_array($parseObj->setup['TSFE.']['constants.'])) {
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($constArray, $parseObj->setup['TSFE.']['constants.']);
     }
     return $constArray;
 }
 /**
  * Returns the parsed TSconfig for the fe_user
  * The TSconfig will be cached in $this->userTS.
  *
  * @return array TSconfig array for the fe_user
  * @todo Define visibility
  */
 public function getUserTSconf()
 {
     if (!$this->userTSUpdated) {
         // Parsing the user TS (or getting from cache)
         $this->TSdataArray = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines_array($this->TSdataArray);
         $userTS = implode(LF . '[GLOBAL]' . LF, $this->TSdataArray);
         $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
         $parseObj->parse($userTS);
         $this->userTS = $parseObj->setup;
         $this->userTSUpdated = TRUE;
     }
     return $this->userTS;
 }
 /**
  * Returns the pages TSconfig array based on the currect ->rootLine
  *
  * @return array
  */
 public function getPagesTSconfig()
 {
     if (!is_array($this->pagesTSconfig)) {
         $TSdataArray = array();
         foreach ($this->rootLine as $k => $v) {
             $TSdataArray[] = $v['TSconfig'];
         }
         // Adding the default configuration:
         $TSdataArray[] = $this->TYPO3_CONF_VARS['BE']['defaultPageTSconfig'];
         // Bring everything in the right order. Default first, then the Rootline down to the current page
         $TSdataArray = array_reverse($TSdataArray);
         // Parsing the user TS (or getting from cache)
         $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray);
         $userTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
         $hash = md5('pageTS:' . $userTS);
         $cachedContent = $this->sys_page->getHash($hash);
         if (is_array($cachedContent)) {
             $this->pagesTSconfig = $cachedContent;
         } else {
             $parseObj = GeneralUtility::makeInstance(TypoScriptParser::class);
             $parseObj->parse($userTS);
             $this->pagesTSconfig = $parseObj->setup;
             $this->sys_page->storeHash($hash, $this->pagesTSconfig, 'PAGES_TSconfig');
         }
     }
     return $this->pagesTSconfig;
 }
示例#7
0
 /**
  * Returns the Page TSconfig for page with id, $id
  *
  * @param int $id Page uid for which to create Page TSconfig
  * @param array $rootLine If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated
  * @param bool $returnPartArray If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser.
  * @return array Page TSconfig
  * @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
  */
 public static function getPagesTSconfig($id, $rootLine = null, $returnPartArray = false)
 {
     static $pagesTSconfig_cacheReference = array();
     static $combinedTSconfig_cache = array();
     $id = (int) $id;
     if ($returnPartArray === false && $rootLine === null && isset($pagesTSconfig_cacheReference[$id])) {
         return $combinedTSconfig_cache[$pagesTSconfig_cacheReference[$id]];
     } else {
         $TSconfig = array();
         if (!is_array($rootLine)) {
             $useCacheForCurrentPageId = true;
             $rootLine = self::BEgetRootLine($id, '', true);
         } else {
             $useCacheForCurrentPageId = false;
         }
         // Order correctly
         ksort($rootLine);
         $TSdataArray = array();
         // Setting default configuration
         $TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];
         foreach ($rootLine as $k => $v) {
             if (trim($v['tsconfig_includes'])) {
                 $includeTsConfigFileList = GeneralUtility::trimExplode(',', $v['tsconfig_includes'], true);
                 // Traversing list
                 foreach ($includeTsConfigFileList as $key => $includeTsConfigFile) {
                     if (StringUtility::beginsWith($includeTsConfigFile, 'EXT:')) {
                         list($includeTsConfigFileExtensionKey, $includeTsConfigFilename) = explode('/', substr($includeTsConfigFile, 4), 2);
                         if ((string) $includeTsConfigFileExtensionKey !== '' && ExtensionManagementUtility::isLoaded($includeTsConfigFileExtensionKey) && (string) $includeTsConfigFilename !== '') {
                             $includeTsConfigFileAndPath = ExtensionManagementUtility::extPath($includeTsConfigFileExtensionKey) . $includeTsConfigFilename;
                             if (file_exists($includeTsConfigFileAndPath)) {
                                 $TSdataArray['uid_' . $v['uid'] . '_static_' . $key] = GeneralUtility::getUrl($includeTsConfigFileAndPath);
                             }
                         }
                     }
                 }
             }
             $TSdataArray['uid_' . $v['uid']] = $v['TSconfig'];
         }
         $TSdataArray = static::emitGetPagesTSconfigPreIncludeSignal($TSdataArray, $id, $rootLine, $returnPartArray);
         $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray);
         if ($returnPartArray) {
             return $TSdataArray;
         }
         // Parsing the page TS-Config
         $pageTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
         /* @var $parseObj \TYPO3\CMS\Backend\Configuration\TsConfigParser */
         $parseObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Configuration\TsConfigParser::class);
         $res = $parseObj->parseTSconfig($pageTS, 'PAGES', $id, $rootLine);
         if ($res) {
             $TSconfig = $res['TSconfig'];
         }
         $cacheHash = $res['hash'];
         // Get User TSconfig overlay
         $userTSconfig = static::getBackendUserAuthentication()->userTS['page.'];
         if (is_array($userTSconfig)) {
             ArrayUtility::mergeRecursiveWithOverrule($TSconfig, $userTSconfig);
             $cacheHash .= '_user' . $GLOBALS['BE_USER']->user['uid'];
         }
         if ($useCacheForCurrentPageId) {
             if (!isset($combinedTSconfig_cache[$cacheHash])) {
                 $combinedTSconfig_cache[$cacheHash] = $TSconfig;
             }
             $pagesTSconfig_cacheReference[$id] = $cacheHash;
         }
     }
     return $TSconfig;
 }
 /**
  * Returns the Page TSconfig for page with id, $id
  * Requires class "t3lib_TSparser"
  *
  * @param $id integer Page uid for which to create Page TSconfig
  * @param $rootLine array If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated
  * @param boolean $returnPartArray If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser.
  * @return array Page TSconfig
  * @see t3lib_TSparser
  */
 public static function getPagesTSconfig($id, $rootLine = '', $returnPartArray = 0)
 {
     $id = intval($id);
     if (!is_array($rootLine)) {
         $rootLine = self::BEgetRootLine($id, '', TRUE);
     }
     // Order correctly
     ksort($rootLine);
     $TSdataArray = array();
     // Setting default configuration
     $TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];
     foreach ($rootLine as $k => $v) {
         $TSdataArray['uid_' . $v['uid']] = $v['TSconfig'];
     }
     $TSdataArray = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines_array($TSdataArray);
     if ($returnPartArray) {
         return $TSdataArray;
     }
     // Parsing the page TS-Config (or getting from cache)
     $pageTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
     if ($GLOBALS['TYPO3_CONF_VARS']['BE']['TSconfigConditions']) {
         /* @var $parseObj t3lib_TSparser_TSconfig */
         $parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Configuration\\TsConfigParser');
         $res = $parseObj->parseTSconfig($pageTS, 'PAGES', $id, $rootLine);
         if ($res) {
             $TSconfig = $res['TSconfig'];
         }
     } else {
         $hash = md5('pageTS:' . $pageTS);
         $cachedContent = self::getHash($hash);
         $TSconfig = array();
         if (isset($cachedContent)) {
             $TSconfig = unserialize($cachedContent);
         } else {
             $parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
             $parseObj->parse($pageTS);
             $TSconfig = $parseObj->setup;
             self::storeHash($hash, serialize($TSconfig), 'PAGES_TSconfig');
         }
     }
     // Get User TSconfig overlay
     $userTSconfig = $GLOBALS['BE_USER']->userTS['page.'];
     if (is_array($userTSconfig)) {
         $TSconfig = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($TSconfig, $userTSconfig);
     }
     return $TSconfig;
 }
 /**
  * Returns the parsed TSconfig for the fe_user
  * The TSconfig will be cached in $this->userTS.
  *
  * @return array TSconfig array for the fe_user
  */
 public function getUserTSconf()
 {
     if (!$this->userTSUpdated) {
         // Parsing the user TS (or getting from cache)
         $this->TSdataArray = TypoScriptParser::checkIncludeLines_array($this->TSdataArray);
         $userTS = implode(LF . '[GLOBAL]' . LF, $this->TSdataArray);
         $parseObj = GeneralUtility::makeInstance(TypoScriptParser::class);
         $parseObj->parse($userTS);
         $this->userTS = $parseObj->setup;
         $this->userTSUpdated = true;
     }
     return $this->userTS;
 }
    /**
     * Initializes a lot of stuff like the access-lists, database-mountpoints and filemountpoints
     * This method is called by ->backendCheckLogin() (from extending BackendUserAuthentication)
     * if the backend user login has verified OK.
     * Generally this is required initialization of a backend user.
     *
     * @return void
     * @access private
     * @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
     * @todo Define visibility
     */
    public function fetchGroupData()
    {
        if ($this->user['uid']) {
            // Get lists for the be_user record and set them as default/primary values.
            // Enabled Backend Modules
            $this->dataLists['modList'] = $this->user['userMods'];
            // Add Allowed Languages
            $this->dataLists['allowed_languages'] = $this->user['allowed_languages'];
            // Set user value for workspace permissions.
            $this->dataLists['workspace_perms'] = $this->user['workspace_perms'];
            // User mount points are only added if the user is not an admin as admins do not have visible
            // mountpoints fields. Processing them loads mountpoints defined when the user was a non-admin.
            if (!$this->isAdmin()) {
                // Database mountpoints
                $this->dataLists['webmount_list'] = $this->user['db_mountpoints'];
                // File mountpoints
                $this->dataLists['filemount_list'] = $this->user['file_mountpoints'];
            }
            // Fileoperation permissions
            $this->dataLists['file_permissions'] = $this->user['file_permissions'];
            // Setting default User TSconfig:
            $this->TSdataArray[] = $this->addTScomment('From $GLOBALS["TYPO3_CONF_VARS"]["BE"]["defaultUserTSconfig"]:') . $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'];
            // Default TSconfig for admin-users
            if ($this->isAdmin()) {
                $this->TSdataArray[] = $this->addTScomment('"admin" user presets:') . '
					admPanel.enable.all = 1
				';
                if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sys_note')) {
                    $this->TSdataArray[] = '
							// Setting defaults for sys_note author / email...
						TCAdefaults.sys_note.author = ' . $this->user['realName'] . '
						TCAdefaults.sys_note.email = ' . $this->user['email'] . '
					';
                }
            }
            // BE_GROUPS:
            // Get the groups...
            // 240203: Since the group-field never contains any references to groups with a prepended table name
            // we think it's safe to just intExplode and re-implode - which should be much faster than the other function call.
            $grList = $this->db->cleanIntList($this->user[$this->usergroup_column]);
            if ($grList) {
                // Fetch groups will add a lot of information to the internal arrays: modules, accesslists, TSconfig etc.
                // Refer to fetchGroups() function.
                $this->fetchGroups($grList);
            }
            // Populating the $this->userGroupsUID -array with the groups in the order in which they were LAST included.!!
            $this->userGroupsUID = array_reverse(array_unique(array_reverse($this->includeGroupArray)));
            // Finally this is the list of group_uid's in the order they are parsed (including subgroups!)
            // and without duplicates (duplicates are presented with their last entrance in the list,
            // which thus reflects the order of the TypoScript in TSconfig)
            $this->groupList = implode(',', $this->userGroupsUID);
            $this->setCachedList($this->groupList);
            // Add the TSconfig for this specific user:
            $this->TSdataArray[] = $this->addTScomment('USER TSconfig field') . $this->user['TSconfig'];
            // Check include lines.
            $this->TSdataArray = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines_array($this->TSdataArray);
            // Imploding with "[global]" will make sure that non-ended confinements with braces are ignored.
            $this->userTS_text = implode(LF . '[GLOBAL]' . LF, $this->TSdataArray);
            if (!$this->userTS_dontGetCached) {
                // Perform TS-Config parsing with condition matching
                $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Configuration\\TsConfigParser');
                $res = $parseObj->parseTSconfig($this->userTS_text, 'userTS');
                if ($res) {
                    $this->userTS = $res['TSconfig'];
                    $this->userTSUpdated = (bool) $res['cached'];
                }
            } else {
                // Parsing the user TSconfig (or getting from cache)
                $hash = md5('userTS:' . $this->userTS_text);
                $cachedContent = BackendUtility::getHash($hash);
                if (is_array($cachedContent) && !$this->userTS_dontGetCached) {
                    $this->userTS = $cachedContent;
                } else {
                    $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
                    $parseObj->parse($this->userTS_text);
                    $this->userTS = $parseObj->setup;
                    BackendUtility::storeHash($hash, $this->userTS, 'BE_USER_TSconfig');
                    // Update UC:
                    $this->userTSUpdated = TRUE;
                }
            }
            // Processing webmounts
            // Admin's always have the root mounted
            if ($this->isAdmin() && !$this->getTSConfigVal('options.dontMountAdminMounts')) {
                $this->dataLists['webmount_list'] = '0,' . $this->dataLists['webmount_list'];
            }
            // The lists are cleaned for duplicates
            $this->groupData['webmounts'] = GeneralUtility::uniqueList($this->dataLists['webmount_list']);
            $this->groupData['pagetypes_select'] = GeneralUtility::uniqueList($this->dataLists['pagetypes_select']);
            $this->groupData['tables_select'] = GeneralUtility::uniqueList($this->dataLists['tables_modify'] . ',' . $this->dataLists['tables_select']);
            $this->groupData['tables_modify'] = GeneralUtility::uniqueList($this->dataLists['tables_modify']);
            $this->groupData['non_exclude_fields'] = GeneralUtility::uniqueList($this->dataLists['non_exclude_fields']);
            $this->groupData['explicit_allowdeny'] = GeneralUtility::uniqueList($this->dataLists['explicit_allowdeny']);
            $this->groupData['allowed_languages'] = GeneralUtility::uniqueList($this->dataLists['allowed_languages']);
            $this->groupData['custom_options'] = GeneralUtility::uniqueList($this->dataLists['custom_options']);
            $this->groupData['modules'] = GeneralUtility::uniqueList($this->dataLists['modList']);
            $this->groupData['file_permissions'] = GeneralUtility::uniqueList($this->dataLists['file_permissions']);
            $this->groupData['workspace_perms'] = $this->dataLists['workspace_perms'];
            // Checking read access to webmounts:
            if (trim($this->groupData['webmounts']) !== '') {
                $webmounts = explode(',', $this->groupData['webmounts']);
                // Explode mounts
                // Selecting all webmounts with permission clause for reading
                $where = 'deleted=0 AND uid IN (' . $this->groupData['webmounts'] . ') AND ' . $this->getPagePermsClause(1);
                $MProws = $this->db->exec_SELECTgetRows('uid', 'pages', $where, '', '', '', 'uid');
                foreach ($webmounts as $idx => $mountPointUid) {
                    // If the mount ID is NOT found among selected pages, unset it:
                    if ($mountPointUid > 0 && !isset($MProws[$mountPointUid])) {
                        unset($webmounts[$idx]);
                    }
                }
                // Implode mounts in the end.
                $this->groupData['webmounts'] = implode(',', $webmounts);
            }
            // Setting up workspace situation (after webmounts are processed!):
            $this->workspaceInit();
        }
    }
 /**
  * Loads Page TSconfig until the outermost template record and parses the configuration - if TSFE.constants object path is found it is merged with the default data in here!
  *
  * @param array $constArray Constants array, default input.
  * @return array Constants array, modified
  * @todo Apply caching to the parsed Page TSconfig. This is done in the other similar functions for both frontend and backend. However, since this functions works for BOTH frontend and backend we will have to either write our own local caching function or (more likely) detect if we are in FE or BE and use caching functions accordingly. Not having caching affects mostly the backend modules inside the "Template" module since the overhead in the frontend is only seen when TypoScript templates are parsed anyways (after which point they are cached anyways...)
  */
 public function mergeConstantsFromPageTSconfig($constArray)
 {
     $TSdataArray = array();
     // Setting default configuration:
     $TSdataArray[] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];
     for ($a = 0; $a <= $this->outermostRootlineIndexWithTemplate; $a++) {
         if (trim($this->absoluteRootLine[$a]['tsconfig_includes'])) {
             $includeTsConfigFileList = GeneralUtility::trimExplode(',', $this->absoluteRootLine[$a]['tsconfig_includes'], true);
             $TSdataArray = $this->mergeConstantsFromIncludedTsConfigFiles($includeTsConfigFileList, $TSdataArray);
         }
         $TSdataArray[] = $this->absoluteRootLine[$a]['TSconfig'];
     }
     // Parsing the user TS (or getting from cache)
     $TSdataArray = Parser\TypoScriptParser::checkIncludeLines_array($TSdataArray);
     $userTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
     /** @var $parseObj Parser\TypoScriptParser */
     $parseObj = GeneralUtility::makeInstance(Parser\TypoScriptParser::class);
     $parseObj->parse($userTS);
     if (is_array($parseObj->setup['TSFE.']['constants.'])) {
         ArrayUtility::mergeRecursiveWithOverrule($constArray, $parseObj->setup['TSFE.']['constants.']);
     }
     return $constArray;
 }