/** * Constructor * * @param tslib_cObj $contentObject The current cObject. If NULL a new instance will be created */ public function __construct(tslib_cObj $contentObject = NULL) { if (!t3lib_extMgm::isLoaded('extbase')) { return 'In the current version you still need to have Extbase installed in order to use the Fluid Standalone view!'; } $this->initializeAutoloader(); $this->objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager'); $configurationManager = $this->objectManager->get('Tx_Extbase_Configuration_ConfigurationManagerInterface'); if ($contentObject === NULL) { $contentObject = t3lib_div::makeInstance('tslib_cObj'); } $configurationManager->setContentObject($contentObject); $this->templateParser = $this->objectManager->get('Tx_Fluid_Core_Parser_TemplateParser'); $this->setRenderingContext($this->objectManager->create('Tx_Fluid_Core_Rendering_RenderingContext')); $request = $this->objectManager->create('Tx_Extbase_MVC_Web_Request'); $request->setRequestURI(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')); $request->setBaseURI(t3lib_div::getIndpEnv('TYPO3_SITE_URL')); $uriBuilder = $this->objectManager->create('Tx_Extbase_MVC_Web_Routing_UriBuilder'); $uriBuilder->setRequest($request); $controllerContext = $this->objectManager->create('Tx_Extbase_MVC_Controller_ControllerContext'); $controllerContext->setRequest($request); $controllerContext->setUriBuilder($uriBuilder); $flashMessageContainer = $this->objectManager->get('Tx_Extbase_MVC_Controller_FlashMessages'); // singleton $controllerContext->setFlashMessageContainer($flashMessageContainer); $this->setControllerContext($controllerContext); }
/** * 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 ... */ public function get_localized_categories($params) { /* $params['items'] = &$items; $params['config'] = $config; $params['TSconfig'] = $iArray; $params['table'] = $table; $params['row'] = $row; $params['field'] = $field; */ $items = $params['items']; $config = $params['config']; $table = $config['itemsProcFunc_config']['table']; // initialize backend user language if ($GLOBALS['LANG']->lang && t3lib_extMgm::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($GLOBALS['LANG']->lang, 'static_languages') . t3lib_pageSelect::enableFields('sys_language') . t3lib_pageSelect::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']; } } if (is_array($params['items'])) { reset($params['items']); while (list($k, $item) = each($params['items'])) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . intval($item[1])); while ($rowCat = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $localizedRowCat = tx_srfeuserregister_dmstatic::getRecordOverlay($table, $rowCat, $this->sys_language_uid, ''); if ($localizedRowCat) { $params['items'][$k][0] = $localizedRowCat['category']; } } } } }
/** * Initialize handler * * @param array Configuration from DBAL * @param object Parent object * @return boolean True on success. */ function init($config, $pObj) { $this->config = $config['config']; if (t3lib_extMgm::isLoaded('libunzipped')) { // Include Unzip library: require_once t3lib_extMgm::extPath('libunzipped') . 'class.tx_libunzipped.php'; // Find database file: $sxc_file = t3lib_div::getFileAbsFileName($this->config['sxc_file']); if (@is_file($sxc_file)) { // Initialize Unzip object: $this->unzip = t3lib_div::makeInstance('tx_libunzipped'); $this->spreadSheetFiles = $this->unzip->init($sxc_file); if (is_array($this->spreadSheetFiles)) { return TRUE; } else { $this->errorStatus = 'Spreadsheet could not be unzipped...?'; } } else { $this->errorStatus = 'The Spreadsheet file "' . $sxc_file . '" was not found!'; } } else { $this->errorStatus = 'This data handler needs the extension "tx_libunzipped" to be installed!'; } return FALSE; }
public function user_rgsg($content, $conf) { $sysPageObj = t3lib_div::makeInstance('t3lib_pageSelect'); $rootLine = $sysPageObj->getRootLine($GLOBALS['TSFE']->id); $TSObj = t3lib_div::makeInstance('t3lib_tsparser_ext'); $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 (t3lib_extMgm::isLoaded('t3mootools')) { require_once t3lib_extMgm::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; }
/** * Return dam record * * @param integer $uid uid of media element. * @param string $as name of element which is used for the dam record * @return string * @throws Tx_Fluid_Core_ViewHelper_Exception */ public function render($uid, $as) { if (!t3lib_extMgm::isLoaded('dam')) { throw new Tx_Fluid_Core_ViewHelper_Exception('DamViewHelper needs a loaded DAM extension', 1318786684); } if ($GLOBALS['TSFE']->sys_language_content > 0) { $media = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'tx_news_domain_model_media', 'deleted=0 AND uid =' . $uid); $media = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_news_domain_model_media', $media, $GLOBALS['TSFE']->sys_language_content); if ($media['_LOCALIZED_UID'] > 0) { // Does this localized media has dam record? $where = 'uid_foreign =' . (int) $media['_LOCALIZED_UID'] . ' AND tablenames =\'tx_news_domain_model_media\' AND ident = \'tx_news_media\''; $damRec = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid_local', 'tx_dam_mm_ref', $where); if (is_array($damRec) && $damRec['uid_local']) { $uid = $media['_LOCALIZED_UID']; } } } $res = tx_dam_db::referencesQuery('tx_dam', '', 'tx_news_domain_model_media', (int) $uid, $mmIdent = '', $mmTable = 'tx_dam_mm_ref', $fields = 'tx_dam.*'); $record = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $GLOBALS['TYPO3_DB']->sql_free_result($res); $this->templateVariableContainer->add($as, $record); $output = $this->renderChildren(); $this->templateVariableContainer->remove($as); return $output; }
/** * @param array $fieldList * @param array $r * @param tx_ttnews $tt_news_original * @return array */ public function indexSingleNewsRecord(array $fieldList, array $r, tx_ttnews $tt_news_original) { $tt_news = clone $tt_news_original; // Add ###NEWS_CONTENT### to the list of markers that need to be rendered $tt_news->renderMarkers = array('###NEWS_CONTENT###'); // Load tt_news in single-view $tt_news->config['code'] = 'SINGLE'; // Disable caching, as this is not a normal page-rendering process $tt_news->allowCaching = false; // Disable custom image-marker rendering, used f.e. by perfectlightbox ... unset($tt_news->conf['imageMarkerFunc']); // Disable all extensions for image-generation. This prevents any image-generation and works around a bug with FAL :) $imageExtensions = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']; $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] = ""; $k = false; // The extension newsreadedcount is known to use an instance of fe_user and it would count the news-read value up every time the article is indexed ... if (t3lib_extMgm::isLoaded('newsreadedcount') && false !== ($k = array_search('EXT:newsreadedcount/pi1/class.tx_newsreadedcount_pi1.php:tx_newsreadedcount_pi1', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_news']['extraItemMarkerHook']))) { unset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_news']['extraItemMarkerHook'][$k]); } // Render markers for single-view $markerArray = $tt_news->getItemMarkerArray($r, $tt_news->conf['displaySingle.']); // Add the settings back, so we don't leave a gap here. if (t3lib_extMgm::isLoaded('newsreadedcount') && $k !== false) { $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_news']['extraItemMarkerHook'][$k] = 'EXT:newsreadedcount/pi1/class.tx_newsreadedcount_pi1.php:tx_newsreadedcount_pi1'; } // Restore value for allowed image file-extensions $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] = $imageExtensions; // Replace the row's body-text by it's rendered value $r['bodytext'] = $markerArray['###NEWS_CONTENT###']; return $r; }
/** * Main function, returning the HTML content of the module * * @return string HTML */ function main() { $content = ''; $content .= '<br />Update the Static Info Tables with new language labels.'; $content .= '<br />'; if (t3lib_div::_GP('import')) { $destEncoding = t3lib_div::_GP('dest_encoding'); $extPath = t3lib_extMgm::extPath('static_info_tables_it'); $fileContent = explode("\n", t3lib_div::getUrl($extPath . 'ext_tables_static_update.sql')); foreach ($fileContent as $line) { if ($line = trim($line) and preg_match('#^UPDATE#i', $line)) { $query = $this->getUpdateEncoded($line, $destEncoding); $res = $GLOBALS['TYPO3_DB']->admin_query($query); } } $content .= '<br />'; $content .= '<p>Encoding: ' . htmlspecialchars($destEncoding) . '</p>'; $content .= '<p>Done.</p>'; } elseif (t3lib_extMgm::isLoaded('static_info_tables_it')) { $content .= '</form>'; $content .= '<form action="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" method="post">'; $content .= '<br />Destination character encoding:'; $content .= '<br />' . tx_staticinfotables_encoding::getEncodingSelect('dest_encoding', '', 'utf-8'); $content .= '<br />(The character encoding must match the encoding of the existing tables data. By default this is UTF-8.)'; $content .= '<br /><br />'; $content .= '<input type="submit" name="import" value="Import" />'; $content .= '</form>'; } else { $content .= '<br /><strong>The extension needs to be installed first!</strong>'; } return $content; }
/** * Synchronizes backend users. * * @param array $users */ protected function synchronizeUsers(array $users) { /** @var $instance tx_saltedpasswords_salts */ $instance = null; if (t3lib_extMgm::isLoaded('saltedpasswords')) { $instance = tx_saltedpasswords_salts_factory::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 = t3lib_div::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); } } }
/** * Sets the storage security level * * @return void */ protected function setStorageSecurityLevel() { $this->storageSecurityLevel = 'normal'; if (t3lib_extMgm::isLoaded('saltedpasswords') && tx_saltedpasswords_div::isUsageEnabled('FE')) { $this->storageSecurityLevel = 'salted'; } }
/** * Activates DBAL if it is supported. * * @param tx_install $instObj * @return void */ public function execute(tx_install $instObj) { if ($instObj->mode == '123') { switch ($instObj->step) { case 1: if (!t3lib_extMgm::isLoaded('dbal') && $this->isDbalSupported()) { $this->activateDbal(); // Reload page to have Install Tool actually load DBAL $redirectUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'); t3lib_utility_Http::redirect($redirectUrl); } break; case 2: if (!t3lib_extMgm::isLoaded('dbal') && $this->isDbalSupported()) { $this->activateDbal(); } break; case 3: $driver = $instObj->INSTALL['localconf.php']['typo_db_driver']; if ($driver === 'mysql') { $this->deactivateDbal(); } break; } } }
/** * Returns array of system languages * @param integer page id (only used to get TSconfig configuration setting flag and label for default language) * @param string Backpath for flags * @return array */ function getSystemLanguages($page_id = 0, $backPath = '') { global $TCA, $LANG; // Icons and language titles: t3lib_div::loadTCA('sys_language'); $flagAbsPath = t3lib_div::getFileAbsFileName($TCA['sys_language']['columns']['flag']['config']['fileFolder']); $flagIconPath = $backPath . '../' . substr($flagAbsPath, strlen(PATH_site)); $modSharedTSconfig = t3lib_BEfunc::getModTSconfig($page_id, 'mod.SHARED'); $languageIconTitles = array(); // Set default: $languageIconTitles[0] = array('uid' => 0, 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $LANG->getLL('defaultLanguage') . ')' : $LANG->getLL('defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) && @is_file($flagAbsPath . $modSharedTSconfig['properties']['defaultLanguageFlag']) ? $flagIconPath . $modSharedTSconfig['properties']['defaultLanguageFlag'] : null); // Set "All" language: $languageIconTitles[-1] = array('uid' => -1, 'title' => $LANG->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => $flagIconPath . 'multi-language.gif'); // 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'] && t3lib_extMgm::isLoaded('static_info_tables')) { $staticLangRow = t3lib_BEfunc::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'] = @is_file($flagAbsPath . $row['flag']) ? $flagIconPath . $row['flag'] : ''; } } return $languageIconTitles; }
/** * Evaluates the captcha word */ public function evalValues($theTable, $dataArray, $origArray, $markContentArray, $cmdKey, $requiredArray, $theField, $cmdParts, $bInternal, &$test, $dataObject) { $errorField = ''; // Must be set to FALSE if it is not a test $test = FALSE; if (trim($cmdParts[0]) == 'freecap' && t3lib_extMgm::isLoaded('sr_freecap') && isset($dataArray[$theField])) { $freeCap = t3lib_div::getUserObj('&tx_srfreecap_pi2'); if (isset($GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['sr_freecap_EidDispatcher'])) { $sessionNameSpace = 'tx_srfreecap'; } else { // Old version of sr_freecap $sessionNameSpace = 'tx_' . $freeCap->extKey; } // Save the sr_freecap word_hash // sr_freecap will invalidate the word_hash after calling checkWord $sessionData = $GLOBALS['TSFE']->fe_user->getKey('ses', $sessionNameSpace); if (!$freeCap->checkWord($dataArray[$theField])) { $errorField = $theField; } else { // Restore sr_freecap word_hash $GLOBALS['TSFE']->fe_user->setKey('ses', $sessionNameSpace, $sessionData); $GLOBALS['TSFE']->storeSessionData(); } } return $errorField; }
/** * Draw the item in the page module * * @param array parameters * @param object the parent object * @return string */ public function pmDrawItem($params, $pObj) { if ($this->extKey != '' && t3lib_extMgm::isLoaded($this->extKey) && in_array(intval($pObj->pageRecord['doktype']), array(1, 2, 5)) && $params['row']['pi_flexform'] != '') { tx_div2007_ff::load($params['row']['pi_flexform'], $this->extKey); $codes = 'CODE: ' . tx_div2007_ff::get($this->extKey, 'display_mode'); } return $codes; }
/** * checks whether the user has access to this toolbar item * * @see typo3/alt_shortcut.php * @return boolean true if user has access, false if not */ public function checkAccess() { if (t3lib_extMgm::isLoaded('version')) { $MCONF = array(); include 'mod/user/ws/conf.php'; return $GLOBALS['BE_USER']->modAccess(array('name' => 'user', 'access' => 'user,group'), false) && $GLOBALS['BE_USER']->modAccess($MCONF, false); } return FALSE; }
private function assertFluid() { if (!t3lib_extMgm::isLoaded("extbase")) { $this->oForm->mayday("<b>renderer:FLUID</b> needs the extension <b>extbase</b> to be loaded."); } if (!t3lib_extMgm::isLoaded("fluid")) { $this->oForm->mayday("<b>renderer:FLUID</b> needs the extension <b>fluid</b> to be loaded."); } }
/** * Construcor of this object */ public function __construct($pObj) { parent::__construct($pObj); if (TYPO3_VERSION_INTEGER < 6002000) { $this->templavoilaIsLoaded = t3lib_extMgm::isLoaded('templavoila'); } else { $this->templavoilaIsLoaded = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('templavoila'); } if ($this->templavoilaIsLoaded) { if (TYPO3_VERSION_INTEGER >= 7000000) { $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('pages') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('pages'); } else { $enableFields = t3lib_BEfunc::BEenableFields('pages') . t3lib_BEfunc::deleteClause('pages'); } $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid,title', 'pages', 'pid = 0' . $enableFields); $GLOBALS['TT'] = new t3lib_timeTrackNull(); if (TYPO3_VERSION_INTEGER >= 6002000) { $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $row['uid'], 0); $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_pageSelect'); } else { $GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $row['uid'], 0); $GLOBALS['TSFE']->sys_page = t3lib_div::makeInstance('t3lib_pageSelect'); } $GLOBALS['TSFE']->sys_page->init(TRUE); $GLOBALS['TSFE']->initTemplate(); // Filling the config-array, first with the main "config." part if (is_array($GLOBALS['TSFE']->tmpl->setup['config.'])) { $GLOBALS['TSFE']->config['config'] = $GLOBALS['TSFE']->tmpl->setup['config.']; } // override it with the page/type-specific "config." if (is_array($GLOBALS['TSFE']->pSetup['config.'])) { if (TYPO3_VERSION_INTEGER >= 7000000) { $GLOBALS['TSFE']->config['config'] = TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($GLOBALS['TSFE']->config['config'], $GLOBALS['TSFE']->pSetup['config.']); } else { $GLOBALS['TSFE']->config['config'] = t3lib_div::array_merge_recursive_overrule($GLOBALS['TSFE']->config['config'], $GLOBALS['TSFE']->pSetup['config.']); } } // generate basic rootline $GLOBALS['TSFE']->rootLine = array(0 => array('uid' => $row['uid'], 'title' => $row['title'])); if (TYPO3_VERSION_INTEGER >= 6002000) { $this->tv = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_templavoila_pi1'); } else { $this->tv = t3lib_div::makeInstance('tx_templavoila_pi1'); } } $this->counter = 0; foreach ($this->indexCTypes as $value) { $cTypes[] = 'CType="' . $value . '"'; } $this->whereClauseForCType = implode(' OR ', $cTypes); // get all available sys_language_uid records if (TYPO3_VERSION_INTEGER >= 7000000) { $this->sysLanguages = TYPO3\CMS\Backend\Utility\BackendUtility::getSystemLanguages(); } else { $this->sysLanguages = t3lib_BEfunc::getSystemLanguages(); } }
/** * Init function * REMEMBER to feed a $clause which will filter out non-readable pages! * * @param string Part of where query which will filter out non-readable pages. * @return void */ function init($clause = '') { parent::init(' AND deleted=0 ' . $clause, 'sorting'); if (t3lib_extMgm::isLoaded('cms')) { $this->fieldArray = array_merge($this->fieldArray, array('hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'nav_hide')); } $this->table = 'pages'; $this->treeName = 'pages'; }
/** * 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 Parameters from frontend * @param object TSFE object (reference under PHP5) * @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 (t3lib_extMgm::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; } }
/** * @param string $extKey * @return boolean */ protected function dbUpdateNeeded() { if (t3lib_extMgm::isLoaded($this->extension->getExtensionKey()) && !empty($this->installTool)) { $updateNeeded = $this->installTool->checkDBupdates($this->extension->getExtensionKey(), array('type' => 'L', 'files' => array('ext_tables.sql')), 1); if (!empty($updateNeeded['structure']['diff']['extra'])) { return TRUE; } } return FALSE; }
/** * Render the Smarty template and return the result as a string (typically html). * * @param string name of template file (e.g. myTemplate.tpl) or full path to template (e.g. full/path/to/myTemplate.tpl) * @param array Optional array of Smarty configuration variables, for example array('debugging' => true). * @return string typically an (x)html string */ function render($template, $conf = array()) { if (!t3lib_extMgm::isLoaded('smarty')) { return '<p class="warning">smarty is not available.</p>'; } $this->smarty = tx_smarty::smarty($conf); $this->smarty->assign($this->getArrayCopy()); $this->smarty->assign_by_ref('view', $this); return $this->smarty->display($template); }
function init($clause) { if (t3lib_extMgm::isLoaded("cms")) { $this->fieldArray = array_merge($this->fieldArray, array("hidden", "starttime", "endtime", "fe_group", "module", "extendToSubpages")); } $this->backPath = $GLOBALS["BACK_PATH"]; if ($clause) { $this->clause .= " " . $clause; } }
/** * Replaces password with salted hash of passwort * extends tx_srfeuserregister_data->parseOutgoingData * * @param array $dataArray: array with user data to be modified * @param array $origArray * * @return array parsed array */ function parseOutgoingData(&$dataArray, $origArray) { $parsedArray = parent::parseOutgoingData($dataArray, $origArray); if (t3lib_extMgm::isLoaded('saltedpasswords') && tx_saltedpasswords_div::isUsageEnabled()) { $objPHPass = t3lib_div::makeInstance(tx_saltedpasswords_div::getDefaultSaltingHashingMethod()); $updatedPassword = $objPHPass->getHashedPassword($parsedArray['password']); $parsedArray['password'] = $parsedArray['password_again'] = $updatedPassword; } return $parsedArray; }
/** * Loads php files containing classes or interfaces found in the classes directory of * an extension. * * @param string $className: Name of the class/interface to load * @uses t3lib_extMgm::extPath() * @return void */ public static function loadClass($className) { $classNameParts = explode('_', $className, 3); $extensionKey = Tx_Extbase_Utility_Extension::convertCamelCaseToLowerCaseUnderscored($classNameParts[1]); if (t3lib_extMgm::isLoaded($extensionKey)) { $classFilePathAndName = t3lib_extMgm::extPath($extensionKey) . 'Classes/' . strtr($classNameParts[2], '_', '/') . '.php'; if (file_exists($classFilePathAndName)) { require_once $classFilePathAndName; } } }
function handleError($params, tslib_fe $pObj) { // create regular FE environment so we can link, access setup, etc $this->createTSFE(); // get constants/setup $setup = $GLOBALS['TSFE']->tmpl->setup['plugin.']['itypo_404handler.']; // support for itypo_securedfiles if (t3lib_extMgm::isLoaded('itypo_securedfiles') && $params['reasonText'] == 'No permission to access this file') { $throw403 = true; } if (isset($params['pageAccessFailureReasons']['fe_group']) && !isset($params['pageAccessFailureReasons']['hidden']) && current($params['pageAccessFailureReasons']['fe_group']) !== 0 && !is_array($pObj->fe_user->user)) { // redirect to login page, 303 if (is_numeric($setup['loginPage'])) { $loginPage = $this->cObj->getTypoLink_URL(intval($setup['loginPage'])); } else { $loginPage = $setup['loginPage']; } // if the url ends with a /, add a ? for the parameters, this happens when realurl is used for example if (substr($loginPage, -1, 1) == '/') { $loginPage .= '?'; } $url = 'REDIRECT:' . $loginPage . '&redirect_url=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')); } elseif (isset($params['pageAccessFailureReasons']['fe_group']) && !isset($params['pageAccessFailureReasons']['hidden']) && current($params['pageAccessFailureReasons']['fe_group']) !== 0 && is_array($pObj->fe_user->user) || $throw403) { // logged in but no access, 403 $header = 'HTTP/1.0 403 Forbidden'; $forbiddenPage = $this->cObj->getTypoLink_URL(intval($setup['forbiddenPage'])); // if the url ends with a /, add a ? for the parameters, this happens when realurl is used for example if (substr($forbiddenPage, -1, 1) == '/') { $forbiddenPage .= '?'; } $url = $forbiddenPage; if (is_array($pObj->fe_user->user)) { $urlParams = '&tx_itypo404handler[ses_id]=' . $pObj->fe_user->user['ses_id']; $url .= $urlParams; $url .= '&cHash=' . t3lib_div::generateCHash($urlParams); } } else { // item not found, 404 $header = $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_statheader']; $notfoundPage = $this->cObj->getTypoLink_URL(intval($setup['notfoundPage'])); // if the url ends with a /, add a ? for the parameters, this happens when realurl is used for example if (substr($notfoundPage, -1, 1) == '/') { $notfoundPage .= '?'; } $url = $notfoundPage; if (is_array($pObj->fe_user->user)) { $urlParams = '&tx_itypo404handler[ses_id]=' . $pObj->fe_user->user['ses_id']; $url .= $urlParams; $url .= '&cHash=' . t3lib_div::generateCHash($urlParams); } } // output the page $pObj->pageErrorHandler($url, $header, $params['reasonText']); }
/** * Render method * * @return string */ public function render() { $extensionName = $this->arguments['extensionName']; $extensionKey = t3lib_div::camelCaseToLowerCaseUnderscored($extensionName); $isLoaded = t3lib_extMgm::isLoaded($extensionKey); if ($isLoaded !== FALSE) { return $this->renderThenChild(); } else { return $this->renderElseChild(); } }
/** * The main method of the Plugin * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website */ function main($content, $config) { if (!t3lib_extMgm::isLoaded('geshilib')) { return "Geshi library not loaded"; } // get content $this->pi_initPIflexForm(); $config['content.']['lang'] = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'cLang', 'sVIEW'); $config['content.']['code'] = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'cCode', 'sVIEW'); $config['content.']['highlight'] = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'cHighlight', 'sOPTIONS'); $config['content.']['startnumber'] = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'cStartnumber', 'sOPTIONS'); // init geshi library $this->geshi = new GeSHi($config['content.']['code'], $config['content.']['lang']); // defaults $this->geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS); // set highlighted lines if ($config['content.']['highlight'] !== '') { $this->geshi->highlight_lines_extra(split(',', $config['content.']['highlight'])); } // set startnumber if (isset($config['content.']['startnumber'])) { $this->geshi->start_line_numbers_at($config['content.']['startnumber']); } // style if (isset($config['default.'])) { $this->_styleSubjects($config['default.']); } if (isset($config[$config['content.']['lang'] . '.'])) { $this->_styleSubjects($config[$config['content.']['lang'] . '.']); } // external stylesheets if (isset($config['global.']['external']) && $config['global.']['external'] == 0) { // do not use external style sheets } else { // mtness.net modification: I love stylesheets! $this->geshi->enable_classes(); // Echo out the stylesheet for this code block And continue echoing the page $this->geshiCSS = '<style type="text/css"><!--' . $this->geshi->get_stylesheet() . '--></style>'; // additional headerdata to include the styles $GLOBALS['TSFE']->additionalHeaderData['sema_sourcecode:' . $config['content.']['lang']] = $this->geshiCSS; } // xhtml compliance if (isset($config['global.']['xhtmlcompliant']) && $config['global.']['xhtmlcompliant'] == 1) { $this->geshi->force_xhtml_compliance = true; } // check for errors if ($this->geshi->error() !== false) { // log an error, this happens if the language file is missing or non-readable. Other input // specific errors can also occour, eg. if a non-existing container type is set for the engine. $GLOBALS['BE_USER']->simplelog($this->geshi->error(), $extKey = 'sema_sourcecode', 1); } // render return $this->pi_wrapInBaseClass($this->geshi->parse_code()); }
/** * Set DAM as an additional option. Changes are done in $config * * @param array $config configuration of TCA field * @param t3lib_TCEforms $parentObject parent object * @return void */ public function user_MediaType(array &$config, t3lib_TCEforms $parentObject) { // if dam is loaded if (t3lib_extMgm::isLoaded('dam')) { $locallangFile = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xml:'; // additional entry $damEntry = array($GLOBALS['LANG']->sL($locallangFile . 'tx_news_domain_model_media.type.I.3'), '3', t3lib_extMgm::extRelPath('news') . 'Resources/Public/Icons/media_type_dam.gif'); // add entry to type list array_push($config['items'], $damEntry); } }
/** * (non-PHPdoc) * @see PHPUnit_Framework_TestCase::setUp() */ protected function setUp() { if (!t3lib_extMgm::isLoaded('static_info_tables')) { $this->markTestSkipped('static_info_tables nicht installiert'); } // zur Sicherheit die Zip Code Rules einfügen $sqlFilename = t3lib_div::getFileAbsFileName(t3lib_extMgm::extPath('mklib', 'ext_tables_static_update.sql')); if (@is_file($sqlFilename)) { tx_mklib_tests_Util::queryDB($sqlFilename, false, true); //alle statements importieren } }
/** * Adds T3Jquery as Lib * @param string color * @param string delta */ public function render() { // checks if t3jquery is loaded if (t3lib_extMgm::isLoaded('t3jquery')) { require_once t3lib_extMgm::extPath('t3jquery') . 'class.tx_t3jquery.php'; } // if t3jquery is loaded and the custom Library had been created if (T3JQUERY === true) { tx_t3jquery::addJqJS(); } return ''; }
/** * Validates that a specified field's value matches the generated word of the extension "sr_freecap" * * @param array &$check The TypoScript settings for this error check * @param string $name The field name * @param array &$gp The current GET/POST parameters * @return string The error string */ public function check(&$check, $name, &$gp) { $checkFailed = ''; if (t3lib_extMgm::isLoaded('sr_freecap')) { require_once t3lib_extMgm::extPath('sr_freecap') . 'pi2/class.tx_srfreecap_pi2.php'; $this->freeCap = t3lib_div::makeInstance('tx_srfreecap_pi2'); if (!$this->freeCap->checkWord($gp[$name])) { $checkFailed = $this->getCheckFailed($check); } } return $checkFailed; }