/** * Checks whether a an BE user account named admin with default password exists. * * @return \TYPO3\CMS\Reports\Status An object representing whether a default admin account exists */ protected function getAdminAccountStatus() { $value = $GLOBALS['LANG']->getLL('status_ok'); $message = ''; $severity = \TYPO3\CMS\Reports\Status::OK; $whereClause = 'username = '******'TYPO3_DB']->fullQuoteStr('admin', 'be_users') . BackendUtility::deleteClause('be_users'); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $whereClause); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if (!empty($row)) { $secure = TRUE; /** @var $saltingObject \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface */ $saltingObject = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($row['password']); if (is_object($saltingObject)) { if ($saltingObject->checkPassword('password', $row['password'])) { $secure = FALSE; } } // Check against plain MD5 if ($row['password'] === '5f4dcc3b5aa765d61d8327deb882cf99') { $secure = FALSE; } if (!$secure) { $value = $GLOBALS['LANG']->getLL('status_insecure'); $severity = \TYPO3\CMS\Reports\Status::ERROR; $editUserAccountUrl = BackendUtility::getModuleUrl('record_edit', array('edit[be_users][' . $row['uid'] . ']' => 'edit', 'returnUrl' => BackendUtility::getModuleUrl('system_ReportsTxreportsm1'))); $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.backend_admin'), '<a href="' . htmlspecialchars($editUserAccountUrl) . '">', '</a>'); } } $GLOBALS['TYPO3_DB']->sql_free_result($res); return GeneralUtility::makeInstance(\TYPO3\CMS\Reports\Status::class, $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity); }
/** * MAIN function for page information display * * @return string Output HTML for the module. * @todo Define visibility */ public function main() { global $BACK_PATH, $LANG, $SOBE; $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\PageLayoutView'); $dblist->descrTable = '_MOD_' . $GLOBALS['MCONF']['name']; $dblist->backPath = $BACK_PATH; $dblist->thumbs = 0; $dblist->script = BackendUtility::getModuleUrl('web_info'); $dblist->showIcon = 0; $dblist->setLMargin = 0; $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears'); $dblist->pI_showUser = 1; // PAGES: $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth']; // ONLY for the sake of dblist module which uses this value. $h_func = BackendUtility::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']); $h_func .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages']); $dblist->start($this->pObj->id, 'pages', 0); $dblist->generateList(); // CSH $theOutput = $this->pObj->doc->header($LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:page_title')); $theOutput .= $this->pObj->doc->section('', BackendUtility::cshItem($dblist->descrTable, 'pagetree_overview', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $dblist->HTMLcode, 0, 1); // Additional footer content $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook']; if (is_array($footerContentHook)) { foreach ($footerContentHook as $hook) { $params = array(); $theOutput .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this); } } return $theOutput; }
/** * Post-processing to define which control items to show. Possibly own icons can be added here. * * @param string $parentUid The uid of the parent (embedding) record (uid or NEW...) * @param string $foreignTable The table (foreign_table) we create control-icons for * @param array $childRecord The current record of that foreign_table * @param array $childConfig TCA configuration of the current field of the child record * @param boolean $isVirtual Defines whether the current records is only virtually shown and not physically part of the parent record * @param array $controlItems (reference) Associative array with the currently available control items * * @return void */ public function renderForeignRecordHeaderControl_postProcess($parentUid, $foreignTable, array $childRecord, array $childConfig, $isVirtual, array &$controlItems) { if ($foreignTable != 'sys_file_reference') { return; } if (!GeneralUtility::isFirstPartOfStr($childRecord['uid_local'], 'sys_file_')) { return; } $parts = BackendUtility::splitTable_Uid($childRecord['uid_local']); if (!isset($parts[1])) { return; } $table = $childRecord['tablenames']; $uid = $parentUid; $arguments = GeneralUtility::_GET(); if ($this->isValidRecord($table, $uid) && isset($arguments['edit'])) { $returnUrl = ['edit' => $arguments['edit'], 'returnUrl' => $arguments['returnUrl']]; if (GeneralUtility::compat_version('7.0')) { $returnUrlGenerated = BackendUtility::getModuleUrl('record_edit', $returnUrl); } else { $returnUrlGenerated = 'alt_doc.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $returnUrl, '', true, true), '&') . BackendUtility::getUrlToken('editRecord'); } $wizardArguments = ['P' => ['referenceUid' => $childRecord['uid'], 'returnUrl' => $returnUrlGenerated]]; $wizardUri = BackendUtility::getModuleUrl('focuspoint', $wizardArguments); } else { $wizardUri = 'javascript:alert(\'Please save the base record first, because open this wizard will not save the changes in the current form!\');'; } /** @var WizardService $wizardService */ $wizardService = GeneralUtility::makeInstance('HDNET\\Focuspoint\\Service\\WizardService'); $this->arrayUnshiftAssoc($controlItems, 'focuspoint', $wizardService->getWizardButton($wizardUri)); }
/** * Modifies CacheMenuItems array * * @param array $cacheActions Array of CacheMenuItems * @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier) * * @return void */ public function manipulateCacheActions(&$cacheActions, &$optionValues) { if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) { $cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.title', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.description', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('extensions-dyncss-lightning-blue')); $optionValues[] = 'dyncss'; } }
/** * Main function. * Creates the header code in XHTML, the JavaScript, then the frameset for the two frames. * * @return void */ public function main() { // Setting GPvars: $mode = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('mode'); $bparams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('bparams'); $moduleUrl = BackendUtility::getModuleUrl('wizard_element_browser') . '&mode='; // Set doktype: $GLOBALS['TBE_TEMPLATE']->docType = 'xhtml_frames'; $GLOBALS['TBE_TEMPLATE']->JScode = $GLOBALS['TBE_TEMPLATE']->wrapScriptTags(' function closing() { // close(); } function setParams(mode,params) { // parent.content.location.href = ' . GeneralUtility::quoteJSvalue($moduleUrl) . '+mode+"&bparams="+params; } if (!window.opener) { alert("ERROR: Sorry, no link to main window... Closing"); close(); } '); $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:TYPO3_Element_Browser')); // URL for the inner main frame: $url = $GLOBALS['BACK_PATH'] . $moduleUrl . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams); // Create the frameset for the window: // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload" $this->content .= ' <frameset rows="*,1" framespacing="0" frameborder="0" border="0"> <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" /> <frame name="menu" src="' . $GLOBALS['BACK_PATH'] . 'dummy.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" /> </frameset> '; $this->content .= ' </html>'; }
/** * MAIN function for static publishing information * * @return string Output HTML for the module. */ public function main() { // Handle actions: $this->handleActions(); $this->pageId = intval($this->pObj->id); // Initialize tree object: /* @var $tree BrowseTreeView */ $tree = GeneralUtility::makeInstance(BrowseTreeView::class); $tree->makeHTML = 2; $tree->init(); // Set starting page Id of tree (overrides webmounts): if ($this->pageId > 0) { $tree->MOUNTS = [0 => $this->pageId]; } $tree->ext_IconMode = true; $tree->showDefaultTitleAttribute = true; $tree->thisScript = BackendUtility::getModuleUrl(GeneralUtility::_GP('M')); if (is_callable([$tree, 'setTreeName'])) { $tree->setTreeName('staticfilecache'); } else { $tree->treeName = 'staticfilecache'; } // Creating top icon; the current page $tree->getBrowsableTree(); // Render information table: return $this->processExpandCollapseLinks($this->renderModule($tree)); }
/** * Main function of the module. Write the content to $this->content * * @return void */ public function main() { $languageService = $this->getLanguageService(); $this->thisScript = BackendUtility::getModuleUrl($this->MCONF['name']); // Clean up settings: $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SET'), $this->MCONF['name']); // Draw the header $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->form = '<form action="" method="post">'; // DBAL page title: $this->content .= $this->doc->startPage($languageService->getLL('title')); $this->content .= $this->doc->header($languageService->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->section('', $this->doc->funcMenu('', BackendUtility::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']))); // Debug log: switch ($this->MOD_SETTINGS['function']) { case 'info': $this->content .= $this->doc->section($languageService->getLL('Cached_info'), $this->printCachedInfo()); break; case 'sqlcheck': $this->content .= $this->doc->section($languageService->getLL('SQL_check'), $this->printSqlCheck()); break; case 0: $this->content .= $this->doc->section($languageService->getLL('Debug_log'), $this->printLogMgm()); break; } // ShortCut if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'])); } $this->content .= $this->doc->spacer(10); }
/** * Modifies CacheMenuItems array * * @param array $cacheActions Array of CacheMenuItems * @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier) */ public function manipulateCacheActions(&$cacheActions, &$optionValues) { if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) { $cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high')); $optionValues[] = 'dyncss'; } }
/** * Main function, adding the item to input menuItems array * * @param ClickMenu $backRef References to parent clickmenu objects. * @param array $menuItems Array of existing menu items accumulated. New element added to this. * @param string $table Table name of the element * @param int $uid Record UID of the element * @return array Modified menuItems array */ public function main(&$backRef, $menuItems, $table, $uid) { $localItems = array(); if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) { // Returns directly, because the clicked item was not from the pages table if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { return $menuItems; } // Adds the regular item $LL = $this->includeLL(); // "Versioning" element added: $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid)); $localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon('<img src="' . $backRef->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('version') . 'Resources/Public/Icons/module-version.png" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url), TRUE); // Find position of "delete" element: $c = 0; foreach ($menuItems as $k => $value) { $c++; if ($k === 'delete') { break; } } // .. subtract two (delete item + divider line) $c -= 2; // ... and insert the items just before the delete element. array_splice($menuItems, $c, 0, $localItems); } return $menuItems; }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { parent::initializeAction(); $this->stageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\StagesService'); $this->workspaceService = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService'); $this->template->setExtDirectStateProvider(); $resourcePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('workspaces') . 'Resources/Public/StyleSheet/preview.css'; $GLOBALS['TBE_STYLES']['extJS']['theme'] = $resourcePath; $this->pageRenderer->loadExtJS(); $this->pageRenderer->enableExtJSQuickTips(); // Load JavaScript: $this->pageRenderer->addExtDirectCode(array('TYPO3.Workspaces', 'TYPO3.ExtDirectStateProvider')); $states = $GLOBALS['BE_USER']->uc['moduleData']['Workspaces']['States']; $this->pageRenderer->addInlineSetting('Workspaces', 'States', $states); $this->pageRenderer->addJsFile($this->backPath . 'sysext/backend/Resources/Public/JavaScript/notifications.js'); $this->pageRenderer->addJsFile($this->backPath . 'sysext/backend/Resources/Public/JavaScript/flashmessages.js'); $this->pageRenderer->addJsFile($this->backPath . 'sysext/backend/Resources/Public/JavaScript/iframepanel.js'); $resourcePathJavaScript = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('workspaces') . 'Resources/Public/JavaScript/'; $jsFiles = array('Ext.ux.plugins.TabStripContainer.js', 'Store/mainstore.js', 'helpers.js', 'actions.js'); foreach ($jsFiles as $jsFile) { $this->pageRenderer->addJsFile($resourcePathJavaScript . $jsFile); } $this->pageRenderer->addInlineSetting('RecordHistory', 'moduleUrl', BackendUtility::getModuleUrl('record_history')); // todo this part should be done with inlineLocallanglabels $this->pageRenderer->addJsInlineCode('workspace-inline-code', $this->generateJavascript()); }
/** * Constructor * * @throws \UnexpectedValueException */ public function __construct() { $backendUser = $this->getBackendUser(); $languageService = $this->getLanguageService(); $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ClearCacheMenu'); // Clear all page-related caches if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) { $this->cacheActions[] = array('id' => 'pages', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', true), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', true), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'pages', 'ajaxCall' => 1]), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-low', Icon::SIZE_SMALL)->render()); $this->optionValues[] = 'pages'; } // Clear cache for ALL tables! if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) { $this->cacheActions[] = array('id' => 'all', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', true), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', true), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'all', 'ajaxCall' => 1]), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-medium', Icon::SIZE_SMALL)->render()); $this->optionValues[] = 'all'; } // Clearing of system cache (core cache, class cache etc) // is only shown explicitly if activated for a BE-user (not activated for admins by default) // or if the system runs in development mode // or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins) if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === true && $backendUser->isAdmin()) { $this->cacheActions[] = array('id' => 'system', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', true), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', true), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'system', 'ajaxCall' => 1]), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-high', Icon::SIZE_SMALL)->render()); $this->optionValues[] = 'system'; } // Hook for manipulating cacheActions if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) { $hookObject = GeneralUtility::getUserObj($cacheAction); if (!$hookObject instanceof ClearCacheActionsHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000); } $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues); } } }
/** * Displaying a message to click the update in the extension config * * @return string $out: the html message */ public static function displayMessage() { $parameters = array('tx_extensionmanager_tools_extensionmanagerextensionmanager[extensionKey]' => 'direct_mail', 'tx_extensionmanager_tools_extensionmanagerextensionmanager[action]' => 'show', 'tx_extensionmanager_tools_extensionmanagerextensionmanager[controller]' => 'UpdateScript'); $link = BackendUtility::getModuleUrl('tools_ExtensionmanagerExtensionmanager', $parameters); $out = "\n\t\t<div style=\"position:absolute;top:10px;right:10px; width:300px;\">\n\t\t\t<div class=\"typo3-message message-information\">\n\t\t\t\t\t<div class=\"message-header\">" . $GLOBALS['LANG']->sL('LLL:EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xml:update_optionHeader') . "</div>\n\t\t\t\t\t<div class=\"message-body\">\n\t\t\t\t\t\t" . $GLOBALS['LANG']->sL("LLL:EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xml:update_optionMsg") . "<br />\n\t\t\t\t\t\t<a style=\"text-decoration:underline;\" href=\"" . $link . "\">\n\t\t\t\t\t\t" . $GLOBALS['LANG']->sL("LLL:EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xml:update_optionLink") . "</a>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t"; return $out; }
/** * Initialize * * @return void */ protected function init() { // Initialize GPvars: $this->target = GeneralUtility::_GP('target'); $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')); if (!$this->returnUrl) { $this->returnUrl = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . BackendUtility::getModuleUrl('file_list') . '&id=' . rawurlencode($this->target); } // Create the folder object if ($this->target) { $this->folderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target); } if ($this->folderObject->getStorage()->getUid() === 0) { throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException('You are not allowed to access folders outside your storages', 1375889834); } // Cleaning and checking target directory if (!$this->folderObject) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE); $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586843); } // Setting the title and the icon $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->folderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->folderObject->getIdentifier()); // Setting template object $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_upload.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->form = '<form action="tce_file.php" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">'; }
/** * Provides form code and javascript for the user setup. * * @param array $parameters Parameters to the script * @param \TYPO3\CMS\Setup\Controller\SetupModuleController $userSetupObject Calling object: user setup module * @return string The code for the user setup */ public function getLoginScripts(array $parameters, \TYPO3\CMS\Setup\Controller\SetupModuleController $userSetupObject) { $content = ''; if ($this->isRsaAvailable()) { // If we can get the backend, we can proceed $backend = \TYPO3\CMS\Rsaauth\Backend\BackendFactory::getBackend(); $javascriptPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('rsaauth') . 'resources/'; $files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js', 'rsaauth_min.js'); $content = ''; foreach ($files as $file) { $content .= '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $javascriptPath . $file . '"></script>'; } // Generate a new key pair $keyPair = $backend->createNewKeyPair(); // Save private key $storage = \TYPO3\CMS\Rsaauth\Storage\StorageFactory::getStorage(); /** @var $storage \TYPO3\CMS\Rsaauth\Storage\AbstractStorage */ $storage->put($keyPair->getPrivateKey()); // Add form tag $form = '<form action="' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('user_setup') . '" method="post" name="usersetup" enctype="application/x-www-form-urlencoded" onsubmit="tx_rsaauth_encryptUserSetup();">'; // Add RSA hidden fields $form .= '<input type="hidden" id="rsa_n" name="n" value="' . htmlspecialchars($keyPair->getPublicKeyModulus()) . '" />'; $form .= '<input type="hidden" id="rsa_e" name="e" value="' . sprintf('%x', $keyPair->getExponent()) . '" />'; $userSetupObject->doc->form = $form; } return $content; }
/** * Generates the index file for the admin interface. */ public function indexAction() { $cssHeader = ''; $abslen = strlen(PATH_site); $langid = $this->getContext()->getLocale()->getLanguageId(); $controller = $this->getController(); foreach (Base::getAimeos()->getCustomPaths('client/extjs') as $base => $paths) { $relJsbPath = '../' . substr($base, $abslen); foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; if (!is_file($jsbAbsPath)) { throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); } $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, $relJsbPath . '/' . dirname($path)); $cssHeader .= $jsb2->getHtml('css'); } } // rawurldecode() is necessary for ExtJS templates to replace "{site}" properly $urlTemplate = rawurldecode(BackendUtility::getModuleUrl($this->request->getPluginName(), array('tx_aimeos_web_aimeostxaimeosadmin' => array('site' => '{site}', 'tab' => '{tab}')))); $serviceUrl = BackendUtility::getModuleUrl($this->request->getPluginName(), array('tx_aimeos_web_aimeostxaimeosadmin' => array('controller' => 'Admin', 'action' => 'do'))); $this->view->assign('cssHeader', $cssHeader); $this->view->assign('lang', $langid); $this->view->assign('i18nContent', $this->getJsonClientI18n($langid)); $this->view->assign('config', $this->getJsonClientConfig()); $this->view->assign('site', $this->getSite($this->request)); $this->view->assign('smd', $controller->getJsonSmd($serviceUrl)); $this->view->assign('itemSchemas', $controller->getJsonItemSchemas()); $this->view->assign('searchSchemas', $controller->getJsonSearchSchemas()); $this->view->assign('activeTab', $this->request->hasArgument('tab') ? (int) $this->request->getArgument('tab') : 0); $this->view->assign('version', $this->getVersion()); $this->view->assign('urlTemplate', $urlTemplate); }
/** * Main function. * Creates the header code in XHTML, the JavaScript, then the frameset for the two frames. * * @return void */ public function main() { // Setting GPvars: $mode = GeneralUtility::_GP('mode'); $bparams = GeneralUtility::_GP('bparams'); $moduleUrl = BackendUtility::getModuleUrl('wizard_element_browser') . '&mode='; $documentTemplate = $this->getDocumentTemplate(); $documentTemplate->JScode = $documentTemplate->wrapScriptTags(' function closing() { // close(); } function setParams(mode,params) { // parent.content.location.href = ' . GeneralUtility::quoteJSvalue($moduleUrl) . '+mode+"&bparams="+params; } if (!window.opener) { alert("ERROR: Sorry, no link to main window... Closing"); close(); } '); // build the header part $documentTemplate->startPage($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:TYPO3_Element_Browser')); // URL for the inner main frame: $url = $GLOBALS['BACK_PATH'] . $moduleUrl . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams); // Create the frameset for the window // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload" $this->content = $documentTemplate->getPageRenderer()->render(PageRenderer::PART_HEADER) . '<frameset rows="*,1" framespacing="0" frameborder="0" border="0"> <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" /> <frame name="menu" src="' . htmlspecialchars(BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" /> </frameset> </html> '; }
/** * Main function * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance... * * @return void * @todo Define visibility */ public function main() { // Get this record $origRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->P['table'], $this->P['uid']); // Get TSconfig for it. $TSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCEFORM_TSconfig($this->table, is_array($origRow) ? $origRow : array('pid' => $this->P['pid'])); // Set [params][pid] if (substr($this->P['params']['pid'], 0, 3) == '###' && substr($this->P['params']['pid'], -3) == '###') { $this->pid = intval($TSconfig['_' . substr($this->P['params']['pid'], 3, -3)]); } else { $this->pid = intval($this->P['params']['pid']); } // Make redirect: // If pid is blank OR if id is set, then return... if (!strcmp($this->pid, '') || strcmp($this->id, '')) { $redirectUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']); } else { // Otherwise, show the list: $urlParameters = array(); $urlParameters['id'] = $this->pid; $urlParameters['table'] = $this->P['params']['table']; $urlParameters['returnUrl'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'); $redirectUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', $urlParameters); } \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl); }
/** * MAIN function for page information display * * @return string Output HTML for the module. */ public function main() { $theOutput = $this->pObj->doc->header($this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:page_title')); $dblist = GeneralUtility::makeInstance(PageLayoutView::class); $dblist->descrTable = '_MOD_web_info'; $dblist->thumbs = 0; $dblist->script = BackendUtility::getModuleUrl('web_info'); $dblist->showIcon = 0; $dblist->setLMargin = 0; $dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears'); $dblist->pI_showUser = 1; // PAGES: $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth']; // ONLY for the sake of dblist module which uses this value. $h_func = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']); $h_func .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages']); $dblist->start($this->pObj->id, 'pages', 0); $dblist->generateList(); // CSH $theOutput .= $this->pObj->doc->section('', BackendUtility::cshItem($dblist->descrTable, 'pagetree_overview', null, '|<br />') . '<div class="form-inline form-inline-spaced">' . $h_func . '</div>' . $dblist->HTMLcode, 0, 1); // Additional footer content $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook']; if (is_array($footerContentHook)) { foreach ($footerContentHook as $hook) { $params = array(); $theOutput .= GeneralUtility::callUserFunction($hook, $params, $this); } } return $theOutput; }
/** * Main function, adding the item to input menuItems array * * @param ClickMenu $backRef References to parent clickmenu objects. * @param array $menuItems Array of existing menu items accumulated. New element added to this. * @param string $table Table name of the element * @param int $uid Record UID of the element * @return array Modified menuItems array */ public function main(&$backRef, $menuItems, $table, $uid) { $localItems = array(); if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) { // Returns directly, because the clicked item was not from the pages table if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { return $menuItems; } // Adds the regular item $LL = $this->includeLL(); // "Versioning" element added: $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid)); $localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon($this->iconFactory->getIcon('actions-version-open', Icon::SIZE_SMALL)->render()), $backRef->urlRefForCM($url), true); // Find position of "delete" element: $c = 0; foreach ($menuItems as $k => $value) { $c++; if ($k === 'delete') { break; } } // .. subtract two (delete item + divider line) $c -= 2; // ... and insert the items just before the delete element. array_splice($menuItems, $c, 0, $localItems); } return $menuItems; }
/** * @param File $file * @return string */ protected function getUri(File $file) { $metadataProperties = $file->_getMetaData(); $parameterName = sprintf('edit[sys_file_metadata][%s]', $metadataProperties['uid']); $uri = BackendUtility::getModuleUrl('record_edit', array($parameterName => 'edit', 'returnUrl' => BackendUtility::getModuleUrl(GeneralUtility::_GP('M'), $this->getAdditionalParameters()))); return $uri; }
/** * Processing of clickmenu items * * @param object $backRef Reference to parent * @param array $menuItems Menu items array to modify * @param string $table Table name * @param integer $uid Uid of the record * @return array Menu item array, returned after modification * @todo Skinning for icons... * @todo Define visibility */ public function main(&$backRef, $menuItems, $table, $uid) { $localItems = array(); // Show import/export on second level menu OR root level. if ($backRef->cmLevel && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) { $LL = $this->includeLL(); $urlParameters = array('tx_impexp' => array('action' => 'export'), 'id' => $table == 'pages' ? $uid : $backRef->rec['pid']); if ($table == 'pages') { $urlParameters['tx_impexp']['pagetree']['id'] = $uid; $urlParameters['tx_impexp']['pagetree']['levels'] = 0; $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL'; } else { $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid; $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL'; } $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters); $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-export-t3d')), $backRef->urlRefForCM($url), 1); if ($table == 'pages') { $urlParameters = array('id' => $uid, 'table' => $table, 'tx_impexp' => array('action' => 'import')); $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters); $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-import-t3d')), $backRef->urlRefForCM($url), 1); } } return array_merge($menuItems, $localItems); }
/** * Processing of clickmenu items * * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef parent * @param array $menuItems Menu items array to modify * @param string $table Table name * @param int $uid Uid of the record * @return array Menu item array, returned after modification * @todo Skinning for icons... */ public function main(&$backRef, $menuItems, $table, $uid) { $localItems = []; // Show import/export on second level menu OR root level. if ($backRef->cmLevel && GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) { $LL = $this->includeLL(); $urlParameters = ['tx_impexp' => ['action' => 'export'], 'id' => $table == 'pages' ? $uid : $backRef->rec['pid']]; if ($table == 'pages') { $urlParameters['tx_impexp']['pagetree']['id'] = $uid; $urlParameters['tx_impexp']['pagetree']['levels'] = 0; $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL'; } else { $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid; $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL'; } $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters); $localItems[] = $backRef->linkItem(htmlspecialchars($this->getLanguageService()->getLLL('export', $LL)), $this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL), $backRef->urlRefForCM($url), 1); if ($table === 'pages') { $backendUser = $this->getBackendUser(); $isEnabledForNonAdmin = $backendUser->getTSConfig('options.impexp.enableImportForNonAdminUser'); if ($backendUser->isAdmin() || !empty($isEnabledForNonAdmin['value'])) { $urlParameters = ['id' => $uid, 'table' => $table, 'tx_impexp' => ['action' => 'import']]; $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters); $localItems[] = $backRef->linkItem(htmlspecialchars($this->getLanguageService()->getLLL('import', $LL)), $this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL), $backRef->urlRefForCM($url), 1); } } } return array_merge($menuItems, $localItems); }
/** * Return JS configuration of the htmlArea plugins registered by the extension * * @param string $rteNumberPlaceholder A dummy string for JS arrays * @return string JS configuration for registered plugins, in this case, JS configuration of block elements */ public function buildJavascriptConfiguration($rteNumberPlaceholder) { $registerRTEinJavascriptString = ''; $button = 'link'; if (in_array($button, $this->toolbar)) { if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][$button . '.'])) { $registerRTEinJavascriptString .= ' RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . ' = new Object();'; } $registerRTEinJavascriptString .= ' RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.pathLinkModule = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_browse_links')) . ';'; if ($this->htmlAreaRTE->is_FE()) { $RTEProperties = $this->htmlAreaRTE->RTEsetup; } else { $RTEProperties = $this->htmlAreaRTE->RTEsetup['properties']; } if (is_array($RTEProperties['classesAnchor.'])) { $registerRTEinJavascriptString .= ' RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.classesAnchorUrl = "' . $this->htmlAreaRTE->writeTemporaryFile('classesAnchor_' . $this->htmlAreaRTE->contentLanguageUid, 'js', $this->buildJSClassesAnchorArray()) . '";'; } $registerRTEinJavascriptString .= ' RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.additionalAttributes = "data-htmlarea-external' . ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['plugins'][$this->pluginName]['additionalAttributes'] ? ',' . $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['plugins'][$this->pluginName]['additionalAttributes'] : '') . '";'; } return $registerRTEinJavascriptString; }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { parent::initializeAction(); $backendRelPath = ExtensionManagementUtility::extRelPath('backend'); $workspacesRelPath = ExtensionManagementUtility::extRelPath('workspaces'); $this->stageService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\StagesService::class); $this->workspaceService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class); $this->pageRenderer->addJsFile($backendRelPath . 'Resources/Public/JavaScript/ExtDirect.StateProvider.js'); $resourcePath = $workspacesRelPath . 'Resources/Public/Css/preview.css'; $GLOBALS['TBE_STYLES']['extJS']['theme'] = $resourcePath; $this->pageRenderer->loadExtJS(); // Load JavaScript: $this->pageRenderer->addExtDirectCode(array('TYPO3.Workspaces', 'TYPO3.ExtDirectStateProvider')); $states = $GLOBALS['BE_USER']->uc['moduleData']['Workspaces']['States']; $this->pageRenderer->addInlineSetting('Workspaces', 'States', $states); $this->pageRenderer->addJsFile($backendRelPath . 'Resources/Public/JavaScript/notifications.js'); $this->pageRenderer->addJsFile($backendRelPath . 'Resources/Public/JavaScript/iframepanel.js'); $resourcePathJavaScript = $workspacesRelPath . 'Resources/Public/JavaScript/'; $jsFiles = array('Ext.ux.plugins.TabStripContainer.js', 'Store/mainstore.js', 'helpers.js', 'actions.js'); foreach ($jsFiles as $jsFile) { $this->pageRenderer->addJsFile($resourcePathJavaScript . $jsFile); } $this->pageRenderer->addInlineSetting('FormEngine', 'moduleUrl', BackendUtility::getModuleUrl('record_edit')); $this->pageRenderer->addInlineSetting('RecordHistory', 'moduleUrl', BackendUtility::getModuleUrl('record_history')); // @todo this part should be done with inlineLocallanglabels $this->pageRenderer->addJsInlineCode('workspace-inline-code', $this->generateJavascript()); }
/** * Include the JS for the Context Sensitive Help * * @param string $title the title of the page * @param \TYPO3\CMS\Backend\Template\DocumentTemplate $documentTemplateObject */ public function addJavaScript($title, $documentTemplateObject) { if (TYPO3_MODE === 'BE' && is_object($GLOBALS['BE_USER'])) { $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ContextHelp'); $pageRenderer->addInlineSetting('ContextHelp', 'moduleUrl', BackendUtility::getModuleUrl('help_CshmanualCshmanual', array('tx_cshmanual_help_cshmanualcshmanual' => array('controller' => 'Help', 'action' => 'detail')))); } }
/** * Create a link for backend edit * * @param string $tableName * @param int $identifier * @param bool $addReturnUrl * @return string */ public function render($tableName, $identifier, $addReturnUrl = true) { $uriParameters = ['edit' => [$tableName => [$identifier => 'edit']]]; if ($addReturnUrl) { $uriParameters['returnUrl'] = BackendUtility::getModuleUrl(GeneralUtility::_GET('M'), $this->getCurrentParameters()); } return BackendUtility::getModuleUrl('record_edit', $uriParameters); }
/** * Renders a link to edit sys_file_metadata * * @param array $arguments * @param Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { if (empty($arguments['returnUrl'])) { $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); } $params = ['edit' => ['sys_file_metadata' => [$arguments['uid'] => 'edit']], 'returnUrl' => $arguments['returnUrl']]; return BackendUtility::getModuleUrl('record_edit', $params); }
/** * Render OpenID identifier field for user setup * * @return string HTML input field to change the OpenId */ public function renderOpenID() { $openid = $this->getBackendUser()->user['tx_openid_openid']; $add = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:addopenid')); $parameters = ['P[itemName]' => 'data[be_users][tx_openid_openid]']; $popUpUrl = GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_openid', $parameters)); return '<div class="input-group">' . '<input id="field_tx_openid_openid"' . ' class="form-control"' . ' type="text" name="data[be_users][tx_openid_openid]"' . ' value="' . htmlspecialchars($openid) . '" />' . '<div class="input-group-addon">' . '<a href="#" onclick="' . 'vHWin=window.open(' . $popUpUrl . ',null,\'width=800,height=600,status=0,menubar=0,scrollbars=0\');' . 'vHWin.focus();return false;' . '">' . '<img src="../typo3/sysext/openid/ext_icon_small.png" alt="' . $add . '" title="' . $add . '"/>' . '</a>' . '</div>' . '</div>'; }
/** * Creates the version selector for the page id inputted. * Moved out of the core file \TYPO3\CMS\Backend\Template\DocumentTemplate * * @param int $id Page id to create selector for. * @param bool $noAction If set, there will be no button for swapping page. * @return void * @see \TYPO3\CMS\Backend\Template\DocumentTemplate */ public function getVersionSelector($id, $noAction = FALSE) { if ($id <= 0) { return; } if ($GLOBALS['BE_USER']->workspace == 0) { // Get Current page record: $curPage = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $id); // If the selected page is not online, find the right ID $onlineId = $curPage['pid'] == -1 ? $curPage['t3ver_oid'] : $id; // Select all versions of online version: $versions = \TYPO3\CMS\Backend\Utility\BackendUtility::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id'); // If more than one was found...: if (count($versions) > 1) { $selectorLabel = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionSelect.label', TRUE) . '</strong>'; // Create selector box entries: $opt = array(); foreach ($versions as $vRow) { if ($vRow['uid'] == $onlineId) { // Live version $label = '[' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionSelect.live', TRUE) . ']'; } else { $label = $vRow['t3ver_label'] . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionId', TRUE) . ' ' . $vRow['t3ver_id'] . ($vRow['t3ver_wsid'] != 0 ? ' ' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:workspaceId', TRUE) . ' ' . $vRow['t3ver_wsid'] : '') . ')'; } $opt[] = '<option value="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $vRow['uid']))) . '"' . ($id == $vRow['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>'; } // Add management link: $management = '<input type="button" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.mgm', TRUE) . '" onclick="window.location.href=\'' . htmlspecialchars($GLOBALS['BACK_PATH'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => 'pages', 'uid' => $onlineId))) . '\';" />'; // Create onchange handler: $onChange = 'window.location.href=this.options[this.selectedIndex].value;'; // Controls: if ($id == $onlineId) { $controls = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="absmiddle" alt="" /> <strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.online', TRUE) . '</strong>'; } elseif (!$noAction) { $href = $GLOBALS['TBE_TEMPLATE']->issueCommand('&cmd[pages][' . $onlineId . '][version][swapWith]=' . $id . '&cmd[pages][' . $onlineId . '][version][action]=swap', GeneralUtility::linkThisScript(array('id' => $onlineId))); $controls = '<a href="' . htmlspecialchars($href) . '" class="text-nowrap">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-version-swap-version', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swapPage', TRUE), 'style' => 'margin-left:5px;vertical-align:bottom;')) . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swap', TRUE) . '</strong></a>'; } // Write out HTML code: return ' <!-- Version selector: --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> <tr> <td>' . $selectorLabel . '</td> <td> <select onchange="' . htmlspecialchars($onChange) . '"> ' . implode('', $opt) . ' </select></td> <td>' . $controls . '</td> <td>' . $management . '</td> </tr> </table> '; } } }
/** * Injects the request object for the current request or sub-request * As this controller goes only through the main() method, it is rather simple for now * * @param ServerRequestInterface $request the current request * @param ResponseInterface $response the prepared response object * @return ResponseInterface the response with the content */ public function mainAction(ServerRequestInterface $request, ResponseInterface $response) { // Fallback for old calls, which use mode "wizard" or "rte" for link selection if ($this->mode === 'wizard' || $this->mode === 'rte') { return $response->withStatus(303)->withHeader('Location', BackendUtility::getModuleUrl('wizard_link', $_GET, false, true)); } $response->getBody()->write($this->main()); return $response; }