/** * Initialize, setting what is necessary for browsing pages. * Using the current user. * * @param string $clause Additional clause for selecting pages. * @param string $orderByFields record ORDER BY field * @return void * @todo Define visibility */ public function init($clause = '', $orderByFields = '') { // This will hide records from display - it has nothing todo with user rights!! $clauseExcludePidList = ''; if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) { if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) { $clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')'; } } // This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly: parent::init(' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1) . ' ' . $clause . $clauseExcludePidList, 'sorting'); $this->table = 'pages'; $this->setTreeName('browsePages'); $this->domIdPrefix = 'pages'; $this->iconName = ''; $this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; $this->MOUNTS = $GLOBALS['WEBMOUNTS']; if ($pidList) { // Remove mountpoint if explicitly set in options.hideRecords.pages (see above) $hideList = explode(',', $pidList); $this->MOUNTS = array_diff($this->MOUNTS, $hideList); } $this->fieldArray = array_merge($this->fieldArray, array('doktype', 'php_tree_stop', 't3ver_id', 't3ver_state', 't3ver_wsid', 't3ver_state', 't3ver_move_id')); if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) { $this->fieldArray = array_merge($this->fieldArray, array('hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'is_siteroot', 'nav_hide')); } }
/** * */ public function parseResource() { $configuration = $this->getConfiguration(); if (!ExtensionManagementUtility::isLoaded('phpexcel_library')) { throw new \Exception('phpexcel_library is not loaded', 12367812368); } $filename = GeneralUtility::getFileAbsFileName($this->filepath); GeneralUtility::makeInstanceService('phpexcel'); $objReader = \PHPExcel_IOFactory::createReaderForFile($filename); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load($filename); if ($configuration['sheet'] >= 0) { $objWorksheet = $objPHPExcel->getSheet($configuration['sheet']); } else { $objWorksheet = $objPHPExcel->getActiveSheet(); } $highestRow = $objWorksheet->getHighestRow(); $highestColumn = $objWorksheet->getHighestColumn(); $highestColumnIndex = \PHPExcel_Cell::columnIndexFromString($highestColumn); for ($row = 1 + $configuration['skipRows']; $row <= $highestRow; ++$row) { $rowRecord = []; for ($col = 0; $col <= $highestColumnIndex; ++$col) { $rowRecord[] = trim($objWorksheet->getCellByColumnAndRow($col, $row)->getValue()); } $this->content[] = $rowRecord; } }
/** * Initializing global variables * * @return void */ function init() { $this->MCONF = $GLOBALS['MCONF']; parent::init(); // initialize IconFactory $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $temp = BackendUtility::getModTSconfig($this->id, 'mod.web_modules.dmail'); if (!is_array($temp['properties'])) { $temp['properties'] = array(); } $this->params = $temp['properties']; $this->implodedParams = DirectMailUtility::implodeTSParams($this->params); if ($this->params['userTable'] && is_array($GLOBALS["TCA"][$this->params['userTable']])) { $this->userTable = $this->params['userTable']; $this->allowedTables[] = $this->userTable; } $this->MOD_MENU['dmail_mode'] = BackendUtility::unsetMenuItems($this->params, $this->MOD_MENU['dmail_mode'], 'menu.dmail_mode'); // initialize backend user language if ($this->getLanguageService()->lang && ExtensionManagementUtility::isLoaded('static_info_tables')) { $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('sys_language.uid', 'sys_language LEFT JOIN static_languages ON sys_language.static_lang_isocode=static_languages.uid', 'static_languages.lg_typo3=' . $GLOBALS["TYPO3_DB"]->fullQuoteStr($this->getLanguageService()->lang, 'static_languages') . BackendUtility::BEenableFields('sys_language') . BackendUtility::deleteClause('sys_language') . BackendUtility::deleteClause('static_languages')); while ($row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) { $this->sys_language_uid = $row['uid']; } $GLOBALS["TYPO3_DB"]->sql_free_result($res); } // load contextual help $this->cshTable = '_MOD_' . $this->MCONF['name']; if ($GLOBALS["BE_USER"]->uc['edit_showFieldHelp']) { $this->getLanguageService()->loadSingleTableDescription($this->cshTable); } }
/** * Validation method * * @param mixed $password * * @return bool */ public function isValid($password) { $result = true; if (!\Evoweb\SfRegister\Services\Login::isLoggedIn()) { $this->addError(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('error_changepassword_notloggedin', 'SfRegister'), 1301599489); $result = false; } else { $user = $this->userRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']); if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('saltedpasswords') && \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('FE')) { /** @var \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface $saltedPassword */ $saltedPassword = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($user->getPassword(), null); if (!$saltedPassword->checkPassword($password, $user->getPassword())) { $this->addError(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('error_changepassword_notequal', 'SfRegister'), 1301599507); $result = false; } } elseif ($this->settings['encryptPassword'] === 'md5') { if (md5($password) !== $user->getPassword()) { $this->addError(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('error_changepassword_notequal', 'SfRegister'), 1301599507); $result = false; } } elseif ($this->settings['encryptPassword'] === 'sha1') { if (sha1($password) !== $user->getPassword()) { $this->addError(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('error_changepassword_notequal', 'SfRegister'), 1301599507); $result = false; } } } return $result; }
/** * Synchronizes backend users. * * @param array $users */ protected function synchronizeUsers(array $users) { /** @var \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface $instance */ $instance = null; if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('saltedpasswords')) { $instance = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(null, 'BE'); } $authorizedKeys = array_flip(array('username', 'admin', 'disable', 'realName', 'email', 'TSconfig', 'starttime', 'endtime', 'lang', 'tx_openid_openid', 'deleted')); foreach ($users as $user) { $user = array_intersect_key($user, $authorizedKeys); if (empty($this->config['synchronizeDeletedAccounts']) || !$this->config['synchronizeDeletedAccounts']) { if (isset($user['deleted']) && $user['deleted']) { // We do not authorize deleted user accounts to be synchronized // on this website continue; } } else { $user['deleted'] = $user['deleted'] ? 1 : 0; } // Generate a random password $password = GeneralUtility::generateRandomBytes(16); $user['password'] = $instance ? $instance->getHashedPassword($password) : md5($password); $localUser = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid', 'be_users', 'username='******'username'], 'be_users')); if ($localUser) { // Update existing user $this->getDatabaseConnection()->exec_UPDATEquery('be_users', 'uid=' . $localUser['uid'], $user); } else { // Create new user $this->getDatabaseConnection()->exec_INSERTquery('be_users', $user); } } }
/** * initializeActionMethodValidators to dynamically add validators * * @return void */ public function initializeActionMethodValidators() { parent::initializeActionMethodValidators(); $requestArguments = $this->request->getArguments(); foreach ($this->arguments as $argument) { /* @var \TYPO3\CMS\Extbase\MVC\Controller\Argument $argument */ if ($argument->getName() == 'newComment' && $this->actionMethodName == 'createAction') { // Get the validators of the model /* @var \TYPO3\CMS\Extbase\Validation\Validator\ConjunctionValidator $validator */ $validator = $argument->getValidator(); // If activated and available add the modified sr_freecap validator if ($this->settings['captcha'] == 'sr_freecap' && ExtensionManagementUtility::isLoaded('sr_freecap')) { $options = array('word' => $requestArguments['newComment']['captchaResponse']); /** @var \Heilmann\JhPwcommentsCaptcha\Validation\Validator\SrFreecapValidator $captchaValidator */ $captchaValidator = GeneralUtility::makeInstance('Heilmann\\JhPwcommentsCaptcha\\Validation\\Validator\\SrFreecapValidator', $options); $validator->addValidator($captchaValidator); } // If activated and available add the modified captcha_viewhelper validator // It seems that EXT:captcha_viewhelper is not maintained anymore. Support will be dropped two minor versions later if ($this->settings['captcha'] == 'captcha' && ExtensionManagementUtility::isLoaded('captcha_viewhelper')) { $options = array('value' => $requestArguments['newComment']['captchaResponse']); /** @var \Heilmann\JhPwcommentsCaptcha\Validation\Validator\CaptchaValidator $captchaValidator */ $captchaValidator = GeneralUtility::makeInstance('Heilmann\\JhPwcommentsCaptcha\\Validation\\Validator\\CaptchaValidator', $options); $validator->addValidator($captchaValidator); } } } }
/** * Return TRUE if dbal and adodb extension is loaded * * @return bool TRUE if dbal and adodb is loaded */ protected function isDbalEnabled() { if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('adodb') && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('dbal')) { return true; } return false; }
/** * Initializes settings for the admin panel. * * @return void */ public function initialize() { $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $this->saveConfigOptions(); $typoScriptFrontend = $this->getTypoScriptFrontendController(); // Setting some values based on the admin panel $this->extFeEditLoaded = ExtensionManagementUtility::isLoaded('feedit'); $typoScriptFrontend->forceTemplateParsing = $this->extGetFeAdminValue('tsdebug', 'forceTemplateParsing'); $typoScriptFrontend->displayEditIcons = $this->extGetFeAdminValue('edit', 'displayIcons'); $typoScriptFrontend->displayFieldEditIcons = $this->extGetFeAdminValue('edit', 'displayFieldIcons'); if (GeneralUtility::_GP('ADMCMD_editIcons')) { $typoScriptFrontend->displayFieldEditIcons = 1; } if (GeneralUtility::_GP('ADMCMD_simUser')) { $this->getBackendUser()->uc['TSFE_adminConfig']['preview_simulateUserGroup'] = (int) GeneralUtility::_GP('ADMCMD_simUser'); $this->ext_forcePreview = true; } if (GeneralUtility::_GP('ADMCMD_simTime')) { $this->getBackendUser()->uc['TSFE_adminConfig']['preview_simulateDate'] = (int) GeneralUtility::_GP('ADMCMD_simTime'); $this->ext_forcePreview = true; } if ($typoScriptFrontend->forceTemplateParsing) { $typoScriptFrontend->set_no_cache('Admin Panel: Force template parsing', true); } elseif ($this->extFeEditLoaded && $typoScriptFrontend->displayEditIcons) { $typoScriptFrontend->set_no_cache('Admin Panel: Display edit icons', true); } elseif ($this->extFeEditLoaded && $typoScriptFrontend->displayFieldEditIcons) { $typoScriptFrontend->set_no_cache('Admin Panel: Display field edit icons', true); } elseif (GeneralUtility::_GP('ADMCMD_view')) { $typoScriptFrontend->set_no_cache('Admin Panel: Display preview', true); } }
/** * Returns array of system languages * * Since TYPO3 4.5 the flagIcon is not returned as a filename in "gfx/flags/*" anymore, * but as a string <flags-xx>. The calling party should call * t3lib_iconWorks::getSpriteIcon(<flags-xx>) to get an HTML which will represent * the flag of this language. * * @param integer $page_id Page id (only used to get TSconfig configuration setting flag and label for default language) * @param string $backPath Backpath for flags * @return array Array with languages (title, uid, flagIcon) * @todo Define visibility */ public function getSystemLanguages($page_id = 0, $backPath = '') { $modSharedTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page_id, 'mod.SHARED'); $languageIconTitles = array(); // fallback "old iconstyles" if (preg_match('/\\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) { $modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace('.gif', '', $modSharedTSconfig['properties']['defaultLanguageFlag']); } $languageIconTitles[0] = array('uid' => 0, 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty'); // Set "All" language: $languageIconTitles[-1] = array('uid' => -1, 'title' => $GLOBALS['LANG']->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple'); // Find all system languages: $sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_language', ''); foreach ($sys_languages as $row) { $languageIconTitles[$row['uid']] = $row; if ($row['static_lang_isocode'] && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) { $staticLangRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2'); if ($staticLangRow['lg_iso_2']) { $languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2']; } } if (strlen($row['flag'])) { $languageIconTitles[$row['uid']]['flagIcon'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconName('sys_language', $row); } } return $languageIconTitles; }
/** * This method decides if the condition is TRUE or FALSE. It can be overriden in extending viewhelpers * to adjust functionality. * * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper, allows for * flexiblity in overriding this method. * @return bool */ protected static function evaluateCondition($arguments = null) { $extensionName = $arguments['extensionName']; $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName); $isLoaded = ExtensionManagementUtility::isLoaded($extensionKey); return true === $isLoaded; }
/** * Override the initialize method to load all available * countries before rendering * * @return void */ public function initialize() { parent::initialize(); if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) { if ($this->hasArgument('allowedCountries') && count($this->arguments['allowedCountries'])) { $result = $this->countryRepository->findByIsoCodeA2($this->arguments['allowedCountries']); } else { $result = $this->countryRepository->findAll(); } if (!empty($this->arguments['allowedCountries'])) { $orderedResults = array(); foreach ($this->arguments['allowedCountries'] as $countryKey) { foreach ($result as $country) { if ($country->getIsoCodeA2() == $countryKey) { $orderedResults[] = $country; } } } $result = $orderedResults; } $this->arguments['options'] = array(); foreach ($result as $country) { $this->arguments['options'][] = $country; } } }
public function user_rgsg($content, $conf) { $sysPageObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $rootLine = $sysPageObj->getRootLine($GLOBALS['TSFE']->id); $TSObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService'); $TSObj->tt_track = 0; $TSObj->init(); $TSObj->runThroughTemplates($rootLine); $TSObj->generateConfig(); $this->conf = $TSObj->setup['plugin.']['tx_rgsmoothgallery_pi1.']; $split = strpos($GLOBALS['TSFE']->currentRecord, ':'); $id = substr($GLOBALS['TSFE']->currentRecord, $split + 1); $where = 'uid =' . $id; $table = 'tt_content'; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('imagewidth,imageheight', $table, $where, $groupBy = '', $orderBy, $limit = ''); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $css .= $row['imagewidth'] ? 'width:' . $row['imagewidth'] . 'px;' : ''; $css .= $row['imageheight'] ? 'height:' . $row['imageheight'] . 'px;' : ''; $GLOBALS['TSFE']->additionalCSS['rgsmoothgallery' . $id] = '#myGallery' . $id . ' {' . $css . '}'; if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('t3mootools')) { require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3mootools') . 'class.tx_t3mootools.php'; } if (defined('T3MOOTOOLS')) { tx_t3mootools::addMooJS(); } else { $header .= $this->getPath($this->conf['pathToMootools']) ? '<script src="' . $this->getPath($this->conf['pathToMootools']) . '" type="text/javascript"></script>' : ''; $header .= $this->getPath($this->conf['pathToMootoolsMore']) ? '<script src="' . $this->getPath($this->conf['pathToMootoolsMore']) . '" type="text/javascript"></script>' : ''; } // path to js + css $GLOBALS['TSFE']->additionalHeaderData['rgsmoothgallery'] = $header . ' <script src="' . $this->getPath($this->conf['pathToJdgalleryJS']) . '" type="text/javascript"></script> <link rel="stylesheet" href="' . $this->getPath($this->conf['pathToJdgalleryCSS']) . '" type="text/css" media="screen" /> '; return $content; }
/** * Get all the complex data for the loader. * This return value will be cached and stored in the database * There is no file monitoring for this cache * * @param Loader $loader * @param int $type * * @return array */ public function prepareLoader(Loader $loader, $type) { $grids = []; if (!ExtensionManagementUtility::isLoaded('gridelements')) { return $grids; } $commandPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Resources/Private/Grids/'; $files = FileUtility::getBaseFilesWithExtensionInDir($commandPath, 'ts,txt'); foreach ($files as $file) { $pathInfo = PathUtility::pathinfo($file); $iconPath = 'EXT:' . $loader->getExtensionKey() . '/Resources/Public/Icons/Grids/' . $pathInfo['filename'] . '.'; $extension = IconUtility::getIconFileExtension(GeneralUtility::getFileAbsFileName($iconPath)); $translationKey = 'grid.' . $pathInfo['filename']; if ($type === LoaderInterface::EXT_TABLES) { TranslateUtility::assureLabel($translationKey, $loader->getExtensionKey(), $pathInfo['filename']); } $path = 'EXT:' . $loader->getExtensionKey() . '/Resources/Private/Grids/' . $file; $icon = $extension ? $iconPath . $extension : false; $label = TranslateUtility::getLllString($translationKey, $loader->getExtensionKey()); $content = GeneralUtility::getUrl(GeneralUtility::getFileAbsFileName($path)); $flexForm = 'EXT:' . $loader->getExtensionKey() . '/Configuration/FlexForms/Grids/' . $pathInfo['filename'] . '.xml'; $flexFormFile = GeneralUtility::getFileAbsFileName($flexForm); $flexFormContent = is_file($flexFormFile) ? GeneralUtility::getUrl($flexFormFile) : false; $grids[] = $this->getPageTsConfig($pathInfo['filename'], $label, $content, $icon, $flexFormContent); } return $grids; }
/** * Get the localization of the select field items (right-hand part of form) * Referenced by TCA * * @param array $params Array of searched translation * * @return void */ function get_localized_categories(array $params) { global $LANG; /* $params['items'] = &$items; $params['config'] = $config; $params['TSconfig'] = $iArray; $params['table'] = $table; $params['row'] = $row; $params['field'] = $field; */ $config = $params['config']; $table = $config['itemsProcFunc_config']['table']; // initialize backend user language if ($LANG->lang && ExtensionManagementUtility::isLoaded('static_info_tables')) { $sysPage = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_language.uid', 'sys_language LEFT JOIN static_languages ON sys_language.static_lang_isocode = static_languages.uid', 'static_languages.lg_typo3 = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($LANG->lang, 'static_languages') . $sysPage->enableFields('sys_language') . $sysPage->enableFields('static_languages')); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $this->sys_language_uid = $row['uid']; $this->collate_locale = $row['lg_collate_locale']; } $GLOBALS['TYPO3_DB']->sql_free_result($res); } if (is_array($params['items']) && !empty($params['items'])) { foreach ($params['items'] as $k => $item) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . intval($item[1])); while ($rowCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($localizedRowCat = DirectMailUtility::getRecordOverlay($table, $rowCat, $this->sys_language_uid, '')) { $params['items'][$k][0] = $localizedRowCat['category']; } } $GLOBALS['TYPO3_DB']->sql_free_result($res); } } }
/** * Get the Records * * @param integer $startPage * @param array $basePages * @param Tx_GoogleServices_Controller_SitemapController $obj * * @throws Exception * @return Tx_GoogleServices_Domain_Model_Node */ public function getRecords($startPage, $basePages, Tx_GoogleServices_Controller_SitemapController $obj) { $nodes = array(); if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tt_news')) { return $nodes; } if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($GLOBALS['TSFE']->tmpl->setup['plugin.']['tt_news.']['singlePid'])) { throw new Exception('You have to set tt_news singlePid.'); } $singlePid = intval($GLOBALS['TSFE']->tmpl->setup['plugin.']['tt_news.']['singlePid']); $news = $this->getRecordsByField('tt_news', 'pid', implode(',', $basePages)); foreach ($news as $record) { // Alternative Single PID $alternativeSinglePid = $this->alternativeSinglePid($record['uid']); $linkPid = $alternativeSinglePid ? $alternativeSinglePid : $singlePid; // Build URL $url = $obj->getUriBuilder()->setArguments(array('tx_ttnews' => array('tt_news' => $record['uid'])))->setTargetPageUid($linkPid)->build(); // can't generate a valid url if (!strlen($url)) { continue; } // Build Node $node = new Tx_GoogleServices_Domain_Model_Node(); $node->setLoc($url); $node->setPriority($this->getPriority($record)); $node->setChangefreq('monthly'); $node->setLastmod($this->getModifiedDate($record)); $nodes[] = $node; } return $nodes; }
/** * Renders the application defined cObject FORM * which overrides the TYPO3 default cObject FORM * * Convert FORM to COA_INT - COA_INT.10 = FORM_INT * If FORM_INT is also dedected by the ContentObjectRenderer, and now * the Extbaseplugin "Form" is initalized. At this time the * controller "Frontend" action "execute" do the rest. * * @param string $typoScriptObjectName Name of the object * @param array $typoScript TS configuration for this cObject * @param string $typoScriptKey A string label used for the internal debugging tracking. * @param ContentObjectRenderer $contentObject reference * @return string HTML output */ public function cObjGetSingleExt($typoScriptObjectName, array $typoScript, $typoScriptKey, ContentObjectRenderer $contentObject) { $content = ''; if ($typoScriptObjectName === 'FORM' && !empty($typoScript['useDefaultContentObject']) && ExtensionManagementUtility::isLoaded('compatibility6')) { $content = $contentObject->getContentObject($typoScriptObjectName)->render($typoScript); } elseif ($typoScriptObjectName === 'FORM') { $mergedTypoScript = null; if ($contentObject->data['CType'] === 'mailform') { $bodytext = $contentObject->data['bodytext']; /** @var $typoScriptParser TypoScriptParser */ $typoScriptParser = GeneralUtility::makeInstance(TypoScriptParser::class); $typoScriptParser->parse($bodytext); $mergedTypoScript = (array) $typoScriptParser->setup; ArrayUtility::mergeRecursiveWithOverrule($mergedTypoScript, $typoScript); // Disables content elements since TypoScript is handled that could contain insecure settings: $mergedTypoScript[Configuration::DISABLE_CONTENT_ELEMENT_RENDERING] = true; } $newTypoScript = array('10' => 'FORM_INT', '10.' => is_array($mergedTypoScript) ? $mergedTypoScript : $typoScript); $content = $contentObject->cObjGetSingle('COA_INT', $newTypoScript); // Only apply stdWrap to TypoScript that was NOT created by the wizard: if (isset($typoScript['stdWrap.'])) { $content = $contentObject->stdWrap($content, $typoScript['stdWrap.']); } } elseif ($typoScriptObjectName === 'FORM_INT') { $extbase = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class); $content = $extbase->run('', array('pluginName' => 'Form', 'extensionName' => 'Form', 'vendorName' => 'TYPO3\\CMS', 'controller' => 'Frontend', 'action' => 'show', 'settings' => array('typoscript' => $typoScript), 'persistence' => array(), 'view' => array())); } return $content; }
/** * @param string $queueName * @return QueueInterface * @throws JobQueueException */ public function getQueue($queueName) { if (!isset($this->queues[$queueName])) { $settings = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['jobqueue']; $className = $this->extensionConfiguration->get('defaultQueue'); $options = []; if (isset($settings[$queueName])) { $className = isset($settings[$queueName]['className']) ? $settings[$queueName]['className'] : null; $options = isset($settings[$queueName]['options']) ? (array) $settings[$queueName]['options'] : []; } if (empty($options)) { $options = isset($settings[$className]['options']) ? (array) $settings[$className]['options'] : []; } if (!isset($options['timeout'])) { $defaultTimeout = (int) $this->extensionConfiguration->get('defaultTimeout'); $options['timeout'] = $defaultTimeout > 0 ? $defaultTimeout : null; } if (empty($className)) { throw new JobQueueException('No jobqueue class name configuration found.', 1448488276); } $classNameParts = ClassNamingUtility::explode($className); ExtensionManagementUtility::isLoaded(GeneralUtility::camelCaseToLowerCaseUnderscored($classNameParts['extensionName']), true); $queue = $this->objectManager->get($className, $queueName, $options); if (!$queue instanceof QueueInterface) { throw new JobQueueException("Queue '{$queueName}' is not a queue.", 1446318455); } $this->queues[$queueName] = $queue; } return $this->queues[$queueName]; }
public function init() { // Check if tt_news is active if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tt_news')) { return false; } // Init Parent parent::init(); // Build config $config = array('item_limit' => array('default' => 10, 'type' => 'int'), 'sysFolderID' => array('default' => 0, 'type' => 'int')); // Set the Default config $this->setDefaultConfig($config); // Set title & icon $title = 'Latest News'; if ((int) $this->getConfigVar('sysFolderID')) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'deleted=0 AND hidden=0 AND uid=' . (int) $this->getConfigVar('sysFolderID'), '', '', 1); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if (sizeof($row['title']) > 0) { $title .= ' - ' . $row['title']; } } # if $this->setTitle($title); $this->setIcon(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('tt_news') . '/ext_icon.gif'); return true; }
/** * Override the initialize method to load all available country * zones for a given parent country before rendering * * @return void */ public function initialize() { parent::initialize(); if ($this->hasArgument('parent') && $this->arguments['parent'] != '' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) { $this->arguments['options'] = $this->countryZonesRepository->findAllByIso2($this->arguments['parent']); } }
/** * Check whether any conflicting extension has been installed * * @return Status */ protected function checkIfNoConflictingExtensionIsInstalled() { // Take note of conflicting extensions $conf = $this->getEmConf(); $conflicts = $conf['rtehtmlarea']['constraints']['conflicts']; $languageService = $this->getLanguageService(); $title = $languageService->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_statusreport.xlf:title'); $conflictingExtensions = []; if (is_array($conflicts)) { foreach ($conflicts as $extensionKey => $version) { if (ExtensionManagementUtility::isLoaded($extensionKey)) { $conflictingExtensions[] = $extensionKey; } } } if (!empty($conflictingExtensions)) { $value = $languageService->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_statusreport.xlf:keys') . ' ' . implode(', ', $conflictingExtensions); $message = $languageService->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_statusreport.xlf:uninstall'); $status = Status::ERROR; } else { $value = $languageService->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_statusreport.xlf:none'); $message = ''; $status = Status::OK; } return GeneralUtility::makeInstance(Status::class, $title, $value, $message, $status); }
/** * @param string $extensionKey * @return string|NULL */ protected function getExtensionPrivateResourcesPath($extensionKey) { $extensionKey = trim($extensionKey); if ($extensionKey && ExtensionManagementUtility::isLoaded($extensionKey)) { return ExtensionManagementUtility::extPath($extensionKey) . 'Resources/Private/'; } return null; }
/** * Automatically update extension upon installation * * This does NOT cover the the extension update case, so manual update via * Extension Manager is still required * * @param string $extensionKey */ public function afterExtensionInstall($extensionKey) { // Only concerned on running auto-updates if it is the newsletter extension that was installed and IS installed. if ($extensionKey != 'newsletter' && !ExtensionManagementUtility::isLoaded($extensionKey)) { return; } $this->update(); }
/** * Set up */ protected function setUp() { if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('scheduler')) { $this->markTestSkipped('Tests need EXT:scheduler loaded.'); } $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances(); $this->repositoryHelper = $this->getMock(\TYPO3\CMS\Extensionmanager\Utility\Repository\Helper::class, array(), array(), '', FALSE); }
/** * Return configured captcha extension * * @param array $settings * @return string */ public static function getCaptchaExtensionFromSettings($settings) { $allowedExtensions = ['captcha']; if (in_array($settings['captcha.']['use'], $allowedExtensions) && ExtensionManagementUtility::isLoaded($settings['captcha.']['use'])) { return $settings['captcha.']['use']; } return 'default'; }
/** * constructor */ public function __construct() { $this->queuedPageHashs = array(); $this->pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages'); if (ExtensionManagementUtility::isLoaded('nc_staticfilecache')) { $this->ncStaticFileCache = GeneralUtility::makeInstance('tx_ncstaticfilecache'); } }
/** * @param string|NULL $packageOrPaths */ public function __construct($packageOrPaths = NULL) { if (TRUE === is_array($packageOrPaths)) { $this->fillFromTypoScriptArray($packageOrPaths); } elseif (FALSE === empty($packageOrPaths) && ExtensionManagementUtility::isLoaded(ExtensionNamingUtility::getExtensionKey($packageOrPaths))) { $this->fillDefaultsByPackageName($packageOrPaths); } }
/** * @test */ public function isUsedInTv() { // test only in my instance if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('templavoila') && PATH_site == '/home/html/dev/packagedev/') { $this->assertTrue(tx_additionalreports_util::isUsedInTv(192, 6)); $this->assertFalse(tx_additionalreports_util::isUsedInTv(99999, 6)); } }
/** * Constuctor */ public function __construct() { if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sr_freecap')) { /** @noinspection PhpIncludeInspection */ require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('sr_freecap') . 'pi2/class.tx_srfreecap_pi2.php'; $this->captcha = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_srfreecap_pi2'); } }
/** * @param string $extensionKey * @param integer $majorVersion * @param integer $minorVersion * @param integer $bugfixVersion * @return boolean */ public static function assertExtensionVersionIsAtLeastVersion($extensionKey, $majorVersion, $minorVersion = 0, $bugfixVersion = 0) { if (FALSE === ExtensionManagementUtility::isLoaded($extensionKey)) { return FALSE; } $extensionVersion = ExtensionManagementUtility::getExtensionVersion($extensionKey); list($major, $minor, $bugfix) = explode('.', $extensionVersion); return $majorVersion <= $major && $minorVersion <= $minor && $bugfixVersion <= $bugfix; }
/** * Frontend hook: If the page is not being re-generated this is our chance to force it to be (because re-generation of the page is required in order to have the indexer called!) * * @param array $params Parameters from frontend * @param TypoScriptFrontendController $ref TSFE object * @return void */ public function headerNoCache(array &$params, $ref) { // Requirements are that the crawler is loaded, a crawler session is running and re-indexing requested as processing instruction: if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('crawler') && $params['pObj']->applicationData['tx_crawler']['running'] && in_array('tx_indexedsearch_reindex', $params['pObj']->applicationData['tx_crawler']['parameters']['procInstructions'])) { // Setting simple log entry: $params['pObj']->applicationData['tx_crawler']['log'][] = 'RE_CACHE (indexed), old status: ' . $params['disableAcquireCacheData']; // Disables a look-up for cached page data - thus resulting in re-generation of the page even if cached. $params['disableAcquireCacheData'] = TRUE; } }