/** * Constructor */ public function __construct() { // we check for existance of our targetDirectory if (!is_dir(PATH_site . $this->targetDirectory)) { t3lib_div::mkdir(PATH_site . $this->targetDirectory); } // if enabled, we check whether we should auto-create the .htaccess file if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['generateApacheHtaccess']) { // check whether .htaccess exists $htaccessPath = PATH_site . $this->targetDirectory . '.htaccess'; if (!file_exists($htaccessPath)) { t3lib_div::writeFile($htaccessPath, $this->htaccessTemplate); } } // decide whether we should create gzipped versions or not $compressionLevel = $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['compressionLevel']; // we need zlib for gzencode() if (extension_loaded('zlib') && $compressionLevel) { $this->createGzipped = TRUE; // $compressionLevel can also be TRUE if (t3lib_div::testInt($compressionLevel)) { $this->gzipCompressionLevel = intval($compressionLevel); } } }
/** * Adds a key to the storage or removes existing key * * @param string $key The key * @return void * @see tx_rsaauth_abstract_storage::put() */ public function put($key) { if ($key == null) { // Remove existing key list($keyId) = $_SESSION['tx_rsaauth_key']; if (t3lib_div::testInt($keyId)) { $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_rsaauth_keys', 'uid=' . $keyId); unset($_SESSION['tx_rsaauth_key']); } } else { // Add key // Get split point. First part is always smaller than the second // because it goes to the file system $keyLength = strlen($key); $splitPoint = rand(intval($keyLength / 10), intval($keyLength / 2)); // Get key parts $keyPart1 = substr($key, 0, $splitPoint); $keyPart2 = substr($key, $splitPoint); // Store part of the key in the database // // Notice: we may not use TCEmain below to insert key part into the // table because TCEmain requires a valid BE user! $time = $GLOBALS['EXEC_TIME']; $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_rsaauth_keys', array('pid' => 0, 'crdate' => $time, 'key_value' => $keyPart2)); $keyId = $GLOBALS['TYPO3_DB']->sql_insert_id(); // Store another part in session $_SESSION['tx_rsaauth_key'] = array($keyId, $keyPart1); } // Remove expired keys (more than 30 minutes old) $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_rsaauth_keys', 'crdate<' . ($GLOBALS['EXEC_TIME'] - 30 * 60)); }
/** * Tests if the input can be interpreted as integer. * @return boolean */ public static function testInt($var) { if (tx_rnbase_util_TYPO3::isTYPO46OrHigher()) { return t3lib_utility_Math::canBeInterpretedAsInteger($var); } else { return t3lib_div::testInt($var); } }
/** * Wrapper for t3lib_div::testInt and \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($var) * @param mixed $var * @return boolean */ public static function isInteger($var) { if (tx_rnbase_util_TYPO3::isTYPO62OrHigher()) { $isInteger = \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($var); } elseif (tx_rnbase_util_TYPO3::isTYPO46OrHigher()) { $isInteger = t3lib_utility_Math::canBeInterpretedAsInteger($var); } else { $isInteger = t3lib_div::testInt($var); } return $isInteger; }
public static function testInt($var) { $result = FALSE; $callingClassName = '\\TYPO3\\CMS\\Core\\Utility\\MathUtility'; if (class_exists($callingClassName) && method_exists($callingClassName, 'canBeInterpretedAsInteger')) { $result = call_user_func($callingClassName . '::canBeInterpretedAsInteger', $var); } else { if (class_exists('t3lib_utility_Math') && method_exists('t3lib_utility_Math', 'canBeInterpretedAsInteger')) { $result = t3lib_utility_Math::canBeInterpretedAsInteger($var); } else { if (class_exists('t3lib_div') && method_exists('t3lib_div', 'testInt')) { $result = t3lib_div::testInt($var); } } } return $result; }
/** * Constructor */ public function __construct() { // we check for existance of our targetDirectory if (!is_dir(PATH_site . $this->targetDirectory)) { t3lib_div::mkdir(PATH_site . $this->targetDirectory); } // decide whether we should create gzipped versions or not $compressionLevel = $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['compressionLevel']; // we need zlib for gzencode() if (extension_loaded('zlib') && $compressionLevel) { $this->createGzipped = TRUE; // $compressionLevel can also be TRUE if (t3lib_div::testInt($compressionLevel)) { $this->gzipCompressionLevel = $compressionLevel; } } }
/** * Transformation handler: 'txdam_media' / direction: "rte" * Processing linked images from database content going into the RTE. * Processing includes converting the src attribute to an absolute URL. * * @param string Content input * @return string Content output */ function transform_rte($value, &$pObj) { // Split content by the TYPO3 pseudo tag "<media>": $blockSplit = $pObj->splitIntoBlock('media', $value, 1); foreach ($blockSplit as $k => $v) { $error = ''; if ($k % 2) { // block: $tagCode = t3lib_div::unQuoteFilenames(trim(substr($pObj->getFirstTag($v), 0, -1)), true); $link_param = $tagCode[1]; $href = ''; $useDAMColumn = FALSE; // Checking if the id-parameter is int and get meta data if (t3lib_div::testInt($link_param)) { $meta = tx_dam::meta_getDataByUid($link_param); } if (is_array($meta)) { $href = tx_dam::file_url($meta); if (!$tagCode[4]) { require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php'; $displayItems = ''; if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $pObj->thisConfig['buttons.']['link.']['media.']['properties.']['title.']['useDAMColumn']) { $displayItems = $pObj->thisConfig['buttons.']['link.']['media.']['properties.']['title.']['useDAMColumn.']['displayItems'] ? $pObj->thisConfig['buttons.']['link.']['media.']['properties.']['title.']['useDAMColumn.']['displayItems'] : ''; $useDAMColumn = TRUE; } $tagCode[4] = tx_dam_guiFunc::meta_compileHoverText($meta, $displayItems, ', '); } } else { $href = $link_param; $error = 'No media file found: ' . $link_param; } // Setting the A-tag: $bTag = '<a href="' . htmlspecialchars($href) . '" txdam="' . htmlspecialchars($link_param) . '"' . ($tagCode[2] && $tagCode[2] != '-' ? ' target="' . htmlspecialchars($tagCode[2]) . '"' : '') . ($tagCode[3] && $tagCode[3] != '-' ? ' class="' . htmlspecialchars($tagCode[3]) . '"' : '') . ($tagCode[4] ? ' title="' . htmlspecialchars($tagCode[4]) . '"' : '') . ($useDAMColumn ? ' usedamcolumn="true"' : '') . ($error ? ' rteerror="' . htmlspecialchars($error) . '" style="background-color: yellow; border:2px red solid; color: black;"' : '') . '>'; $eTag = '</a>'; $blockSplit[$k] = $bTag . $this->transform_rte($pObj->removeFirstAndLastTag($blockSplit[$k]), $pObj) . $eTag; } } $value = implode('', $blockSplit); return $value; }
/** * Processes page and content changes in regard to RealURL caches. * * @param string $status * @param string $tableName * @param int $recordId * @param array $databaseData * @return void * @todo Handle changes to tx_realurl_exclude recursively */ protected function processContentUpdates($status, $tableName, $recordId, array $databaseData) { if ($status == 'update' && t3lib_div::testInt($recordId)) { list($pageId, $languageId) = $this->getPageData($tableName, $recordId); $this->fetchRealURLConfiguration($pageId); if ($this->shouldFixCaches($tableName, $databaseData)) { if (isset($databaseData['alias'])) { $this->expirePathCacheForAllLanguages($pageId); } else { $this->expirePathCache($pageId, $languageId); } $this->clearOtherCaches($pageId); } } }
/** * Checks, if we're looking from the "other" side, the symmetric side, to a symmetric relation. * * @param string $parentUid: The uid of the parent record * @param array $parentConf: The TCA configuration of the parent field embedding the child records * @param array $childRec: The record row of the child record * @return boolean Returns true if looking from the symmetric ("other") side to the relation. */ function isOnSymmetricSide($parentUid, $parentConf, $childRec) { return t3lib_div::testInt($childRec['uid']) && $parentConf['symmetric_field'] && $parentUid == $childRec[$parentConf['symmetric_field']] ? true : false; }
/** * Convert a page path to an ID. * * @param array Array of segments from virtual path * @return integer Page ID * @see decodeSpURL_idFromPath() */ function pagePathtoID(&$pathParts) { // Init: $GET_VARS = ''; // If pagePath cache is not disabled, look for entry: if (!$this->conf['disablePathCache']) { if (!isset($this->conf['firstHitPathCache'])) { $this->conf['firstHitPathCache'] = ((!isset($this->pObj->extConf['postVarSets']) || count($this->pObj->extConf['postVarSets']) == 0) && (!isset($this->pObj->extConf['fixedPostVars']) || count($this->pObj->extConf['fixedPostVars']) == 0)); } // Work from outside-in to look up path in cache: $postVar = false; $copy_pathParts = $pathParts; $charset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] : $GLOBALS['TSFE']->defaultCharSet; foreach ($copy_pathParts as $key => $value) { $copy_pathParts[$key] = $GLOBALS['TSFE']->csConvObj->conv_case($charset, $value, 'toLower'); } while (count($copy_pathParts)) { // Using pathq1 index! $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_realurl_pathcache.*', 'tx_realurl_pathcache,pages', 'tx_realurl_pathcache.page_id=pages.uid AND pages.deleted=0' . ' AND rootpage_id=' . intval($this->conf['rootpage_id']) . ' AND pagepath=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(implode('/', $copy_pathParts), 'tx_realurl_pathcache'), '', 'expire', '1'); // This lookup does not include language and MP var since those are supposed to be fully reflected in the built url! if (false !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))) { break; } $GLOBALS['TYPO3_DB']->sql_free_result($result); if ($this->conf['firstHitPathCache']) { break; } // If no row was found, we simply pop off one element of the path and try again until there are no more elements in the array - which means we didn't find a match! $postVar = array_pop($copy_pathParts); } } else { $row = false; } // It could be that entry point to a page but it is not in the cache. If we popped // any items from path parts, we need to check if they are defined as postSetVars or // fixedPostVars on this page. This does not guarantie 100% success. For example, // if path to page is /hello/world/how/are/you and hello/world found in cache and // there is a postVar 'how' on this page, the check below will not work. But it is still // better than nothing. if ($row && $postVar) { $postVars = $this->pObj->getPostVarSetConfig($row['pid'], 'postVarSets'); if (!is_array($postVars) || !isset($postVars[$postVar])) { // Check fixed $postVars = $this->pObj->getPostVarSetConfig($row['pid'], 'fixedPostVars'); if (!is_array($postVars) || !isset($postVars[$postVar])) { // Not a postVar, so page most likely in not in cache. Clear row. // TODO It would be great to update cache in this case but usually TYPO3 is not // complitely initialized at this place. So we do not do it... $row = false; } } } // Process row if found: if ($row) { // We found it in the cache // Check for expiration. We can get one of three: // 1. expire = 0 // 2. expire <= time() // 3. expire > time() // 1 is permanent, we do not process it. 2 is expired, we look for permanent or non-expired // (in this order!) entry for the same page od and redirect to corresponding path. 3 - same as // 1 but means that entry is going to expire eventually, nothing to do for us yet. if ($row['expire'] > 0) { if ($this->pObj->enableDevLog) { t3lib_div::devLog('pagePathToId found row', 'realurl', 0, $row); } // 'expire' in the query is only for logging // Using pathq2 index! list($newEntry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pagepath,expire', 'tx_realurl_pathcache', 'page_id=' . intval($row['page_id']) . ' AND language_id=' . intval($row['language_id']) . ' AND (expire=0 OR expire>' . $row['expire'] . ')', '', 'expire', '1'); if ($this->pObj->enableDevLog) { t3lib_div::devLog('pagePathToId searched for new entry', 'realurl', 0, $newEntry); } // Redirect to new path immediately if it is found if ($newEntry) { // Replace path-segments with new ones: $originalDirs = $this->pObj->dirParts; // All original $cp_pathParts = $pathParts; // Popping of pages of original dirs (as many as are remaining in $pathParts) for ($a = 0; $a < count($pathParts); $a++) { array_pop($originalDirs); // Finding all preVars here } for ($a = 0; $a < count($copy_pathParts); $a++) { array_shift($cp_pathParts); // Finding all postVars here } $newPathSegments = explode('/', $newEntry['pagepath']); // Split new pagepath into segments. $newUrlSegments = array_merge($originalDirs, $newPathSegments, $cp_pathParts); // Merge those segments. $newUrlSegments[] = $this->pObj->filePart; // Add any filename as well $redirectUrl = implode('/', $newUrlSegments); // Create redirect URL: if ($this->pObj->extConf['fileName']['defaultToHTMLsuffixOnPrev'] && strlen($redirectUrl) > 1) { if (substr($redirectUrl, -1, 1) == '/') { $redirectUrl = substr($redirectUrl, 0, -1); } if (!t3lib_div::testInt($this->pObj->extConf['fileName']['defaultToHTMLsuffixOnPrev'])) { $redirectUrl .= $this->pObj->extConf['fileName']['defaultToHTMLsuffixOnPrev']; } else { $redirectUrl .= '.html'; } } header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . t3lib_div::locationHeaderUrl($redirectUrl)); exit(); } $this->pObj->disableDecodeCache = true; // Do not cache this! } // Unshift the number of segments that must have defined the page: $cc = count($copy_pathParts); for ($a = 0; $a < $cc; $a++) { array_shift($pathParts); } // Assume we can use this info at first $id = $row['page_id']; $GET_VARS = $row['mpvar'] ? array('MP' => $row['mpvar']) : ''; } else { // Find it list($info, $GET_VARS) = $this->findIDByURL($pathParts); // Setting id: $id = ($info['id'] ? $info['id'] : 0); } // Return found ID: return array($id, $GET_VARS); }
/** * The mother of all functions creating links/URLs etc in a TypoScript environment. * See the references below. * Basically this function takes care of issues such as type,id,alias and Mount Points, URL rewriting (through hooks), M5/B6 encoded parameters etc. * It is important to pass all links created through this function since this is the guarantee that globally configured settings for link creating are observed and that your applications will conform to the various/many configuration options in TypoScript Templates regarding this. * * @param array The page record of the page to which we are creating a link. Needed due to fields like uid, alias, target, no_cache, title and sectionIndex_uid. * @param string Default target string to use IF not $page['target'] is set. * @param boolean If set, then the "&no_cache=1" parameter is included in the URL. * @param string Alternative script name if you don't want to use $GLOBALS['TSFE']->config['mainScript'] (normally set to "index.php") * @param array Array with overriding values for the $page array. * @param string Additional URL parameters to set in the URL. Syntax is "&foo=bar&foo2=bar2" etc. Also used internally to add parameters if needed. * @param string If you set this value to something else than a blank string, then the typeNumber used in the link will be forced to this value. Normally the typeNum is based on the target set OR on $GLOBALS['TSFE']->config['config']['forceTypeValue'] if found. * @param string The target Doamin, if any was detected in typolink * @return array Contains keys like "totalURL", "url", "sectionIndex", "linkVars", "no_cache", "type", "target" of which "totalURL" is normally the value you would use while the other keys contains various parts that was used to construct "totalURL" * @see tslib_frameset::frameParams(), tslib_cObj::typoLink(), tslib_cObj::SEARCHRESULT(), TSpagegen::pagegenInit(), tslib_menu::link() */ function linkData($page, $oTarget, $no_cache, $script, $overrideArray = '', $addParams = '', $typeOverride = '', $targetDomain = '') { global $TYPO3_CONF_VARS; $LD = array(); // Overriding some fields in the page record and still preserves the values by adding them as parameters. Little strange function. if (is_array($overrideArray)) { foreach ($overrideArray as $theKey => $theNewVal) { $addParams .= '&real_' . $theKey . '=' . rawurlencode($page[$theKey]); $page[$theKey] = $theNewVal; } } // Adding Mount Points, "&MP=", parameter for the current page if any is set: if (!strstr($addParams, '&MP=')) { if (trim($GLOBALS['TSFE']->MP_defaults[$page['uid']])) { // Looking for hardcoded defaults: $addParams .= '&MP=' . rawurlencode(trim($GLOBALS['TSFE']->MP_defaults[$page['uid']])); } elseif ($GLOBALS['TSFE']->config['config']['MP_mapRootPoints']) { // Else look in automatically created map: $m = $this->getFromMPmap($page['uid']); if ($m) { $addParams .= '&MP=' . rawurlencode($m); } } } // Setting ID/alias: if (!$script) { $script = $GLOBALS['TSFE']->config['mainScript']; } if ($page['alias']) { $LD['url'] = $script . '?id=' . rawurlencode($page['alias']); } else { $LD['url'] = $script . '?id=' . $page['uid']; } // Setting target $LD['target'] = trim($page['target']) ? trim($page['target']) : $oTarget; // typeNum $typeNum = $this->setup[$LD['target'] . '.']['typeNum']; if (!t3lib_div::testInt($typeOverride) && intval($GLOBALS['TSFE']->config['config']['forceTypeValue'])) { $typeOverride = intval($GLOBALS['TSFE']->config['config']['forceTypeValue']); } if (strcmp($typeOverride, '')) { $typeNum = $typeOverride; } // Override... if ($typeNum) { $LD['type'] = '&type=' . intval($typeNum); } else { $LD['type'] = ''; } $LD['orig_type'] = $LD['type']; // Preserving the type number. // noCache $LD['no_cache'] = trim($page['no_cache']) || $no_cache ? '&no_cache=1' : ''; // linkVars if ($GLOBALS['TSFE']->config['config']['uniqueLinkVars']) { if ($addParams) { $LD['linkVars'] = t3lib_div::implodeArrayForUrl('', t3lib_div::explodeUrl2Array($GLOBALS['TSFE']->linkVars . $addParams)); } else { $LD['linkVars'] = $GLOBALS['TSFE']->linkVars; } } else { $LD['linkVars'] = $GLOBALS['TSFE']->linkVars . $addParams; } // Add absRefPrefix if exists. $LD['url'] = $GLOBALS['TSFE']->absRefPrefix . $LD['url']; // If the special key 'sectionIndex_uid' (added 'manually' in tslib/menu.php to the page-record) is set, then the link jumps directly to a section on the page. $LD['sectionIndex'] = $page['sectionIndex_uid'] ? '#c' . $page['sectionIndex_uid'] : ''; // Compile the normal total url $LD['totalURL'] = $this->removeQueryString($LD['url'] . $LD['type'] . $LD['no_cache'] . $LD['linkVars'] . $GLOBALS['TSFE']->getMethodUrlIdToken) . $LD['sectionIndex']; // Call post processing function for link rendering: if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc'])) { $_params = array('LD' => &$LD, 'args' => array('page' => $page, 'oTarget' => $oTarget, 'no_cache' => $no_cache, 'script' => $script, 'overrideArray' => $overrideArray, 'addParams' => $addParams, 'typeOverride' => $typeOverride, 'targetDomain' => $targetDomain), 'typeNum' => $typeNum); foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc'] as $_funcRef) { t3lib_div::callUserFunction($_funcRef, $_params, $this); } } // Return the LD-array return $LD; }
/** * Main function * Makes a header-location redirect to an edit form IF POSSIBLE from the passed data - otherwise the window will just close. * * @return void */ function main() { global $TCA; if ($this->doClose) { $this->closeWindow(); } else { // Initialize: $table = $this->P['table']; $field = $this->P['field']; t3lib_div::loadTCA($table); $config = $TCA[$table]['columns'][$field]['config']; $fTable = $this->P['currentValue'] < 0 ? $config['neg_foreign_table'] : $config['foreign_table']; // Detecting the various allowed field type setups and acting accordingly. if (is_array($config) && $config['type'] == 'select' && !$config['MM'] && $config['maxitems'] <= 1 && t3lib_div::testInt($this->P['currentValue']) && $this->P['currentValue'] && $fTable) { // SINGLE value: $redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . '&edit[' . $fTable . '][' . $this->P['currentValue'] . ']=edit'; t3lib_utility_Http::redirect($redirectUrl); } elseif (is_array($config) && $this->P['currentSelectedValues'] && ($config['type'] == 'select' && $config['foreign_table'] || $config['type'] == 'group' && $config['internal_type'] == 'db')) { // MULTIPLE VALUES: // Init settings: $allowedTables = $config['type'] == 'group' ? $config['allowed'] : $config['foreign_table'] . ',' . $config['neg_foreign_table']; $prependName = 1; $params = ''; // Selecting selected values into an array: $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup'); $dbAnalysis->start($this->P['currentSelectedValues'], $allowedTables); $value = $dbAnalysis->getValueArray($prependName); // Traverse that array and make parameters for alt_doc.php: foreach ($value as $rec) { $recTableUidParts = t3lib_div::revExplode('_', $rec, 2); $params .= '&edit[' . $recTableUidParts[0] . '][' . $recTableUidParts[1] . ']=edit'; } // Redirect to alt_doc.php: t3lib_utility_Http::redirect('alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . $params); } else { $this->closeWindow(); } } }
function TS_links_rte($value) { $value = $this->TS_AtagToAbs($value); // Split content by the TYPO3 pseudo tag "<link>": $blockSplit = $this->splitIntoBlock('link', $value, 1); foreach ($blockSplit as $k => $v) { $error = ''; if ($k % 2) { // block: $tagCode = t3lib_div::unQuoteFilenames(trim(substr($this->getFirstTag($v), 0, -1)), true); $link_param = $tagCode[1]; $href = ''; $siteUrl = $this->siteUrl(); // Parsing the typolink data. This parsing is roughly done like in tslib_content->typolink() if (strstr($link_param, '@')) { // mailadr $href = 'mailto:' . preg_replace('/^mailto:/i', '', $link_param); } elseif (substr($link_param, 0, 1) == '#') { // check if anchor $href = $siteUrl . $link_param; } else { $fileChar = intval(strpos($link_param, '/')); $urlChar = intval(strpos($link_param, '.')); // Detects if a file is found in site-root OR is a simulateStaticDocument. list($rootFileDat) = explode('?', $link_param); $rFD_fI = pathinfo($rootFileDat); if (trim($rootFileDat) && !strstr($link_param, '/') && (@is_file(PATH_site . $rootFileDat) || t3lib_div::inList('php,html,htm', strtolower($rFD_fI['extension'])))) { $href = $siteUrl . $link_param; } elseif ($urlChar && (strstr($link_param, '//') || !$fileChar || $urlChar < $fileChar)) { // url (external): If doubleSlash or if a '.' comes before a '/'. if (!preg_match('/^[a-z]*:\\/\\//', trim(strtolower($link_param)))) { $scheme = 'http://'; } else { $scheme = ''; } $href = $scheme . $link_param; } elseif ($fileChar) { // file (internal) $href = $siteUrl . $link_param; } else { // integer or alias (alias is without slashes or periods or commas, that is 'nospace,alphanum_x,lower,unique' according to tables.php!!) // Splitting the parameter by ',' and if the array counts more than 1 element it's a id/type/parameters triplet $pairParts = t3lib_div::trimExplode(',', $link_param, TRUE); $idPart = $pairParts[0]; $link_params_parts = explode('#', $idPart); $idPart = trim($link_params_parts[0]); $sectionMark = trim($link_params_parts[1]); if (!strcmp($idPart, '')) { $idPart = $this->recPid; } // If no id or alias is given, set it to class record pid // Checking if the id-parameter is an alias. if (!t3lib_div::testInt($idPart)) { list($idPartR) = t3lib_BEfunc::getRecordsByField('pages', 'alias', $idPart); $idPart = intval($idPartR['uid']); } $page = t3lib_BEfunc::getRecord('pages', $idPart); if (is_array($page)) { // Page must exist... // XCLASS changed from $href = $siteUrl .'?id=' . $idPart . ($pairParts[2] ? $pairParts[2] : '') . ($sectionMark ? '#' . $sectionMark : ''); $href = $idPart . ($pairParts[2] ? $pairParts[2] : '') . ($sectionMark ? '#' . $sectionMark : ''); // linkHandler - allowing links to start with registerd linkHandler e.g.. "record:" } elseif (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'][array_shift(explode(':', $link_param))])) { $href = $link_param; } else { #$href = ''; $href = $siteUrl . '?id=' . $link_param; $error = 'No page found: ' . $idPart; } } } // Setting the A-tag: $bTag = '<a href="' . htmlspecialchars($href) . '"' . ($tagCode[2] && $tagCode[2] != '-' ? ' target="' . htmlspecialchars($tagCode[2]) . '"' : '') . ($tagCode[3] && $tagCode[3] != '-' ? ' class="' . htmlspecialchars($tagCode[3]) . '"' : '') . ($tagCode[4] ? ' title="' . htmlspecialchars($tagCode[4]) . '"' : '') . ($error ? ' rteerror="' . htmlspecialchars($error) . '" style="background-color: yellow; border:2px red solid; color: black;"' : '') . '>'; $eTag = '</a>'; $blockSplit[$k] = $bTag . $this->TS_links_rte($this->removeFirstAndLastTag($blockSplit[$k])) . $eTag; } } // Return content: return implode('', $blockSplit); }
/** * For RTE/link: Parses the incoming URL and determines if it's a page, file, external or mail address. * * @param string HREF value tp analyse * @param string The URL of the current website (frontend) * @return array Array with URL information stored in assoc. keys: value, act (page, file, spec, mail), pageid, cElement, info */ function parseCurUrl($href, $siteUrl) { $href = trim($href); if ($href) { $info = array(); // Default is "url": $info['value'] = $href; $info['act'] = 'url'; $specialParts = explode('#_SPECIAL', $href); if (count($specialParts) == 2) { // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig) $info['value'] = '#_SPECIAL' . $specialParts[1]; $info['act'] = 'spec'; } elseif (t3lib_div::isFirstPartOfStr($href, $siteUrl)) { // If URL is on the current frontend website: $rel = substr($href, strlen($siteUrl)); if (file_exists(PATH_site . rawurldecode($rel))) { // URL is a file, which exists: $info['value'] = rawurldecode($rel); if (@is_dir(PATH_site . $info['value'])) { $info['act'] = 'folder'; } else { $info['act'] = 'file'; } } else { // URL is a page (id parameter) $uP = parse_url($rel); if (!trim($uP['path'])) { $pp = preg_split('/^id=/', $uP['query']); $pp[1] = preg_replace('/&id=[^&]*/', '', $pp[1]); $parameters = explode('&', $pp[1]); $id = array_shift($parameters); if ($id) { // Checking if the id-parameter is an alias. if (!t3lib_div::testInt($id)) { list($idPartR) = t3lib_BEfunc::getRecordsByField('pages', 'alias', $id); $id = intval($idPartR['uid']); } $pageRow = t3lib_BEfunc::getRecordWSOL('pages', $id); $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']); $info['value'] = $GLOBALS['LANG']->getLL('page', 1) . " '" . htmlspecialchars(t3lib_div::fixed_lgd_cs($pageRow['title'], $titleLen)) . "' (ID:" . $id . ($uP['fragment'] ? ', #' . $uP['fragment'] : '') . ')'; $info['pageid'] = $id; $info['cElement'] = $uP['fragment']; $info['act'] = 'page'; $info['query'] = $parameters[0] ? '&' . implode('&', $parameters) : ''; } } } } else { // Email link: if (strtolower(substr($href, 0, 7)) == 'mailto:') { $info['value'] = trim(substr($href, 7)); $info['act'] = 'mail'; } } $info['info'] = $info['value']; } else { // NO value inputted: $info = array(); $info['info'] = $GLOBALS['LANG']->getLL('none'); $info['value'] = ''; $info['act'] = 'page'; } // let the hook have a look foreach ($this->hookObjects as $hookObject) { $info = $hookObject->parseCurrentUrl($href, $siteUrl, $info); } return $info; }
/** * Substition of softreference tokens * * @param string Content of field with soft reference tokens in. * @param array Soft reference configurations * @param string Table for which the processing occurs * @param string UID of record from table * @return string The input content with tokens substituted according to entries in softRefCfgs */ function processSoftReferences_substTokens($tokenizedContent, $softRefCfgs, $table, $uid) { // traverse each softref type for this field: foreach ($softRefCfgs as $cfg) { // Get token ID: $tokenID = $cfg['subst']['tokenID']; // Default is current token value: $insertValue = $cfg['subst']['tokenValue']; // Based on mode: switch ((string) $this->softrefCfg[$tokenID]['mode']) { case 'exclude': // Exclude is a simple passthrough of the value break; case 'editable': // Editable always picks up the value from this input array: $insertValue = $this->softrefInputValues[$tokenID]; break; default: // Mapping IDs/creating files: Based on type, look up new value: switch ((string) $cfg['subst']['type']) { case 'db': default: // Trying to map database element if found in the mapID array: list($tempTable, $tempUid) = explode(':', $cfg['subst']['recordRef']); if (isset($this->import_mapId[$tempTable][$tempUid])) { $insertValue = t3lib_BEfunc::wsMapId($tempTable, $this->import_mapId[$tempTable][$tempUid]); // Look if reference is to a page and the original token value was NOT an integer - then we assume is was an alias and try to look up the new one! if ($tempTable === 'pages' && !t3lib_div::testInt($cfg['subst']['tokenValue'])) { $recWithUniqueValue = t3lib_BEfunc::getRecord($tempTable, $insertValue, 'alias'); if ($recWithUniqueValue['alias']) { $insertValue = $recWithUniqueValue['alias']; } } } break; break; case 'file': // Create / Overwrite file: $insertValue = $this->processSoftReferences_saveFile($cfg['subst']['relFileName'], $cfg, $table, $uid); break; } break; } // Finally, swap the soft reference token in tokenized content with the insert value: $tokenizedContent = str_replace('{softref:' . $tokenID . '}', $insertValue, $tokenizedContent); } return $tokenizedContent; }
/** * Implements the "typolink" property of stdWrap (and others) * Basically the input string, $linktext, is (typically) wrapped in a <a>-tag linking to some page, email address, file or URL based on a parameter defined by the configuration array $conf. * This function is best used from internal functions as is. There are some API functions defined after this function which is more suited for general usage in external applications. * Generally the concept "typolink" should be used in your own applications as an API for making links to pages with parameters and more. The reason for this is that you will then automatically make links compatible with all the centralized functions for URL simulation and manipulation of parameters into hashes and more. * For many more details on the parameters and how they are intepreted, please see the link to TSref below. * * @param string $linktxt The string (text) to link * @param array $conf TypoScript configuration (see link below) * @param tslib_cObj $cObj * @return string A link-wrapped string. * @see stdWrap(), tslib_pibase::pi_linkTP() * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=321&cHash=59bd727a5e */ function typoLink($linktxt, $conf, $cObj = NULL) { $finalTagParts = array(); // If called from media link handler, use the reference of the passed cObj if (!is_object($this->cObj)) { $this->cObj = $cObj; } $link_param = trim($this->cObj->stdWrap($conf['parameter'], $conf['parameter.'])); $initP = '?id=' . $GLOBALS['TSFE']->id . '&type=' . $GLOBALS['TSFE']->type; $this->cObj->lastTypoLinkUrl = ''; $this->cObj->lastTypoLinkTarget = ''; if ($link_param) { $link_paramA = t3lib_div::unQuoteFilenames($link_param, TRUE); $link_param = trim($link_paramA[0]); // Link parameter value $linkClass = trim($link_paramA[2]); // Link class if ($linkClass === '-') { $linkClass = ''; } // The '-' character means 'no class'. Necessary in order to specify a title as fourth parameter without setting the target or class! $forceTarget = trim($link_paramA[1]); // Target value $forceTitle = trim($link_paramA[3]); // Title value if ($forceTarget === '-') { $forceTarget = ''; } // The '-' character means 'no target'. Necessary in order to specify a class as third parameter without setting the target! // Check, if the target is coded as a JS open window link: $JSwindowParts = array(); $JSwindowParams = ''; $onClick = ''; if ($forceTarget && preg_match('/^([0-9]+)x([0-9]+)(:(.*)|.*)$/', $forceTarget, $JSwindowParts)) { // Take all pre-configured and inserted parameters and compile parameter list, including width+height: $JSwindow_tempParamsArr = t3lib_div::trimExplode(',', strtolower($conf['JSwindow_params'] . ',' . $JSwindowParts[4]), TRUE); $JSwindow_paramsArr = array(); foreach ($JSwindow_tempParamsArr as $JSv) { list($JSp, $JSv) = explode('=', $JSv); $JSwindow_paramsArr[$JSp] = $JSp . '=' . $JSv; } // Add width/height: $JSwindow_paramsArr['width'] = 'width=' . $JSwindowParts[1]; $JSwindow_paramsArr['height'] = 'height=' . $JSwindowParts[2]; // Imploding into string: $JSwindowParams = implode(',', $JSwindow_paramsArr); $forceTarget = ''; // Resetting the target since we will use onClick. } // Internal target: $target = isset($conf['target']) ? $conf['target'] : $GLOBALS['TSFE']->intTarget; if ($conf['target.']) { $target = $this->cObj->stdWrap($target, $conf['target.']); } // Checking if the id-parameter is an alias. if (version_compare(TYPO3_version, '4.6.0', '>=')) { $isInteger = t3lib_utility_Math::canBeInterpretedAsInteger($link_param); } else { $isInteger = t3lib_div::testInt($link_param); } if (!$isInteger) { $GLOBALS['TT']->setTSlogMessage("tx_dam_tsfemediatag->typolink(): File id '" . $link_param . "' is not an integer, so '" . $linktxt . "' was not linked.", 1); return $linktxt; } if (!is_object($media = tx_dam::media_getByUid($link_param))) { $GLOBALS['TT']->setTSlogMessage("tx_dam_tsfemediatag->typolink(): File id '" . $link_param . "' was not found, so '" . $linktxt . "' was not linked.", 1); return $linktxt; } if (!$media->isAvailable) { $GLOBALS['TT']->setTSlogMessage("tx_dam_tsfemediatag->typolink(): File '" . $media->getPathForSite() . "' (" . $link_param . ") did not exist, so '" . $linktxt . "' was not linked.", 1); return $linktxt; } $meta = $media->getMetaArray(); if (is_array($this->conf['procFields.'])) { foreach ($this->conf['procFields.'] as $field => $fieldConf) { if (substr($field, -1, 1) === '.') { $fN = substr($field, 0, -1); } else { $fN = $field; $fieldConf = array(); } $meta[$fN] = $media->getContent($fN, $fieldConf); } } $this->addMetaToData($meta); // Title tag $title = $conf['title']; if ($conf['title.']) { $title = $this->cObj->stdWrap($title, $conf['title.']); } // Setting title if blank value to link: if ($linktxt === '') { $linktxt = $media->getContent('title'); } if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) { $this->cObj->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix . $GLOBALS['TSFE']->config['mainScript'] . $initP . '&jumpurl=' . rawurlencode($media->getPathForSite()) . $GLOBALS['TSFE']->getMethodUrlIdToken; } else { $this->cObj->lastTypoLinkUrl = $media->getURL(); } if ($forceTarget) { $target = $forceTarget; } $this->cObj->lastTypoLinkTarget = $target; $finalTagParts['url'] = $this->cObj->lastTypoLinkUrl; $finalTagParts['targetParams'] = $target ? ' target="' . $target . '"' : ''; $finalTagParts['aTagParams'] = $this->cObj->getATagParams($conf); $finalTagParts['TYPE'] = 'file'; if ($forceTitle) { $title = $forceTitle; } if ($JSwindowParams) { // Create TARGET-attribute only if the right doctype is used if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype)) { $target = ' target="FEopenLink"'; } else { $target = ''; } $onClick = "vHWin=window.open('" . $GLOBALS['TSFE']->baseUrlWrap($finalTagParts['url']) . "','FEopenLink','" . $JSwindowParams . "');vHWin.focus();return false;"; $res = '<a href="' . htmlspecialchars($finalTagParts['url']) . '"' . $target . ' onclick="' . htmlspecialchars($onClick) . '"' . ($title ? ' title="' . $title . '"' : '') . ($linkClass ? ' class="' . $linkClass . '"' : '') . $finalTagParts['aTagParams'] . '>'; } else { $res = '<a href="' . htmlspecialchars($finalTagParts['url']) . '"' . ($title ? ' title="' . $title . '"' : '') . $finalTagParts['targetParams'] . ($linkClass ? ' class="' . $linkClass . '"' : '') . $finalTagParts['aTagParams'] . '>'; } // Call userFunc if ($conf['userFunc']) { $finalTagParts['TAG'] = $res; $res = $this->cObj->callUserFunction($conf['userFunc'], $conf['userFunc.'], $finalTagParts); } // If flag "returnLastTypoLinkUrl" set, then just return the latest URL made: if ($conf['returnLast']) { switch ($conf['returnLast']) { case 'url': return $this->cObj->lastTypoLinkUrl; break; case 'target': return $this->cObj->lastTypoLinkTarget; break; } } if ($conf['postUserFunc']) { $linktxt = $this->cObj->callUserFunction($conf['postUserFunc'], $conf['postUserFunc.'], $linktxt); } if ($conf['ATagBeforeWrap']) { return $res . $this->cObj->wrap($linktxt, $conf['wrap']) . '</a>'; } else { return $this->cObj->wrap($res . $linktxt . '</a>', $conf['wrap']); } } else { return $linktxt; } }
/** * Hook function for cleaning output XHTML * hooks on "class.tslib_fe.php:2946" * page.config.tx_seo.sourceCodeFormatter.indentType = space * page.config.tx_seo.sourceCodeFormatter.indentAmount = 16 * * @param array hook parameters * @param object Reference to parent object (TSFE-obj) * @return void */ public function processOutputHook(&$feObj, $ref) { if ($GLOBALS['TSFE']->type != 0) { return; } $configuration = $GLOBALS['TSFE']->config['config']['tx_seo.']['sourceCodeFormatter.']; // disabled for this page type if (isset($configuration['enable']) && $configuration['enable'] == '0') { return; } // 4.5 compatibility if (method_exists('t3lib_div', 'intInRange')) { $indentAmount = t3lib_div::intInRange($configuration['indentAmount'], 1, 100); } else { $indentAmount = t3lib_utility_Math::forceIntegerInRange($configuration['indentAmount'], 1, 100); } // use the "space" character as a indention type if ($configuration['indentType'] == 'space') { $indentElement = ' '; // use any character from the ASCII table } else { $indentTypeIsNumeric = FALSE; // 4.5 compatibility if (method_exists('t3lib_div', 'testInt')) { $indentTypeIsNumeric == t3lib_div::testInt($configuration['indentType']); } else { $indentTypeIsNumeric = t3lib_utility_Math::canBeInterpretedAsInteger($configuration['indentType']); } if ($indentTypeIsNumeric) { $indentElement = chr($configuration['indentType']); } else { // use tab by default $indentElement = "\t"; } } $indention = ''; for ($i = 1; $i <= $indentAmount; $i++) { $indention .= $indentElement; } $spltContent = explode("\n", $ref->content); $level = 0; $cleanContent = array(); $textareaOpen = false; foreach ($spltContent as $lineNum => $line) { $line = trim($line); if (empty($line)) { continue; } $out = $line; // ugly strpos => TODO: use regular expressions // starts with an ending tag if (strpos($line, '</div>') === 0 || strpos($line, '<div') !== 0 && strpos($line, '</div>') === strlen($line) - 6 || strpos($line, '</html>') === 0 || strpos($line, '</body>') === 0 || strpos($line, '</head>') === 0 || strpos($line, '</ul>') === 0) { $level--; } if (strpos($line, '<textarea') !== false) { $textareaOpen = true; } // add indention only if no textarea is open if (!$textareaOpen) { for ($i = 0; $i < $level; $i++) { $out = $indention . $out; } } if (strpos($line, '</textarea>') !== false) { $textareaOpen = false; } // starts with an opening <div>, <ul>, <head> or <body> if (strpos($line, '<div') === 0 && strpos($line, '</div>') !== strlen($line) - 6 || strpos($line, '<body') === 0 && strpos($line, '</body>') !== strlen($line) - 7 || strpos($line, '<head') === 0 && strpos($line, '</head>') !== strlen($line) - 7 || strpos($line, '<ul') === 0 && strpos($line, '</ul>') !== strlen($line) - 5) { $level++; } $cleanContent[] = $out; } $ref->content = implode("\n", $cleanContent); }
/** * creates a shortcut through an AJAX call * * @param array array of parameters from the AJAX interface, currently unused * @param TYPO3AJAX object of type TYPO3AJAX * @return void */ public function createAjaxShortcut($params = array(), TYPO3AJAX &$ajaxObj = null) { global $TCA, $LANG; $shortcutCreated = 'failed'; $shortcutName = 'Shortcut'; // default name $shortcutNamePrepend = ''; $url = t3lib_div::_POST('url'); $module = t3lib_div::_POST('module'); $motherModule = t3lib_div::_POST('motherModName'); // determine shortcut type $queryParts = parse_url($url); $queryParameters = t3lib_div::explodeUrl2Array($queryParts['query'], 1); // Proceed only if no scheme is defined, as URL is expected to be relative if (empty($queryParts['scheme'])) { if (is_array($queryParameters['edit'])) { $shortcut['table'] = key($queryParameters['edit']); $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]); if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') { $shortcut['type'] = 'edit'; $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1); } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') { $shortcut['type'] = 'new'; $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_create', 1); } } else { $shortcut['type'] = 'other'; } // Lookup the title of this page and use it as default description $pageId = $shortcut['recordid'] ? $shortcut['recordid'] : $this->getLinkedPageId($url); if (t3lib_div::testInt($pageId)) { $page = t3lib_BEfunc::getRecord('pages', $pageId); if (count($page)) { // set the name to the title of the page if ($shortcut['type'] == 'other') { $shortcutName = $page['title']; } else { $shortcutName = $shortcutNamePrepend . ' ' . $LANG->sL($TCA[$shortcut['table']]['ctrl']['title']) . ' (' . $page['title'] . ')'; } } } else { $dirName = urldecode($pageId); if (preg_match('/\\/$/', $dirName)) { // if $pageId is a string and ends with a slash, // assume it is a fileadmin reference and set // the description to the basename of that path $shortcutName .= ' ' . basename($dirName); } } // adding the shortcut if ($module && $url) { $fieldValues = array('userid' => $GLOBALS['BE_USER']->user['uid'], 'module_name' => $module . '|' . $motherModule, 'url' => $url, 'description' => $shortcutName, 'sorting' => $GLOBALS['EXEC_TIME']); $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fieldValues); if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) { $shortcutCreated = 'success'; } } $ajaxObj->addContent('create', $shortcutCreated); } }
/** * Tests if the value represents an integer number. * * @param mixed $value * @return bool */ static public function testInt($value) { static $useOldGoodTestInt = null; if (is_null($useOldGoodTestInt)) { $useOldGoodTestInt = !class_exists('t3lib_utility_Math'); } if ($useOldGoodTestInt) { $result = t3lib_div::testInt($value); } else { $result = t3lib_utility_Math::canBeInterpretedAsInteger($value); } return $result; }
/** * The main processing method if this class * * @return string Information of the template status or the taken actions as HTML string */ function main() { global $SOBE, $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; global $tmpl, $tplRow, $theConstants; $edit = $this->pObj->edit; $e = $this->pObj->e; t3lib_div::loadTCA('sys_template'); // ************************** // Checking for more than one template an if, set a menu... // ************************** $manyTemplatesMenu = $this->pObj->templateMenu(); $template_uid = 0; if ($manyTemplatesMenu) { $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage']; } // ************************** // Initialize // ************************** $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); // initialize if ($existTemplate) { $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']; } // ************************** // Create extension template // ************************** $newId = $this->pObj->createTemplate($this->pObj->id, $saveId); if ($newId) { // switch to new template t3lib_utility_Http::redirect('index.php?id=' . $this->pObj->id . '&SET[templatesOnPage]=' . $newId); } if ($existTemplate) { // Update template ? $POST = t3lib_div::_POST(); if ($POST['submit'] || t3lib_div::testInt($POST['submit_x']) && t3lib_div::testInt($POST['submit_y']) || $POST['saveclose'] || t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y'])) { // Set the data to be saved $recData = array(); $alternativeFileName = array(); $resList = $tplRow['resources']; $tmp_upload_name = ''; $tmp_newresource_name = ''; // Set this to blank if (is_array($POST['data'])) { foreach ($POST['data'] as $field => $val) { switch ($field) { case 'constants': case 'config': case 'title': case 'sitetitle': case 'description': $recData['sys_template'][$saveId][$field] = $val; break; case 'resources': $tmp_upload_name = t3lib_div::upload_to_tempfile($_FILES['resources']['tmp_name']); // If there is an uploaded file, move it for the sake of safe_mode. if ($tmp_upload_name) { if ($tmp_upload_name != 'none' && $_FILES['resources']['name']) { $alternativeFileName[$tmp_upload_name] = trim($_FILES['resources']['name']); $resList = $tmp_upload_name . ',' . $resList; } } break; case 'new_resource': $newName = trim(t3lib_div::_GP('new_resource')); if ($newName) { $newName .= '.' . t3lib_div::_GP('new_resource_ext'); $tmp_newresource_name = t3lib_div::tempnam('new_resource_'); $alternativeFileName[$tmp_newresource_name] = $newName; $resList = $tmp_newresource_name . ',' . $resList; } break; case 'makecopy_resource': if (is_array($val)) { $resList = ',' . $resList . ','; foreach ($val as $k => $file) { $tmp_name = PATH_site . $TCA['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $file; $resList = $tmp_name . ',' . $resList; } } break; case 'remove_resource': if (is_array($val)) { $resList = ',' . $resList . ','; foreach ($val as $k => $file) { $resList = str_replace(',' . $file . ',', ',', $resList); } } break; case 'totop_resource': if (is_array($val)) { $resList = ',' . $resList . ','; foreach ($val as $k => $file) { $resList = str_replace(',' . $file . ',', ',', $resList); $resList = ',' . $file . $resList; } } break; } } } $resList = implode(',', t3lib_div::trimExplode(',', $resList, 1)); if (strcmp($resList, $tplRow['resources'])) { $recData['sys_template'][$saveId]['resources'] = $resList; } if (count($recData)) { // Create new tce-object $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; $tce->alternativeFileName = $alternativeFileName; // Initialize $tce->start($recData, array()); // Saved the stuff $tce->process_datamap(); // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php) $tce->clear_cacheCmd('all'); // tce were processed successfully $this->tce_processed = true; // re-read the template ... $this->initialize_editor($this->pObj->id, $template_uid); } // Unlink any uploaded/new temp files there was: t3lib_div::unlink_tempfile($tmp_upload_name); t3lib_div::unlink_tempfile($tmp_newresource_name); // If files has been edited: if (is_array($edit)) { if ($edit['filename'] && $tplRow['resources'] && t3lib_div::inList($tplRow['resources'], $edit['filename'])) { // Check if there are resources, and that the file is in the resourcelist. $path = PATH_site . $TCA['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $edit['filename']; $fI = t3lib_div::split_fileref($edit['filename']); if (@is_file($path) && t3lib_div::getFileAbsFileName($path) && t3lib_div::inList($this->pObj->textExtensions, $fI['fileext'])) { // checks that have already been done.. Just to make sure // @TODO: Check if the hardcorded value already has a config member, otherwise create one if (filesize($path) < 30720) { // checks that have already been done.. Just to make sure t3lib_div::writeFile($path, $edit['file']); $theOutput .= $this->pObj->doc->spacer(10); $theOutput .= $this->pObj->doc->section('<font color=red>' . $GLOBALS['LANG']->getLL('fileChanged') . '</font>', sprintf($GLOBALS['LANG']->getLL('resourceUpdated'), $edit['filename']), 0, 0, 0, 1); // Clear cache - the file has probably affected the template setup // @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible! $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; $tce->start(array(), array()); $tce->clear_cacheCmd('all'); } } } } } // hook Post updating template/TCE processing if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'])) { $postTCEProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook']; if (is_array($postTCEProcessingHook)) { $hookParameters = array('POST' => $POST, 'tce' => $tce); foreach ($postTCEProcessingHook as $hookFunction) { t3lib_div::callUserFunction($hookFunction, $hookParameters, $this); } } } $theOutput .= $this->pObj->doc->spacer(5); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateInformation'), t3lib_iconWorks::getSpriteIconForRecord('sys_template', $tplRow) . '<strong>' . htmlspecialchars($tplRow['title']) . '</strong>' . htmlspecialchars(trim($tplRow['sitetitle']) ? ' - (' . $tplRow['sitetitle'] . ')' : ''), 0, 1); if ($manyTemplatesMenu) { $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu); $theOutput .= $this->pObj->doc->divider(5); } #$numberOfRows= t3lib_div::intInRange($this->pObj->MOD_SETTINGS["ts_template_editor_TArows"],0,150); #if (!$numberOfRows) $numberOfRows = 35; // If abort pressed, nothing should be edited: if ($POST['abort'] || t3lib_div::testInt($POST['abort_x']) && t3lib_div::testInt($POST['abort_y']) || $POST['saveclose'] || t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y'])) { unset($e); } if ($e['title']) { $outCode = '<input type="Text" name="data[title]" value="' . htmlspecialchars($tplRow['title']) . '"' . $this->pObj->doc->formWidth() . '>'; $outCode .= '<input type="Hidden" name="e[title]" value="1">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('title'), $outCode); } if ($e['sitetitle']) { $outCode = '<input type="Text" name="data[sitetitle]" value="' . htmlspecialchars($tplRow['sitetitle']) . '"' . $this->pObj->doc->formWidth() . '>'; $outCode .= '<input type="Hidden" name="e[sitetitle]" value="1">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('sitetitle'), $outCode); } if ($e['description']) { $outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, '', '') . '>' . t3lib_div::formatForTextarea($tplRow['description']) . '</textarea>'; $outCode .= '<input type="Hidden" name="e[description]" value="1">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('description'), $outCode); } if ($e['resources']) { // Upload $outCode = '<input type="File" name="resources"' . $this->pObj->doc->formWidth() . ' size="50">'; $outCode .= '<input type="Hidden" name="data[resources]" value="1">'; $outCode .= '<input type="Hidden" name="e[resources]" value="1">'; $outCode .= '<BR>' . $GLOBALS['LANG']->getLL('allowedExtensions') . ' <strong>' . $TCA['sys_template']['columns']['resources']['config']['allowed'] . '</strong>'; $outCode .= '<BR>' . $GLOBALS['LANG']->getLL('maxFilesize') . ' <strong>' . t3lib_div::formatSize($TCA['sys_template']['columns']['resources']['config']['max_size'] * 1024) . '</strong>'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('uploadResource'), $outCode); // New $opt = explode(',', $this->pObj->textExtensions); $optTags = ''; foreach ($opt as $extVal) { $optTags .= '<option value="' . $extVal . '">.' . $extVal . '</option>'; } $outCode = '<input type="text" name="new_resource"' . $this->pObj->doc->formWidth(20) . '> <select name="new_resource_ext">' . $optTags . '</select>'; $outCode .= '<input type="Hidden" name="data[new_resource]" value="1">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('newTextResource'), $outCode); // Make copy $rL = $this->resourceListForCopy($this->pObj->id, $template_uid); if ($rL) { $theOutput .= $this->pObj->doc->spacer(20); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('copyResource'), $rL); } // Update resource list $rL = $this->procesResources($tplRow['resources'], 1); if ($rL) { $theOutput .= $this->pObj->doc->spacer(20); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('updateResourceList'), $rL); } } if ($e['constants']) { $outCode = '<textarea name="data[constants]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea($tplRow['constants']) . '</textarea>'; $outCode .= '<input type="Hidden" name="e[constants]" value="1">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants'), ''); $theOutput .= $this->pObj->doc->sectionEnd() . $outCode; } if ($e['file']) { $path = PATH_site . $TCA['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $e[file]; $fI = t3lib_div::split_fileref($e[file]); if (@is_file($path) && t3lib_div::inList($this->pObj->textExtensions, $fI['fileext'])) { if (filesize($path) < $TCA['sys_template']['columns']['resources']['config']['max_size'] * 1024) { $fileContent = t3lib_div::getUrl($path); $outCode = $GLOBALS['LANG']->getLL('file') . ' <strong>' . $e[file] . '</strong><BR>'; $outCode .= '<textarea name="edit[file]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea($fileContent) . '</textarea>'; $outCode .= '<input type="Hidden" name="edit[filename]" value="' . $e[file] . '">'; $outCode .= '<input type="Hidden" name="e[file]" value="' . htmlspecialchars($e[file]) . '">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editResource'), ''); $theOutput .= $this->pObj->doc->sectionEnd() . $outCode; } else { $theOutput .= $this->pObj->doc->spacer(15); $fileToBig = sprintf($GLOBALS['LANG']->getLL('filesizeExceeded'), $TCA['sys_template']['columns']['resources']['config']['max_size']); $filesizeNotAllowed = sprintf($GLOBALS['LANG']->getLL('notAllowed'), $TCA['sys_template']['columns']['resources']['config']['max_size']); $theOutput .= $this->pObj->doc->section('<font color=red>' . $fileToBig . '</font>', $filesizeNotAllowed, 0, 0, 0, 1); } } } if ($e['config']) { $outCode = '<textarea name="data[config]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, "width:98%;height:70%", "off") . ' class="fixed-font">' . t3lib_div::formatForTextarea($tplRow["config"]) . '</textarea>'; if (t3lib_extMgm::isLoaded('tsconfig_help')) { $url = $BACK_PATH . 'wizard_tsconfig.php?mode=tsref'; $params = array('formName' => 'editForm', 'itemName' => 'data[config]'); $outCode .= '<a href="#" onClick="vHWin=window.open(\'' . $url . t3lib_div::implodeArrayForUrl('', array('P' => $params)) . '\',\'popUp' . $md5ID . '\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;">' . t3lib_iconWorks::getSpriteIcon('actions-system-typoscript-documentation-open', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:tsRef', true))) . '</a>'; } $outCode .= '<input type="Hidden" name="e[config]" value="1">'; $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup'), ''); $theOutput .= $this->pObj->doc->sectionEnd() . $outCode; } // Processing: $outCode = ''; $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('title'), htmlspecialchars($tplRow['title']), 'title'); $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('sitetitle'), htmlspecialchars($tplRow['sitetitle']), 'sitetitle'); $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('description'), nl2br(htmlspecialchars($tplRow['description'])), 'description'); $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('resources'), $this->procesResources($tplRow['resources']), 'resources'); $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('constants'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[constants]) ? count(explode(LF, $tplRow[constants])) : 0), 'constants'); $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('setup'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[config]) ? count(explode(LF, $tplRow[config])) : 0), 'config'); $outCode = '<br /><br /><table class="t3-table-info">' . $outCode . '</table>'; // Edit all icon: $outCode .= '<br /><a href="#" onClick="' . t3lib_BEfunc::editOnClick(rawurlencode('&createExtension=0') . '&edit[sys_template][' . $tplRow['uid'] . ']=edit', $BACK_PATH, '') . '"><strong>' . t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->getLL('editTemplateRecord'))) . $GLOBALS['LANG']->getLL('editTemplateRecord') . '</strong></a>'; $theOutput .= $this->pObj->doc->section('', $outCode); // hook after compiling the output if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'])) { $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook']; if (is_array($postOutputProcessingHook)) { $hookParameters = array('theOutput' => &$theOutput, 'POST' => $POST, 'e' => $e, 'tplRow' => $tplRow, 'numberOfRows' => $numberOfRows); foreach ($postOutputProcessingHook as $hookFunction) { t3lib_div::callUserFunction($hookFunction, $hookParameters, $this); } } } } else { $theOutput .= $this->pObj->noTemplate(1); } return $theOutput; }
/** * Returns the 'age' of the tstamp $seconds * * @param integer Seconds to return age for. Example: "70" => "1 min", "3601" => "1 hrs" * @param string $labels are the labels of the individual units. Defaults to : ' min| hrs| days| yrs' * @return string The formatted string */ function calcAge($seconds, $labels) { if (t3lib_div::testInt($labels)) { $labels = ' min| hrs| days| yrs| min| hour| day| year'; } else { $labels = str_replace('"', '', $labels); } $labelArr = explode('|', $labels); if (count($labelArr) == 4) { $labelArr = array_merge($labelArr, $labelArr); } $absSeconds = abs($seconds); $sign = $seconds > 0 ? 1 : -1; if ($absSeconds < 3600) { $val = round($absSeconds / 60); $seconds = $sign * $val . ($val == 1 ? $labelArr[4] : $labelArr[0]); } elseif ($absSeconds < 24 * 3600) { $val = round($absSeconds / 3600); $seconds = $sign * $val . ($val == 1 ? $labelArr[5] : $labelArr[1]); } elseif ($absSeconds < 365 * 24 * 3600) { $val = round($absSeconds / (24 * 3600)); $seconds = $sign * $val . ($val == 1 ? $labelArr[6] : $labelArr[2]); } else { $val = round($absSeconds / (365 * 24 * 3600)); $seconds = $sign * $val . ($val == 1 ? $labelArr[7] : $labelArr[3]); } return $seconds; }
/** * Compiling an array with tag attributes into a string * * @param array Tag attributes * @param array Meta information about these attributes (like if they were quoted) * @param boolean If set, then the attribute names will be set in lower case, value quotes in double-quotes and the value will be htmlspecialchar()'ed * @return string Imploded attributes, eg: 'attribute="value" attrib2="value2"' * @access private */ function compileTagAttribs($tagAttrib, $meta = array(), $xhtmlClean = 0) { $accu = array(); foreach ($tagAttrib as $k => $v) { if ($xhtmlClean) { $attr = strtolower($k); if (strcmp($v, '') || isset($meta[$k]['dashType'])) { $attr .= '="' . htmlspecialchars($v) . '"'; } } else { $attr = $meta[$k]['origTag'] ? $meta[$k]['origTag'] : $k; if (strcmp($v, '') || isset($meta[$k]['dashType'])) { $dash = $meta[$k]['dashType'] ? $meta[$k]['dashType'] : (t3lib_div::testInt($v) ? '' : '"'); $attr .= '=' . $dash . $v . $dash; } } $accu[] = $attr; } return implode(' ', $accu); }
/** * Helper function for editPanel() which wraps icons in the panel in a link with the action of the panel. * The links are for some of them not simple hyperlinks but onclick-actions which submits a little form which the panel is wrapped in. * * @param string The string to wrap in a link, typ. and image used as button in the edit panel. * @param string The name of the form wrapping the edit panel. * @param string The command of the link. There is a predefined list available: edit, new, up, down etc. * @param string The "table:uid" of the record being processed by the panel. * @param string Text string with confirmation message; If set a confirm box will be displayed before carrying out the action (if Yes is pressed) * @param integer "New pid" - for new records * @return string A <a> tag wrapped string. * @see editPanel(), editIcons(), t3lib_tsfeBeUserAuth::extEditAction() */ protected function editPanelLinkWrap($string, $formName, $cmd, $currentRecord = '', $confirm = '', $nPid = '') { // Editing forms on page only supported in Live workspace (because of incomplete implementation) $editFormsOnPage = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] && $GLOBALS['BE_USER']->workspace === 0; $nV = t3lib_div::_GP('ADMCMD_view') ? 1 : 0; $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir; if ($cmd == 'edit' && !$editFormsOnPage) { $rParts = explode(':', $currentRecord); $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'alt_doc.php?edit[' . $rParts[0] . '][' . $rParts[1] . ']=edit&noView=' . $nV, $currentRecord); } elseif ($cmd == 'new' && !$editFormsOnPage) { $rParts = explode(':', $currentRecord); if ($rParts[0] == 'pages') { $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'db_new.php?id=' . $rParts[1] . '&pagesOnly=1', $currentRecord); } else { if (!intval($nPid)) { $nPid = t3lib_div::testInt($rParts[1]) ? -$rParts[1] : $GLOBALS['TSFE']->id; } $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'alt_doc.php?edit[' . $rParts[0] . '][' . $nPid . ']=new&noView=' . $nV, $currentRecord); } } else { if ($confirm && $GLOBALS['BE_USER']->jsConfirmation(8)) { // Gets htmlspecialchared later $cf1 = 'if (confirm(' . t3lib_div::quoteJSvalue($confirm, true) . ')) {'; $cf2 = '}'; } else { $cf1 = $cf2 = ''; } $out = '<a href="#" onclick="' . htmlspecialchars($cf1 . 'document.' . $formName . '[\'TSFE_EDIT[cmd]\'].value=\'' . $cmd . '\'; document.' . $formName . '.submit();' . $cf2 . ' return false;') . '">' . $string . '</a>'; } return $out; }
/** * Crops a title string to a limited lenght and if it really was cropped, wrap it in a <span title="...">|</span>, * which offers a tooltip with the original title when moving mouse over it. * * @param string $title: The title string to be cropped * @param integer $titleLength: Crop title after this length - if not set, BE_USER->uc['titleLen'] is used * @return string The processed title string, wrapped in <span title="...">|</span> if cropped */ public function getRecordTitlePrep($title, $titleLength = 0) { // If $titleLength is not a valid positive integer, use BE_USER->uc['titleLen']: if (!$titleLength || !t3lib_div::testInt($titleLength) || $titleLength < 0) { $titleLength = $GLOBALS['BE_USER']->uc['titleLen']; } return htmlspecialchars(t3lib_div::fixed_lgd_cs($title, $titleLength)); }
/** * Creates the TCA for fields * * @param array &$DBfields: array of fields (PASSED BY REFERENCE) * @param array $columns: $array of fields (PASSED BY REFERENCE) * @param array $fConf: field config * @param string $WOP: ??? * @param string $table: tablename * @param string $extKey: extensionkey * @return void */ function makeFieldTCA(&$DBfields, &$columns, $fConf, $WOP, $table, $extKey) { if (!(string) $fConf['type']) { return; } $id = $table . '_' . $fConf['fieldname']; $version = class_exists('t3lib_utility_VersionNumber') ? t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) : t3lib_div::int_from_ver(TYPO3_version); $configL = array(); $t = (string) $fConf['type']; switch ($t) { case 'input': case 'input+': $isString = true; $configL[] = '\'type\' => \'input\', ' . $this->WOPcomment('WOP:' . $WOP . '[type]'); if ($version < 4006000) { $configL[] = '\'size\' => \'' . t3lib_div::intInRange($fConf['conf_size'], 5, 48, 30) . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_size]'); if (intval($fConf['conf_max'])) { $configL[] = '\'max\' => \'' . t3lib_div::intInRange($fConf['conf_max'], 1, 255) . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_max]'); } } else { $configL[] = '\'size\' => \'' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_size'], 5, 48, 30) . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_size]'); if (intval($fConf['conf_max'])) { $configL[] = '\'max\' => \'' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_max'], 1, 255) . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_max]'); } } $evalItems = array(); if ($fConf['conf_required']) { $evalItems[0][] = 'required'; $evalItems[1][] = $WOP . '[conf_required]'; } if ($t == 'input+') { $isString = (bool) (!$fConf['conf_eval']) || t3lib_div::inList('alphanum,upper,lower', $fConf['conf_eval']); $isDouble2 = (bool) (!$fConf['conf_eval']) || t3lib_div::inList('double2', $fConf['conf_eval']); if ($fConf['conf_varchar'] && $isString) { $evalItems[0][] = 'trim'; $evalItems[1][] = $WOP . '[conf_varchar]'; } if ($fConf['conf_eval'] === 'int+') { $configL[] = '\'range\' => array(\'lower\' => 0, \'upper\' => 1000), ' . $this->WOPcomment('WOP:' . $WOP . '[conf_eval] = int+ results in a range setting'); $fConf['conf_eval'] = 'int'; } if ($fConf['conf_eval']) { $evalItems[0][] = $fConf['conf_eval']; $evalItems[1][] = $WOP . '[conf_eval]'; } if ($fConf['conf_check']) { $configL[] = '\'checkbox\' => \'' . ($isString ? '' : '0') . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_check]'); } if ($fConf['conf_stripspace']) { $evalItems[0][] = 'nospace'; $evalItems[1][] = $WOP . '[conf_stripspace]'; } if ($fConf['conf_pass']) { $evalItems[0][] = 'password'; $evalItems[1][] = $WOP . '[conf_pass]'; } if ($fConf['conf_md5']) { $evalItems[0][] = 'md5'; $evalItems[1][] = $WOP . '[conf_md5]'; } if ($fConf['conf_unique']) { if ($fConf['conf_unique'] == 'L') { $evalItems[0][] = 'uniqueInPid'; $evalItems[1][] = $WOP . '[conf_unique] = Local (unique in this page (PID))'; } if ($fConf['conf_unique'] == 'G') { $evalItems[0][] = 'unique'; $evalItems[1][] = $WOP . '[conf_unique] = Global (unique in whole database)'; } } $wizards = array(); if ($fConf['conf_wiz_color']) { $wizards[] = trim($this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_color]') . ' \'color\' => array( \'title\' => \'Color:\', \'type\' => \'colorbox\', \'dim\' => \'12x12\', \'tableStyle\' => \'border:solid 1px black;\', \'script\' => \'wizard_colorpicker.php\', \'JSopenParams\' => \'height=300,width=250,status=0,menubar=0,scrollbars=1\', ), ')); } if ($fConf['conf_wiz_link']) { $wizards[] = trim($this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_link]') . ' \'link\' => array( \'type\' => \'popup\', \'title\' => \'Link\', \'icon\' => \'link_popup.gif\', \'script\' => \'browse_links.php?mode=wizard\', \'JSopenParams\' => \'height=300,width=500,status=0,menubar=0,scrollbars=1\' ), ')); } if (count($wizards)) { $configL[] = trim($this->wrapBody(' \'wizards\' => array( \'_PADDING\' => 2, ', implode(chr(10), $wizards), ' ), ')); } } else { if ($fConf['conf_varchar']) { $evalItems[0][] = 'trim'; $evalItems[1][] = $WOP . '[conf_varchar]'; } } if (count($evalItems)) { $configL[] = '\'eval\' => \'' . implode(",", $evalItems[0]) . '\', ' . $this->WOPcomment('WOP:' . implode(' / ', $evalItems[1])); } if (!$isString && !$isDouble2) { $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,'; } elseif (!$isString && $isDouble2) { $DBfields[] = $fConf["fieldname"] . " double(11,2) DEFAULT '0.00' NOT NULL,"; } elseif (!$fConf['conf_varchar']) { $DBfields[] = $fConf['fieldname'] . ' tinytext,'; } else { if ($version < 4006000) { $varCharLn = intval($fConf['conf_max']) ? t3lib_div::intInRange($fConf['conf_max'], 1, 255) : 255; } else { $varCharLn = intval($fConf['conf_max']) ? t3lib_utility_Math::forceIntegerInRange($fConf['conf_max'], 1, 255) : 255; } $DBfields[] = $fConf['fieldname'] . ' ' . ($varCharLn > $this->wizard->charMaxLng ? 'var' : '') . 'char(' . $varCharLn . ') DEFAULT \'\' NOT NULL,'; } break; case 'link': $DBfields[] = $fConf['fieldname'] . ' tinytext,'; $configL[] = trim($this->sPS(' \'type\' => \'input\', \'size\' => \'15\', \'max\' => \'255\', \'checkbox\' => \'\', \'eval\' => \'trim\', \'wizards\' => array( \'_PADDING\' => 2, \'link\' => array( \'type\' => \'popup\', \'title\' => \'Link\', \'icon\' => \'link_popup.gif\', \'script\' => \'browse_links.php?mode=wizard\', \'JSopenParams\' => \'height=300,width=500,status=0,menubar=0,scrollbars=1\' ) ) ')); break; case 'datetime': case 'date': $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,'; $configL[] = trim($this->sPS(' \'type\' => \'input\', \'size\' => \'' . ($t == "datetime" ? 12 : 8) . '\', \'max\' => \'20\', \'eval\' => \'' . $t . '\', \'checkbox\' => \'0\', \'default\' => \'0\' ')); break; case 'integer': $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,'; $configL[] = trim($this->sPS(' \'type\' => \'input\', \'size\' => \'4\', \'max\' => \'4\', \'eval\' => \'int\', \'checkbox\' => \'0\', \'range\' => array( \'upper\' => \'1000\', \'lower\' => \'10\' ), \'default\' => 0 ')); break; case 'textarea': case 'textarea_nowrap': $DBfields[] = $fConf['fieldname'] . ' text,'; $configL[] = '\'type\' => \'text\','; if ($t == 'textarea_nowrap') { $configL[] = '\'wrap\' => \'OFF\','; } if ($version < 4006000) { $configL[] = '\'cols\' => \'' . t3lib_div::intInRange($fConf['conf_cols'], 5, 48, 30) . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_cols]'); $configL[] = '\'rows\' => \'' . t3lib_div::intInRange($fConf['conf_rows'], 1, 20, 5) . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rows]'); } else { $configL[] = '\'cols\' => \'' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_cols'], 5, 48, 30) . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_cols]'); $configL[] = '\'rows\' => \'' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_rows'], 1, 20, 5) . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rows]'); } if ($fConf["conf_wiz_example"]) { $wizards = array(); $wizards[] = trim($this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_example]') . ' \'example\' => array( \'title\' => \'Example Wizard:\', \'type\' => \'script\', \'notNewRecords\' => 1, \'icon\' => t3lib_extMgm::extRelPath(\'' . $extKey . '\').\'' . $id . '/wizard_icon.gif\', \'script\' => t3lib_extMgm::extRelPath(\'' . $extKey . '\').\'' . $id . '/index.php\', ), ')); $cN = $this->returnName($extKey, 'class', $id . 'wiz'); $this->writeStandardBE_xMod($extKey, array('title' => 'Example Wizard title...'), $id . '/', $cN, 0, $id . 'wiz'); $this->addFileToFileArray($id . '/wizard_icon.gif', t3lib_div::getUrl(t3lib_extMgm::extPath('kickstarter') . 'res/notfound.gif')); $configL[] = trim($this->wrapBody(' \'wizards\' => array( \'_PADDING\' => 2, ', implode(chr(10), $wizards), ' ), ')); } break; case 'textarea_rte': $DBfields[] = $fConf['fieldname'] . ' text,'; $configL[] = '\'type\' => \'text\','; $configL[] = '\'cols\' => \'30\','; $configL[] = '\'rows\' => \'5\','; if ($fConf['conf_rte_fullscreen']) { $wizards = array(); $wizards[] = trim($this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_fullscreen]') . ' \'RTE\' => array( \'notNewRecords\' => 1, \'RTEonly\' => 1, \'type\' => \'script\', \'title\' => \'Full screen Rich Text Editing|Formatteret redigering i hele vinduet\', \'icon\' => \'wizard_rte2.gif\', \'script\' => \'wizard_rte.php\', ), ')); $configL[] = trim($this->wrapBody(' \'wizards\' => array( \'_PADDING\' => 2, ', implode(chr(10), $wizards), ' ), ')); } $rteImageDir = ''; if ($fConf['conf_rte_separateStorageForImages'] && t3lib_div::inList('moderate,basic,custom', $fConf['conf_rte'])) { $this->wizard->EM_CONF_presets['createDirs'][] = $this->ulFolder($extKey) . 'rte/'; $rteImageDir = '|imgpath=' . $this->ulFolder($extKey) . 'rte/'; } $transformation = 'ts_images-ts_reglinks'; if ($fConf['conf_mode_cssOrNot'] && t3lib_div::inList('moderate,custom', $fConf['conf_rte'])) { $transformation = 'ts_css'; } switch ($fConf['conf_rte']) { case 'tt_content': $typeP = 'richtext[]:rte_transform[mode=ts]'; break; case 'moderate': $typeP = 'richtext[]:rte_transform[mode=' . $transformation . '' . $rteImageDir . ']'; break; case 'basic': $typeP = 'richtext[]:rte_transform[mode=ts_css' . $rteImageDir . ']'; $this->wizard->ext_localconf[] = trim($this->wrapBody("\n\t\t\t\t\t\t\t\tt3lib_extMgm::addPageTSConfig('\n\n\t\t\t\t\t\t\t\t\t# ***************************************************************************************\n\t\t\t\t\t\t\t\t\t# CONFIGURATION of RTE in table \"" . $table . "\", field \"" . $fConf["fieldname"] . "\"\n\t\t\t\t\t\t\t\t\t# ***************************************************************************************\n\n\t\t\t\t\t\t\t\t\t", trim($this->slashValueForSingleDashes(str_replace(chr(9), " ", $this->sPS("\n\t\t\t\t\t\t\t\t\t\tRTE.config." . $table . "." . $fConf["fieldname"] . " {\n\t\t\t\t\t\t\t\t\t\t\thidePStyleItems = H1, H4, H5, H6\n\t\t\t\t\t\t\t\t\t\t\tproc.exitHTMLparser_db=1\n\t\t\t\t\t\t\t\t\t\t\tproc.exitHTMLparser_db {\n\t\t\t\t\t\t\t\t\t\t\t\tkeepNonMatchedTags=1\n\t\t\t\t\t\t\t\t\t\t\t\ttags.font.allowedAttribs= color\n\t\t\t\t\t\t\t\t\t\t\t\ttags.font.rmTagIfNoAttrib = 1\n\t\t\t\t\t\t\t\t\t\t\t\ttags.font.nesting = global\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t")))), "\n\t\t\t\t\t\t\t\t');\n\t\t\t\t\t\t", 0)); break; case 'none': $typeP = 'richtext[]'; break; case 'custom': $enabledButtons = array(); $traverseList = explode(',', 'cut,copy,paste,formatblock,class,fontstyle,fontsize,textcolor,bold,italic,underline,left,center,right,orderedlist,unorderedlist,outdent,indent,link,table,image,line,user,chMode'); $HTMLparser = array(); $fontAllowedAttrib = array(); $allowedTags_WOP = array(); $allowedTags = array(); while (list(, $lI) = each($traverseList)) { $nothingDone = 0; if ($fConf['conf_rte_b_' . $lI]) { $enabledButtons[] = $lI; switch ($lI) { case 'formatblock': case 'left': case 'center': case 'right': $allowedTags[] = 'div'; $allowedTags[] = 'p'; break; case 'class': $allowedTags[] = 'span'; break; case 'fontstyle': $allowedTags[] = 'font'; $fontAllowedAttrib[] = 'face'; break; case 'fontsize': $allowedTags[] = 'font'; $fontAllowedAttrib[] = 'size'; break; case 'textcolor': $allowedTags[] = 'font'; $fontAllowedAttrib[] = 'color'; break; case 'bold': $allowedTags[] = 'b'; $allowedTags[] = 'strong'; break; case 'italic': $allowedTags[] = 'i'; $allowedTags[] = 'em'; break; case 'underline': $allowedTags[] = 'u'; break; case 'orderedlist': $allowedTags[] = 'ol'; $allowedTags[] = 'li'; break; case 'unorderedlist': $allowedTags[] = 'ul'; $allowedTags[] = 'li'; break; case 'outdent': case 'indent': $allowedTags[] = 'blockquote'; break; case 'link': $allowedTags[] = 'a'; break; case 'table': $allowedTags[] = 'table'; $allowedTags[] = 'tr'; $allowedTags[] = 'td'; break; case 'image': $allowedTags[] = 'img'; break; case 'line': $allowedTags[] = 'hr'; break; default: $nothingDone = 1; break; } if (!$nothingDone) { $allowedTags_WOP[] = $WOP . '[conf_rte_b_' . $lI . ']'; } } } if (count($fontAllowedAttrib)) { $HTMLparser[] = 'tags.font.allowedAttribs = ' . implode(',', $fontAllowedAttrib); $HTMLparser[] = 'tags.font.rmTagIfNoAttrib = 1'; $HTMLparser[] = 'tags.font.nesting = global'; } if (count($enabledButtons)) { $typeP = 'richtext[' . implode('|', $enabledButtons) . ']:rte_transform[mode=' . $transformation . '' . $rteImageDir . ']'; } $rte_colors = array(); $setupUpColors = array(); for ($a = 1; $a <= 3; $a++) { if ($fConf['conf_rte_color' . $a]) { $rte_colors[$id . '_color' . $a] = trim($this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_color' . $a . ']') . ' ' . $id . '_color' . $a . ' { name = Color ' . $a . ' value = ' . $fConf['conf_rte_color' . $a] . ' } ')); $setupUpColors[] = trim($fConf['conf_rte_color' . $a]); } } $rte_classes = array(); for ($a = 1; $a <= 6; $a++) { if ($fConf['conf_rte_class' . $a]) { $rte_classes[$id . '_class' . $a] = trim($this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_class' . $a . ']') . ' ' . $id . '_class' . $a . ' { name = ' . $fConf['conf_rte_class' . $a] . ' value = ' . $fConf['conf_rte_class' . $a . '_style'] . ' } ')); } } $PageTSconfig = array(); if ($fConf['conf_rte_removecolorpicker']) { $PageTSconfig[] = ' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_removecolorpicker]'); $PageTSconfig[] = 'disableColorPicker = 1'; } if (count($rte_classes)) { $PageTSconfig[] = ' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_class*]'); $PageTSconfig[] = 'classesParagraph = ' . implode(', ', array_keys($rte_classes)); $PageTSconfig[] = 'classesCharacter = ' . implode(', ', array_keys($rte_classes)); if (in_array('p', $allowedTags) || in_array('div', $allowedTags)) { $HTMLparser[] = ' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_class*]'); if (in_array('p', $allowedTags)) { $HTMLparser[] = 'p.fixAttrib.class.list = ,' . implode(',', array_keys($rte_classes)); } if (in_array('div', $allowedTags)) { $HTMLparser[] = 'div.fixAttrib.class.list = ,' . implode(',', array_keys($rte_classes)); } } } if (count($rte_colors)) { $PageTSconfig[] = ' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_color*]'); $PageTSconfig[] = 'colors = ' . implode(', ', array_keys($rte_colors)); if (in_array('color', $fontAllowedAttrib) && $fConf['conf_rte_removecolorpicker']) { $HTMLparser[] = ' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_removecolorpicker]'); $HTMLparser[] = 'tags.font.fixAttrib.color.list = ,' . implode(',', $setupUpColors); $HTMLparser[] = 'tags.font.fixAttrib.color.removeIfFalse = 1'; } } if (!strcmp($fConf['conf_rte_removePdefaults'], 1)) { $PageTSconfig[] = ' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_removePdefaults]'); $PageTSconfig[] = 'hidePStyleItems = H1, H2, H3, H4, H5, H6, PRE'; } elseif ($fConf['conf_rte_removePdefaults'] == 'H2H3') { $PageTSconfig[] = ' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_removePdefaults]'); $PageTSconfig[] = 'hidePStyleItems = H1, H4, H5, H6'; } else { $allowedTags[] = 'h1'; $allowedTags[] = 'h2'; $allowedTags[] = 'h3'; $allowedTags[] = 'h4'; $allowedTags[] = 'h5'; $allowedTags[] = 'h6'; $allowedTags[] = 'pre'; } $allowedTags = array_unique($allowedTags); if (count($allowedTags)) { $HTMLparser[] = ' ' . $this->WOPcomment('WOP:' . implode(' / ', $allowedTags_WOP)); $HTMLparser[] = 'allowTags = ' . implode(', ', $allowedTags); } if ($fConf['conf_rte_div_to_p']) { $HTMLparser[] = ' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_div_to_p]'); $HTMLparser[] = 'tags.div.remap = P'; } if (count($HTMLparser)) { $PageTSconfig[] = trim($this->wrapBody(' proc.exitHTMLparser_db=1 proc.exitHTMLparser_db { ', implode(chr(10), $HTMLparser), ' } ')); } $finalPageTSconfig = array(); if (count($rte_colors)) { $finalPageTSconfig[] = trim($this->wrapBody(' RTE.colors { ', implode(chr(10), $rte_colors), ' } ')); } if (count($rte_classes)) { $finalPageTSconfig[] = trim($this->wrapBody(' RTE.classes { ', implode(chr(10), $rte_classes), ' } ')); } if (count($PageTSconfig)) { $finalPageTSconfig[] = trim($this->wrapBody(' RTE.config.' . $table . '.' . $fConf['fieldname'] . ' { ', implode(chr(10), $PageTSconfig), ' } ')); } if (count($finalPageTSconfig)) { $this->wizard->ext_localconf[] = trim($this->wrapBody("\n\t\t\t\t\t\t\t\tt3lib_extMgm::addPageTSConfig('\n\n\t\t\t\t\t\t\t\t\t# ***************************************************************************************\n\t\t\t\t\t\t\t\t\t# CONFIGURATION of RTE in table \"" . $table . "\", field \"" . $fConf["fieldname"] . "\"\n\t\t\t\t\t\t\t\t\t# ***************************************************************************************\n\n\t\t\t\t\t\t\t\t", trim($this->slashValueForSingleDashes(str_replace(chr(9), " ", implode(chr(10) . chr(10), $finalPageTSconfig)))), "\n\t\t\t\t\t\t\t\t');\n\t\t\t\t\t\t\t", 0)); } break; } $this->wizard->_typeP[$fConf['fieldname']] = $typeP; break; case 'check': case 'check_4': case 'check_10': $configL[] = '\'type\' => \'check\','; if ($t == 'check') { $DBfields[] = $fConf['fieldname'] . ' tinyint(3) DEFAULT \'0\' NOT NULL,'; if ($fConf['conf_check_default']) { $configL[] = '\'default\' => 1, ' . $this->WOPcomment('WOP:' . $WOP . '[conf_check_default]'); } } else { $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,'; } if ($t == 'check_4' || $t == 'check_10') { $configL[] = '\'cols\' => 4,'; $cItems = array(); $aMax = intval($fConf["conf_numberBoxes"]); for ($a = 0; $a < $aMax; $a++) { $cItems[] = 'array(\'' . addslashes($this->getSplitLabels_reference($fConf, "conf_boxLabel_" . $a, $table . "." . $fConf["fieldname"] . ".I." . $a)) . '\', \'\'),'; } $configL[] = trim($this->wrapBody(' \'items\' => array( ', implode(chr(10), $cItems), ' ), ')); } break; case 'radio': case 'select': $configL[] = '\'type\' => \'' . ($t == 'select' ? 'select' : 'radio') . '\','; $notIntVal = 0; $len = array(); $numberOfItems = $version < 4006000 ? t3lib_div::intInRange($fConf['conf_select_items'], 1, 20) : t3lib_utility_Math::forceIntegerInRange($fConf['conf_select_items'], 1, 20); for ($a = 0; $a < $numberOfItems; $a++) { $val = $fConf["conf_select_itemvalue_" . $a]; if ($version < 4006000) { $notIntVal += t3lib_div::testInt($val) ? 0 : 1; } else { $notIntVal += t3lib_utility_Math::canBeInterpretedAsInteger($val) ? 0 : 1; } $len[] = strlen($val); if ($fConf["conf_select_icons"] && $t == "select") { $icon = ', t3lib_extMgm::extRelPath(\'' . $extKey . '\').\'' . 'selicon_' . $id . '_' . $a . '.gif' . '\''; // Add wizard icon $this->addFileToFileArray("selicon_" . $id . "_" . $a . ".gif", t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter") . "res/wiz.gif")); } else { $icon = ""; } // $cItems[]='Array("'.str_replace("\\'","'",addslashes($this->getSplitLabels($fConf,"conf_select_item_".$a))).'", "'.addslashes($val).'"'.$icon.'),'; $cItems[] = 'array(\'' . addslashes($this->getSplitLabels_reference($fConf, "conf_select_item_" . $a, $table . "." . $fConf["fieldname"] . ".I." . $a)) . '\', \'' . addslashes($val) . '\'' . $icon . '),'; } $configL[] = trim($this->wrapBody(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_select_items]') . ' \'items\' => array( ', implode(chr(10), $cItems), ' ), ')); if ($fConf['conf_select_pro'] && $t == 'select') { $cN = $this->returnName($extKey, 'class', $id); $configL[] = '\'itemsProcFunc\' => \'' . $cN . '->main\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_select_pro]'); $classContent = $this->sPS('class ' . $cN . ' { /** * [Describe function...] * * @param [type] $$params: ... * @param [type] $pObj: ... * @return [type] ... */ function main(&$params,&$pObj) { /* debug(\'Hello World!\',1); debug(\'$params:\',1); debug($params); debug(\'$pObj:\',1); debug($pObj); */ // Adding an item! $params[\'items\'][] = array($pObj->sL(\'Added label by PHP function|Tilfjet Dansk tekst med PHP funktion\'), 999); // No return - the $params and $pObj variables are passed by reference, so just change content in then and it is passed back automatically... } } ', 0); $this->addFileToFileArray('class.' . $cN . '.php', $this->PHPclassFile($extKey, 'class.' . $cN . '.php', $classContent, 'Class/Function which manipulates the item-array for table/field ' . $id . '.')); $this->wizard->ext_tables[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_select_pro]:') . ' if (TYPO3_MODE === \'BE\') { include_once(t3lib_extMgm::extPath(\'' . $extKey . '\').\'' . 'class.' . $cN . '.php\'); } '); } $numberOfRelations = $version < 4006000 ? t3lib_div::intInRange($fConf['conf_relations'], 1, 100) : t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations'], 1, 100); if ($t == 'select') { if ($version < 4006000) { $configL[] = '\'size\' => ' . t3lib_div::intInRange($fConf['conf_relations_selsize'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_selsize]'); } else { $configL[] = '\'size\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations_selsize'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_selsize]'); } $configL[] = '\'maxitems\' => ' . $numberOfRelations . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations]'); } if ($numberOfRelations > 1 && $t == "select") { if ($numberOfRelations * 4 < 256) { $DBfields[] = $fConf["fieldname"] . " varchar(" . $numberOfRelations * 4 . ") DEFAULT '' NOT NULL,"; } else { $DBfields[] = $fConf["fieldname"] . " text,"; } } elseif ($notIntVal) { $varCharLn = $version < 4006000 ? t3lib_div::intInRange(max($len), 1) : t3lib_utility_Math::forceIntegerInRange(max($len), 1); $DBfields[] = $fConf["fieldname"] . " " . ($varCharLn > $this->wizard->charMaxLng ? 'var' : '') . "char(" . $varCharLn . ") DEFAULT '' NOT NULL,"; } else { $DBfields[] = $fConf["fieldname"] . ' int(11) DEFAULT \'0\' NOT NULL,'; } break; case 'rel': if ($fConf["conf_rel_type"] == "group") { $configL[] = '\'type\' => \'group\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_type]'); $configL[] = '\'internal_type\' => \'db\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_type]'); } else { $configL[] = '\'type\' => \'select\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_type]'); } if ($fConf["conf_rel_type"] != "group" && $fConf["conf_relations"] == 1 && $fConf["conf_rel_dummyitem"]) { $configL[] = trim($this->wrapBody(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_dummyitem]') . ' \'items\' => array( ', 'array(\'\', 0),', ' ), ')); } if (t3lib_div::inList("tt_content,fe_users,fe_groups", $fConf["conf_rel_table"])) { $this->wizard->EM_CONF_presets["dependencies"][] = "cms"; } if ($fConf["conf_rel_table"] == "_CUSTOM") { $fConf["conf_rel_table"] = $fConf["conf_custom_table_name"] ? $fConf["conf_custom_table_name"] : "NO_TABLE_NAME_AVAILABLE"; } if ($fConf["conf_rel_type"] == "group") { $configL[] = '\'allowed\' => \'' . ($fConf["conf_rel_table"] != "_ALL" ? $fConf["conf_rel_table"] : "*") . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_table]'); if ($fConf["conf_rel_table"] == "_ALL") { $configL[] = '\'prepend_tname\' => 1, ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_table]=_ALL'); } } else { switch ($fConf["conf_rel_type"]) { case "select_cur": $where = "AND " . $fConf["conf_rel_table"] . ".pid=###CURRENT_PID### "; break; case "select_root": $where = "AND " . $fConf["conf_rel_table"] . ".pid=###SITEROOT### "; break; case "select_storage": $where = "AND " . $fConf["conf_rel_table"] . ".pid=###STORAGE_PID### "; break; default: $where = ""; break; } $configL[] = '\'foreign_table\' => \'' . $fConf["conf_rel_table"] . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_table]'); $configL[] = '\'foreign_table_where\' => \'' . $where . 'ORDER BY ' . $fConf["conf_rel_table"] . '.uid\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_type]'); } if ($version < 4006000) { $configL[] = '\'size\' => ' . t3lib_div::intInRange($fConf['conf_relations_selsize'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_selsize]'); $configL[] = '\'minitems\' => 0,'; $configL[] = '\'maxitems\' => ' . t3lib_div::intInRange($fConf['conf_relations'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations]'); $confRelations = t3lib_div::intInRange($fConf['conf_relations'], 1, 100); } else { $configL[] = '\'size\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations_selsize'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_selsize]'); $configL[] = '\'minitems\' => 0,'; $configL[] = '\'maxitems\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations]'); $confRelations = t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations'], 1, 100); } if ($fConf["conf_relations_mm"]) { $mmTableName = $id . "_mm"; $configL[] = '"MM" => "' . $mmTableName . '", ' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_mm]'); $DBfields[] = $fConf["fieldname"] . ' int(11) DEFAULT \'0\' NOT NULL,'; $createTable = $this->sPS("\n\t\t\t\t\t\t#\n\t\t\t\t\t\t# Table structure for table '" . $mmTableName . "'\n\t\t\t\t\t\t# " . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_mm]') . "\n\t\t\t\t\t\t#\n\t\t\t\t\t\tCREATE TABLE " . $mmTableName . " (\n\t\t\t\t\t\t uid_local int(11) DEFAULT '0' NOT NULL,\n\t\t\t\t\t\t uid_foreign int(11) DEFAULT '0' NOT NULL,\n\t\t\t\t\t\t tablenames varchar(30) DEFAULT '' NOT NULL,\n\t\t\t\t\t\t sorting int(11) DEFAULT '0' NOT NULL,\n\t\t\t\t\t\t KEY uid_local (uid_local),\n\t\t\t\t\t\t KEY uid_foreign (uid_foreign)\n\t\t\t\t\t\t);\n\t\t\t\t\t"); $this->wizard->ext_tables_sql[] = chr(10) . $createTable . chr(10); } elseif ($confRelations > 1 || $fConf["conf_rel_type"] == "group") { $DBfields[] = $fConf["fieldname"] . " text,"; } else { $DBfields[] = $fConf["fieldname"] . ' int(11) DEFAULT \'0\' NOT NULL,'; } if ($fConf["conf_rel_type"] != "group") { $wTable = $fConf["conf_rel_table"]; $wizards = array(); if ($fConf["conf_wiz_addrec"]) { $wizards[] = trim($this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_addrec]') . ' \'add\' => array( \'type\' => \'script\', \'title\' => \'Create new record\', \'icon\' => \'add.gif\', \'params\' => array( \'table\' => \'' . $wTable . '\', \'pid\' => \'###CURRENT_PID###\', \'setValue\' => \'prepend\' ), \'script\' => \'wizard_add.php\', ), ')); } if ($fConf["conf_wiz_listrec"]) { $wizards[] = trim($this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_listrec]') . ' \'list\' => array( \'type\' => \'script\', \'title\' => \'List\', \'icon\' => \'list.gif\', \'params\' => array( \'table\' => \'' . $wTable . '\', \'pid\' => \'###CURRENT_PID###\', ), \'script\' => \'wizard_list.php\', ), ')); } if ($fConf["conf_wiz_editrec"]) { $wizards[] = trim($this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_editrec]') . ' \'edit\' => array( \'type\' => \'popup\', \'title\' => \'Edit\', \'script\' => \'wizard_edit.php\', \'popup_onlyOpenIfSelected\' => 1, \'icon\' => \'edit2.gif\', \'JSopenParams\' => \'height=350,width=580,status=0,menubar=0,scrollbars=1\', ), ')); } if (count($wizards)) { $configL[] = trim($this->wrapBody(' \'wizards\' => array( \'_PADDING\' => 2, \'_VERTICAL\' => 1, ', implode(chr(10), $wizards), ' ), ')); } } break; case "files": $configL[] = '\'type\' => \'group\','; $configL[] = '\'internal_type\' => \'file\','; switch ($fConf["conf_files_type"]) { case "images": $configL[] = '\'allowed\' => $GLOBALS[\'TYPO3_CONF_VARS\'][\'GFX\'][\'imagefile_ext\'], ' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_type]'); break; case "webimages": $configL[] = '\'allowed\' => \'gif,png,jpeg,jpg\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_type]'); // TODO use web images definition from install tool break; case "all": $configL[] = '\'allowed\' => \'\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_type]'); $configL[] = '\'disallowed\' => \'php,php3\', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_type]'); break; } $configL[] = '\'max_size\' => $GLOBALS[\'TYPO3_CONF_VARS\'][\'BE\'][\'maxFileSize\'], ' . $this->WOPcomment('WOP:' . $WOP . '[conf_max_filesize]'); $this->wizard->EM_CONF_presets["uploadfolder"] = 1; $ulFolder = 'uploads/tx_' . str_replace("_", "", $extKey); $configL[] = '\'uploadfolder\' => \'' . $ulFolder . '\','; if ($fConf['conf_files_thumbs']) { $configL[] = '\'show_thumbs\' => 1, ' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_thumbs]'); } if ($version < 4006000) { $configL[] = '\'size\' => ' . t3lib_div::intInRange($fConf['conf_files_selsize'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_selsize]'); $configL[] = '\'minitems\' => 0,'; $configL[] = '\'maxitems\' => ' . t3lib_div::intInRange($fConf['conf_files'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_files]'); } else { $configL[] = '\'size\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_files_selsize'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_selsize]'); $configL[] = '\'minitems\' => 0,'; $configL[] = '\'maxitems\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_files'], 1, 100) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[conf_files]'); } $DBfields[] = $fConf["fieldname"] . " text,"; break; case 'flex': $DBfields[] = $fConf['fieldname'] . ' mediumtext,'; $configL[] = trim($this->sPS(' \'type\' => \'flex\', \'ds\' => array( \'default\' => \'FILE:EXT:' . $extKey . '/flexform_' . $table . '_' . $fConf['fieldname'] . '.xml\', ), ')); $this->addFileToFileArray('flexform_' . $table . '_' . $fConf['fieldname'] . '.xml', $this->createFlexForm()); break; case "none": $DBfields[] = $fConf["fieldname"] . " tinytext,"; $configL[] = trim($this->sPS(' \'type\' => \'none\', ')); break; case "passthrough": $DBfields[] = $fConf["fieldname"] . " tinytext,"; $configL[] = trim($this->sPS(' \'type\' => \'passthrough\', ')); break; case 'inline': #$DBfields=$this->getInlineDBfields($fConf); if ($DBfields) { $DBfields = array_merge($DBfields, $this->getInlineDBfields($table, $fConf)); } $configL = $this->getInlineTCAconfig($table, $fConf); break; default: debug("Unknown type: " . (string) $fConf["type"]); break; } if ($t == "passthrough") { $columns[$fConf["fieldname"]] = trim($this->wrapBody(' \'' . $fConf["fieldname"] . '\' => array( ' . $this->WOPcomment('WOP:' . $WOP . '[fieldname]') . ' \'config\' => array( ', implode(chr(10), $configL), ' ) ), ', 2)); } else { $columns[$fConf["fieldname"]] = trim($this->wrapBody(' \'' . $fConf["fieldname"] . '\' => array( ' . $this->WOPcomment('WOP:' . $WOP . '[fieldname]') . ' \'exclude\' => ' . ($fConf["excludeField"] ? 1 : 0) . ', ' . $this->WOPcomment('WOP:' . $WOP . '[excludeField]') . ' \'label\' => \'' . addslashes($this->getSplitLabels_reference($fConf, "title", $table . "." . $fConf["fieldname"])) . '\', ' . $this->WOPcomment('WOP:' . $WOP . '[title]') . ' \'config\' => array( ', implode(chr(10), $configL), ' ) ), ', 2)); } }
/** * Proprocesses field array based on field type. Some fields must be adjusted * before going to database. This is done on the copy of the field array because * original values are used in remap action later. * * @param string $table Table name * @param array $fieldArray Field array to check * @return array Updated field array */ function insertUpdateDB_preprocessBasedOnFieldType($table, $fieldArray) { global $TCA; $result = $fieldArray; foreach ($fieldArray as $field => $value) { switch ($TCA[$table]['columns'][$field]['config']['type']) { case 'inline': if ($TCA[$table]['columns'][$field]['config']['foreign_field']) { if (!t3lib_div::testInt($value)) { $result[$field] = count(t3lib_div::trimExplode(',', $value, TRUE)); } } break; } } return $result; }
/** * Outputting the accumulated content to screen * * @return void */ function printContent() { $content = ''; $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); if ($this->editPage && $this->isAjaxCall) { $data = array(); // edit page if ($this->theEditRec['uid']) { $data['type'] = 'page'; $data['editRecord'] = $this->theEditRec['uid']; } // edit alternative table/uid if (count($this->alternativeTableUid) == 2 && isset($GLOBALS['TCA'][$this->alternativeTableUid[0]]) && t3lib_div::testInt($this->alternativeTableUid[1])) { $data['type'] = 'alternative'; $data['alternativeTable'] = $this->alternativeTableUid[0]; $data['alternativeUid'] = $this->alternativeTableUid[1]; } // search for something else if ($this->searchFor) { $data['type'] = 'search'; $data['firstMountPoint'] = intval($GLOBALS['WEBMOUNTS'][0]); $data['searchFor'] = rawurlencode($this->searchFor); } $content = json_encode($data); header('Content-type: application/json; charset=utf-8'); header('X-JSON: ' . $content); } else { $content = $this->content; } echo $content; }
/** * Renders the display of Template Objects. * * @return void */ function renderTO() { if (intval($this->displayUid) > 0) { $row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj', $this->displayUid); if (is_array($row)) { $tRows = array(); $tRows[] = ' <tr class="bgColor5"> <td colspan="2"><strong>Template Object Details:</strong>' . $this->cshItem('xMOD_tx_templavoila', 'mapping_to', $this->doc->backPath, '') . '</td> </tr>'; // Get title and icon: $icon = t3lib_iconworks::getIconImage('tx_templavoila_tmplobj', $row, $GLOBALS['BACK_PATH'], ' align="top" title="UID: ' . $this->displayUid . '"'); $title = t3lib_BEfunc::getRecordTitle('tx_templavoila_tmplobj', $row, 1); $tRows[] = ' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('templateObject') . ':</td> <td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_tmplobj', $row['uid'], 1) . $title . '</td> </tr>'; // Find the file: $theFile = t3lib_div::getFileAbsFileName($row['fileref'], 1); if ($theFile && @is_file($theFile)) { $relFilePath = substr($theFile, strlen(PATH_site)); $onCl = 'return top.openUrlInWindow(\'' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $relFilePath . '\',\'FileView\');'; $tRows[] = ' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('templateFile') . ':</td> <td><a href="#" onclick="' . htmlspecialchars($onCl) . '">' . htmlspecialchars($relFilePath) . '</a></td> </tr>'; // Finding Data Structure Record: $DSOfile = ''; $dsValue = $row['datastructure']; if ($row['parent']) { $parentRec = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj', $row['parent'], 'datastructure'); $dsValue = $parentRec['datastructure']; } if (t3lib_div::testInt($dsValue)) { $DS_row = t3lib_BEfunc::getRecordWSOL('tx_templavoila_datastructure', $dsValue); } else { $DSOfile = t3lib_div::getFileAbsFileName($dsValue); } if (is_array($DS_row) || @is_file($DSOfile)) { // Get main DS array: if (is_array($DS_row)) { // Get title and icon: $icon = t3lib_iconworks::getIconImage('tx_templavoila_datastructure', $DS_row, $GLOBALS['BACK_PATH'], ' align="top" title="UID: ' . $DS_row['uid'] . '"'); $title = t3lib_BEfunc::getRecordTitle('tx_templavoila_datastructure', $DS_row, 1); $tRows[] = ' <tr class="bgColor4"> <td>Data Structure Record:</td> <td>' . $this->doc->wrapClickMenuOnIcon($icon, 'tx_templavoila_datastructure', $DS_row['uid'], 1) . $title . '</td> </tr>'; // Link to updating DS/TO: $onCl = 'index.php?file=' . rawurlencode($theFile) . '&_load_ds_xml=1&_load_ds_xml_to=' . $row['uid']; $onClMsg = ' if (confirm(unescape(\'' . rawurlencode('Warning: You should only modify Data Structures and Template Objects which have not been manually edited.' . chr(10) . 'You risk that manual changes will be removed without further notice!') . '\'))) { document.location=\'' . $onCl . '\'; } return false; '; $tRows[] = ' <tr class="bgColor4"> <td> </td> <td><input type="submit" name="_" value="Modify DS / TO" onclick="' . htmlspecialchars($onClMsg) . '"/>' . $this->cshItem('xMOD_tx_templavoila', 'mapping_to_modifyDSTO', $this->doc->backPath, '') . '</td> </tr>'; // Read Data Structure: $dataStruct = $this->getDataStructFromDSO($DS_row['dataprot']); } else { // Show filepath of external XML file: $relFilePath = substr($DSOfile, strlen(PATH_site)); $onCl = 'return top.openUrlInWindow(\'' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $relFilePath . '\',\'FileView\');'; $tRows[] = ' <tr class="bgColor4"> <td>Data Structure File:</td> <td><a href="#" onclick="' . htmlspecialchars($onCl) . '">' . htmlspecialchars($relFilePath) . '</a></td> </tr>'; // Read Data Structure: $dataStruct = $this->getDataStructFromDSO('', $DSOfile); } // Write header of page: $content .= ' <!-- Template Object Header: --> <h3>Template Object Information:</h3> <table border="0" cellpadding="2" cellspacing="1" id="c-toHeader"> ' . implode('', $tRows) . ' </table> '; // If there is a valid data structure, draw table: if (is_array($dataStruct)) { // Working on Header and Body of HTML source: // -- Processing the header editing -- list($editContent, $currentHeaderMappingInfo) = $this->renderTO_editProcessing($dataStruct, $row, $theFile, 1); // Determine if DS is a template record and if it is a page template: $showBodyTag = !is_array($DS_row) || $DS_row['scope'] == 1 ? TRUE : FALSE; $parts = array(); $parts[] = array('label' => $GLOBALS['LANG']->getLL('tabTODetails'), 'content' => $content); // -- Processing the head editing $headerContent .= ' <!-- HTML header parts selection: --> <h3>' . $GLOBALS['LANG']->getLL('mappingHeadParts') . ': ' . $this->cshItem('xMOD_tx_templavoila', 'mapping_to_headerParts', $this->doc->backPath, '') . '</h3> ' . $this->renderHeaderSelection($theFile, $currentHeaderMappingInfo, $showBodyTag, $editContent); $parts[] = array('label' => $GLOBALS['LANG']->getLL('tabHeadParts'), 'content' => $headerContent); // -- Processing the body editing -- list($editContent, $currentMappingInfo) = $this->renderTO_editProcessing($dataStruct, $row, $theFile, 0); $bodyContent .= ' <!-- Data Structure mapping table: --> <h3>' . $GLOBALS['LANG']->getLL('mappingBodyParts') . ':</h3> ' . $this->renderTemplateMapper($theFile, $this->displayPath, $dataStruct, $currentMappingInfo, $editContent); $parts[] = array('label' => $GLOBALS['LANG']->getLL('tabBodyParts'), 'content' => $bodyContent); } else { $content .= $GLOBALS['LANG']->getLL('error') . ': No Data Structure Record could be found with UID "' . $dsValue . '"'; } } else { $content .= $GLOBALS['LANG']->getLL('error') . ': No Data Structure Record could be found with UID "' . $dsValue . '"'; } } else { $content .= $GLOBALS['LANG']->getLL('error') . ': The file "' . $row['fileref'] . '" could not be found!'; } } else { $content .= $GLOBALS['LANG']->getLL('error') . ': No Template Object Record with the UID ' . $this->displayUid; } $parts[0]['content'] = $content; } else { $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('templateObject') . ' ' . $GLOBALS['LANG']->getLL('error'), $GLOBALS['LANG']->getLL('errorNoUidFound'), 0, 1, 3); } // show tab menu if (is_array($parts)) { $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('mappingTitle'), '' . $this->doc->getDynTabMenu($parts, 'TEMPLAVOILA:templateModule:' . $this->id, 0, 0, 300), 0, 1); } }
// ! WILL INCLUDE deleted mount pages as well! $FILEMOUNTS = $BE_USER->returnFilemounts(); // ******************************* // $GLOBALS['LANG'] initialisation // ******************************* $GLOBALS['LANG'] = t3lib_div::makeInstance('language'); $GLOBALS['LANG']->init($BE_USER->uc['lang']); // **************** // CLI processing // **************** if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) { // Status output: if (!strcmp($_SERVER['argv'][1], 'status')) { echo "Status of TYPO3 CLI script:\n\n"; echo "Username [uid]: " . $BE_USER->user['username'] . " [" . $BE_USER->user['uid'] . "]\n"; echo "Database: " . TYPO3_db . LF; echo "PATH_site: " . PATH_site . LF; echo LF; exit; } } // **************** // compression // **************** ob_clean(); if (extension_loaded('zlib') && $TYPO3_CONF_VARS['BE']['compressionLevel']) { if (t3lib_div::testInt($TYPO3_CONF_VARS['BE']['compressionLevel'])) { @ini_set('zlib.output_compression_level', $TYPO3_CONF_VARS['BE']['compressionLevel']); } ob_start('ob_gzhandler'); }
function main() { global $SOBE, $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; global $tmpl, $tplRow, $theConstants; // ************************** // Create extension template // ************************** $this->pObj->createTemplate($this->pObj->id); // ************************** // Checking for more than one template an if, set a menu... // ************************** $manyTemplatesMenu = $this->pObj->templateMenu(); $template_uid = 0; if ($manyTemplatesMenu) { $template_uid = $this->pObj->MOD_SETTINGS["templatesOnPage"]; } // ************************** // Main // ************************** // BUGBUG: Should we check if the uset may at all read and write template-records??? $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); // initialize if ($existTemplate) { $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']; // Update template ? if (t3lib_div::_POST('submit') || t3lib_div::testInt(t3lib_div::_POST('submit_x')) && t3lib_div::testInt(t3lib_div::_POST('submit_y'))) { $tmpl->changed = 0; $tmpl->ext_procesInput(t3lib_div::_POST(), $_FILES, $theConstants, $tplRow); // debug($tmpl->changed); // debug($tmpl->raw); // $tmpl->changed=0; if ($tmpl->changed) { // Set the data to be saved $recData = array(); $recData["sys_template"][$saveId]["constants"] = implode($tmpl->raw, LF); // Create new tce-object $tce = t3lib_div::makeInstance("t3lib_TCEmain"); $tce->stripslashes_values = 0; // Initialize $tce->start($recData, array()); // Saved the stuff $tce->process_datamap(); // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php) $tce->clear_cacheCmd("all"); // re-read the template ... $this->initialize_editor($this->pObj->id, $template_uid); } } // Output edit form $tmpl->ext_readDirResources($TYPO3_CONF_VARS["MODS"]["web_ts"]["onlineResourceDir"]); $tmpl->ext_resourceDims(); // Resetting the menu (start). I wonder if this in any way is a violation of the menu-system. Haven't checked. But need to do it here, because the menu is dependent on the categories available. $this->pObj->MOD_MENU["constant_editor_cat"] = $tmpl->ext_getCategoryLabelArray(); $this->pObj->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->pObj->MOD_MENU, t3lib_div::_GP("SET"), $this->pObj->MCONF["name"]); // Resetting the menu (stop) $theOutput .= $this->pObj->doc->spacer(5); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editConstants', true), t3lib_iconWorks::getSpriteIconForRecord('sys_template', $tplRow) . '<strong>' . $this->pObj->linkWrapTemplateTitle($tplRow["title"], "constants") . '</strong>' . htmlspecialchars(trim($tplRow["sitetitle"]) ? ' - (' . $tplRow["sitetitle"] . ')' : ''), 0, 1); if ($manyTemplatesMenu) { $theOutput .= $this->pObj->doc->section("", $manyTemplatesMenu); $theOutput .= $this->pObj->doc->divider(5); } $theOutput .= $this->pObj->doc->spacer(5); if (count($this->pObj->MOD_MENU["constant_editor_cat"])) { $menu = $GLOBALS['LANG']->getLL('category', true) . " " . t3lib_BEfunc::getFuncMenu($this->pObj->id, "SET[constant_editor_cat]", $this->pObj->MOD_SETTINGS["constant_editor_cat"], $this->pObj->MOD_MENU["constant_editor_cat"]); $theOutput .= $this->pObj->doc->section("", '<NOBR>' . $menu . '</NOBR>'); } else { $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('noConstants', true), $GLOBALS['LANG']->getLL('noConstantsDescription', true), 1, 0, 1); } // Category and constant editor config: $category = $this->pObj->MOD_SETTINGS["constant_editor_cat"]; /* $TSCE_tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext"); // Defined global here! $TSCE_tmpl->tt_track = 0; // Do not log time-performance information $TSCE_tmpl->init(); $TSCE_tmpl->constants=array($tplRow["constants"]); debug($tplRow); $TSCE_tmpl->generateConfig_constants(); debug($TSCE_tmpl->setup); */ $tmpl->ext_getTSCE_config($category); # NOT WORKING: if ($BE_USER_modOptions["properties"]["constantEditor."]["example"] == "top") { $theOutput = $this->displayExample($theOutput); } $printFields = trim($tmpl->ext_printFields($theConstants, $category)); if ($printFields) { $theOutput .= $this->pObj->doc->spacer(20); $theOutput .= $this->pObj->doc->section("", $printFields); } if ($BE_USER_modOptions["properties"]["constantEditor."]["example"] != "top") { $theOutput = $this->displayExample($theOutput); } } else { $theOutput .= $this->pObj->noTemplate(1); } return $theOutput; }