public function main()
 {
     $result = $error = $url = NULL;
     $this->view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($this->templatePath . 'Main.html'));
     if ($this->configuration->isValid()) {
         try {
             $this->checkPageId();
             $url = $this->urlService->getFullUrl($this->pageId, $this->pObj->MOD_SETTINGS);
             if (GeneralUtility::_GET('clear')) {
                 $this->pageSpeedRepository->clearByIdentifier($url);
                 $this->view->assign('cacheCleared', TRUE);
             }
             $result = $this->pageSpeedRepository->findByIdentifier($url);
         } catch (\HTTP_Request2_ConnectionException $e) {
             $error = 'error.http_request.connection';
             // todo add log
         } catch (\RuntimeException $e) {
             $error = $e->getMessage();
         }
     } else {
         $error = 'error.invalid.key';
     }
     $this->view->assignMultiple(array('lll' => 'LLL:EXT:page_speed/Resources/Private/Language/locallang.xlf:', 'menu' => $this->modifyFuncMenu(BackendUtility::getFuncMenu($this->pObj->id, 'SET[language]', $this->pObj->MOD_SETTINGS['language'], $this->pObj->MOD_MENU['language']), 'language'), 'configuration' => $this->configuration, 'result' => $result, 'url' => $url, 'error' => $error, 'pageId' => $this->pageId));
     return $this->view->render();
 }
 /**
  * @param StandaloneView $view
  * @param PageRenderer $pageRenderer
  * @param LoginController $loginController
  * @throws \UnexpectedValueException
  */
 public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController)
 {
     GeneralUtility::makeInstance(ObjectManager::class)->get(Dispatcher::class)->dispatch(__CLASS__, self::SIGNAL_getPageRenderer, array($pageRenderer));
     $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/UserPassLogin');
     $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/UserPassLoginForm.html'));
     if (GeneralUtility::getIndpEnv('TYPO3_SSL')) {
         $view->assign('presetUsername', GeneralUtility::_GP('u'));
         $view->assign('presetPassword', GeneralUtility::_GP('p'));
     }
 }
 /**
  * Callback function for rendering quotes.
  *
  * @param string $matches PCRE matches.
  * @return string  The quote content.
  */
 protected function replaceCallback($matches)
 {
     $this->view->setControllerContext($this->controllerContext);
     $this->view->setTemplatePathAndFilename(File::replaceSiteRelPath($this->settings['template']));
     $tmp = $this->postRepository->findByUid((int) $matches[1]);
     if (!empty($tmp)) {
         $this->view->assign('post', $tmp);
     }
     $this->view->assign('quote', trim($matches[2]));
     return $this->view->render();
 }
 /**
  * inits the standalone fluid template
  */
 public function initFluidTemplate()
 {
     $this->searchFormView = GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $this->searchFormView->setPartialRootPaths([$this->conf['partialRootPath']]);
     $this->searchFormView->setLayoutRootPaths([$this->conf['layoutRootPath']]);
     $this->searchFormView->setTemplatePathAndFilename($this->conf['templateRootPath'] . 'SearchForm.html');
     // make settings available in fluid template
     $this->searchFormView->assign('conf', $this->conf);
     $this->searchFormView->assign('extConf', $this->extConf);
     $this->searchFormView->assign('extConfPremium', $this->extConfPremium);
 }
Exemple #5
0
 /**
  * Initialize the handle action, sets up fluid stuff and assigns default variables.
  *
  * @return void
  */
 protected function initializeHandle()
 {
     // Context service distinguishes between standalone and backend context
     $contextService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\ContextService::class);
     $viewRootPath = GeneralUtility::getFileAbsFileName('EXT:install/Resources/Private/');
     $controllerActionDirectoryName = ucfirst($this->controller);
     $mainTemplate = ucfirst($this->action);
     $this->view = GeneralUtility::makeInstance(StandaloneView::class);
     $this->view->setTemplatePathAndFilename($viewRootPath . 'Templates/Action/' . $controllerActionDirectoryName . '/' . $mainTemplate . '.html');
     $this->view->setLayoutRootPaths([$viewRootPath . 'Layouts/']);
     $this->view->setPartialRootPaths([$viewRootPath . 'Partials/']);
     $this->view->assign('time', time())->assign('action', $this->action)->assign('controller', $this->controller)->assign('token', $this->token)->assign('context', $contextService->getContextString())->assign('contextService', $contextService)->assign('lastError', $this->lastError)->assign('messages', $this->messages)->assign('typo3Version', TYPO3_version)->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']);
 }
Exemple #6
0
 /**
  * Search (Full / Advanced)
  *
  * @return void
  */
 public function func_search()
 {
     $lang = $this->getLanguageService();
     $searchMode = $this->MOD_SETTINGS['search'];
     $fullsearch = GeneralUtility::makeInstance(QueryView::class);
     $fullsearch->setFormName($this->formName);
     $submenu = '<div class="form-inline form-inline-spaced">';
     $submenu .= BackendUtility::getDropdownMenu(0, 'SET[search]', $searchMode, $this->MOD_MENU['search']);
     if ($this->MOD_SETTINGS['search'] == 'query') {
         $submenu .= BackendUtility::getDropdownMenu(0, 'SET[search_query_makeQuery]', $this->MOD_SETTINGS['search_query_makeQuery'], $this->MOD_MENU['search_query_makeQuery']) . '<br />';
     }
     $submenu .= '</div>';
     if ($this->MOD_SETTINGS['search'] == 'query') {
         $submenu .= '<div class="checkbox"><label for="checkSearch_query_smallparts">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[search_query_smallparts]', $this->MOD_SETTINGS['search_query_smallparts'], '', '', 'id="checkSearch_query_smallparts"') . $lang->getLL('showSQL') . '</label></div>';
         $submenu .= '<div class="checkbox"><label for="checkSearch_result_labels">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[search_result_labels]', $this->MOD_SETTINGS['search_result_labels'], '', '', 'id="checkSearch_result_labels"') . $lang->getLL('useFormattedStrings') . '</label></div>';
         $submenu .= '<div class="checkbox"><label for="checkLabels_noprefix">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[labels_noprefix]', $this->MOD_SETTINGS['labels_noprefix'], '', '', 'id="checkLabels_noprefix"') . $lang->getLL('dontUseOrigValues') . '</label></div>';
         $submenu .= '<div class="checkbox"><label for="checkOptions_sortlabel">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[options_sortlabel]', $this->MOD_SETTINGS['options_sortlabel'], '', '', 'id="checkOptions_sortlabel"') . $lang->getLL('sortOptions') . '</label></div>';
         $submenu .= '<div class="checkbox"><label for="checkShow_deleted">' . BackendUtility::getFuncCheck($GLOBALS['SOBE']->id, 'SET[show_deleted]', $this->MOD_SETTINGS['show_deleted'], '', '', 'id="checkShow_deleted"') . $lang->getLL('showDeleted') . '</label></div>';
     }
     $this->view->assign('submenu', $submenu);
     $this->view->assign('searchMode', $searchMode);
     switch ($searchMode) {
         case 'query':
             $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Lowlevel/QueryGenerator');
             $this->view->assign('queryMaker', $fullsearch->queryMaker());
             break;
         case 'raw':
         default:
             $this->view->assign('searchOptions', $fullsearch->form());
             $this->view->assign('results', $fullsearch->search());
     }
 }
 /**
  * @param string $viewHelperTemplate
  * @param string $expectedOutput
  *
  * @test
  * @dataProvider viewHelperTemplateSourcesDataProvider
  */
 public function renderingTest($viewHelperTemplate, $expectedOutput)
 {
     $view = new StandaloneView();
     $view->getRenderingContext()->getViewHelperResolver()->addNamespace('ft', 'TYPO3Fluid\\FluidTest\\ViewHelpers');
     $view->getRenderingContext()->getTemplatePaths()->setTemplateSource($viewHelperTemplate);
     $view->assign('settings', ['test' => '<strong>Bla</strong>']);
     $this->assertSame($expectedOutput, $view->render());
 }
Exemple #8
0
 /**
  * Prints the clipboard
  *
  * @return string HTML output
  * @throws \BadFunctionCallException
  */
 public function printClipboard()
 {
     $languageService = $this->getLanguageService();
     $elementCount = count($this->elFromTable($this->fileMode ? '_FILE' : ''));
     // Copymode Selector menu
     $copymodeUrl = GeneralUtility::linkThisScript();
     $this->view->assign('actionCopyModeUrl', htmlspecialchars(GeneralUtility::quoteJSvalue($copymodeUrl . '&CB[setCopyMode]=')));
     $this->view->assign('actionCopyModeUrl1', htmlspecialchars(GeneralUtility::quoteJSvalue($copymodeUrl . '&CB[setCopyMode]=1')));
     $this->view->assign('currentMode', $this->currentMode());
     $this->view->assign('elementCount', $elementCount);
     if ($elementCount) {
         $removeAllUrl = GeneralUtility::linkThisScript(['CB' => ['removeAll' => $this->current]]);
         $this->view->assign('removeAllUrl', $removeAllUrl);
         // Selector menu + clear button
         $optionArray = [];
         // Import / Export link:
         if (ExtensionManagementUtility::isLoaded('impexp')) {
             $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $this->exportClipElementParameters());
             $optionArray[] = ['label' => $this->clLabel('export', 'rm'), 'uri' => $url];
         }
         // Edit:
         if (!$this->fileMode) {
             $optionArray[] = ['label' => $this->clLabel('edit', 'rm'), 'uri' => '#', 'additionalAttributes' => ['onclick' => htmlspecialchars('window.location.href=' . GeneralUtility::quoteJSvalue($this->editUrl() . '&returnUrl=') . '+top.rawurlencode(window.location.href);')]];
         }
         // Delete referenced elements:
         $confirmationCheck = false;
         if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
             $confirmationCheck = true;
         }
         $confirmationMessage = sprintf($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:mess.deleteClip'), $elementCount);
         $title = $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.clipboard.delete_elements');
         $returnUrl = $this->deleteUrl(1, $this->fileMode ? 1 : 0);
         $btnOkText = $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:buttons.confirm.delete_elements.yes');
         $btnCancelText = $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:buttons.confirm.delete_elements.no');
         $optionArray[] = ['label' => htmlspecialchars($title), 'uri' => $returnUrl, 'additionalAttributes' => ['class' => $confirmationCheck ? 't3js-modal-trigger' : ''], 'data' => ['severity' => 'warning', 'button-close-text' => htmlspecialchars($btnCancelText), 'button-ok-text' => htmlspecialchars($btnOkText), 'content' => htmlspecialchars($confirmationMessage), 'title' => htmlspecialchars($title)]];
         // Clear clipboard
         $optionArray[] = ['label' => $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.clipboard.clear_clipboard', true), 'uri' => $removeAllUrl . '#clip_head'];
         $this->view->assign('optionArray', $optionArray);
     }
     // Print header and content for the NORMAL tab:
     $this->view->assign('current', $this->current);
     $tabArray = [];
     $tabArray['normal'] = ['id' => 'normal', 'number' => 0, 'url' => GeneralUtility::linkThisScript(['CB' => ['setP' => 'normal']]), 'description' => 'normal-description', 'label' => 'labels.normal', 'padding' => $this->padTitle('normal')];
     if ($this->current == 'normal') {
         $tabArray['normal']['content'] = $this->getContentFromTab('normal');
     }
     // Print header and content for the NUMERIC tabs:
     for ($a = 1; $a <= $this->numberTabs; $a++) {
         $tabArray['tab_' . $a] = ['id' => 'tab_' . $a, 'number' => $a, 'url' => GeneralUtility::linkThisScript(['CB' => ['setP' => 'tab_' . $a]]), 'description' => 'cliptabs-description', 'label' => 'labels.cliptabs-name', 'padding' => $this->padTitle('tab_' . $a)];
         if ($this->current === 'tab_' . $a) {
             $tabArray['tab_' . $a]['content'] = $this->getContentFromTab('tab_' . $a);
         }
     }
     $this->view->assign('clipboardHeader', BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_clipboard', $this->clLabel('clipboard', 'buttons')));
     $this->view->assign('tabArray', $tabArray);
     return $this->view->render();
 }
 /**
  * Set any TypoScript settings to the view. This is similar to a
  * default MVC action controller in extbase.
  *
  * @param array $conf Configuration
  * @return void
  */
 protected function assignSettings(array $conf)
 {
     if (isset($conf['settings.'])) {
         /** @var $typoScriptService TypoScriptService */
         $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
         $settings = $typoScriptService->convertTypoScriptArrayToPlainArray($conf['settings.']);
         $this->view->assign('settings', $settings);
     }
 }
Exemple #10
0
 /**
  * Render the Plugin Info
  *
  * @param array $params
  * @param object $pObj
  * @return string
  */
 public function getExtensionSummary($params, &$pObj)
 {
     $data = GeneralUtility::xml2array($params['row']['pi_flexform']);
     $this->init($data);
     $this->getSelectedObjects($data);
     $this->fluidRenderer->assign($this->pluginMode, true);
     $this->fluidRenderer->assign('storageFolder', $this->getStorageFolder($data));
     $this->fluidRenderer->assign('gallery', $this->selectedGallery);
     $this->fluidRenderer->assign('album', $this->selectedAlbum);
     $this->fluidRenderer->assign('item', $this->selectedItem);
     $this->fluidRenderer->assign('caLabel', 'LLL:EXT:yag/Resources/Private/Language/locallang.xlf:tx_yag_flexform_controllerAction.' . $this->pluginMode);
     $this->fluidRenderer->assign('theme', $this->theme);
     $this->fluidRenderer->assign('context', $this->getDataValue($data, 'settings.contextIdentifier'));
     return $this->fluidRenderer->render();
 }
 /**
  * renderContent renders sie given Fluidtemplate an adds the given data to the view helper.
  * Your templates have to be in "Resources/Private/Html/Content/"
  *
  * @param array  $data Daten für das Fluid-Template
  * @param string $templateFile
  *
  * @return string Content
  */
 public function renderContent($data, $templateFile)
 {
     if (file_exists($templateFile)) {
         $this->view->getRequest()->setControllerExtensionName($this->extKey);
         $this->view->setTemplatePathAndFilename($templateFile);
         $this->view->assign('data', $data);
         $content = $this->view->render();
     } else {
         $content = 'Could not load template!';
     }
     return $content;
 }
 /**
  * Making interface selector:
  *
  * @return void
  */
 public function makeInterfaceSelectorBox()
 {
     // If interfaces are defined AND no input redirect URL in GET vars:
     if ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] && ($this->isLoginInProgress() || !$this->redirectUrl)) {
         $parts = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']);
         if (count($parts) > 1) {
             // Only if more than one interface is defined we will show the selector
             $interfaces = array('backend' => array('label' => $this->getLanguageService()->getLL('interface.backend'), 'jumpScript' => BackendUtility::getModuleUrl('main'), 'interface' => 'backend'), 'frontend' => array('label' => $this->getLanguageService()->getLL('interface.frontend'), 'jumpScript' => '../', 'interface' => 'frontend'));
             $this->view->assign('showInterfaceSelector', true);
             $this->view->assign('interfaces', $interfaces);
         } elseif (!$this->redirectUrl) {
             // If there is only ONE interface value set and no redirect_url is present
             $this->view->assign('showInterfaceSelector', false);
             $this->view->assign('interface', $parts[0]);
         }
     }
 }
Exemple #13
0
    /**
     * Initialize module header etc and call extObjContent function
     *
     * @return void
     */
    public function main()
    {
        // We leave this here because of dependencies to submodules
        $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
        // The page will show only if there is a valid page and if this page
        // may be viewed by the user
        $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
        if ($this->pageinfo) {
            $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
        }
        $access = is_array($this->pageinfo);
        if ($this->id && $access || $this->backendUser->user['admin'] && !$this->id) {
            if ($this->backendUser->user['admin'] && !$this->id) {
                $this->pageinfo = ['title' => '[root-level]', 'uid' => 0, 'pid' => 0];
            }
            // JavaScript
            $this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
				function jumpToUrl(URL) {
					window.location.href = URL;
					return false;
				}
				');
            // Setting up the context sensitive menu:
            $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
            $this->view = $this->getFluidTemplateObject();
            $this->view->assign('moduleName', BackendUtility::getModuleUrl($this->moduleName));
            $this->view->assign('versionSelector', $this->moduleTemplate->getVersionSelector($this->id, 1));
            $this->view->assign('functionMenuModuleContent', $this->getExtObjContent());
            // Setting up the buttons and markers for docheader
            $this->getButtons();
            $this->generateMenu();
            $this->content .= $this->view->render();
        } else {
            // If no access or if ID == zero
            $this->content = $this->moduleTemplate->header($this->languageService->getLL('title'));
        }
    }
Exemple #14
0
 /**
  * Initialize module header etc and call extObjContent function
  *
  * @return void
  */
 public function main()
 {
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     if ($this->pageinfo) {
         $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
     }
     $access = is_array($this->pageinfo);
     // We keep this here, in case somebody relies on the old doc being here
     $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
     // Main
     if ($this->id && $access) {
         // JavaScript
         $this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
         // Setting up the context sensitive menu:
         $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
         $this->view = $this->getFluidTemplateObject('func', 'func');
         $this->view->assign('moduleName', BackendUtility::getModuleUrl('web_func'));
         $this->view->assign('id', $this->id);
         $this->view->assign('versionSelector', $this->moduleTemplate->getVersionSelector($this->id, true));
         $this->view->assign('functionMenuModuleContent', $this->getExtObjContent());
         // Setting up the buttons and markers for docheader
         $this->getButtons();
         $this->generateMenu();
         $this->content .= $this->view->render();
     } else {
         // If no access or if ID == zero
         $title = $this->getLanguageService()->getLL('title');
         $message = $this->getLanguageService()->getLL('clickAPage_content');
         $this->view = $this->getFluidTemplateObject('func', 'func', 'InfoBox');
         $this->view->assignMultiple(['title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO]);
         $this->content = $this->view->render();
         // Setting up the buttons and markers for docheader
         $this->getButtons();
     }
 }
 /**
  * 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;
         default:
             $theVar = array();
     }
     // 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, array());
     }
     // mask sensitive information
     $varName = trim($arrayBrowser->varName, '$');
     if (isset($this->blindedConfigurationOptions[$varName])) {
         ArrayUtility::mergeRecursiveWithOverrule($theVar, $this->blindedConfigurationOptions[$varName]);
     }
     $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>';
 }
Exemple #16
0
 /**
  * Set form tag
  *
  * @param string $formTag Form tag to add
  *
  * @return void
  */
 public function setForm($formTag = '')
 {
     $this->view->assign('formTag', $formTag);
 }
 /**
  * Assemble display of list of scheduled tasks
  *
  * @return string Table of pending tasks
  */
 protected function listTasksAction()
 {
     $this->view->setTemplatePathAndFilename($this->backendTemplatePath . 'ListTasks.html');
     // Define display format for dates
     $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
     // Get list of registered classes
     $registeredClasses = $this->getRegisteredClasses();
     // Get list of registered task groups
     $registeredTaskGroups = $this->getRegisteredTaskGroups();
     // add an empty entry for non-grouped tasks
     // add in front of list
     array_unshift($registeredTaskGroups, array('uid' => 0, 'groupName' => ''));
     // Get all registered tasks
     // Just to get the number of entries
     $query = array('SELECT' => '
             tx_scheduler_task.*,
             tx_scheduler_task_group.groupName as taskGroupName,
             tx_scheduler_task_group.description as taskGroupDescription,
             tx_scheduler_task_group.deleted as isTaskGroupDeleted
             ', 'FROM' => '
             tx_scheduler_task
             LEFT JOIN tx_scheduler_task_group ON tx_scheduler_task_group.uid = tx_scheduler_task.task_group
             ', 'WHERE' => '1=1', 'ORDERBY' => 'tx_scheduler_task_group.sorting');
     $res = $this->getDatabaseConnection()->exec_SELECT_queryArray($query);
     $numRows = $this->getDatabaseConnection()->sql_num_rows($res);
     // No tasks defined, display information message
     if ($numRows == 0) {
         $this->view->setTemplatePathAndFilename($this->backendTemplatePath . 'ListTasksNoTasks.html');
         return $this->view->render();
     } else {
         $this->getPageRenderer()->loadJquery();
         $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Scheduler/Scheduler');
         $table = array();
         // Header row
         $table[] = '<thead><tr>' . '<th><a href="#" id="checkall" title="' . $this->getLanguageService()->getLL('label.checkAll', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-select', Icon::SIZE_SMALL)->render() . '</a></th>' . '<th>' . $this->getLanguageService()->getLL('label.id', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('task', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.type', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.frequency', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.parallel', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.lastExecution', true) . '</th>' . '<th>' . $this->getLanguageService()->getLL('label.nextExecution', true) . '</th>' . '<th></th>' . '</tr></thead>';
         // Loop on all tasks
         $temporaryResult = array();
         while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
             if ($row['taskGroupName'] === null || $row['isTaskGroupDeleted'] === '1') {
                 $row['taskGroupName'] = '';
                 $row['taskGroupDescription'] = '';
                 $row['task_group'] = 0;
             }
             $temporaryResult[$row['task_group']]['groupName'] = $row['taskGroupName'];
             $temporaryResult[$row['task_group']]['groupDescription'] = $row['taskGroupDescription'];
             $temporaryResult[$row['task_group']]['tasks'][] = $row;
         }
         $registeredClasses = $this->getRegisteredClasses();
         foreach ($temporaryResult as $taskGroup) {
             if (!empty($taskGroup['groupName'])) {
                 $groupText = '<strong>' . htmlspecialchars($taskGroup['groupName']) . '</strong>';
                 if (!empty($taskGroup['groupDescription'])) {
                     $groupText .= '<br>' . nl2br(htmlspecialchars($taskGroup['groupDescription']));
                 }
                 $table[] = '<tr><td colspan="9">' . $groupText . '</td></tr>';
             }
             foreach ($taskGroup['tasks'] as $schedulerRecord) {
                 // Define action icons
                 $link = htmlspecialchars($this->moduleUri . '&CMD=edit&tx_scheduler[uid]=' . $schedulerRecord['uid']);
                 $editAction = '<a class="btn btn-default" href="' . $link . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:edit', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
                 if ((int) $schedulerRecord['disable'] === 1) {
                     $translationKey = 'enable';
                     $icon = $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-unhide', Icon::SIZE_SMALL);
                 } else {
                     $translationKey = 'disable';
                     $icon = $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-hide', Icon::SIZE_SMALL);
                 }
                 $toggleHiddenAction = '<a class="btn btn-default" href="' . htmlspecialchars($this->moduleUri . '&CMD=toggleHidden&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:' . $translationKey, true) . '" class="icon">' . $icon->render() . '</a>';
                 $deleteAction = '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars($this->moduleUri . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" ' . ' data-severity="warning"' . ' data-title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', true) . '"' . ' data-button-close-text="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:cancel', true) . '"' . ' data-content="' . $this->getLanguageService()->getLL('msg.delete', true) . '"' . ' title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
                 $stopAction = '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars($this->moduleUri . '&CMD=stop&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" ' . ' data-severity="warning"' . ' data-title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:stop', true) . '"' . ' data-button-close-text="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:cancel', true) . '"' . ' data-content="' . $this->getLanguageService()->getLL('msg.stop', true) . '"' . ' title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:stop', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL)->render() . '</a>';
                 $runAction = '<a class="btn btn-default" href="' . htmlspecialchars($this->moduleUri . '&tx_scheduler[execute][]=' . $schedulerRecord['uid']) . '" title="' . $this->getLanguageService()->getLL('action.run_task', true) . '" class="icon">' . $this->moduleTemplate->getIconFactory()->getIcon('extensions-scheduler-run-task', Icon::SIZE_SMALL)->render() . '</a>';
                 // Define some default values
                 $lastExecution = '-';
                 $isRunning = false;
                 $showAsDisabled = false;
                 $startExecutionElement = '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
                 // Restore the serialized task and pass it a reference to the scheduler object
                 /** @var $task \TYPO3\CMS\Scheduler\Task\AbstractTask|\TYPO3\CMS\Scheduler\ProgressProviderInterface */
                 $task = unserialize($schedulerRecord['serialized_task_object']);
                 $class = get_class($task);
                 if ($class === '__PHP_Incomplete_Class' && preg_match('/^O:[0-9]+:"(?P<classname>.+?)"/', $schedulerRecord['serialized_task_object'], $matches) === 1) {
                     $class = $matches['classname'];
                 }
                 // Assemble information about last execution
                 if (!empty($schedulerRecord['lastexecution_time'])) {
                     $lastExecution = date($dateFormat, $schedulerRecord['lastexecution_time']);
                     if ($schedulerRecord['lastexecution_context'] == 'CLI') {
                         $context = $this->getLanguageService()->getLL('label.cron');
                     } else {
                         $context = $this->getLanguageService()->getLL('label.manual');
                     }
                     $lastExecution .= ' (' . $context . ')';
                 }
                 if (isset($registeredClasses[get_class($task)]) && $this->scheduler->isValidTaskObject($task)) {
                     // The task object is valid
                     $labels = array();
                     $name = htmlspecialchars($registeredClasses[$class]['title'] . ' (' . $registeredClasses[$class]['extension'] . ')');
                     $additionalInformation = $task->getAdditionalInformation();
                     if ($task instanceof \TYPO3\CMS\Scheduler\ProgressProviderInterface) {
                         $progress = round(floatval($task->getProgress()), 2);
                         $name .= $this->renderTaskProgressBar($progress);
                     }
                     if (!empty($additionalInformation)) {
                         $name .= '<div class="additional-information">' . nl2br(htmlspecialchars($additionalInformation)) . '</div>';
                     }
                     // Check if task currently has a running execution
                     if (!empty($schedulerRecord['serialized_executions'])) {
                         $labels[] = array('class' => 'success', 'text' => $this->getLanguageService()->getLL('status.running'));
                         $isRunning = true;
                     }
                     // Prepare display of next execution date
                     // If task is currently running, date is not displayed (as next hasn't been calculated yet)
                     // Also hide the date if task is disabled (the information doesn't make sense, as it will not run anyway)
                     if ($isRunning || $schedulerRecord['disable']) {
                         $nextDate = '-';
                     } else {
                         $nextDate = date($dateFormat, $schedulerRecord['nextexecution']);
                         if (empty($schedulerRecord['nextexecution'])) {
                             $nextDate = $this->getLanguageService()->getLL('none');
                         } elseif ($schedulerRecord['nextexecution'] < $GLOBALS['EXEC_TIME']) {
                             $labels[] = array('class' => 'warning', 'text' => $this->getLanguageService()->getLL('status.late'), 'description' => $this->getLanguageService()->getLL('status.legend.scheduled'));
                         }
                     }
                     // Get execution type
                     if ($task->getType() === AbstractTask::TYPE_SINGLE) {
                         $execType = $this->getLanguageService()->getLL('label.type.single');
                         $frequency = '-';
                     } else {
                         $execType = $this->getLanguageService()->getLL('label.type.recurring');
                         if ($task->getExecution()->getCronCmd() == '') {
                             $frequency = $task->getExecution()->getInterval();
                         } else {
                             $frequency = $task->getExecution()->getCronCmd();
                         }
                     }
                     // Get multiple executions setting
                     if ($task->getExecution()->getMultiple()) {
                         $multiple = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:yes');
                     } else {
                         $multiple = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:no');
                     }
                     // Define checkbox
                     $startExecutionElement = '<label class="btn btn-default btn-checkbox"><input type="checkbox" name="tx_scheduler[execute][]" value="' . $schedulerRecord['uid'] . '" id="task_' . $schedulerRecord['uid'] . '"><span class="t3-icon fa"></span></label>';
                     $actions = $editAction . $toggleHiddenAction . $deleteAction;
                     // Check the disable status
                     // Row is shown dimmed if task is disabled, unless it is still running
                     if ($schedulerRecord['disable'] && !$isRunning) {
                         $labels[] = array('class' => 'default', 'text' => $this->getLanguageService()->getLL('status.disabled'));
                         $showAsDisabled = true;
                     }
                     // Show no action links (edit, delete) if task is running
                     if ($isRunning) {
                         $actions = $stopAction;
                     } else {
                         $actions .= $runAction;
                     }
                     // Check if the last run failed
                     if (!empty($schedulerRecord['lastexecution_failure'])) {
                         // Try to get the stored exception array
                         /** @var $exceptionArray array */
                         $exceptionArray = @unserialize($schedulerRecord['lastexecution_failure']);
                         // If the exception could not be unserialized, issue a default error message
                         if (!is_array($exceptionArray) || empty($exceptionArray)) {
                             $labelDescription = $this->getLanguageService()->getLL('msg.executionFailureDefault');
                         } else {
                             $labelDescription = sprintf($this->getLanguageService()->getLL('msg.executionFailureReport'), $exceptionArray['code'], $exceptionArray['message']);
                         }
                         $labels[] = array('class' => 'danger', 'text' => $this->getLanguageService()->getLL('status.failure'), 'description' => $labelDescription);
                     }
                     // Format the execution status,
                     // including failure feedback, if any
                     $taskDesc = '';
                     if ($schedulerRecord['description'] !== '') {
                         $taskDesc = '<span class="description">' . nl2br(htmlspecialchars($schedulerRecord['description'])) . '</span>';
                     }
                     $taskName = '<span class="name"><a href="' . $link . '">' . $name . '</a></span>';
                     $table[] = '<tr class="' . ($showAsDisabled ? 'disabled' : '') . '">' . '<td>' . $startExecutionElement . '</td>' . '<td class="right">' . $schedulerRecord['uid'] . '</td>' . '<td>' . $this->makeStatusLabel($labels) . $taskName . $taskDesc . '</td>' . '<td>' . $execType . '</td>' . '<td>' . $frequency . '</td>' . '<td>' . $multiple . '</td>' . '<td>' . $lastExecution . '</td>' . '<td>' . $nextDate . '</td>' . '<td nowrap="nowrap"><div class="btn-group" role="group">' . $actions . '</div></td>' . '</tr>';
                 } else {
                     // The task object is not valid
                     // Prepare to issue an error
                     $executionStatusOutput = '<span class="label label-danger">' . htmlspecialchars(sprintf($this->getLanguageService()->getLL('msg.invalidTaskClass'), $class)) . '</span>';
                     $table[] = '<tr>' . '<td>' . $startExecutionElement . '</td>' . '<td class="right">' . $schedulerRecord['uid'] . '</td>' . '<td colspan="6">' . $executionStatusOutput . '</td>' . '<td nowrap="nowrap"><div class="btn-group" role="group">' . '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>' . '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>' . $deleteAction . '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>' . '</div></td>' . '</tr>';
                 }
             }
         }
         $this->getDatabaseConnection()->sql_free_result($res);
         $this->view->assign('table', '<table class="table table-striped table-hover">' . implode(LF, $table) . '</table>');
         // Server date time
         $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] . ' T (e';
         $this->view->assign('now', date($dateFormat) . ', GMT ' . date('P') . ')');
     }
     return $this->view->render();
 }
Exemple #18
0
    /**
     * Creating the module output.
     *
     * @throws \UnexpectedValueException
     * @return void
     */
    public function main()
    {
        $hasAccess = true;
        if ($this->id && $this->access) {
            // Init position map object:
            $posMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\ContentCreationPagePositionMap::class);
            $posMap->cur_sys_language = $this->sys_language;
            // If a column is pre-set:
            if (isset($this->colPos)) {
                if ($this->uid_pid < 0) {
                    $row = [];
                    $row['uid'] = abs($this->uid_pid);
                } else {
                    $row = '';
                }
                $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language);
            } else {
                $this->onClickEvent = '';
            }
            // ***************************
            // Creating content
            // ***************************
            // Wizard
            $wizardItems = $this->wizardArray();
            // Wrapper for wizards
            // Hook for manipulating wizardItems, wrapper, onClickEvent etc.
            if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) {
                foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) {
                    $hookObject = GeneralUtility::getUserObj($classData);
                    if (!$hookObject instanceof NewContentElementWizardHookInterface) {
                        throw new \UnexpectedValueException($classData . ' must implement interface ' . NewContentElementWizardHookInterface::class, 1227834741);
                    }
                    $hookObject->manipulateWizardItems($wizardItems, $this);
                }
            }
            // Add document inline javascript
            $this->moduleTemplate->addJavaScriptCode('NewContentElementWizardInlineJavascript', '
				function goToalt_doc() {
					' . $this->onClickEvent . '
				}');
            // Traverse items for the wizard.
            // An item is either a header or an item rendered with a radio button and title/description and icon:
            $cc = $key = 0;
            $menuItems = [];
            $this->view->assign('onClickEvent', $this->onClickEvent);
            foreach ($wizardItems as $wizardKey => $wInfo) {
                $wizardOnClick = '';
                if ($wInfo['header']) {
                    $menuItems[] = ['label' => htmlspecialchars($wInfo['header']), 'content' => ''];
                    $key = count($menuItems) - 1;
                } else {
                    if (!$this->onClickEvent) {
                        // Radio button:
                        $wizardOnClick = 'document.editForm.defValues.value=unescape(' . GeneralUtility::quoteJSvalue(rawurlencode($wInfo['params'])) . ');goToalt_doc();' . (!$this->onClickEvent ? 'window.location.hash=\'#sel2\';' : '');
                        // Onclick action for icon/title:
                        $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $wizardOnClick . 'return false;';
                    } else {
                        $aOnClick = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : '');
                    }
                    $icon = $this->moduleTemplate->getIconFactory()->getIcon($wInfo['iconIdentifier'])->render();
                    $this->menuItemView->assignMultiple(['onClickEvent' => $this->onClickEvent, 'aOnClick' => $aOnClick, 'wizardInformation' => $wInfo, 'icon' => $icon, 'wizardOnClick' => $wizardOnClick, 'wizardKey' => $wizardKey]);
                    $menuItems[$key]['content'] .= $this->menuItemView->render();
                    $cc++;
                }
            }
            $this->view->assign('renderedTabs', $this->moduleTemplate->getDynamicTabMenu($menuItems, 'new-content-element-wizard'));
            // If the user must also select a column:
            if (!$this->onClickEvent) {
                // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                $colPosArray = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getColPosListItemsParsed', $this->id, $this);
                $colPosIds = array_column($colPosArray, 1);
                // Removing duplicates, if any
                $colPosList = implode(',', array_unique(array_map('intval', $colPosIds)));
                // Finally, add the content of the column selector to the content:
                $this->view->assign('posMap', $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI));
            }
        } else {
            // In case of no access:
            $hasAccess = false;
        }
        $this->view->assign('hasAccess', $hasAccess);
        $this->content = $this->view->render();
        // Setting up the buttons and markers for docheader
        $this->getButtons();
    }
 /**
  * Displays a diff over multiple fields including rollback links
  *
  * @param array $diff Difference array
  */
 public function displayMultipleDiff($diff)
 {
     // Get all array keys needed
     $arrayKeys = array_merge(array_keys($diff['newData']), array_keys($diff['insertsDeletes']), array_keys($diff['oldData']));
     $arrayKeys = array_unique($arrayKeys);
     $languageService = $this->getLanguageService();
     if ($arrayKeys) {
         $lines = array();
         foreach ($arrayKeys as $key) {
             $singleLine = array();
             $elParts = explode(':', $key);
             // Turn around diff because it should be a "rollback preview"
             if ((int) $diff['insertsDeletes'][$key] === 1) {
                 // insert
                 $singleLine['insertDelete'] = 'delete';
             } elseif ((int) $diff['insertsDeletes'][$key] === -1) {
                 $singleLine['insertDelete'] = 'insert';
             }
             // Build up temporary diff array
             // turn around diff because it should be a "rollback preview"
             if ($diff['newData'][$key]) {
                 $tmpArr['newRecord'] = $diff['oldData'][$key];
                 $tmpArr['oldRecord'] = $diff['newData'][$key];
                 $singleLine['differences'] = $this->renderDiff($tmpArr, $elParts[0], $elParts[1]);
             }
             $elParts = explode(':', $key);
             $singleLine['revertRecordLink'] = $this->createRollbackLink($key, $languageService->getLL('revertRecord', true), 1);
             $singleLine['title'] = $this->generateTitle($elParts[0], $elParts[1]);
             $lines[] = $singleLine;
         }
         $this->view->assign('revertAllLink', $this->createRollbackLink('ALL', $languageService->getLL('revertAll', true), 0));
         $this->view->assign('multipleDiff', $lines);
     }
 }
 /**
  * Assign content object renderer data and current to view
  *
  * @param array $conf Configuration
  * @return void
  */
 protected function assignContentObjectDataAndCurrent(array $conf)
 {
     $this->view->assign('data', $this->cObj->data);
     $this->view->assign('current', $this->cObj->data[$this->cObj->currentValKey]);
 }
 /**
  * @param StandaloneView $view
  * @param PageRenderer $pageRenderer
  * @param LoginController $loginController
  */
 public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController)
 {
     $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:openid/Resources/Private/Templates/OpenidLogin.html'));
     $view->assign('presetOpenId', GeneralUtility::_GP('openid_url'));
 }
 /**
  * Calls the mainAction
  *
  * @return string
  */
 public function mainAction()
 {
     $this->init();
     $this->view->assign('status', $this->status);
     return $this->view->render();
 }
 /**
  * Import part of module
  *
  * @param array $inData Content of POST VAR tx_impexp[]..
  * @throws \BadFunctionCallException
  * @throws \InvalidArgumentException
  * @throws \RuntimeException
  * @return void Setting content in $this->content
  */
 public function importData($inData)
 {
     $access = is_array($this->pageinfo) ? 1 : 0;
     $beUser = $this->getBackendUser();
     if ($this->id && $access || $beUser->user['admin'] && !$this->id) {
         if ($beUser->user['admin'] && !$this->id) {
             $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
         }
         if ($inData['new_import']) {
             unset($inData['import_mode']);
         }
         /** @var $import Import */
         $import = GeneralUtility::makeInstance(Import::class);
         $import->init();
         $import->update = $inData['do_update'];
         $import->import_mode = $inData['import_mode'];
         $import->enableLogging = $inData['enableLogging'];
         $import->global_ignore_pid = $inData['global_ignore_pid'];
         $import->force_all_UIDS = $inData['force_all_UIDS'];
         $import->showDiff = !$inData['notShowDiff'];
         $import->allowPHPScripts = $inData['allowPHPScripts'];
         $import->softrefInputValues = $inData['softrefInputValues'];
         // OUTPUT creation:
         // Make input selector:
         // must have trailing slash.
         $path = $this->getDefaultImportExportFolder();
         $exportFiles = $this->getExportFiles();
         $this->shortcutName .= ' (' . $this->pageinfo['title'] . ')';
         // Configuration
         $selectOptions = array('');
         foreach ($exportFiles as $file) {
             $selectOptions[$file->getCombinedIdentifier()] = $file->getPublicUrl();
         }
         $this->standaloneView->assign('import', $import);
         $this->standaloneView->assign('inData', $inData);
         $this->standaloneView->assign('fileSelectOptions', $selectOptions);
         if ($path) {
             $this->standaloneView->assign('importPath', sprintf($this->lang->getLL('importdata_fromPathS', true), $path->getCombinedIdentifier()));
         } else {
             $this->standaloneView->assign('importPath', $this->lang->getLL('importdata_no_default_upload_folder', true));
         }
         $this->standaloneView->assign('isAdmin', $beUser->isAdmin());
         // Upload file:
         $tempFolder = $this->getDefaultImportExportFolder();
         if ($tempFolder) {
             $this->standaloneView->assign('tempFolder', $tempFolder->getCombinedIdentifier());
             $this->standaloneView->assign('hasTempUploadFolder', true);
             if (GeneralUtility::_POST('_upload')) {
                 $this->standaloneView->assign('submitted', GeneralUtility::_POST('_upload'));
                 $this->standaloneView->assign('noFileUploaded', $this->fileProcessor->internalUploadMap[1]);
                 if ($this->uploadedFiles[0]) {
                     $this->standaloneView->assign('uploadedFile', $this->uploadedFiles[0]->getName());
                 }
             }
         }
         // Perform import or preview depending:
         $inFile = $this->getFile($inData['file']);
         if ($inFile !== null && $inFile->exists()) {
             $this->standaloneView->assign('metaDataInFileExists', true);
             $importInhibitedMessages = array();
             if ($import->loadFile($inFile->getForLocalProcessing(false), 1)) {
                 $importInhibitedMessages = $import->checkImportPrerequisites();
                 if ($inData['import_file']) {
                     if (empty($importInhibitedMessages)) {
                         $import->importData($this->id);
                         BackendUtility::setUpdateSignal('updatePageTree');
                     }
                 }
                 $import->display_import_pid_record = $this->pageinfo;
                 $this->standaloneView->assign('contentOverview', $import->displayContentOverview());
             }
             // Compile messages which are inhibiting a proper import and add them to output.
             if (!empty($importInhibitedMessages)) {
                 $flashMessageQueue = GeneralUtility::makeInstance(FlashMessageService::class)->getMessageQueueByIdentifier('impexp.errors');
                 foreach ($importInhibitedMessages as $message) {
                     $flashMessageQueue->addMessage(GeneralUtility::makeInstance(FlashMessage::class, $message, '', FlashMessage::ERROR));
                 }
             }
         }
         // Print errors that might be:
         $errors = $import->printErrorLog();
         $this->standaloneView->assign('errors', trim($errors));
     }
 }
 /**
  * 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;
         default:
             $theVar = array();
     }
     // Update node:
     $update = 0;
     $node = GeneralUtility::_GET('node');
     // If any plus-signs were clicked, it's registred.
     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, array());
     }
     // mask the encryption key to not show it as plaintext in the configuration module
     if ($theVar == $GLOBALS['TYPO3_CONF_VARS']) {
         $theVar['SYS']['encryptionKey'] = '***** (length: ' . strlen($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']) . ' characters)';
     }
     $tree = $arrayBrowser->tree($theVar, '', '');
     $this->view->assign('tree', $tree);
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu(), 'CONTENT' => $this->view->render());
     // Build the <body> for the module
     $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
     // Renders the module page
     $this->content = $this->doc->render('Configuration', $this->content);
 }
 /**
  * Main function of class
  *
  * @return string HTML output
  */
 public function main()
 {
     $pageId = (int) GeneralUtility::_GP('id');
     if ($pageId === 0) {
         $this->view->assign('pageZero', 1);
         $this->view->assign('overviewOfPagesUsingTSConfig', $this->getOverviewOfPagesUsingTSConfig());
     } else {
         if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) {
             $TSparts = BackendUtility::getPagesTSconfig($this->pObj->id, null, true);
             $lines = array();
             $pUids = array();
             foreach ($TSparts as $k => $v) {
                 if ($k != 'uid_0') {
                     $line = array();
                     if ($k == 'defaultPageTSconfig') {
                         $line['defaultPageTSconfig'] = 1;
                     } else {
                         $pUids[] = substr($k, 4);
                         $row = BackendUtility::getRecordWSOL('pages', substr($k, 4));
                         $icon = $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL);
                         $editIdList = substr($k, 4);
                         $urlParameters = ['edit' => ['pages' => [$editIdList => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
                         $line['editIcon'] = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                         $line['editTitle'] = 'editTSconfig';
                         $line['title'] = BackendUtility::wrapClickMenuOnIcon($icon, 'pages', $row['uid']) . ' ' . htmlspecialchars(BackendUtility::getRecordTitle('pages', $row));
                     }
                     $tsparser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class);
                     $tsparser->lineNumberOffset = 0;
                     $line['content'] = $tsparser->doSyntaxHighlight(trim($v) . LF);
                     $lines[] = $line;
                 }
             }
             if (!empty($pUids)) {
                 $urlParameters = ['edit' => ['pages' => [implode(',', $pUids) => 'edit']], 'columnsOnly' => 'TSconfig', 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
                 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                 $editIcon = htmlspecialchars($url);
                 $editTitle = 'editTSconfig_all';
             } else {
                 $editIcon = '';
                 $editTitle = '';
             }
             $this->view->assign('tsconfParts99', 1);
             $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_edit', null, '|'));
             $this->view->assign('lines', $lines);
             $this->view->assign('editIcon', $editIcon);
             $this->view->assign('editTitle', $editTitle);
         } else {
             $this->view->assign('tsconfParts99', 0);
             // Defined global here!
             $tmpl = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
             // Do not log time-performance information
             $tmpl->tt_track = 0;
             $tmpl->fixedLgd = 0;
             $tmpl->linkObjects = 0;
             $tmpl->bType = '';
             $tmpl->ext_expandAllNotes = 1;
             $tmpl->ext_noPMicons = 1;
             $beUser = $this->getBackendUser();
             switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) {
                 case '1':
                     $modTSconfig = BackendUtility::getModTSconfig($this->pObj->id, 'mod');
                     break;
                 case '1a':
                     $modTSconfig = $beUser->getTSConfig('mod.web_layout', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1b':
                     $modTSconfig = $beUser->getTSConfig('mod.web_view', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1c':
                     $modTSconfig = $beUser->getTSConfig('mod.web_modules', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1d':
                     $modTSconfig = $beUser->getTSConfig('mod.web_list', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1e':
                     $modTSconfig = $beUser->getTSConfig('mod.web_info', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1f':
                     $modTSconfig = $beUser->getTSConfig('mod.web_func', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '1g':
                     $modTSconfig = $beUser->getTSConfig('mod.web_ts', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '2':
                     $modTSconfig = $beUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '5':
                     $modTSconfig = $beUser->getTSConfig('TCEFORM', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '6':
                     $modTSconfig = $beUser->getTSConfig('TCEMAIN', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '3':
                     $modTSconfig = $beUser->getTSConfig('TSFE', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 case '4':
                     $modTSconfig = $beUser->getTSConfig('user', BackendUtility::getPagesTSconfig($this->pObj->id));
                     break;
                 default:
                     $modTSconfig['properties'] = BackendUtility::getPagesTSconfig($this->pObj->id);
             }
             $modTSconfig = $modTSconfig['properties'];
             if (!is_array($modTSconfig)) {
                 $modTSconfig = array();
             }
             $this->view->assign('csh', BackendUtility::cshItem('_MOD_web_info', 'tsconfig_hierarchy', null, '|'));
             $this->view->assign('tree', $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']));
         }
         $this->view->assign('alphaSort', BackendUtility::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"'));
         $this->view->assign('dropdownMenu', BackendUtility::getDropdownMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']));
     }
     return $this->view->render();
 }
 /**
  * @return string
  */
 protected function renderViewForMail()
 {
     $view = new StandaloneView();
     $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:pt_extbase/Resources/Private/Templates/Logger/ErrorEmail.html'));
     $view->assign('logRecord', $this->logRecord);
     $view->assign('serverInformation', $this->serverInformation);
     $view->assign('userAgent', $this->userAgent);
     $view->assign('requestId', $this->requestInformation->getCurrentRequestId());
     return $view->render();
 }