/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $id = GeneralUtility::_GP('id'); $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1)); // Add icon with clickmenu, etc: /** @var IconFactory $iconFactory */ $iconFactory = GeneralUtility::makeInstance(IconFactory::class); if ($pageRecord['uid']) { // If there IS a real page $altText = BackendUtility::getRecordIconAltText($pageRecord, 'pages'); $theIcon = '<span title="' . $altText . '">' . $iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>'; // Make Icon: $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']); // Setting icon with clickmenu + uid $theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>'; } else { // On root-level of page tree // Make Icon $theIcon = '<span title="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $iconFactory->getIcon('apps-pagetree-page-domain', Icon::SIZE_SMALL)->render() . '</span>'; if ($GLOBALS['BE_USER']->user['admin']) { $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', 0); } } return $theIcon; }
/** * Parses the passed TS-Config using conditions and caching * * @param string $TStext The TSConfig being parsed * @param string $type The type of TSConfig (either "userTS" or "PAGES") * @param integer $id The uid of the page being handled * @param array $rootLine The rootline of the page being handled * @return array Array containing the parsed TSConfig and a flag whether the content was retrieved from cache */ public function parseTSconfig($TStext, $type, $id = 0, array $rootLine = array()) { $this->type = $type; $this->id = $id; $this->rootLine = $rootLine; $hash = md5($type . ':' . $TStext); $cachedContent = BackendUtility::getHash($hash); if (is_array($cachedContent)) { $storedData = $cachedContent[0]; $storedMD5 = $cachedContent[1]; $storedData['match'] = array(); $storedData = $this->matching($storedData); $checkMD5 = md5(serialize($storedData)); if ($checkMD5 == $storedMD5) { $res = array('TSconfig' => $storedData['TSconfig'], 'cached' => 1); } else { $shash = md5($checkMD5 . $hash); $cachedSpec = BackendUtility::getHash($shash); if (is_array($cachedSpec)) { $storedData = $cachedSpec; $res = array('TSconfig' => $storedData['TSconfig'], 'cached' => 1); } else { $storeData = $this->parseWithConditions($TStext); BackendUtility::storeHash($shash, $storeData, $type . '_TSconfig'); $res = array('TSconfig' => $storeData['TSconfig'], 'cached' => 0); } } } else { $storeData = $this->parseWithConditions($TStext); $md5 = md5(serialize($storeData)); BackendUtility::storeHash($hash, array($storeData, $md5), $type . '_TSconfig'); $res = array('TSconfig' => $storeData['TSconfig'], 'cached' => 0); } return $res; }
/** * Wrapping icon in browse tree * * @param string $thePageIcon Icon IMG code * @param array $row Data row for element. * @return string Page icon */ public function wrapIcon($thePageIcon, &$row) { // If the record is locked, present a warning sign. if ($lockInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::isRecordLocked('pages', $row['uid'])) { $aOnClick = 'alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . ');return false;'; $lockIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . IconUtility::getSpriteIcon('status-warning-in-use', array('title' => $lockInfo['msg'])) . '</a>'; } else { $lockIcon = ''; } // Wrap icon in click-menu link. if (!$this->ext_IconMode) { $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon, 'pages', $row['uid'], 0, '&bank=' . $this->bank); } elseif ($this->ext_IconMode === 'titlelink') { $aOnClick = 'return jumpTo(' . GeneralUtility::quoteJSvalue($this->getJumpToParam($row)) . ',this,' . GeneralUtility::quoteJSvalue($this->treeName) . ');'; $thePageIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $thePageIcon . '</a>'; } // Wrap icon in a drag/drop span. $dragDropIcon = '<span class="dragIcon" id="dragIconID_' . $row['uid'] . '">' . $thePageIcon . '</span>'; // Add Page ID: $pageIdStr = ''; if ($this->ext_showPageId) { $pageIdStr = '<span class="dragId">[' . $row['uid'] . ']</span> '; } // Call stats information hook $stat = ''; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) { $_params = array('pages', $row['uid']); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) { $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $this); } } return $dragDropIcon . $lockIcon . $pageIdStr . $stat; }
/** * 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; }
/** * Get event list * * @param $events * * @return string */ protected function getEventList($events) { $items = []; foreach ($events as $event) { $startDateStamp = $event['start_date'] instanceof \DateTime ? $event['start_date']->getTimestamp() : $event['start_date']; $startDate = strftime('%a %d.%m.%G', $startDateStamp); $endDateStamp = $event['end_date'] instanceof \DateTime ? $event['end_date']->getTimestamp() : $event['end_date']; $endDate = strftime('%a %d.%m.%G', $endDateStamp); $entry = $startDate . ' - ' . $endDate; if (!$event['all_day']) { $start = BackendUtility::time($event['start_time'], false); if ((int) $event['end_time'] === AbstractTimeTable::DAY_END) { $end = '"' . TranslateUtility::get('openEndTime') . '"'; } else { $end = BackendUtility::time($event['end_time'], false); } $entry .= ' (' . $start . ' - ' . $end . ')'; } $items[] = $entry; } if (!sizeof($items)) { $items[] = TranslateUtility::get('noEvents'); } return '<ul><li>' . implode('</li><li>', $items) . '</li></ul>'; }
/** * 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; }
/** * 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); }
/** * Get the referenced record from the database * * Using the GET or POST variable 'P' * * @return boolean|\TYPO3\CMS\Form\Domain\Model\Content if found, FALSE if not */ public function getRecord() { $record = FALSE; $getPostVariables = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P'); $table = (string) $getPostVariables['table']; $recordId = (int) $getPostVariables['uid']; $row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $recordId); if (is_array($row)) { // strip off the leading "[Translate to XY]" text after localizing the original record $languageField = $GLOBALS['TCA']['tt_content']['ctrl']['languageField']; $transOrigPointerField = $GLOBALS['TCA']['tt_content']['ctrl']['transOrigPointerField']; if ($row[$languageField] > 0 && $row[$transOrigPointerField] > 0) { $bodytext = preg_replace('/^\\[.*?\\] /', '', $row['bodytext'], 1); } else { $bodytext = $row['bodytext']; } /** @var $typoScriptParser \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser */ $typoScriptParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser'); $typoScriptParser->parse($bodytext); /** @var $record \TYPO3\CMS\Form\Domain\Model\Content */ $record = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Domain\\Model\\Content'); $record->setUid($row['uid']); $record->setPageId($row['pid']); $record->setTyposcript($typoScriptParser->setup); } return $record; }
/** * This method forwards the call to Bootstrap's run() method. This method is invoked by the mod.php * function of TYPO3. * * @param string $moduleSignature * @throws \RuntimeException * @return boolean TRUE, if the request request could be dispatched * @see run() */ public function callModule($moduleSignature) { if (!isset($GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature])) { return FALSE; } $moduleConfiguration = $GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature]; // Check permissions and exit if the user has no permission for entry $GLOBALS['BE_USER']->modAccess($moduleConfiguration, TRUE); $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'); if ($id && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) { // Check page access $permClause = $GLOBALS['BE_USER']->getPagePermsClause(TRUE); $access = is_array(\TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess((int) $id, $permClause)); if (!$access) { throw new \RuntimeException('You don\'t have access to this page', 1289917924); } } // BACK_PATH is the path from the typo3/ directory from within the // directory containing the controller file. We are using mod.php dispatcher // and thus we are already within typo3/ because we call typo3/mod.php $GLOBALS['BACK_PATH'] = ''; $configuration = array('extensionName' => $moduleConfiguration['extensionName'], 'pluginName' => $moduleSignature); if (isset($moduleConfiguration['vendorName'])) { $configuration['vendorName'] = $moduleConfiguration['vendorName']; } $bootstrap = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Core\\BootstrapInterface'); $content = $bootstrap->run('', $configuration); print $content; return TRUE; }
/** * Executes an itemsProcFunc if defined in TCA and returns the combined result (predefined + processed items) * * @param string $table * @param int $pageId * @param string $field * @param array $row * @param array $tcaConfig The TCA configuration of $field * @param array $selectedItems The items already defined in the TCA configuration * @return array The processed items (including the predefined items) */ public function getProcessingItems($table, $pageId, $field, $row, $tcaConfig, $selectedItems) { $pageId = $table === 'pages' ? $row['uid'] : $row['pid']; $TSconfig = BackendUtility::getPagesTSconfig($pageId); $fieldTSconfig = $TSconfig['TCEFORM.'][$table . '.'][$field . '.']; $params = []; $params['items'] =& $selectedItems; $params['config'] = $tcaConfig; $params['TSconfig'] = $fieldTSconfig['itemsProcFunc.']; $params['table'] = $table; $params['row'] = $row; $params['field'] = $field; // The itemsProcFunc method may throw an exception. // If it does display an error message and return items unchanged. try { GeneralUtility::callUserFunction($tcaConfig['itemsProcFunc'], $params, $this); } catch (\Exception $exception) { $languageService = $this->getLanguageService(); $fieldLabel = $field; if (isset($GLOBALS['TCA'][$table]['columns'][$field]['label'])) { $fieldLabel = $languageService->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']); } $message = sprintf($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:error.items_proc_func_error'), $fieldLabel, $exception->getMessage()); /** @var FlashMessage $flashMessage */ $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $message, '', FlashMessage::ERROR, true); /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($flashMessage); } return $selectedItems; }
/** * @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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * Generate a different preview link * * @param string $status status * @param string $table table name * @param integer $recordUid id of the record * @param array $fields fieldArray * @param \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject parent Object * @return void */ public function processDatamap_afterDatabaseOperations($status, $table, $recordUid, array $fields, \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject) { // Clear category cache if ($table === 'sys_category') { /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */ $cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('cache_news_category'); $cache->flush(); } // Preview link if ($table === 'tx_news_domain_model_news') { // direct preview if (!is_numeric($recordUid)) { $recordUid = $parentObject->substNEWwithIDs[$recordUid]; } if (isset($GLOBALS['_POST']['_savedokview_x']) && !$fields['type']) { // If "savedokview" has been pressed and current article has "type" 0 (= normal news article) $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']); if ($pagesTsConfig['tx_news.']['singlePid']) { $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('tx_news_domain_model_news', $recordUid); $parameters = array('no_cache' => 1, 'tx_news_pi1[controller]' => 'News', 'tx_news_pi1[action]' => 'detail', 'tx_news_pi1[news_preview]' => $record['uid']); if ($record['sys_language_uid'] > 0) { if ($record['l10n_parent'] > 0) { $parameters['tx_news_pi1[news_preview]'] = $record['l10n_parent']; } $parameters['L'] = $record['sys_language_uid']; } $GLOBALS['_POST']['popViewId_addParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $parameters, '', FALSE, TRUE); $GLOBALS['_POST']['popViewId'] = $pagesTsConfig['tx_news.']['singlePid']; } } } }
/** * This will render a selector box element, or possibly a special construction with two selector boxes. * * @return array As defined in initializeResultArray() of AbstractNode */ public function render() { $table = $this->globalOptions['table']; $field = $this->globalOptions['fieldName']; $row = $this->globalOptions['databaseRow']; $parameterArray = $this->globalOptions['parameterArray']; // Field configuration from TCA: $config = $parameterArray['fieldConf']['config']; $disabled = ''; if ($this->isGlobalReadonly() || $config['readOnly']) { $disabled = ' disabled="disabled"'; } $this->resultArray = $this->initializeResultArray(); // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. $specConf = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']); $selItems = FormEngineUtility::getSelectItems($table, $field, $row, $parameterArray); // Creating the label for the "No Matching Value" entry. $noMatchingLabel = isset($parameterArray['fieldTSConfig']['noMatchingValue_label']) ? $this->getLanguageService()->sL($parameterArray['fieldTSConfig']['noMatchingValue_label']) : '[ ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue') . ' ]'; $html = $this->getSingleField_typeSelect_singlebox($table, $field, $row, $parameterArray, $config, $selItems, $noMatchingLabel); // Wizards: if (!$disabled) { $html = $this->renderWizards(array($html), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf); } $this->resultArray['html'] = $html; return $this->resultArray; }
/** * Checks whether a an BE user account named admin with default password exists. * * @return \TYPO3\CMS\Reports\Status An tx_reports_reports_status_Status 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') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users'); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $whereClause); if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $secure = TRUE; // Check against salted password if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('saltedpasswords')) { if (\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('BE')) { /** @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 = 'alt_doc.php?returnUrl=mod.php?M=tools_txreportsM1&edit[be_users][' . $row['uid'] . ']=edit'; $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_admin'), '<a href="' . $editUserAccountUrl . '">', '</a>'); } } $GLOBALS['TYPO3_DB']->sql_free_result($res); return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity); }
/** * Renders a HTML Block with file information * * @param File $file * @return string */ protected function renderFileInformationContent(File $file = null) { /** @var LanguageService $lang */ $lang = $GLOBALS['LANG']; if ($file !== null) { $processedFile = $file->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 150, 'height' => 150)); $previewImage = $processedFile->getPublicUrl(true); $content = ''; if ($file->isMissing()) { $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($file); $content .= $flashMessage->render(); } if ($previewImage) { $content .= '<img src="' . htmlspecialchars($previewImage) . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'alt="" class="t3-tceforms-sysfile-imagepreview" />'; } $content .= '<strong>' . htmlspecialchars($file->getName()) . '</strong>'; $content .= ' (' . htmlspecialchars(GeneralUtility::formatSize($file->getSize())) . 'bytes)<br />'; $content .= BackendUtility::getProcessedValue('sys_file', 'type', $file->getType()) . ' (' . $file->getMimeType() . ')<br />'; $content .= $lang->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaDataLocation', true) . ': '; $content .= htmlspecialchars($file->getStorage()->getName()) . ' - ' . htmlspecialchars($file->getIdentifier()) . '<br />'; $content .= '<br />'; } else { $content = '<h2>' . $lang->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaErrorInvalidRecord', true) . '</h2>'; } return $content; }
/** * 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 = 'index.php'; $dblist->showIcon = 0; $dblist->setLMargin = 0; $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php: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 = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth'], 'index.php'); $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages'], 'index.php'); $dblist->start($this->pObj->id, 'pages', 0); $dblist->generateList(); // CSH $theOutput .= $this->pObj->doc->header($LANG->getLL('page_title')); $theOutput .= $this->pObj->doc->section('', \TYPO3\CMS\Backend\Utility\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; }
/** * Constructor * * @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference TYPO3 backend object reference * @throws \UnexpectedValueException */ public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL) { $this->backendReference = $backendReference; $this->cacheActions = array(); $this->optionValues = array(); $backendUser = $this->getBackendUser(); // Clear all page-related caches if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) { $this->cacheActions[] = array('id' => 'pages', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=pages&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low')); $this->optionValues[] = 'pages'; } // Clear cache for ALL tables! if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) { $this->cacheActions[] = array('id' => 'all', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=all&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium')); $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' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=system&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high')); $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 \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface', 1228262000); } $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues); } } }
/** * @test */ public function exportGroupFileAndFileReferenceItem() { $this->export->setRecordTypesIncludeFields(array('pages' => array('title', 'deleted', 'doktype', 'hidden', 'perms_everybody'), 'sys_file' => array('storage', 'type', 'metadata', 'extension', 'identifier', 'identifier_hash', 'folder_hash', 'mime_type', 'name', 'sha1', 'size', 'creation_date', 'modification_date'), 'sys_file_storage' => array('name', 'description', 'driver', 'configuration', 'is_default', 'is_browsable', 'is_public', 'is_writable', 'is_online'), 'tx_impexpgroupfiles_item' => array('title', 'deleted', 'hidden', 'images', 'image_references', 'flexform'))); $this->export->relOnlyTables = array('sys_file', 'sys_file_storage'); $this->export->export_addRecord('pages', BackendUtility::getRecord('pages', 2)); $this->export->export_addRecord('tx_impexpgroupfiles_item', BackendUtility::getRecord('tx_impexpgroupfiles_item', 2)); $this->setPageTree(2, 0); // After adding ALL records we set relations: for ($a = 0; $a < 10; $a++) { $addR = $this->export->export_addDBRelations($a); if (!count($addR)) { break; } } // hacky, but the timestamp will change on every clone, so set the file // modification timestamp to the asserted value $success = @touch(PATH_site . 'uploads/tx_impexpgroupfiles/typo3_image4.jpg', 1393866824); if (!$success) { $this->markTestSkipped('Could not set file modification timestamp for a fixture binary file. This is required for running the test successful.'); } $this->export->export_addFilesFromRelations(); $this->export->export_addFilesFromSysFilesRecords(); $out = $this->export->compileMemoryToFileContent('xml'); $this->assertXmlStringEqualsXmlFile(__DIR__ . '/../../Fixtures/ImportExportXml/impexp-group-file-and-file_reference-item-in-ff.xml', $out); }
/** * Render tree widget * * @return array As defined in initializeResultArray() of AbstractNode * @see AbstractNode::initializeResultArray() */ public function render() { $resultArray = $this->initializeResultArray(); $parameterArray = $this->data['parameterArray']; $formElementId = md5($parameterArray['itemFormElName']); // Field configuration from TCA: $config = $parameterArray['fieldConf']['config']; $resultArray['extJSCODE'] .= LF . $this->generateJavascript($formElementId); $html = []; $html[] = '<div class="typo3-tceforms-tree">'; $html[] = ' <input class="treeRecord" type="hidden"'; $html[] = ' ' . $this->getValidationDataAsDataAttribute($parameterArray['fieldConf']['config']); $html[] = ' data-formengine-input-name="' . htmlspecialchars($parameterArray['itemFormElName']) . '"'; $html[] = ' data-relatedfieldname="' . htmlspecialchars($parameterArray['itemFormElName']) . '"'; $html[] = ' name="' . htmlspecialchars($parameterArray['itemFormElName']) . '"'; $html[] = ' id="treeinput' . $formElementId . '"'; $html[] = ' value="' . htmlspecialchars(implode(',', $config['treeData']['selectedNodes'])) . '"'; $html[] = ' />'; $html[] = '</div>'; $html[] = '<div id="tree_' . $formElementId . '"></div>'; $resultArray['html'] = implode(LF, $html); // Wizards: if (empty($config['readOnly'])) { $resultArray['html'] = $this->renderWizards([$resultArray['html']], $config['wizards'], $this->data['tableName'], $this->data['databaseRow'], $this->data['fieldName'], $parameterArray, $parameterArray['itemFormElName'], BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras'])); } return $resultArray; }
/** * 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); }
/** * Get the Records * * @param integer $startPage * @param array $basePages * @param Tx_GoogleServices_Controller_SitemapController $obj * * @return Tx_GoogleServices_Domain_Model_Node */ public function getRecords($startPage, $basePages, Tx_GoogleServices_Controller_SitemapController $obj) { $nodes = array(); $database = $this->getDatabaseConnection(); $res = $database->exec_SELECTquery('*', 'tt_content', 'CType="list" AND list_type="googleservices_pisitemap" AND hidden=0 AND deleted=0'); while ($row = $database->sql_fetch_assoc($res)) { $uid = $row['pid']; if ($uid == $GLOBALS['TSFE']->id) { continue; } // Build URL $url = $obj->getUriBuilder()->setTargetPageUid($uid)->build(); // can't generate a valid url if (!strlen($url)) { continue; } // Get Record $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $uid); // Build Node $node = new Tx_GoogleServices_Domain_Model_Node(); $node->setLoc($url); $node->setLastmod($this->getModifiedDate($record)); $nodes[] = $node; } return $nodes; }
/** * 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); }
/** * Sets the TYPO3 Backend context to a certain workspace, * called by the Backend toolbar menu * * @param ServerRequestInterface $request * @param ResponseInterface $response * @return ResponseInterface */ public function switchWorkspaceAction(ServerRequestInterface $request, ResponseInterface $response) { $parsedBody = $request->getParsedBody(); $queryParams = $request->getQueryParams(); $workspaceId = (int) (isset($parsedBody['workspaceId']) ? $parsedBody['workspaceId'] : $queryParams['workspaceId']); $pageId = (int) (isset($parsedBody['pageId']) ? $parsedBody['pageId'] : $queryParams['pageId']); $finalPageUid = 0; $originalPageId = $pageId; $this->getBackendUser()->setWorkspace($workspaceId); while ($pageId) { $page = BackendUtility::getRecordWSOL('pages', $pageId, '*', ' AND pages.t3ver_wsid IN (0, ' . $workspaceId . ')'); if ($page) { if ($this->getBackendUser()->doesUserHaveAccess($page, 1)) { break; } } else { $page = BackendUtility::getRecord('pages', $pageId); } $pageId = $page['pid']; } if (isset($page['uid'])) { $finalPageUid = (int) $page['uid']; } $ajaxResponse = ['title' => \TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($workspaceId), 'workspaceId' => $workspaceId, 'pageId' => $finalPageUid && $originalPageId == $finalPageUid ? null : $finalPageUid]; $response->getBody()->write(json_encode($ajaxResponse)); return $response; }
/** * 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); } } }
/** * 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); }
/** * This method is called by the Scheduler task that triggers * the autopublication process * It searches for workspaces whose publication date is in the past * and publishes them * * @return void */ public function autoPublishWorkspaces() { // Temporarily set admin rights // @todo once workspaces are cleaned up a better solution should be implemented $currentAdminStatus = $GLOBALS['BE_USER']->user['admin']; $GLOBALS['BE_USER']->user['admin'] = 1; // Select all workspaces that needs to be published / unpublished: $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,swap_modes,publish_time,unpublish_time', 'sys_workspace', 'pid=0 AND ((publish_time!=0 AND publish_time<=' . (int) $GLOBALS['EXEC_TIME'] . ') OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<=' . (int) $GLOBALS['EXEC_TIME'] . '))' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_workspace')); $workspaceService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class); foreach ($workspaces as $rec) { // First, clear start/end time so it doesn't get select once again: $fieldArray = $rec['publish_time'] != 0 ? array('publish_time' => 0) : array('unpublish_time' => 0); $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid=' . (int) $rec['uid'], $fieldArray); // Get CMD array: $cmd = $workspaceService->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes'] == 1); // $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace. // Execute CMD array: $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class); $tce->stripslashes_values = 0; $tce->start(array(), $cmd); $tce->process_cmdmap(); } // Restore admin status $GLOBALS['BE_USER']->user['admin'] = $currentAdminStatus; }
/** * 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; }