/** * 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; }
/** * Returns information about this extension plugin * * @param array $params Parameters to the hook * * @return string Information about pi1 plugin * @hook TYPO3_CONF_VARS|SC_OPTIONS|cms/layout/class.tx_cms_layout.php|list_type_Info|calendarize_calendar */ public function getExtensionSummary(array $params) { $relIconPath = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . ExtensionManagementUtility::siteRelPath('calendarize') . 'ext_icon.png'; $this->flexFormService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\FlexFormService'); $this->layoutService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\ContentElementLayoutService'); $this->layoutService->setTitle('<img src="' . $relIconPath . '" /> Calendarize'); if ($params['row']['list_type'] != 'calendarize_calendar') { return ''; } $this->flexFormService->load($params['row']['pi_flexform']); if (!$this->flexFormService->isValid()) { return ''; } $actions = $this->flexFormService->get('switchableControllerActions', 'main'); $parts = GeneralUtility::trimExplode(';', $actions, true); $parts = array_map(function ($element) { $split = explode('->', $element); return ucfirst($split[1]); }, $parts); $actionKey = lcfirst(implode('', $parts)); $this->layoutService->addRow(LocalizationUtility::translate('mode', 'calendarize'), LocalizationUtility::translate('mode.' . $actionKey, 'calendarize')); $this->layoutService->addRow(LocalizationUtility::translate('configuration', 'calendarize'), $this->flexFormService->get('settings.configuration', 'main')); if ((bool) $this->flexFormService->get('settings.hidePagination', 'main')) { $this->layoutService->addRow(LocalizationUtility::translate('hide.pagination.teaser', 'calendarize'), '!!!'); } $this->addPageIdsToTable(); return $this->layoutService->render(); }
/** * Returns the default markers for the template, with some additional parameters for the error page. * * @return array */ protected function getDefaultMarkers() { $defaultMarkers = parent::getDefaultMarkers(); $defaultMarkers['###EXTPATH_CORE###'] = ExtensionManagementUtility::siteRelPath('core'); $defaultMarkers['###EXTPATH_BACKEND###'] = ExtensionManagementUtility::siteRelPath('backend'); return $defaultMarkers; }
/** * 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; }
/** * Hooks to the felogin extension to provide additional code for FE login * * @return array 0 => onSubmit function, 1 => extra fields and required files */ public function loginFormHook() { $result = array(0 => '', 1 => ''); if (trim($GLOBALS['TYPO3_CONF_VARS']['FE']['loginSecurityLevel']) === 'rsa') { $backend = \TYPO3\CMS\Rsaauth\Backend\BackendFactory::getBackend(); if ($backend) { $result[0] = 'tx_rsaauth_feencrypt(this);'; $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'); foreach ($files as $file) { $result[1] .= '<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 RSA hidden fields $result[1] .= '<input type="hidden" id="rsa_n" name="n" value="' . htmlspecialchars($keyPair->getPublicKeyModulus()) . '" />'; $result[1] .= '<input type="hidden" id="rsa_e" name="e" value="' . sprintf('%x', $keyPair->getExponent()) . '" />'; } } return $result; }
/** * Load all necessary Javascript files * * @param bool $useRequireJsModule */ public function enableRsaEncryption($useRequireJsModule = false) { if ($this->moduleLoaded || !$this->isAvailable()) { return; } $this->moduleLoaded = true; $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); // Include necessary javascript files if ($useRequireJsModule) { $pageRenderer->loadRequireJsModule('TYPO3/CMS/Rsaauth/RsaEncryptionModule'); } else { // Register ajax handler url $code = 'var TYPO3RsaEncryptionPublicKeyUrl = ' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?eID=RsaPublicKeyGenerationController') . ';'; $pageRenderer->addJsInlineCode('TYPO3RsaEncryptionPublicKeyUrl', $code); $javascriptPath = ExtensionManagementUtility::siteRelPath('rsaauth') . 'Resources/Public/JavaScript/'; if (!$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['debug']) { $files = array('RsaEncryptionWithLib.min.js'); } else { $files = array('RsaLibrary.js', 'RsaEncryption.js'); } foreach ($files as $file) { $pageRenderer->addJsFile($javascriptPath . $file); } } }
/** * Constructor */ public function __construct() { $this->defaultIcon = '../' . ExtensionManagementUtility::siteRelPath('fluidcontent') . 'Resources/Public/Icons/Plugin.png'; $this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['fluidcontent']); $this->extConf['iconWidth'] = $this->extConf['iconWidth'] ?: self::ICON_WIDTH; $this->extConf['iconHeight'] = $this->extConf['iconHeight'] ?: self::ICON_HEIGHT; }
/** * Sets the newsletter * * @param Newsletter $newsletter * @param string $language * @throws \Exception */ public function setNewsletter(Newsletter $newsletter, $language = null) { // When sending newsletter via scheduler (so via CLI mode) realurl cannot guess // the domain name by himself, so we help him by filling HTTP_HOST variable $_SERVER['HTTP_HOST'] = $newsletter->getDomain(); $_SERVER['SCRIPT_NAME'] = '/index.php'; $this->siteUrl = $newsletter->getBaseUrl() . '/'; $this->linksCache = []; $this->newsletter = $newsletter; $this->homeUrl = $this->siteUrl . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('newsletter'); $this->senderName = $newsletter->getSenderName(); $this->senderEmail = $newsletter->getSenderEmail(); $this->replytoName = $newsletter->getReplytoName(); $this->replytoEmail = $newsletter->getReplytoEmail(); $bounceAccount = $newsletter->getBounceAccount(); $this->bounceAddress = $bounceAccount ? $bounceAccount->getEmail() : null; // Build html $validatedContent = $newsletter->getValidatedContent($language); if (count($validatedContent['errors'])) { throw new \Exception('The newsletter HTML content does not validate. The sending is aborted. See errors: ' . serialize($validatedContent['errors'])); } $this->setHtml($validatedContent['content']); // Build title from HTML source (we cannot use $newsletter->getTitle(), because it is NOT localized) $this->setTitle($validatedContent['content']); // Attaching files $files = $newsletter->getAttachments(); foreach ($files as $file) { if (trim($file) != '') { $filename = PATH_site . "uploads/tx_newsletter/{$file}"; $this->attachments[] = Swift_Attachment::fromPath($filename); } } }
/** * Renders entry for one page of the current document. * * @access protected * * @param integer $number: The page to render * @param string $template: Parsed template subpart * * @return string The rendered entry ready for output */ protected function getEntry($number, $template) { // Set current page if applicable. if (!empty($this->piVars['page']) && $this->piVars['page'] == $number) { $markerArray['###STATE###'] = 'cur'; } else { $markerArray['###STATE###'] = 'no'; } // Set page number. $markerArray['###NUMBER###'] = $number; // Set pagination. $markerArray['###PAGINATION###'] = $this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['label']; // Get thumbnail or placeholder. if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['files'][$this->conf['fileGrpThumbs']])) { $thumbnailFile = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['files'][$this->conf['fileGrpThumbs']]); } elseif (!empty($this->conf['placeholder'])) { $thumbnailFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['placeholder']); } else { $thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'plugins/pagegrid/placeholder.jpg'; } $thumbnail = '<img alt="' . $markerArray['###PAGINATION###'] . '" src="' . $thumbnailFile . '" />'; // Get new plugin variables for typolink. $piVars = $this->piVars; // Unset no longer needed plugin variables. // unset($piVars['pagegrid']) is for DFG Viewer compatibility! unset($piVars['pointer'], $piVars['DATA'], $piVars['pagegrid']); $piVars['page'] = $number; $linkConf = array('useCacheHash' => 1, 'parameter' => $this->conf['targetPid'], 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $piVars, '', TRUE, FALSE), 'title' => $markerArray['###PAGINATION###']); $markerArray['###THUMBNAIL###'] = $this->cObj->typoLink($thumbnail, $linkConf); return $this->cObj->substituteMarkerArray($template, $markerArray); }
/** * constructPostProcess * * @param array $config * @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference */ public function constructPostProcess($config, &$backendReference) { $lastPwChange = $GLOBALS['BE_USER']->user['tx_besecurepw_lastpwchange']; $lastLogin = $GLOBALS['BE_USER']->user['lastlogin']; // get configuration of a secure password $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_secure_pw']); $validUntilConfiguration = trim($extConf['validUntil']); $validUntil = 0; if ($validUntilConfiguration != '') { $validUntil = strtotime('- ' . $validUntilConfiguration); } if ($validUntilConfiguration != '' && ($lastPwChange == 0 || $lastPwChange < $validUntil) || $lastLogin == 0) { // let the popup pop up :) $generatedLabels = array('passwordReminderWindow_title' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_title'), 'passwordReminderWindow_message' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_message'), 'passwordReminderWindow_button_changePassword' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_button_changePassword'), 'passwordReminderWindow_button_postpone' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_button_postpone')); // Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8: if ($GLOBALS['LANG']->charSet !== 'utf-8') { $GLOBALS['LANG']->csConvObj->convArray($generatedLabels, $GLOBALS['LANG']->charSet, 'utf-8'); } $labelsForJS = 'TYPO3.LLL.beSecurePw = ' . json_encode($generatedLabels) . ';'; $backendReference->addJavascript($labelsForJS); $version7 = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('7.0.0'); $currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version); if ($currentVersion < $version7) { $javaScriptFile = 'passwordreminder.js'; } else { $javaScriptFile = 'passwordreminder7.js'; } $backendReference->addJavascriptFile($GLOBALS['BACK_PATH'] . '../' . ExtensionManagementUtility::siteRelPath('be_secure_pw') . 'Resources/Public/JavaScript/' . $javaScriptFile); } }
/** * action show * @return void */ public function show3dAction() { if ($this->settings['general']['mode3d'] == 1) { // get relative typo path $relPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('vk2'); // render different js library regarding if production or debug mode if ($this->settings['general']['debug'] == 1) { $GLOBALS['TSFE']->additionalHeaderData[] = ' <script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/Cesium/Cesium.js"></script> <script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/ol3cesium-debug.js"></script> <script type="text/javascript" src="' . $relPath . 'Resources/Public/lib/closure-library/closure/goog/base.js"></script> <script type="text/javascript" src="' . $relPath . 'Resources/Public/lib/closure-library/closure/goog/deps.js"></script> <script type="text/javascript" src="' . $relPath . 'Resources/Public/src/vk2-deps.js"></script>'; } else { $GLOBALS['TSFE']->additionalHeaderData[] = ' <script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/Cesium/Cesium.js"></script> <script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/ol3cesium.js"></script> <script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/vk2-min.js"></script>'; } \SLUB\Vk2\Utils\Tools::renderClientSettings($this->settings); } else { // 2.5d mode is deactivated // redirect to main page $this->redirect('show', 'Main', NULL); } }
/** * Initializes the Module * * @return void */ public function __construct() { parent::init(); // Initialize document $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('taskcenter') . 'res/mod_template.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->getPageRenderer()->loadScriptaculous('effects,dragdrop'); $this->doc->addStyleSheet('tx_taskcenter', '../' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('taskcenter') . 'res/mod_styles.css'); }
/** * * @param string $name * @return NULL */ public function render($name) { $pageRenderer = $this->getPageRenderer(); $block = $this->renderChildren(); $pageRenderer->addJsLibrary('googlemap', 'http://maps.google.com/maps/api/js?v=3&sensor=false', 'text/javascript', false, false, '', true); $pageRenderer->addJsLibrary('infobox', 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox.js', 'text/javascript', false, false, '', true); $pageRenderer->addCssFile($this->templateVariableContainer->get('settings')['cssfile'] ?: \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath(easy_googlemap) . 'Resources/Public/css/map.css'); $pageRenderer->addJsFooterInlineCode($name, $block, $compress, $forceOnTop); return null; }
/** * Post-processing to define which control items to show. Possibly own icons can be added here. * * @param string $parentUid The uid of the parent (embedding) record (uid or NEW...) * @param string $foreignTable The table (foreign_table) we create control-icons for * @param array $childRecord The current record of that foreign_table * @param array $childConfig TCA configuration of the current field of the child record * @param bool $isVirtual Defines whether the current records is only virtually shown and not physically part of the parent record * @param array &$controlItems (reference) Associative array with the currently available control items * @return void */ public function renderForeignRecordHeaderControl_postProcess($parentUid, $foreignTable, array $childRecord, array $childConfig, $isVirtual, array &$controlItems) { if ($foreignTable === 'sys_file_reference' && !empty($childRecord['showinpreview'])) { $ll = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xlf:'; $label = $GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.showinpreview', true); $icon = '../' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('news') . 'Resources/Public/Icons/preview.gif'; $extraItem = ['showinpreview' => ' <span class="btn btn-default"><img title="' . $label . '" src="' . $icon . '" /></span>']; $controlItems = $extraItem + $controlItems; } }
/** * * Initialize ViewHelper */ public function initialize() { $this->extKey = $this->controllerContext->getRequest()->getControllerExtensionKey(); $this->extPath = ExtensionManagementUtility::extPath($this->extKey); $this->relExtPath = ExtensionManagementUtility::siteRelPath($this->extKey); if (TYPO3_MODE === 'BE') { $this->initializeBackend(); } else { $this->initializeFrontend(); } }
/** * Initializes the Module */ public function __construct() { $this->getLanguageService()->includeLLFile('EXT:taskcenter/task/locallang.xlf'); $this->MCONF = array('name' => $this->moduleName); parent::init(); // Initialize document $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); $this->doc->setModuleTemplate(ExtensionManagementUtility::extPath('taskcenter') . 'Resources/Private/Templates/mod_template.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->getPageRenderer()->loadJquery(); $this->doc->addStyleSheet('tx_taskcenter', '../' . ExtensionManagementUtility::siteRelPath('taskcenter') . 'Resources/Public/Styles/styles.css'); }
/** * Renders the avatar. * * @param \Mittwald\Typo3Forum\Domain\Model\User\FrontendUser|NULL $user * * @return null|string */ public function render(\Mittwald\Typo3Forum\Domain\Model\User\FrontendUser $user = NULL) { // if user ist not set $avatarFilename = NULL; if ($user != NULL) { $avatarFilename = $user->getImagePath(); } if ($avatarFilename === NULL) { $avatarFilename = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('typo3_forum') . 'Resources/Public/Images/Icons/AvatarEmpty.png'; } return $avatarFilename; }
/** * Initializes the Module * * @return void */ public function __construct() { $GLOBALS['LANG']->includeLLFile('EXT:taskcenter/task/locallang.xlf'); $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], TRUE); parent::init(); // Initialize document $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('taskcenter') . 'res/mod_template.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->getPageRenderer()->loadScriptaculous('effects,dragdrop'); $this->doc->addStyleSheet('tx_taskcenter', '../' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('taskcenter') . 'res/mod_styles.css'); }
/** * Resolves the path * * @param string $filename * @return string */ protected function resolvePath($filename) { if (substr($filename, 0, 4) == 'EXT:') { // extension list($extKey, $local) = explode('/', substr($filename, 4), 2); $filename = ''; if (strcmp($extKey, '') && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey) && strcmp($local, '')) { $filename = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey) . $local; } } return $filename; }
/** * @param PageRenderer $pageRenderer */ public function getPageRenderer(PageRenderer $pageRenderer) { $loginSecurityLevel = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) ?: 'normal'; if ($loginSecurityLevel === 'rsa') { $javascriptPath = '../' . ExtensionManagementUtility::siteRelPath('rsaauth') . 'Resources/Public/JavaScript/'; $files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js'); foreach ($files as $file) { $pageRenderer->addJsFile($javascriptPath . $file); } $pageRenderer->loadRequireJsModule('TYPO3/CMS/Rsaauth/BackendLoginFormRsaEncryption'); } }
/** * Get avatar img tag * * @param array $backendUser be_users record * @param int $size * @return string */ public function getImgTag(array $backendUser = null, $size = 32) { if (!is_array($backendUser)) { $backendUser = $this->getBackendUser()->user; } $avatarImage = $this->getImage($backendUser, $size); if (!$avatarImage) { $avatarImage = GeneralUtility::makeInstance(Image::class, ExtensionManagementUtility::siteRelPath('core') . 'Resources/Public/Icons/T3Icons/avatar/avatar-default.svg', $size, $size); } $imageTag = '<img src="' . htmlspecialchars($avatarImage->getUrl(true)) . '" ' . 'width="' . (int) $avatarImage->getWidth() . '" ' . 'height="' . (int) $avatarImage->getHeight() . '" />'; return $imageTag; }
/** * Provides form code for the superchallenged authentication. * * @param array $params Parameters to the script * @param \TYPO3\CMS\Backend\Controller\LoginController $pObj Calling object * @return string The code for the login form */ public function getLoginScripts(array $params, \TYPO3\CMS\Backend\Controller\LoginController &$pObj) { $content = ''; if ($pObj->loginSecurityLevel == 'rsa') { $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>'; } } return $content; }
/** * Returns Captcha-Image String * * @param Field $field * @return string image URL */ public function render(Field $field) { switch (TypoScriptUtility::getCaptchaExtensionFromSettings($this->settings)) { case 'captcha': $image = ExtensionManagementUtility::siteRelPath('captcha') . 'captcha/captcha.php'; break; default: /** @var CalculatingCaptchaService $captchaService */ $captchaService = $this->objectManager->get('In2code\\Powermail\\Domain\\Service\\CalculatingCaptchaService'); $image = $captchaService->render($field); } return $image; }
/** * Adds RSA-specific JavaScript and returns a form tag * * @param array $params * @param \TYPO3\CMS\Backend\Controller\LoginController $pObj * @return string Form tag * @throws \TYPO3\CMS\Core\Error\Exception */ public function getLoginFormTag(array $params, \TYPO3\CMS\Backend\Controller\LoginController &$pObj) { $form = NULL; if ($pObj->loginSecurityLevel === 'rsa') { /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */ $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer(); $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', 'BackendLoginFormRsaEncryption.js'); foreach ($files as $file) { $pageRenderer->addJsFile($javascriptPath . $file); } return '<form action="index.php" id="typo3-login-form" method="post" name="loginform">'; } return $form; }
public function initializeAction() { $this->response->addAdditionalHeaderData('<link rel="stylesheet" type="text/css" href="' . ExtensionManagementUtility::siteRelPath($this->request->getControllerExtensionKey()) . 'Resources/Public/StyleSheets/base.css" />'); $this->response->addAdditionalHeaderData('<script type="text/javascript" src="' . ExtensionManagementUtility::siteRelPath($this->request->getControllerExtensionKey()) . 'Resources/Public/JavaScript/yt_pl.js"></script>'); $this->youtubeChannelId = $this->settings["channelId"]; $this->youtubeServerApiToken = $this->settings["apiServerToken"]; $this->youTubeApi = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Powrup\\YoutubePlaylist\\Utility\\YouTubeApi', $this->youtubeServerApiToken); $this->config = \Powrup\YoutubePlaylist\Utility\Configuration::getTsArrayByPath($this->configurationManager, "plugin.tx_youtubeplaylist.config"); if ($this->config['addJQuery'] == true) { // add jQuery to the DOM /* @var \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer */ $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); $pageRenderer->addJsFile(ExtensionManagementUtility::siteRelPath($this->request->getControllerExtensionKey()) . 'Resources/Public/JavaScript/jQuery/jquery-1.11.3.min.js', $type = 'text/javascript', $compress = false, $forceOnTop = true, $allWrap = '', $excludeFromConcatenation = true, $splitChar = '|', $async = false, $integrity = ''); } }
/** * Adds the JS files necessary for search suggestions * * @access protected * * @return void */ protected function addAutocompleteJS() { // Check if there are any metadata to suggest. $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_metadata.*', 'tx_dlf_metadata', 'tx_dlf_metadata.autocomplete=1 AND tx_dlf_metadata.pid=' . intval($this->conf['pages']) . tx_dlf_helper::whereClause('tx_dlf_metadata'), '', '', '1'); if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { // Add javascript to page header. if (tx_dlf_helper::loadJQuery()) { $GLOBALS['TSFE']->additionalHeaderData[$this->prefixId . '_search_suggest'] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'plugins/search/tx_dlf_search_suggest.js"></script>'; } } else { if (TYPO3_DLOG) { \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING); } } }
/** * Display the BFV widget. */ public function indexAction() { // Get extension key for later use. $extKey = $this->request->getControllerExtensionKey(); // Create an data object and encode it as JSON. $widgetId = uniqid($extKey); $this->view->assign('widgetId', $widgetId); $widgetData = $this->settings; $widgetData['id'] = $widgetId; $this->view->assign('widgetData', json_encode($widgetData, JSON_FORCE_OBJECT)); // Add required JavaScript. /** @var \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer */ $pageRenderer = $GLOBALS['TSFE']->getPageRenderer(); $pageRenderer->addJsFooterFile('http://ergebnisse.bfv.de/javascript/widgets/bfvWidgetFunctions.js'); $extRelPath = ExtensionManagementUtility::siteRelPath('retiolumbfvwidget'); $pageRenderer->addJsFooterFile($extRelPath . 'Resources/Public/Scripts/retiolumbfvwidget_loader.js'); }
/** * Creates the HTML (mixture of a <form> and a JavaScript section) for the JavaScript menu (basically an array of selector boxes with onchange handlers) * * @return string The HTML code for the menu */ public function writeMenu() { if (!$this->id) { return ''; } $levels = MathUtility::forceIntegerInRange($this->mconf['levels'], 1, 5); $this->levels = $levels; $uniqueParam = GeneralUtility::shortMD5(microtime(), 5); $this->JSVarName = 'eid' . $uniqueParam; $this->JSMenuName = $this->mconf['menuName'] ?: 'JSmenu' . $uniqueParam; $JScode = ' var ' . $this->JSMenuName . ' = new JSmenu(' . $levels . ', ' . GeneralUtility::quoteJSvalue($this->JSMenuName . 'Form') . ');'; for ($a = 1; $a <= $levels; $a++) { $JScode .= ' var ' . $this->JSVarName . $a . '=0;'; } $JScode .= $this->generate_level($levels, 1, $this->id, $this->menuArr, $this->MP_array) . LF; $GLOBALS['TSFE']->additionalHeaderData['JSMenuCode'] = '<script type="text/javascript" src="' . $GLOBALS['TSFE']->absRefPrefix . ExtensionManagementUtility::siteRelPath('frontend') . 'Resources/Public/JavaScript/jsfunc.menu.js"></script>'; $GLOBALS['TSFE']->additionalJavaScript['JSCode'] .= $JScode; // Printing: $allFormCode = ''; for ($a = 1; $a <= $this->levels; $a++) { $formCode = ''; $levelConf = $this->mconf[$a . '.']; $length = $levelConf['width'] ?: 14; $lengthStr = ''; for ($b = 0; $b < $length; $b++) { $lengthStr .= '_'; } $height = $levelConf['elements'] ?: 5; $formCode .= '<select name="selector' . $a . '" onchange="' . $this->JSMenuName . '.act(' . $a . ');"' . ($levelConf['additionalParams'] ? ' ' . $levelConf['additionalParams'] : '') . '>'; for ($b = 0; $b < $height; $b++) { $formCode .= '<option value="0">'; if ($b === 0) { $formCode .= $lengthStr; } $formCode .= '</option>'; } $formCode .= '</select>'; $allFormCode .= $this->WMcObj->wrap($formCode, $levelConf['wrap']); } $formContent = $this->WMcObj->wrap($allFormCode, $this->mconf['wrap']); $formCode = '<form action="" method="post" style="margin: 0 0 0 0;" name="' . $this->JSMenuName . 'Form">' . $formContent . '</form>'; $formCode .= '<script type="text/javascript"> /*<![CDATA[*/ ' . $this->JSMenuName . '.writeOut(1,' . $this->JSMenuName . '.openID,1); /*]]>*/ </script>'; return $this->WMcObj->wrap($formCode, $this->mconf['wrapAfterTags']); }
/** * Hooks to the felogin extension to provide additional code for FE login * * @return array 0 => onSubmit function, 1 => extra fields and required files */ public function loginFormHook() { $result = array(0 => '', 1 => ''); if (trim($GLOBALS['TYPO3_CONF_VARS']['FE']['loginSecurityLevel']) === 'rsa') { $backend = \TYPO3\CMS\Rsaauth\Backend\BackendFactory::getBackend(); if ($backend) { $result[0] = 'return TYPO3FrontendLoginFormRsaEncryption.submitForm(this, TYPO3FrontendLoginFormRsaEncryptionPublicKeyUrl);'; $javascriptPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('rsaauth') . 'Resources/Public/JavaScript/'; $files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js', 'FrontendLoginFormRsaEncryption.min.js'); $eIdUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($GLOBALS['TSFE']->absRefPrefix . 'index.php?eID=FrontendLoginRsaPublicKey'); $additionalHeader = '<script type="text/javascript">var TYPO3FrontendLoginFormRsaEncryptionPublicKeyUrl = ' . $eIdUrl . ';</script>'; foreach ($files as $file) { $additionalHeader .= '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $javascriptPath . $file . '"></script>'; } $GLOBALS['TSFE']->additionalHeaderData['rsaauth_js'] = $additionalHeader; } } return $result; }
/** * Returns the icon associated to a given document key. * * @param string $documentKey * @return string */ public static function getIcon($documentKey) { $basePath = 'typo3conf/Documentation/'; $documentPath = $basePath . $documentKey . '/'; // Fallback icon $icon = ExtensionManagementUtility::siteRelPath('documentation') . 'ext_icon.png'; if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($documentKey, 'typo3cms.extensions.')) { // Standard extension icon $extensionKey = substr($documentKey, 20); if (ExtensionManagementUtility::isLoaded($extensionKey)) { $extensionPath = ExtensionManagementUtility::extPath($extensionKey); $siteRelativePath = ExtensionManagementUtility::siteRelPath($extensionKey); $icon = $siteRelativePath . ExtensionManagementUtility::getExtensionIcon($extensionPath); } } elseif (is_file(PATH_site . $documentPath . 'icon.png')) { $icon = $documentPath . 'icon.png'; } elseif (is_file(PATH_site . $documentPath . 'icon.gif')) { $icon = $documentPath . 'icon.gif'; } return $icon; }