Esempio n. 1
0
 /**
  * @test
  * @param array $source
  * @param array $mask
  * @param array $expected
  * @dataProvider intersectRecursiveCalculatesExpectedResultDataProvider
  */
 public function intersectRecursiveCalculatesExpectedResult(array $source, array $mask, array $expected)
 {
     $this->assertSame($expected, ArrayUtility::intersectRecursive($source, $mask));
 }
 /**
  * Add additional parameters for links according to TS setting preserveGETvars.
  * Possible values are "all" or a comma separated list of allowed GET-vars.
  * Supports multi-dimensional GET-vars.
  * Some hardcoded values are dropped.
  *
  * @return string additionalParams-string
  */
 protected function getPreserveGetVars()
 {
     $getVars = GeneralUtility::_GET();
     unset($getVars['id'], $getVars['no_cache'], $getVars['logintype'], $getVars['redirect_url'], $getVars['cHash'], $getVars[$this->prefixId]);
     if ($this->conf['preserveGETvars'] === 'all') {
         $preserveQueryParts = $getVars;
     } else {
         $preserveQueryParts = GeneralUtility::trimExplode(',', $this->conf['preserveGETvars']);
         $preserveQueryParts = GeneralUtility::explodeUrl2Array(implode('=1&', $preserveQueryParts) . '=1', TRUE);
         $preserveQueryParts = \TYPO3\CMS\Core\Utility\ArrayUtility::intersectRecursive($getVars, $preserveQueryParts);
     }
     $parameters = GeneralUtility::implodeArrayForUrl('', $preserveQueryParts);
     return $parameters;
 }
Esempio n. 3
0
 /**
  * Main function
  *
  * @return void
  */
 public function main()
 {
     /** @var ArrayBrowser $arrayBrowser */
     $arrayBrowser = GeneralUtility::makeInstance(ArrayBrowser::class);
     $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
     $search_field = GeneralUtility::_GP('search_field');
     $templatePathAndFilename = GeneralUtility::getFileAbsFileName('EXT:lowlevel/Resources/Private/Templates/Backend/Configuration.html');
     $this->view->setTemplatePathAndFilename($templatePathAndFilename);
     $this->view->assign('label', $label);
     $this->view->assign('search_field', $search_field);
     $this->view->assign('checkbox_checkRegexsearch', BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"'));
     switch ($this->MOD_SETTINGS['function']) {
         case 0:
             $theVar = $GLOBALS['TYPO3_CONF_VARS'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_CONF_VARS';
             break;
         case 1:
             $theVar = $GLOBALS['TCA'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TCA';
             break;
         case 2:
             $theVar = $GLOBALS['TCA_DESCR'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TCA_DESCR';
             break;
         case 3:
             $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
             break;
         case 4:
             $theVar = $GLOBALS['T3_SERVICES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$T3_SERVICES';
             break;
         case 5:
             $theVar = $GLOBALS['TBE_MODULES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_MODULES';
             break;
         case 6:
             $theVar = $GLOBALS['TBE_MODULES_EXT'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_MODULES_EXT';
             break;
         case 7:
             $theVar = $GLOBALS['TBE_STYLES'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TBE_STYLES';
             break;
         case 8:
             $theVar = $GLOBALS['BE_USER']->uc;
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$BE_USER->uc';
             break;
         case 9:
             $theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
             break;
         case 10:
             $router = GeneralUtility::makeInstance(Router::class);
             $routes = $router->getRoutes();
             $theVar = [];
             foreach ($routes as $identifier => $route) {
                 $theVar[$identifier] = ['path' => $route->getPath(), 'options' => $route->getOptions()];
             }
             ArrayUtility::naturalKeySortRecursive($theVar);
             $arrayBrowser->varName = 'BackendRoutes';
             break;
         default:
             $theVar = [];
     }
     // Update node:
     $update = 0;
     $node = GeneralUtility::_GET('node');
     // If any plus-signs were clicked, it's registered.
     if (is_array($node)) {
         $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]);
         $update = 1;
     }
     if ($update) {
         $this->getBackendUser()->pushModuleData($this->moduleName, $this->MOD_SETTINGS);
     }
     $arrayBrowser->dontLinkVar = true;
     $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
     $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
     $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
     $arrayBrowser->searchKeysToo = true;
     // If any POST-vars are send, update the condition array
     if (GeneralUtility::_POST('search') && trim($search_field)) {
         $arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, []);
     }
     // mask sensitive information
     $varName = trim($arrayBrowser->varName, '$');
     if (isset($this->blindedConfigurationOptions[$varName])) {
         ArrayUtility::mergeRecursiveWithOverrule($theVar, ArrayUtility::intersectRecursive($this->blindedConfigurationOptions[$varName], $theVar));
     }
     $tree = $arrayBrowser->tree($theVar, '', '');
     $this->view->assign('tree', $tree);
     // Setting up the shortcut button for docheader
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     // Shortcut
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setDisplayName($this->MOD_MENU['function'][$this->MOD_SETTINGS['function']])->setSetVariables(['function']);
     $buttonBar->addButton($shortcutButton);
     $this->getModuleMenu();
     $this->content = '<form action="" id="ConfigurationView" method="post">';
     $this->content .= $this->view->render();
     $this->content .= '</form>';
 }