/** * Render the captcha image html * * @param string suffix to be appended to the extenstion key when forming css class names * @return string The html used to render the captcha image */ public function render($suffix = '') { $value = ''; // Include the required JavaScript $GLOBALS['TSFE']->additionalHeaderData[$this->extensionKey . '_freeCap'] = '<script type="text/javascript" src="' . GeneralUtility::createVersionNumberedFilename(ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/JavaScript/freeCap.js') . '"></script>'; // Disable caching $GLOBALS['TSFE']->no_cache = 1; // Get the plugin configuration $settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, $this->extensionName); // Get the translation view helper $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper'); $translator->injectConfigurationManager($this->configurationManager); // Generate the image url $fakeId = GeneralUtility::shortMD5(uniqid(rand()), 5); $siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); $L = GeneralUtility::_GP('L'); $urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => 'SrFreecap', 'pluginName' => 'ImageGenerator', 'controllerName' => 'ImageGenerator', 'actionName' => 'show', 'formatName' => 'png', 'L' => $GLOBALS['TSFE']->sys_language_uid); if ($GLOBALS['TSFE']->MP) { $urlParams['MP'] = $GLOBALS['TSFE']->MP; } $urlParams['set'] = $fakeId; $imageUrl = $siteURL . 'index.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParams), '&'); // Generate the html text $value = '<img' . $this->getClassAttribute('image', $suffix) . ' id="tx_srfreecap_captcha_image_' . $fakeId . '"' . ' src="' . htmlspecialchars($imageUrl) . '"' . ' alt="' . $translator->render('altText') . ' "/>' . '<span' . $this->getClassAttribute('cant-read', $suffix) . '>' . $translator->render('cant_read1') . ' <a href="#" onclick="this.blur();' . $this->extensionName . '.newImage(\'' . $fakeId . '\', \'' . $translator->render('noImageMessage') . '\');return false;">' . $translator->render('click_here') . '</a>' . $translator->render('cant_read2') . '</span>'; return $value; }
/** * Main function. * Creates the header code in XHTML, the JavaScript, then the frameset for the two frames. * * @return void * @todo Define visibility */ public function main() { // Setting GPvars: $mode = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('mode'); $bparams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('bparams'); // 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 = "browse_links.php?mode="+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.php:TYPO3_Element_Browser')); // URL for the inner main frame: $url = $GLOBALS['BACK_PATH'] . 'browse_links.php?mode=' . 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>'; }
/** * 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); }
/** * Initializes the Module * @return void */ function init() { $id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id')); $tsconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($id, 'tx_formhandler_mod1'); $this->settings = $tsconfig['properties']['config.']; parent::init(); }
/** * Initialize script class * * @return void * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException */ protected function init() { // Setting target, which must be a file reference to a file within the mounts. $this->target = $this->origTarget = $fileIdentifier = GeneralUtility::_GP('target'); $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')); // create the file object if ($fileIdentifier) { $this->fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($fileIdentifier); } // Cleaning and checking target directory if (!$this->fileObject) { $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE); $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586841); } if ($this->fileObject->getStorage()->getUid() === 0) { throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1375889832); } // Setting the title and the icon $icon = IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->fileObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileObject->getIdentifier()); // Setting template object $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_edit.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->JScode = $this->doc->wrapScriptTags(' function backToList() { // top.goToModule("file_list"); } '); $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform">'; }
/** * Gets a constant * * @param string $constant The name of the constant * @return string Constant-Value * * = Examples = * * <code title="Example"> * <theme:constant constant="themes.configuration.baseurl" /> * </code> * <output> * http://yourdomain.tld/ * (depending on your domain) * </output> */ public function render($constant = '') { $pageWithTheme = \KayStrobach\Themes\Utilities\FindParentPageWithThemeUtility::find($this->getFrontendController()->id); $pageLanguage = (int) GeneralUtility::_GP('L'); // instantiate the cache /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */ $cache = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('themes_cache'); $cacheLifeTime = 60 * 60 * 24 * 7 * 365 * 20; $cacheIdentifierString = 'theme-of-page-' . $pageWithTheme . '-of-language-' . $pageLanguage; $cacheIdentifier = sha1($cacheIdentifierString); // If flatSetup is available, cache it $flatSetup = $this->getFrontendController()->tmpl->flatSetup; if (isset($flatSetup) && is_array($flatSetup) && count($flatSetup) > 0) { $cache->set($cacheIdentifier, $flatSetup, array('page-' . $this->getFrontendController()->id), $cacheLifeTime); } else { $flatSetup = $cache->get($cacheIdentifier); } // If flatSetup not available and not cached, generate it! if (!isset($flatSetup) || !is_array($flatSetup)) { $this->getFrontendController()->tmpl->generateConfig(); $flatSetup = $this->getFrontendController()->tmpl->flatSetup; $cache->set($cacheIdentifier, $flatSetup, array('page-' . $this->getFrontendController()->id), $cacheLifeTime); } // check if there is a value and return it if (is_array($flatSetup) && array_key_exists($constant, $flatSetup)) { return $this->getFrontendController()->tmpl->substituteConstants($flatSetup[$constant]); } return NULL; }
/** * Action initializer * * @return void */ protected function initializeAction() { $pageId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'); $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $persistenceConfiguration = ['persistence' => ['storagePid' => $pageId]]; $this->configurationManager->setConfiguration(array_merge($frameworkConfiguration, $persistenceConfiguration)); }
/** * Main function. Generates all output. * * @author Martin Helmich <*****@*****.**> * @version 2007-05-02 * * @param string $content The content that was generated until now * @return string The import script content * * @uses display_step0 * @uses display_step1 * @uses display_step2 * @uses outputImportSettings */ function main($content) { $this->importData = GeneralUtility::_GP('tx_mmforum_import'); if (!isset($this->importData['step'])) { $this->importData['step'] = 0; } if (isset($this->importData['extdb']) && !is_array($this->importData['extdb'])) { $this->importData['extdb'] = stripslashes($this->importData['extdb']); $this->importData['extdb'] = unserialize($this->importData['extdb']); } if ($this->importData['action'] == 'phpbb') { $this->maxSteps = 6; } else { $this->maxSteps = 4; } switch ($this->importData['step']) { case 0: $content .= $this->display_step0(); break; case 1: $content .= $this->display_step1(); break; case 2: $content .= $this->display_step2(); break; } $content .= $this->outputImportSettings(); return $content; }
/** * Queries a table for records and completely processes them * * Returns a two-dimensional array of almost finished records; * they only need to be put into a <li>-structure * * @param array $params * @param integer $recursionCounter recursion counter * @return mixed array of rows or FALSE if nothing found */ public function queryTable(&$params, $recursionCounter = 0) { $uid = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('uid'); $records = parent::queryTable($params, $recursionCounter); if ($this->checkIfTagIsNotFound($records)) { $text = htmlspecialchars($params['value']); $javaScriptCode = ' var value=\'' . $text . '\'; Ext.Ajax.request({ url : \'ajax.php\' , params : { ajaxID : \'News::createTag\', item:value,newsid:\'' . $uid . '\' }, success: function ( result, request ) { var arr = result.responseText.split(\'-\'); setFormValueFromBrowseWin(arr[5], arr[2] + \'_\' + arr[0], arr[1]); TBE_EDITOR.fieldChanged(arr[3], arr[6], arr[4], arr[5]); }, failure: function ( result, request) { Ext.MessageBox.alert(\'Failed\', result.responseText); } }); '; $javaScriptCode = trim(str_replace('"', '\'', $javaScriptCode)); $link = implode(' ', explode(chr(10), $javaScriptCode)); $records['tx_news_domain_model_tag_' . strlen($text)] = array('text' => '<div onclick="' . $link . '"> <span class="suggest-path"> <a>' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:news/Resources/Private/Language/locallang_be.xml:tag_suggest'), $text) . '</a> </span></div>', 'table' => 'tx_news_domain_model_tag', 'class' => 'suggest-noresults', 'style' => 'background-color:#E9F1FE !important;background-image:url(' . $this->getDummyIconPath() . ');'); } return $records; }
/** * 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 = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', TRUE); $message = $this->getLanguageService()->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::class); $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_upload.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_file')) . '" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">'; }
/** * @param string $listenerId * @return object */ public function findById($listenerId) { if ($listenerId) { $object = parent::findById($listenerId); if (!$object) { list($table, $uid, $rawListenerId) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('-', $listenerId, false, 3); // try to generate the listener cache if ($table == 'tt_content' && $uid) { $object = $this->serviceContent->generateListenerCacheForContentElement($table, $uid); } elseif ($table == 'h' || $table == 'hInt') { $settingsHash = $uid; $encodedSettings = $rawListenerId; if (\TYPO3\CMS\Core\Utility\GeneralUtility::hmac($encodedSettings) == $settingsHash) { $loadContentFromTypoScript = str_replace('---', '.', $encodedSettings); $eventsToListen = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('e'); $object = $this->serviceContent->generateListenerCacheForHijaxPi1($loadContentFromTypoScript, $eventsToListen[$listenerId], $table == 'h'); } } if ($table == 'f') { $settingsHash = $uid; $encodedSettings = $rawListenerId; if (\TYPO3\CMS\Core\Utility\GeneralUtility::hmac($encodedSettings) == $settingsHash) { $fallbackTypoScriptConfiguration = str_replace('---', '.', $encodedSettings); $object = $this->serviceContent->generateListenerCacheForTypoScriptFallback($fallbackTypoScriptConfiguration); } } } return $object; } else { return null; } }
/** * @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; }
protected function getSortingLinks() { $sortHelper = GeneralUtility::makeInstance('Tx_Solr_Sorting', $this->configuration['search.']['sorting.']['options.']); $query = $this->search->getQuery(); $queryLinkBuilder = GeneralUtility::makeInstance('Tx_Solr_Query_LinkBuilder', $query); $queryLinkBuilder->setLinkTargetPageId($this->parentPlugin->getLinkTargetPageId()); $sortOptions = array(); $urlParameters = GeneralUtility::_GP('tx_solr'); $urlSortParameters = GeneralUtility::trimExplode(',', $urlParameters['sort']); $configuredSortOptions = $sortHelper->getSortOptions(); foreach ($configuredSortOptions as $sortOptionName => $sortOption) { $sortDirection = $this->configuration['search.']['sorting.']['defaultOrder']; if (!empty($this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['defaultOrder'])) { $sortDirection = $this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['defaultOrder']; } $sortIndicator = $sortDirection; $currentSortOption = ''; $currentSortDirection = ''; foreach ($urlSortParameters as $urlSortParameter) { $explodedUrlSortParameter = explode(' ', $urlSortParameter); if ($explodedUrlSortParameter[0] == $sortOptionName) { list($currentSortOption, $currentSortDirection) = $explodedUrlSortParameter; break; } } // toggle sorting direction for the current sorting field if ($currentSortOption == $sortOptionName) { switch ($currentSortDirection) { case 'asc': $sortDirection = 'desc'; $sortIndicator = 'asc'; break; case 'desc': $sortDirection = 'asc'; $sortIndicator = 'desc'; break; } } if (!empty($this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['fixedOrder'])) { $sortDirection = $this->configuration['search.']['sorting.']['options.'][$sortOptionName . '.']['fixedOrder']; } $sortParameter = $sortOptionName . ' ' . $sortDirection; $temp = array('link' => $queryLinkBuilder->getQueryLink($sortOption['label'], array('sort' => $sortParameter)), 'url' => $queryLinkBuilder->getQueryUrl(array('sort' => $sortParameter)), 'optionName' => $sortOptionName, 'field' => $sortOption['field'], 'label' => $sortOption['label'], 'is_current' => '0', 'direction' => $sortDirection, 'indicator' => $sortIndicator, 'current_direction' => ' '); // set sort indicator for the current sorting field if ($currentSortOption == $sortOptionName) { $temp['selected'] = 'selected="selected"'; $temp['current'] = 'current'; $temp['is_current'] = '1'; $temp['current_direction'] = $sortIndicator; } // special case relevance: just reset the search to normal behavior if ($sortOptionName == 'relevance') { $temp['link'] = $queryLinkBuilder->getQueryLink($sortOption['label'], array('sort' => NULL)); $temp['url'] = $queryLinkBuilder->getQueryUrl(array('sort' => NULL)); unset($temp['direction'], $temp['indicator']); } $sortOptions[] = $temp; } return $sortOptions; }
/** * Returns the locale object for frontend * * @param \Aimeos\MShop\Context\Item\Iface $context Context object * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface|null $request Request object * @return \Aimeos\MShop\Locale\Item\Iface Locale item object */ public static function get(\Aimeos\MShop\Context\Item\Iface $context, \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null) { if (!isset(self::$locale)) { $config = $context->getConfig(); $sitecode = $config->get('mshop/locale/site', 'default'); $name = $config->get('typo3/param/name/site', 'loc_site'); if ($request !== null && $request->hasArgument($name) === true) { $sitecode = $request->getArgument($name); } elseif (($value = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('S')) !== null) { $sitecode = $value; } $langid = $config->get('mshop/locale/language', ''); $name = $config->get('typo3/param/name/language', 'loc_language'); if ($request !== null && $request->hasArgument($name) === true) { $langid = $request->getArgument($name); } elseif (isset($GLOBALS['TSFE']->config['config']['language'])) { $langid = $GLOBALS['TSFE']->config['config']['language']; } $currency = $config->get('mshop/locale/currency', ''); $name = $config->get('typo3/param/name/currency', 'loc_currency'); if ($request !== null && $request->hasArgument($name) === true) { $currency = $request->getArgument($name); } elseif (($value = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('C')) !== null) { $currency = $value; } $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); self::$locale = $localeManager->bootstrap($sitecode, $langid, $currency); } return self::$locale; }
/** * Constructor, prepare the context information */ public function __construct() { $formValues = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('install'); if (isset($formValues['context'])) { $this->backendContext = $formValues['context'] === 'backend'; } }
/** * Initialize * * @throws InsufficientFolderAccessPermissionsException */ 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 = ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target); } if ($this->folderObject->getStorage()->getUid() === 0) { throw new InsufficientFolderAccessPermissionsException('You are not allowed to access folders outside your storages', 1375889834); } // Cleaning and checking target directory if (!$this->folderObject) { $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', true); $message = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', true); throw new \RuntimeException($title . ': ' . $message, 1294586843); } // Setting up the context sensitive menu $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); // building pathInfo for metaInformation $pathInfo = ['combined_identifier' => $this->folderObject->getCombinedIdentifier()]; $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pathInfo); }
protected function getPostfix($PA) { // just for "title"-fields if (strpos($PA['field'], 'title') === false) { return array(); } $pageId = intval(GU::_GP('id')); if ($PA['table'] == 'pages') { $pageId = $PA['uid']; } if (!$pageId && $PA['table'] != 'pages') { $pageId = $PA['pid']; } $template = GU::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\TemplateService'); // do not log time-performance information $template->tt_track = 0; $template->forceTemplateParsing = 1; $template->init(); // Get the root line $sys_page = GU::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); // the selected page in the BE is found $rootline = $sys_page->getRootLine($pageId); // This generates the constants/config + hierarchy info for the template. $template->runThroughTemplates($rootline, 0); $template->generateConfig(); return array('postfix' => '[SPACE]- ' . $template->setup['sitetitle']); }
/** * @param array $ajaxParams * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObject * @return string */ public function updateConfigurationFile($ajaxParams, $ajaxObject) { $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('extensionKey'); if (!empty($extensionKey)) { $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getEarlyInstance('TYPO3\\Flow\\Package\\PackageManager'); $extensionConfigurationPath = $packageManager->getPackage($extensionKey)->getPackagePath() . 'ext_emconf.php'; $_EXTKEY = $extensionKey; $EM_CONF = NULL; $extension = NULL; if (file_exists($extensionConfigurationPath)) { include $extensionConfigurationPath; if (is_array($EM_CONF[$_EXTKEY])) { $extension = $EM_CONF[$_EXTKEY]; } } if ($EM_CONF !== NULL) { $currentMd5HashArray = \IchHabRecht\Devtools\Utility\ExtensionUtility::getMd5HashArrayForExtension($extensionKey); $EM_CONF[$extensionKey]['_md5_values_when_last_written'] = serialize($currentMd5HashArray); /** @var \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility $emConfUtility */ $emConfUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\\TYPO3\\CMS\\Extensionmanager\\Utility\\EmConfUtility'); $extensionData = array('extKey' => $extensionKey, 'EM_CONF' => $EM_CONF[$extensionKey]); $emConfContent = $emConfUtility->constructEmConf($extensionData); \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($extensionConfigurationPath, $emConfContent); } $ajaxObject->setContentFormat('json'); $ajaxObject->addContent('title', $this->translate('title')); $ajaxObject->addContent('message', sprintf($this->translate('message'), $extensionKey)); } }
/** * 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 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; }
/** * Generates the output * * @return string from action */ public function main() { $lat = GeneralUtility::_GP('lat'); $lng = GeneralUtility::_GP('lng'); $address = $this->getAddressFromGeo($lat, $lng); return $address['route'] . ' ' . $address['street_number'] . ', ' . $address['locality']; }
/** * Initialization of the class. * * @return void */ public function init() { // Setting GPvars: $this->id = (int) GeneralUtility::_GP('id'); if (!$this->id) { \CommerceTeam\Commerce\Utility\FolderUtility::initFolders(); $this->id = current(array_unique(FolderRepository::initFolders('Products', 'Commerce', 0, 'Commerce'))); } $this->edit = GeneralUtility::_GP('edit'); $this->return_id = GeneralUtility::_GP('return_id'); $this->lastEdited = GeneralUtility::_GP('lastEdited'); // Setting GPvars: $controlParams = GeneralUtility::_GP('control'); if ($controlParams) { $controlArray = current($controlParams); $this->categoryUid = (int) $controlArray['uid']; } // Module name; $this->MCONF = $GLOBALS['MCONF']; // Page select clause: $this->perms_clause = \CommerceTeam\Commerce\Utility\BackendUtility::getCategoryPermsClause(1); $this->initPage(); // Set up menus: $this->menuConfig(); }
/** * Queries a table for records and completely processes them * * Returns a two-dimensional array of almost finished records; * they only need to be put into a <li>-structure * * @param array $params * @param int $recursionCounter recursion counter * @return mixed array of rows or FALSE if nothing found */ public function queryTable(&$params, $recursionCounter = 0) { $uid = (int) GeneralUtility::_GP('uid'); $records = parent::queryTable($params, $recursionCounter); if ($this->checkIfTagIsNotFound($records)) { $text = GeneralUtility::quoteJSvalue($params['value']); $javaScriptCode = ' var value=' . $text . '; Ext.Ajax.request({ url : \'ajax.php\' , method: "GET", params : { ajaxID : \'News::createTag\', item:value,newsid:\'' . $uid . '\' }, success: function ( result, request ) { var arr = result.responseText.split(\'-\'); setFormValueFromBrowseWin(arr[5], arr[2] + \'_\' + arr[0], arr[1]); TBE_EDITOR.fieldChanged(arr[3], arr[6], arr[4], arr[5]); }, failure: function ( result, request) { Ext.MessageBox.alert(\'Failed\', result.responseText); } }); '; $javaScriptCode = trim(str_replace('"', '\'', $javaScriptCode)); $link = implode(' ', explode(LF, $javaScriptCode)); $records['tx_news_domain_model_tag_' . strlen($text)] = ['text' => '<div onclick="' . $link . '"> <span class="suggest-path"> <a>' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:tag_suggest'), $text) . '</a> </span></div>', 'table' => 'tx_news_domain_model_tag', 'class' => 'suggest-noresults', 'icon' => $this->getDummyIcon()->render()]; } return $records; }
/** * 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 = GeneralUtility::wrapJS(' 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/Resources/Private/Language/locallang_core.xlf:TYPO3_Element_Browser')); // URL for the inner main frame: $url = $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 = $this->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> '; }
/** * Initialiation of the class * * @return void * @todo Define visibility */ public function init() { // Setting backPath $this->backPath = $GLOBALS['BACK_PATH']; // Setting GPvars: $this->cMR = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cMR'); $this->currentSubScript = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('currentSubScript'); $this->setTempDBmount = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setTempDBmount'); // look for User setting $this->hasFilterBox = !$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.hideFilter'); // Create page tree object: $this->pagetree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\PageTreeView'); $this->pagetree->ext_IconMode = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu'); $this->pagetree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle'); $this->pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle'); $this->pagetree->ext_separateNotinmenuPages = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.separateNotinmenuPages'); $this->pagetree->ext_alphasortNotinmenuPages = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.alphasortNotinmenuPages'); $this->pagetree->thisScript = 'alt_db_navframe.php'; $this->pagetree->addField('alias'); $this->pagetree->addField('shortcut'); $this->pagetree->addField('shortcut_mode'); $this->pagetree->addField('mount_pid'); $this->pagetree->addField('mount_pid_ol'); $this->pagetree->addField('nav_hide'); $this->pagetree->addField('nav_title'); $this->pagetree->addField('url'); // Temporary DB mounts: $this->initializeTemporaryDBmount(); }
public function getMainFields_preProcess($table, $row, $parent) { $recordsHide = explode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('recordsHide')); if (count($recordsHide) > 0) { $parent->hiddenFieldListArr = array_merge($parent->hiddenFieldListArr, $recordsHide); } }
/** * Init function, setting the input vars in the global space. * * @return void * @todo Define visibility */ public function init() { // Loading internal vars with the GET/POST parameters from outside: $this->file = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('file'); $parametersArray = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('parameters'); $this->frame = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('frame'); $this->md5 = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('md5'); // Check parameters // If no file-param or parameters are given, we must exit if (!$this->file || !isset($parametersArray) || !is_array($parametersArray)) { \TYPO3\CMS\Core\Utility\HttpUtility::setResponseCodeAndExit(\TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_410); } $this->parametersEncoded = implode('', $parametersArray); // Chech md5-checksum: If this md5-value does not match the one submitted, then we fail... (this is a kind of security that somebody don't just hit the script with a lot of different parameters $md5_value = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac(implode('|', array($this->file, $this->parametersEncoded))); if ($md5_value !== $this->md5) { \TYPO3\CMS\Core\Utility\HttpUtility::setResponseCodeAndExit(\TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_410); } $parameters = unserialize(base64_decode($this->parametersEncoded)); foreach ($parameters as $parameterName => $parameterValue) { $this->{$parameterName} = $parameterValue; } // Check the file. If must be in a directory beneath the dir of this script... // $this->file remains unchanged, because of the code in stdgraphic, but we do check if the file exists within the current path $test_file = PATH_site . $this->file; if (!\TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr($test_file)) { \TYPO3\CMS\Core\Utility\HttpUtility::setResponseCodeAndExit(\TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_410); } if (!@is_file($test_file)) { \TYPO3\CMS\Core\Utility\HttpUtility::setResponseCodeAndExit(\TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_404); } }
/** * Initialiation of the class * * @todo Check with User Permissions * @return void */ public function init() { $backendUser = $this->getBackendUser(); // Setting GPvars: $this->currentSubScript = GeneralUtility::_GP('currentSubScript'); $this->cMR = GeneralUtility::_GP('cMR'); $this->setTemporaryDatabaseMount = GeneralUtility::_GP('setTempDBmount'); // Generate Folder if necessary Tx_Commerce_Utility_FolderUtility::initFolders(); // Create page tree object: $this->pagetree = GeneralUtility::makeInstance('Tx_Commerce_Tree_OrderTree'); $this->pagetree->ext_IconMode = $backendUser->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu'); $this->pagetree->ext_showPageId = $backendUser->getTSConfigVal('options.pageTree.showPageIdWithTitle'); $this->pagetree->addField('alias'); $this->pagetree->addField('shortcut'); $this->pagetree->addField('shortcut_mode'); $this->pagetree->addField('mount_pid'); $this->pagetree->addField('mount_pid_ol'); $this->pagetree->addField('nav_hide'); $this->pagetree->addField('url'); // Temporary DB mounts: $this->pagetree->MOUNTS = array_unique(Tx_Commerce_Domain_Repository_FolderRepository::initFolders('Orders', 'Commerce', 0, 'Commerce')); $this->initializeTemporaryDatabaseMount(); // Setting highlight mode: $this->doHighlight = !$backendUser->getTSConfigVal('options.pageTree.disableTitleHighlight'); }
/** * Returns TRUE if the associated action in _GET is allowed. * * @return boolean */ public function actionIsAllowed() { if (!in_array(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action'), array('route', 'getAPI'))) { return FALSE; } return TRUE; }
/** * Determine the url to view * * @return string */ protected function getTargetUrl() { $pageIdToShow = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id')); $adminCommand = $this->getAdminCommand($pageIdToShow); $domainName = $this->getDomainName($pageIdToShow); // Mount point overlay: Set new target page id and mp parameter /** @var \TYPO3\CMS\Frontend\Page\PageRepository $sysPage */ $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $sysPage->init(FALSE); $mountPointMpParameter = ''; $finalPageIdToShow = $pageIdToShow; $mountPointInformation = $sysPage->getMountPointInfo($pageIdToShow); if ($mountPointInformation && $mountPointInformation['overlay']) { // New page id $finalPageIdToShow = $mountPointInformation['mount_pid']; $mountPointMpParameter = '&MP=' . $mountPointInformation['MPvar']; } // Modify relative path to protocol with host if domain record is given $protocolAndHost = '..'; if ($domainName) { $protocol = 'http'; $page = (array) $sysPage->getPage($finalPageIdToShow); if ($page['url_scheme'] == 2 || $page['url_scheme'] == 0 && \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL')) { $protocol = 'https'; } $protocolAndHost = $protocol . '://' . $domainName; } $url = $protocolAndHost . '/index.php?id=' . $finalPageIdToShow . $this->getTypeParameterIfSet($finalPageIdToShow) . $mountPointMpParameter . $adminCommand; return $url; }