/** * Renders <f:then> child if BE user is allowed to edit given table, otherwise renders <f:else> child. * * @param string $table Name of the table * @return string the rendered string * @api */ public function render($table) { if ($GLOBALS['BE_USER']->isAdmin() || t3lib_div::inList($GLOBALS['BE_USER']->groupData['tables_modify'], $table)) { return $this->renderThenChild(); } return $this->renderElseChild(); }
/** * constructor * * @param Tx_CzSimpleCal_Domain_Repository_EventRepository $eventRepository * @param Tx_CzSimpleCal_Domain_Repository_EventIndexRepository $eventIndexRepository * @param Tx_Extbase_Persistence_ManagerInterface $persistenceManager */ public function __construct(Tx_CzSimpleCal_Domain_Repository_EventRepository $eventRepository, Tx_CzSimpleCal_Domain_Repository_EventIndexRepository $eventIndexRepository, Tx_Extbase_Persistence_ManagerInterface $persistenceManager) { t3lib_div::makeInstance('Tx_Extbase_Dispatcher'); $this->eventRepository = $eventRepository; $this->eventIndexRepository = $eventIndexRepository; $this->persistenceManager = $persistenceManager; }
/** * Processing of clickmenu items * * @param object Reference to parent * @param array Menu items array to modify * @param string Table name * @param integer Uid of the record * @return array Menu item array, returned after modification * @todo Skinning for icons... */ function main(&$backRef, $menuItems, $table, $uid) { global $BE_USER, $TCA; $localItems = array(); if ($backRef->cmLevel && t3lib_div::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) { // Show import/export on second level menu OR root level. $LL = $this->includeLL(); $modUrl = $backRef->backPath . t3lib_extMgm::extRelPath('impexp') . 'app/index.php'; $url = $modUrl . '?tx_impexp[action]=export&id=' . ($table == 'pages' ? $uid : $backRef->rec['pid']); if ($table == 'pages') { $url .= '&tx_impexp[pagetree][id]=' . $uid; $url .= '&tx_impexp[pagetree][levels]=0'; $url .= '&tx_impexp[pagetree][tables][]=_ALL'; } else { $url .= '&tx_impexp[record][]=' . rawurlencode($table . ':' . $uid); $url .= '&tx_impexp[external_ref][tables][]=_ALL'; } $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-export-t3d')), $backRef->urlRefForCM($url), 1); if ($table == 'pages') { $url = $modUrl . '?id=' . $uid . '&table=' . $table . '&tx_impexp[action]=import'; $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-import-t3d')), $backRef->urlRefForCM($url), 1); } } return array_merge($menuItems, $localItems); }
/** * This method is called by the Scheduler task that triggers * the autopublication process * It searches for workspaces whose publication date is in the past * and publishes them * * @return void */ public function autoPublishWorkspaces() { global $TYPO3_CONF_VARS; // Temporarily set admin rights // FIXME: once workspaces are cleaned up a better solution should be implemented $currentAdminStatus = $GLOBALS['BE_USER']->user['admin']; $GLOBALS['BE_USER']->user['admin'] = 1; // Select all workspaces that needs to be published / unpublished: $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,swap_modes,publish_time,unpublish_time', 'sys_workspace', 'pid=0 AND ((publish_time!=0 AND publish_time<=' . intval($GLOBALS['EXEC_TIME']) . ') OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<=' . intval($GLOBALS['EXEC_TIME']) . '))' . t3lib_BEfunc::deleteClause('sys_workspace')); $workspaceService = t3lib_div::makeInstance('tx_Workspaces_Service_Workspaces'); foreach ($workspaces as $rec) { // First, clear start/end time so it doesn't get select once again: $fieldArray = $rec['publish_time'] != 0 ? array('publish_time' => 0) : array('unpublish_time' => 0); $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid=' . intval($rec['uid']), $fieldArray); // Get CMD array: $cmd = $workspaceService->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes'] == 1); // $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace. // Execute CMD array: $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; $tce->start(array(), $cmd); $tce->process_cmdmap(); } // Restore admin status $GLOBALS['BE_USER']->user['admin'] = $currentAdminStatus; }
/** * constructor for class Tx_Solr_ViewHelper_Date */ public function __construct(array $arguments = array()) { if (is_null($this->dateFormat) || is_null($this->contentObject)) { $this->dateFormat = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['general.']['dateFormat.']; $this->contentObject = t3lib_div::makeInstance('tslib_cObj'); } }
/** * @test */ public function getResultReturnsAllResults() { $request = t3lib_div::makeInstance('Tx_Solr_IndexQueue_PageIndexerResponse'); $request->addActionResult('action1', 'result1'); $request->addActionResult('action2', 'result2'); $this->assertEquals(array('action1' => 'result1', 'action2' => 'result2'), $request->getActionResult()); }
function _render($conf) { require_once PATH_formidable . "api/class.tx_ameosformidable.php"; $this->oForm = t3lib_div::makeInstance("tx_ameosformidable"); $this->oForm->initFromTs($this, $conf); return $this->oForm->render(); }
/** * Check if the remote IP is the allowed range. * Supports IPv4 and IPv6. * * @param string $strIp remote IP address * @param boolean $bIpv4 If the IP is IPv4 (if not, it's IPv6) * @param string $strRange Defined range. Comma-separated list of IPs. * * supported for parts of the address. * * @return boolean True if the IP is in the range */ protected function isIpInRange($strIp, $bIpv4, $strRange) { if ($bIpv4) { return t3lib_div::cmpIPv4($strIp, $strRange); } return t3lib_div::cmpIPv6($strIp, $strRange); }
/** * Rendering the "clickenlarge" custom attribute, called from TypoScript * * @param string Content input. Not used, ignore. * @param array TypoScript configuration * @return string HTML output. * @access private */ function render_clickenlarge($content, $conf) { $clickenlarge = isset($this->cObj->parameters['clickenlarge']) ? $this->cObj->parameters['clickenlarge'] : 0; $path = $this->cObj->parameters['src']; $pathPre = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicC_'; if (t3lib_div::isFirstPartOfStr($path, $pathPre)) { // Find original file: $pI = pathinfo(substr($path, strlen($pathPre))); $filename = substr($pI['basename'], 0, -strlen('.' . $pI['extension'])); $file = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicP_' . $filename; } else { $file = $this->cObj->parameters['src']; } unset($this->cObj->parameters['clickenlarge']); unset($this->cObj->parameters['allParams']); $content = '<img ' . t3lib_div::implodeAttributes($this->cObj->parameters, TRUE, TRUE) . ' />'; if ($clickenlarge && is_array($conf['imageLinkWrap.'])) { $theImage = $file ? $GLOBALS['TSFE']->tmpl->getFileName($file) : ''; if ($theImage) { $this->cObj->parameters['origFile'] = $theImage; if ($this->cObj->parameters['title']) { $conf['imageLinkWrap.']['title'] = $this->cObj->parameters['title']; } if ($this->cObj->parameters['alt']) { $conf['imageLinkWrap.']['alt'] = $this->cObj->parameters['alt']; } $content = $this->cObj->imageLinkWrap($content, $theImage, $conf['imageLinkWrap.']); $content = $this->cObj->stdWrap($content, $conf['stdWrap.']); } } return $content; }
public function getAllowedActions($config) { $pid = $config['row']['pid']; $tsConfig = t3lib_befunc::getPagesTSconfig($pid); $flexConfig =& $tsConfig['options.']['cz_simple_cal_pi1.']['flexform.']; if (empty($flexConfig) || !isset($flexConfig['allowedActions.'])) { return; } $allowedActions = array(); if (isset($flexConfig['allowedActions'])) { $enabled = array(); foreach (t3lib_div::trimExplode(',', $flexConfig['allowedActions'], true) as $i) { $enabled[$i . '.'] = ''; } $allowedActions = array_intersect_key($flexConfig['allowedActions.'], $enabled); } else { $allowedActions = $flexConfig['allowedActions.']; } foreach ($allowedActions as $name => $action) { $name = rtrim($name, '.'); $label = $GLOBALS['LANG']->sL($action['label']); if (empty($label)) { $label = $name; } $config['items'][$name] = array($label, $name); } }
/** * Logs the given values. * * @return void */ public function process() { //set params $table = "tx_formhandler_log"; $fields['ip'] = t3lib_div::getIndpEnv('REMOTE_ADDR'); if (isset($this->settings['disableIPlog']) && intval($this->settings['disableIPlog']) == 1) { $fields['ip'] = NULL; } $fields['tstamp'] = time(); $fields['crdate'] = time(); $fields['pid'] = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'pid'); if (!$fields['pid']) { $fields['pid'] = $GLOBALS['TSFE']->id; } ksort($this->gp); $keys = array_keys($this->gp); $serialized = serialize($this->gp); $hash = md5(serialize($keys)); $fields['params'] = $serialized; $fields['key_hash'] = $hash; if (intval($this->settings['markAsSpam']) == 1) { $fields['is_spam'] = 1; } //query the database $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $fields); $insertedUID = $GLOBALS['TYPO3_DB']->sql_insert_id(); $sessionValues = array('inserted_uid' => $insertedUID, 'inserted_tstamp' => $fields['tstamp'], 'key_hash' => $hash); Tx_Formhandler_Globals::$session->setMultiple($sessionValues); if (!$this->settings['nodebug']) { Tx_Formhandler_StaticFuncs::debugMessage('logging', array($table, implode(',', $fields))); if (strlen($GLOBALS['TYPO3_DB']->sql_error()) > 0) { Tx_Formhandler_StaticFuncs::debugMessage('error', array($GLOBALS['TYPO3_DB']->sql_error()), 3); } } }
/** * Render the facebook like viewhelper * * @return string */ public function render() { $code = ''; $url = !empty($this->arguments['href']) ? $this->arguments['href'] : t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'); // absolute urls are needed $this->tag->addAttribute('href', Tx_News_Utility_Url::prependDomain($url)); $this->tag->forceClosingTag(TRUE); // -1 means no JS if ($this->arguments['javaScript'] != '-1') { if (empty($this->arguments['javaScript'])) { $tsSettings = $this->pluginSettingsService->getSettings(); $locale = !empty($tsSettings['facebookLocale']) ? $tsSettings['facebookLocale'] : 'en_US'; $code = '<script src="http://connect.facebook.net/' . $locale . '/all.js#xfbml=1"></script>'; // Social interaction Google Analytics if ($this->pluginSettingsService->getByPath('analytics.social.facebookLike') == 1) { $code .= t3lib_div::wrapJS("\n\t\t\t\t\t\tFB.Event.subscribe('edge.create', function(targetUrl) {\n\t\t\t\t\t\t \t_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tFB.Event.subscribe('edge.remove', function(targetUrl) {\n\t\t\t\t\t\t _gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]);\n\t\t\t\t\t\t});\n\t\t\t\t\t"); } } else { $code = '<script src="' . htmlspecialchars($this->arguments['javaScript']) . '"></script>'; } } // seems as if a div with id fb-root is needed this is just a dirty // workaround to make things work again Perhaps we should // use the iframe variation. $code .= '<div id="fb-root"></div>' . $this->tag->render(); return $code; }
public static function getDevMode() { if (self::$devMode === null) { self::$devMode = t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']); } return self::$devMode; }
/** * Initializes the identifier prefix when setting the cache. * * @param t3lib_cache_frontend_Frontend $cache The frontend for this backend * @return void * @author Robert Lemke <*****@*****.**> */ public function setCache(t3lib_cache_frontend_Frontend $cache) { parent::setCache($cache); $processUser = extension_loaded('posix') ? posix_getpwuid(posix_geteuid()) : array('name' => 'default'); $pathHash = t3lib_div::shortMD5(PATH_site . $processUser['name'], 12); $this->identifierPrefix = 'TYPO3_' . $pathHash; }
/** * This test creates an extension based on a JSON file, generated * with version 1.0 of the ExtensionBuilder and compares all * generated files with the originally created ones * This test should help, to find compatibility breaking changes * * @test */ function generateExtensionFromVersion1Configuration() { $this->configurationManager = $this->getMock($this->buildAccessibleProxy('Tx_ExtensionBuilder_Configuration_ConfigurationManager'), array('dummy')); $this->extensionSchemaBuilder = $this->objectManager->get('Tx_ExtensionBuilder_Service_ExtensionSchemaBuilder'); $testExtensionDir = PATH_typo3conf . 'ext/extension_builder/Tests/Examples/TestExtensions/test_extension_v1/'; $jsonFile = $testExtensionDir . Tx_ExtensionBuilder_Configuration_ConfigurationManager::EXTENSION_BUILDER_SETTINGS_FILE; if (file_exists($jsonFile)) { // compatibility adaptions for configurations from older versions $extensionConfigurationJSON = json_decode(file_get_contents($jsonFile), TRUE); $extensionConfigurationJSON = $this->configurationManager->fixExtensionBuilderJSON($extensionConfigurationJSON); } else { $this->fail('JSON file not found'); } $this->extension = $this->extensionSchemaBuilder->build($extensionConfigurationJSON); $this->codeGenerator->setSettings(array('codeTemplateRootPath' => PATH_typo3conf . 'ext/extension_builder/Resources/Private/CodeTemplates/Extbase/', 'extConf' => array('enableRoundtrip' => '0'))); $newExtensionDir = vfsStream::url('testDir') . '/'; $this->extension->setExtensionDir($newExtensionDir . 'test_extension/'); $this->codeGenerator->build($this->extension); $referenceFiles = t3lib_div::getAllFilesAndFoldersInPath(array(), $testExtensionDir); foreach ($referenceFiles as $referenceFile) { $createdFile = str_replace($testExtensionDir, $this->extension->getExtensionDir(), $referenceFile); if (!in_array(basename($createdFile), array('ExtensionBuilder.json'))) { // json file is generated by controller $referenceFileContent = str_replace(array('2011-08-11', '###YEAR###'), array(date('Y-m-d'), date('Y')), file_get_contents($referenceFile)); //t3lib_div::writeFile(PATH_site.'fileadmin/'.basename($createdFile), file_get_contents($createdFile)); $this->assertFileExists($createdFile, 'File ' . $createdFile . ' was not created!'); $this->assertEquals(t3lib_div::trimExplode("\n", $referenceFileContent, TRUE), t3lib_div::trimExplode("\n", file_get_contents($createdFile), TRUE), 'File ' . $createdFile . ' was not equal to original file.'); } } }
/** * MAIN function for page information display (including hit statistics) * * @return string Output HTML for the module. */ function main() { global $BACK_PATH, $LANG, $SOBE; $dblist = t3lib_div::makeInstance('tx_cms_layout'); $dblist->descrTable = '_MOD_' . $GLOBALS['MCONF']['name']; $dblist->backPath = $BACK_PATH; $dblist->thumbs = 0; $dblist->script = 'index.php'; $dblist->showIcon = 0; $dblist->setLMargin = 0; $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'); $dblist->pI_showUser = 1; $dblist->pI_showStat = 0; // PAGES: $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth']; // ONLY for the sake of dblist module which uses this value. $h_func = t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth'], 'index.php'); if ($this->pObj->MOD_SETTINGS['function'] == 'tx_cms_webinfo_hits') { $h_func .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[stat_type]', $this->pObj->MOD_SETTINGS['stat_type'], $this->pObj->MOD_MENU['stat_type'], 'index.php'); if ($this->pObj->MOD_SETTINGS['stat_type'] == 1) { $dblist->stat_select_field = 'rl0'; } if ($this->pObj->MOD_SETTINGS['stat_type'] == 2) { $dblist->stat_select_field = 'rl1'; } // Timespan for ($a = 0; $a < 30; $a++) { $dblist->stat_codes[] = 'HITS_days:' . -$a; } $timespan_b = mktime(0, 0, 0); $timespan_e = mktime(0, 0, 0) - (30 - 1) * 3600 * 24 + 1; $header = '<br />' . sprintf($LANG->getLL('stat_period'), t3lib_BEfunc::date($timespan_b), t3lib_BEfunc::date($timespan_e)) . '<br />'; // $dblist->start($this->pObj->id, 'pages', 0); $dblist->pages_noEditColumns = 1; $dblist->generateList(); $theOutput .= $this->pObj->doc->section($LANG->getLL('hits_title'), t3lib_BEfunc::cshItem($dblist->descrTable, 'stat', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $header . $dblist->HTMLcode, 0, 1); } else { $h_func .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages'], 'index.php'); $dblist->start($this->pObj->id, 'pages', 0); $dblist->generateList(); // CSH $theOutput .= $this->pObj->doc->section($LANG->getLL('page_title'), t3lib_BEfunc::cshItem($dblist->descrTable, 'pagetree_overview', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $dblist->HTMLcode, 0, 1); // SYS_NOTES: if (t3lib_extMgm::isLoaded('sys_note')) { $dblist->start($this->pObj->id, 'sys_note', 0); $dblist->generateList(); if ($dblist->HTMLcode) { $theOutput .= $this->pObj->doc->spacer(10); $theOutput .= $this->pObj->doc->section($LANG->getLL('page_sysnote'), $dblist->HTMLcode, 0, 1); } } // PAGE INFORMATION if ($this->pObj->pageinfo['uid']) { $theOutput .= $this->pObj->doc->spacer(10); $theOutput .= $this->pObj->doc->section($LANG->getLL('pageInformation'), $dblist->getPageInfoBox($this->pObj->pageinfo, $this->pObj->CALC_PERMS & 2), 0, 1); } } return $theOutput; }
/** * clear cart * * @return void */ public function user_wtcart_clearCart($content = '', $conf = array()) { $div = t3lib_div::makeInstance('tx_wtcart_div'); // Create new instance for div functions $div->removeAllProductsFromSession(); // clear cart now }
/** * Renders the form in the kickstarter * * @return string wizard */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], ' ', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; // Enter title of the static extension template $subContent = '<strong>Enter a title for the static extension template:</strong><br />' . $this->renderStringBox($ffPrefix . '[title]', $piConf['title']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Enter constants $subContent = '<strong>Constants:</strong><br />' . $this->renderTextareaBox($ffPrefix . '[constants]', $piConf['constants']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Enter setup $subContent = '<strong>Setup:</strong><br />' . $this->renderTextareaBox($ffPrefix . '[setup]', $piConf['setup']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_ts'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_ts'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; }
/** * Main function * * @return void */ function main() { switch ((string) t3lib_div::_GET('cmd')) { case 'menuitem': echo ' <img src="gfx/x_t3logo.png" width="61" height="16" hspace="3" alt="" />'; $menuItems = array(array('title' => 'About TYPO3', 'xurl' => 'http://typo3.com/', 'subitems' => array(array('title' => 'License', 'xurl' => 'http://typo3.com/License.1625.0.html'), array('title' => 'Support', 'subitems' => array(array('title' => 'Mailing lists', 'xurl' => 'http://lists.netfielders.de/cgi-bin/mailman/listinfo'), array('title' => 'Documentation', 'xurl' => 'http://typo3.org/documentation/'), array('title' => 'Find consultancy', 'xurl' => 'http://typo3.com/Consultancies.1248.0.html'))), array('title' => 'Contribute', 'xurl' => 'http://typo3.org/community/participate/'), array('title' => 'Donate', 'xurl' => 'http://typo3.com/Donations.1261.0.html', 'icon' => '1'))), array('title' => 'Extensions', 'url' => 'mod/tools/em/index.php'), array('title' => 'Menu preferences and such things', 'onclick' => 'alert("A dialog is now shown which will allow user configuration of items in the menu");event.stopPropagation();', 'state' => 'checked'), array('title' => '--div--'), array('title' => 'Recent Items', 'id' => $this->id . '_recent', 'subitems' => array(), 'html' => $this->menuItemObject($this->id . '_recent', ' fetched: false, onActivate: function() { // if (!this.fetched) { //Element.update("' . $this->id . '_recent-layer","asdfasdf"); getElementContent("' . $this->id . '_recent-layer", 0, "logomenu.php?cmd=recent") this.fetched = true; // } } ')), array('title' => '--div--'), array('title' => 'View frontend', 'xurl' => t3lib_div::getIndpEnv('TYPO3_SITE_URL')), array('title' => 'Log out', 'onclick' => "top.document.location='logout.php';")); echo $this->menuLayer($menuItems); break; case 'recent': $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_log.*, MAX(sys_log.tstamp) AS tstamp_MAX', 'sys_log,pages', 'pages.uid=sys_log.event_pid AND sys_log.userid=' . intval($GLOBALS['BE_USER']->user['uid']) . ' AND sys_log.event_pid>0 AND sys_log.type=1 AND sys_log.action=2 AND sys_log.error=0', 'tablename,recuid', 'tstamp_MAX DESC', 20); $items = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $elRow = t3lib_BEfunc::getRecord($row['tablename'], $row['recuid']); if (is_array($elRow)) { $items[] = array('title' => t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($row['tablename'], $elRow), $GLOBALS['BE_USER']->uc['titleLen']) . ' - ' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $row['tstamp_MAX']), 'icon' => array(t3lib_iconworks::getIcon($row['tablename'], $elRow), 'width="18" height="16"'), 'onclick' => 'content.' . t3lib_BEfunc::editOnClick('&edit[' . $row['tablename'] . '][' . $row['recuid'] . ']=edit', '', 'dummy.php')); } } echo $this->menuItems($items); break; } }
/** * Compiles a collection of schema version checks against each configured * Solr server. Only adds an entry if a schema other than the * recommended one was found. * * @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus() */ public function getStatus() { $reports = array(); $solrConnections = t3lib_div::makeInstance('tx_solr_ConnectionManager')->getAllConnections(); foreach ($solrConnections as $solrConnection) { if ($solrConnection->ping() && $solrConnection->getSchemaName() != self::RECOMMENDED_SCHEMA_VERSION) { $message = '<p style="margin-bottom: 10px;">A schema different from the one provided with the extension was detected.</p> <p style="margin-bottom: 10px;">It is recommended to use the schema.xml file shipping with the Apache Solr for TYPO3 extension as it provides an optimized field setup for the use of Solr with TYPO3. A difference can occur when you update the TYPO3 extension, but forget to update the schema.xml file on the Solr server. The schema sometimes changes to accommodate changes or new features in Apache Solr. Also make sure to restart the Tomcat server after updating the schema.xml file.</p> <p style="margin-bottom: 10px;">Your Solr server is currently using a schema named <strong>' . $solrConnection->getSchemaName() . '</strong>, the recommended schema is called <strong>' . self::RECOMMENDED_SCHEMA_VERSION . '</strong>. You can find the recommended schema.xml file in the extension\'s resources folder: EXT:solr/resources/solr/schema.xml. While you\'re at it, please check whether you\'re using the current solrconfig.xml file, too.</p>'; $message .= '<p>Affected Solr server:</p> <ul>' . '<li>Host: ' . $solrConnection->getHost() . '</li>' . '<li>Port: ' . $solrConnection->getPort() . '</li>' . '<li>Path: ' . $solrConnection->getPath() . '</li> </ul>'; $status = t3lib_div::makeInstance('tx_reports_reports_status_Status', 'Schema Version', 'Unsupported Schema', $message, tx_reports_reports_status_Status::WARNING); $reports[] = $status; } } return $reports; }
/** * Error handling if no news entry is found * * @param string $configuration configuration what will be done * @throws InvalidArgumentException * @return void */ protected function handleNoNewsFoundError($configuration) { if (empty($configuration)) { return; } $configuration = t3lib_div::trimExplode(',', $configuration, TRUE); switch ($configuration[0]) { case 'redirectToListView': $this->redirect('list'); break; case 'redirectToPage': if (count($configuration) === 1 || count($configuration) > 3) { $msg = sprintf('If error handling "%s" is used, either 2 or 3 arguments, splitted by "," must be used', $configuration[0]); throw new InvalidArgumentException($msg); } /** @var $cObj tslib_cObj */ $cObj = t3lib_div::makeInstance('tslib_cObj'); $url = $cObj->typoLink_URL(array('parameter' => $configuration[1])); if (isset($configuration[2])) { $header = 'HTTP_STATUS_' . $configuration[2]; t3lib_utility_Http::redirect($url, $header); } else { t3lib_utility_Http::redirect($url); } break; case 'pageNotFoundHandler': $GLOBALS['TSFE']->pageNotFoundAndExit('No news entry found.'); break; default: // Do nothing, it might be handled in the view. } }
/** * The main method of the PlugIn * * @access public * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * * @return string The content that is displayed on the website */ public function main($content, $conf) { $this->init($conf); // Quit without doing anything if required variable is not set. if (empty($this->piVars['id'])) { return $content; } // Load template file. if (!empty($this->conf['templateFile'])) { $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); } else { $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/template.tmpl'), '###TEMPLATE###'); } // Build data array. $data = array('conf' => $this->conf, 'piVars' => $this->piVars); // Get template subpart for tools. $subpart = $this->cObj->getSubpart($this->template, '###TOOLS###'); $tools = explode(',', $this->conf['tools']); // Add the tools to the toolbox. foreach ($tools as $tool) { $tool = trim($tool); $cObj = t3lib_div::makeInstance('tslib_cObj'); $cObj->data = $data; $content .= $this->cObj->substituteMarkerArray($subpart, array('###TOOL###' => $cObj->cObjGetSingle($GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool], $GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool . '.']))); } return $this->pi_wrapInBaseClass($this->cObj->substituteSubpart($this->template, '###TOOLS###', $content, TRUE)); }
/** * Generates and prints out a organizers list. * * @return string the HTML source code to display */ public function show() { $content = ''; $pageData = $this->page->getPageData(); $this->template->setMarker('new_record_button', $this->getNewIcon($pageData['uid'])); $this->template->setMarker('label_full_name', $GLOBALS['LANG']->getLL('organizerlist.title')); /** @var tx_seminars_BagBuilder_Organizer $builder */ $builder = t3lib_div::makeInstance('tx_seminars_BagBuilder_Organizer'); $builder->setSourcePages($pageData['uid'], self::RECURSION_DEPTH); $organizerBag = $builder->build(); $tableRows = ''; /** @var tx_seminars_OldModel_Organizer $organizerBag */ foreach ($organizerBag as $this->organizer) { $this->template->setMarker('icon', $this->organizer->getRecordIcon()); $this->template->setMarker('full_name', htmlspecialchars($this->organizer->getTitle())); $this->template->setMarker('edit_button', $this->getEditIcon($this->organizer->getUid(), $this->organizer->getPageUid())); $this->template->setMarker('delete_button', $this->getDeleteIcon($this->organizer->getUid(), $this->organizer->getPageUid())); $tableRows .= $this->template->getSubpart('ORGANIZER_ROW'); } $this->template->setSubpart('ORGANIZER_ROW', $tableRows); $this->template->setMarker('label_print_button', $GLOBALS['LANG']->getLL('print')); $content .= $this->template->getSubpart('SEMINARS_ORGANIZER_LIST'); $content .= $organizerBag->checkConfiguration(); return $content; }
/** * Creates a new public/private key pair using PHP OpenSSL extension. * * @return tx_rsaauth_keypair A new key pair or null in case of error * @see tx_rsaauth_abstract_backend::createNewKeyPair() */ public function createNewKeyPair() { $result = null; $privateKey = @openssl_pkey_new(); if ($privateKey) { // Create private key as string $privateKeyStr = ''; openssl_pkey_export($privateKey, $privateKeyStr); // Prepare public key information $exportedData = ''; $csr = openssl_csr_new(array(), $privateKey); openssl_csr_export($csr, $exportedData, false); // Get public key (in fact modulus) and exponent $publicKey = $this->extractPublicKeyModulus($exportedData); $exponent = $this->extractExponent($exportedData); // Create result object $result = t3lib_div::makeInstance('tx_rsaauth_keypair'); /* @var $result tx_rsaauth_keypair */ $result->setExponent($exponent); $result->setPrivateKey($privateKeyStr); $result->setPublicKey($publicKey); // Clean up all resources openssl_free_key($privateKey); } return $result; }
/** * Function executed from the Scheduler. * * @return void */ public function execute() { $_SERVER['argv'] = array($_SERVER['argv'][0], '0', '-o', $this->mode); /* @var $crawlerObj tx_crawler_lib */ $crawlerObj = t3lib_div::makeInstance('tx_crawler_lib'); return $crawlerObj->CLI_main_flush(); }
/** * get all content elements containing a t3s_content-Plugin * * @return array Array containing tt_content records */ public function getTtContentRecordsWithT3sPlugin() { $targetPid = intval($this->indexerConfig['targetpid']); if ($targetPid) { $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tt_content', '1=1' . ' AND pid=' . $targetPid . ' AND CType="list"' . ' AND list_type="t3s_content_pi1"' . ' AND hidden=0 AND deleted=0', '', '', '', 'uid'); if ($rows) { foreach ($rows as $key => $row) { if (TYPO3_VERSION_INTEGER >= 7000000) { $xml = TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($row['pi_flexform']); } else { $xml = t3lib_div::xml2array($row['pi_flexform']); } $config = $xml['data']['general']['lDEF']; $ttContentUids[] = $config['contentElements']['vDEF']; } $ttContentUids = implode(',', $ttContentUids); if (TYPO3_VERSION_INTEGER >= 7000000) { $ttContentUids = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($ttContentUids); } else { $ttContentUids = t3lib_div::uniqueList($ttContentUids); } $ttContentRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tt_content', ' uid IN (' . $ttContentUids . ')', '', '', '', 'uid'); if ($ttContentRecords) { return $ttContentRecords; } } } return array(); }
/** * Obtains a storage. This function will return a non-abstract class, which * is derieved from the tx_rsaauth_abstract_storage. Applications should * not use anoy methods that are not declared in the tx_rsaauth_abstract_storage. * * @return tx_rsaauth_abstract_storage A storage */ public static function getStorage() { if (is_null(self::$storageInstance)) { self::$storageInstance = t3lib_div::getUserObj(self::$preferredStorage); } return self::$storageInstance; }
/** * Sets up this testcase * * @return void * @author Ingo Renner <*****@*****.**> */ public function setUp() { $this->testingCacheTable = 'test_cache_dbbackend'; $this->testingTagsTable = 'test_cache_dbbackend_tags'; $GLOBALS['TYPO3_DB']->sql_query('CREATE TABLE ' . $this->testingCacheTable . ' ( id int(11) unsigned NOT NULL auto_increment, identifier varchar(128) DEFAULT \'\' NOT NULL, crdate int(11) unsigned DEFAULT \'0\' NOT NULL, content mediumtext, lifetime int(11) unsigned DEFAULT \'0\' NOT NULL, PRIMARY KEY (id), KEY cache_id (identifier) ) ENGINE=InnoDB; '); $GLOBALS['TYPO3_DB']->sql_query('CREATE TABLE ' . $this->testingTagsTable . ' ( id int(11) unsigned NOT NULL auto_increment, identifier varchar(128) DEFAULT \'\' NOT NULL, tag varchar(128) DEFAULT \'\' NOT NULL, PRIMARY KEY (id), KEY cache_id (identifier), KEY cache_tag (tag) ) ENGINE=InnoDB; '); $this->backend = t3lib_div::makeInstance('t3lib_cache_backend_DbBackend', array('cacheTable' => $this->testingCacheTable, 'tagsTable' => $this->testingTagsTable)); }
public function __construct(Tx_Formhandler_Component_Manager $componentManager, Tx_Formhandler_Configuration $configuration) { parent::__construct($componentManager, $configuration); require_once t3lib_extMgm::extPath('formhandler') . 'Resources/PHP/class.formhandler_htmlmail.php'; $this->emailObj = t3lib_div::makeInstance('formhandler_htmlmail'); $this->emailObj->start(); }
/** * Should generate a universally unique identifier (UUID) according to RFC 4122. * * @return string The UUID */ public static function generateUUID() { // FIXME: The algorithm used here, might not be completely random. (borrowed from the TYPO3 FLOW Project) // return uniqid(php_uname('n')); $hex = bin2hex(t3lib_div::generateRandomBytes(16)); return strtolower(substr($hex, 0, 8) . '-' . substr($hex, 8, 4) . '-' . substr($hex, 12, 4) . '-' . substr($hex, 16, 4) . '-' . substr($hex, 20, 12)); }