/** * Main function, returning the HTML content of the module * * @return string HTML */ function main() { $content = ''; $content .= '<br />Update the Static Info Tables with new language labels.'; $content .= '<br />'; if (t3lib_div::_GP('import')) { $destEncoding = t3lib_div::_GP('dest_encoding'); $extPath = t3lib_extMgm::extPath('static_info_tables_it'); $fileContent = explode("\n", t3lib_div::getUrl($extPath . 'ext_tables_static_update.sql')); foreach ($fileContent as $line) { if ($line = trim($line) and preg_match('#^UPDATE#i', $line)) { $query = $this->getUpdateEncoded($line, $destEncoding); $res = $GLOBALS['TYPO3_DB']->admin_query($query); } } $content .= '<br />'; $content .= '<p>Encoding: ' . htmlspecialchars($destEncoding) . '</p>'; $content .= '<p>Done.</p>'; } elseif (t3lib_extMgm::isLoaded('static_info_tables_it')) { $content .= '</form>'; $content .= '<form action="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" method="post">'; $content .= '<br />Destination character encoding:'; $content .= '<br />' . tx_staticinfotables_encoding::getEncodingSelect('dest_encoding', '', 'utf-8'); $content .= '<br />(The character encoding must match the encoding of the existing tables data. By default this is UTF-8.)'; $content .= '<br /><br />'; $content .= '<input type="submit" name="import" value="Import" />'; $content .= '</form>'; } else { $content .= '<br /><strong>The extension needs to be installed first!</strong>'; } return $content; }
/** * Get Address from geo coordinates * * @param float $lat * @param float $lng * @return array all location infos * ['street_number'] = 12; * ['route'] = 'Kunstmuehlstr.'; * ['locality'] = 'Rosenheim'; * ['country'] = 'Germany'; * ['postal_code'] = '83026'; */ protected function getAddressFromGeo($lat, $lng) { $result = array(); $json = t3lib_div::getUrl('https://maps.googleapis.com/maps/api/geocode/json?sensor=false®ion=de&latlng=' . urlencode($lat . ',' . $lng)); $jsonDecoded = json_decode($json, true); if (!empty($jsonDecoded['results'])) { foreach ((array) $jsonDecoded['results'][0]['address_components'] as $values) { $result[$values['types'][0]] = $values['long_name']; } } return $result; }
function parseAndCheckXMLFile() { global $LANG; $fileContent = t3lib_div::getUrl($this->file); $this->xmlNodes = t3lib_div::xml2tree(str_replace(' ', ' ', $fileContent), 3); // For some reason PHP chokes on incoming in XML! if (!is_array($this->xmlNodes)) { $this->_errorMsg[] = $LANG->getLL('import.manager.error.parsing.xml2tree.message') . $this->xmlNodes; return false; } $headerInformationNodes = $this->xmlNodes['TYPO3L10N'][0]['ch']['head'][0]['ch']; if (!is_array($headerInformationNodes)) { $this->_errorMsg[] = $LANG->getLL('import.manager.error.missing.head.message'); return false; } $this->_setHeaderData($headerInformationNodes); if ($this->_isIncorrectXMLFile()) { return false; } }
/** * Manipulating the input array, $params, adding new selectorbox items. * * @param array array of select field options (reference) * @param object parent object (reference) * @return void */ function main(&$params, &$pObj) { // get the current page ID $thePageId = $params['row']['pid']; $template = t3lib_div::makeInstance('t3lib_tsparser_ext'); // do not log time-performance information $template->tt_track = 0; $template->init(); $sys_page = t3lib_div::makeInstance('t3lib_pageSelect'); $rootLine = $sys_page->getRootLine($thePageId); // generate the constants/config + hierarchy info for the template. $template->runThroughTemplates($rootLine); $template->generateConfig(); // get value for the path containing the template files $readPath = t3lib_div::getFileAbsFileName($template->setup['plugin.']['tx_ttaddress_pi1.']['templatePath']); // if that direcotry is valid and is a directory then select files in it if (@is_dir($readPath)) { $template_files = t3lib_div::getFilesInDir($readPath, 'tmpl,html,htm', 1, 1); $parseHTML = t3lib_div::makeInstance('t3lib_parseHTML'); foreach ($template_files as $htmlFilePath) { // reset vars $selectorBoxItem_title = ''; $selectorBoxItem_icon = ''; // read template content $content = t3lib_div::getUrl($htmlFilePath); // ... and extract content of the title-tags $parts = $parseHTML->splitIntoBlock('title', $content); $titleTagContent = $parseHTML->removeFirstAndLastTag($parts[1]); // set the item label $selectorBoxItem_title = trim($titleTagContent . ' (' . basename($htmlFilePath) . ')'); // try to look up an image icon for the template $fI = t3lib_div::split_fileref($htmlFilePath); $testImageFilename = $readPath . $fI['filebody'] . '.gif'; if (@is_file($testImageFilename)) { $selectorBoxItem_icon = '../' . substr($testImageFilename, strlen(PATH_site)); } // finally add the new item $params['items'][] = array($selectorBoxItem_title, basename($htmlFilePath), $selectorBoxItem_icon); } } }
function getTemplateHtml() { if ($this->sTemplateHtml === FALSE) { $mHtml = ""; $sPath = $this->getTemplatePath(); if (!empty($sPath)) { if (!file_exists($sPath)) { $this->oForm->mayday("RENDERER TEMPLATE - Template file does not exist <b>" . $sPath . "</b>"); } if (($sSubpart = $this->getTemplateSubpart()) !== FALSE) { $mHtml = t3lib_parsehtml::getSubpart(t3lib_div::getUrl($sPath), $sSubpart); if (trim($mHtml) == "") { $this->oForm->mayday("RENDERER TEMPLATE - The given template <b>'" . $sPath . "'</b> with subpart marker " . $sSubpart . " <b>returned an empty string</b> - Check your template"); } } else { $mHtml = t3lib_div::getUrl($sPath); if (trim($mHtml) == "") { $this->oForm->mayday("RENDERER TEMPLATE - The given template <b>'" . $sPath . "'</b> with no subpart marker <b>returned an empty string</b> - Check your template"); } } } elseif (($mHtml = $this->_navConf("/html")) !== FALSE) { if (is_array($mHtml)) { if (tx_ameosformidable::isRunneable($mHtml)) { $mHtml = $this->callRunneable($mHtml); } else { $mHtml = $mHtml["__value"]; } } if (trim($mHtml) == "") { $this->oForm->mayday("RENDERER TEMPLATE - The given <b>/html</b> provides an empty string</b> - Check your template"); } } else { $this->oForm->mayday("RENDERER TEMPLATE - You have to provide either <b>/template/path</b> or <b>/html</b>"); } $this->sTemplateHtml = $mHtml; } return $this->sTemplateHtml; }
/** * This is the main method that is called when a task is executed * It MUST be implemented by all classes inheriting from this one * Note that there is no error handling, errors and failures are expected * to be handled and logged by the client implementations. * Should return true on successful execution, false on error. * * @return boolean Returns true on successful execution, false on error */ public function execute() { $success = false; $this->init(); $content = t3lib_div::getUrl($this->config['masterUrl']); if ($content) { $response = json_decode($content, true); if ($response['success']) { $key = $this->config['preSharedKey']; $encrypted = $response['data']; $data = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), ""); $records = json_decode($data, true); if (count($records)) { $this->synchronizeUsers($records); $success = true; } else { t3lib_div::sysLog('No users to be synchronized', self::$extKey, 3); } } else { t3lib_div::sysLog($response['errors'][0], self::$extKey, 3); } } return $success; }
/** * Index External URLs HTML content * * @param string URL, eg. "http://typo3.org/" * @return void * @see indexRegularDocument() */ function indexExternalUrl($externalUrl) { // Parse External URL: $qParts = parse_url($externalUrl); $fI = pathinfo($qParts['path']); $ext = strtolower($fI['extension']); // Get headers: $urlHeaders = $this->getUrlHeaders($externalUrl); if (stristr($urlHeaders['Content-Type'], 'text/html')) { $content = $this->indexExternalUrl_content = t3lib_div::getUrl($externalUrl); if (strlen($content)) { // Create temporary file: $tmpFile = t3lib_div::tempnam('EXTERNAL_URL'); if ($tmpFile) { t3lib_div::writeFile($tmpFile, $content); // Index that file: $this->indexRegularDocument($externalUrl, TRUE, $tmpFile, 'html'); // Using "TRUE" for second parameter to force indexing of external URLs (mtime doesn't make sense, does it?) unlink($tmpFile); } } } }
/** * Checks the input string (un-parsed TypoScript) for include-commands ("<INCLUDE_TYPOSCRIPT: ....") * Use: t3lib_TSparser::checkIncludeLines() * * @param string Unparsed TypoScript * @param integer Counter for detecting endless loops * @param boolean When set an array containing the resulting typoscript and all included files will get returned * @return string Complete TypoScript with includes added. * @static */ function checkIncludeLines($string, $cycle_counter = 1, $returnFiles = false) { $includedFiles = array(); if ($cycle_counter > 100) { t3lib_div::sysLog('It appears like TypoScript code is looping over itself. Check your templates for "<INCLUDE_TYPOSCRIPT: ..." tags', 'Core', 2); if ($returnFiles) { return array('typoscript' => '', 'files' => $includedFiles); } return ''; } $splitStr = '<INCLUDE_TYPOSCRIPT:'; if (strstr($string, $splitStr)) { $newString = ''; $allParts = explode($splitStr, LF . $string . LF); // adds line break char before/after foreach ($allParts as $c => $v) { if (!$c) { // first goes through $newString .= $v; } elseif (preg_match('/\\r?\\n\\s*$/', $allParts[$c - 1])) { // There must be a line-break char before. $subparts = explode('>', $v, 2); if (preg_match('/^\\s*\\r?\\n/', $subparts[1])) { // There must be a line-break char after // SO, the include was positively recognized: $newString .= '### ' . $splitStr . $subparts[0] . '> BEGIN:' . LF; $params = t3lib_div::get_tag_attributes($subparts[0]); if ($params['source']) { $sourceParts = explode(':', $params['source'], 2); switch (strtolower(trim($sourceParts[0]))) { case 'file': $filename = t3lib_div::getFileAbsFileName(trim($sourceParts[1])); if (strcmp($filename, '')) { // Must exist and must not contain '..' and must be relative if (@is_file($filename) && filesize($filename) < 100000) { // Max. 100 KB include files! // check for includes in included text $includedFiles[] = $filename; $included_text = self::checkIncludeLines(t3lib_div::getUrl($filename), $cycle_counter + 1, $returnFiles); // If the method also has to return all included files, merge currently included // files with files included by recursively calling itself if ($returnFiles && is_array($included_text)) { $includedFiles = array_merge($includedFiles, $included_text['files']); $included_text = $included_text['typoscript']; } $newString .= $included_text . LF; } } break; } } $newString .= '### ' . $splitStr . $subparts[0] . '> END:' . LF; $newString .= $subparts[1]; } else { $newString .= $splitStr . $v; } } else { $newString .= $splitStr . $v; } } $string = substr($newString, 1, -1); // not the first/last linebreak char. } // When all included files should get returned, simply return an compound array containing // the TypoScript with all "includes" processed and the files which got included if ($returnFiles) { return array('typoscript' => $string, 'files' => $includedFiles); } return $string; }
/** * Reads the content of an external file being indexed. * * @param string File extension, eg. "pdf", "doc" etc. * @param string Absolute filename of file (must exist and be validated OK before calling function) * @param string Pointer to section (zero for all other than PDF which will have an indication of pages into which the document should be splitted.) * @return array Standard content array (title, description, keywords, body keys) */ function readFileContent($ext, $absFile, $cPKey) { unset($contentArr); // Return immediately if initialization didn't set support up: if (!$this->supportedExtensions[$ext]) { return FALSE; } // Switch by file extension switch ($ext) { case 'pdf': if ($this->app['pdfinfo']) { // Getting pdf-info: $cmd = $this->app['pdfinfo'] . ' ' . escapeshellarg($absFile); exec($cmd, $res); $pdfInfo = $this->splitPdfInfo($res); unset($res); if (intval($pdfInfo['pages'])) { list($low, $high) = explode('-', $cPKey); // Get pdf content: $tempFileName = t3lib_div::tempnam('Typo3_indexer'); // Create temporary name @unlink($tempFileName); // Delete if exists, just to be safe. $cmd = $this->app['pdftotext'] . ' -f ' . $low . ' -l ' . $high . ' -enc UTF-8 -q ' . escapeshellarg($absFile) . ' ' . $tempFileName; exec($cmd); if (@is_file($tempFileName)) { $content = t3lib_div::getUrl($tempFileName); unlink($tempFileName); } else { $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:pdfToolsFailed'), $absFile), 2); } if (strlen($content)) { $contentArr = $this->pObj->splitRegularContent($this->removeEndJunk($content)); } } } break; case 'doc': if ($this->app['catdoc']) { $cmd = $this->app['catdoc'] . ' -d utf-8 ' . escapeshellarg($absFile); exec($cmd, $res); $content = implode(LF, $res); unset($res); $contentArr = $this->pObj->splitRegularContent($this->removeEndJunk($content)); } break; case 'pps': case 'ppt': if ($this->app['ppthtml']) { $cmd = $this->app['ppthtml'] . ' ' . escapeshellarg($absFile); exec($cmd, $res); $content = implode(LF, $res); unset($res); $content = $this->pObj->convertHTMLToUtf8($content); $contentArr = $this->pObj->splitHTMLContent($this->removeEndJunk($content)); $contentArr['title'] = basename($absFile); // Make sure the title doesn't expose the absolute path! } break; case 'xls': if ($this->app['xlhtml']) { $cmd = $this->app['xlhtml'] . ' -nc -te ' . escapeshellarg($absFile); exec($cmd, $res); $content = implode(LF, $res); unset($res); $content = $this->pObj->convertHTMLToUtf8($content); $contentArr = $this->pObj->splitHTMLContent($this->removeEndJunk($content)); $contentArr['title'] = basename($absFile); // Make sure the title doesn't expose the absolute path! } break; case 'sxi': case 'sxc': case 'sxw': case 'ods': case 'odp': case 'odt': if ($this->app['unzip']) { // Read content.xml: $cmd = $this->app['unzip'] . ' -p ' . escapeshellarg($absFile) . ' content.xml'; exec($cmd, $res); $content_xml = implode(LF, $res); unset($res); // Read meta.xml: $cmd = $this->app['unzip'] . ' -p ' . escapeshellarg($absFile) . ' meta.xml'; exec($cmd, $res); $meta_xml = implode(LF, $res); unset($res); $utf8_content = trim(strip_tags(str_replace('<', ' <', $content_xml))); $contentArr = $this->pObj->splitRegularContent($utf8_content); $contentArr['title'] = basename($absFile); // Make sure the title doesn't expose the absolute path! // Meta information $metaContent = t3lib_div::xml2tree($meta_xml); $metaContent = $metaContent['office:document-meta'][0]['ch']['office:meta'][0]['ch']; if (is_array($metaContent)) { $contentArr['title'] = $metaContent['dc:title'][0]['values'][0] ? $metaContent['dc:title'][0]['values'][0] : $contentArr['title']; $contentArr['description'] = $metaContent['dc:subject'][0]['values'][0] . ' ' . $metaContent['dc:description'][0]['values'][0]; // Keywords collected: if (is_array($metaContent['meta:keywords'][0]['ch']['meta:keyword'])) { foreach ($metaContent['meta:keywords'][0]['ch']['meta:keyword'] as $kwDat) { $contentArr['keywords'] .= $kwDat['values'][0] . ' '; } } } } break; case 'rtf': if ($this->app['unrtf']) { $cmd = $this->app['unrtf'] . ' ' . escapeshellarg($absFile); exec($cmd, $res); $fileContent = implode(LF, $res); unset($res); $fileContent = $this->pObj->convertHTMLToUtf8($fileContent); $contentArr = $this->pObj->splitHTMLContent($fileContent); } break; case 'txt': case 'csv': // Raw text $content = t3lib_div::getUrl($absFile); // TODO: Auto-registration of charset???? -> utf-8 (Current assuming western europe...) $content = $this->pObj->convertHTMLToUtf8($content, 'iso-8859-1'); $contentArr = $this->pObj->splitRegularContent($content); $contentArr['title'] = basename($absFile); // Make sure the title doesn't expose the absolute path! break; case 'html': case 'htm': $fileContent = t3lib_div::getUrl($absFile); $fileContent = $this->pObj->convertHTMLToUtf8($fileContent); $contentArr = $this->pObj->splitHTMLContent($fileContent); break; case 'xml': // PHP strip-tags() $fileContent = t3lib_div::getUrl($absFile); // Finding charset: preg_match('/^[[:space:]]*<\\?xml[^>]+encoding[[:space:]]*=[[:space:]]*["\'][[:space:]]*([[:alnum:]_-]+)[[:space:]]*["\']/i', substr($fileContent, 0, 200), $reg); $charset = $reg[1] ? $this->pObj->csObj->parse_charset($reg[1]) : 'utf-8'; // Converting content: $fileContent = $this->pObj->convertHTMLToUtf8(strip_tags(str_replace('<', ' <', $fileContent)), $charset); $contentArr = $this->pObj->splitRegularContent($fileContent); $contentArr['title'] = basename($absFile); // Make sure the title doesn't expose the absolute path! break; case 'jpg': // PHP EXIF // PHP EXIF case 'jpeg': // PHP EXIF // PHP EXIF case 'tif': // PHP EXIF if (function_exists('exif_read_data')) { $exif = exif_read_data($absFile, 'IFD0'); } else { $exif = FALSE; } if ($exif) { $comment = trim($exif['COMMENT'][0] . ' ' . $exif['ImageDescription']); // The comments in JPEG files are utf-8, while in Tif files they are 7-bit ascii. } else { $comment = ''; } $contentArr = $this->pObj->splitRegularContent($comment); $contentArr['title'] = basename($absFile); // Make sure the title doesn't expose the absolute path! break; default: return false; break; } // If no title (and why should there be...) then the file-name is set as title. This will raise the hits considerably if the search matches the document name. if (is_array($contentArr) && !$contentArr['title']) { $contentArr['title'] = str_replace('_', ' ', basename($absFile)); // Substituting "_" for " " because many filenames may have this instead of a space char. } return $contentArr; }
/** * Retrieve data structures * * @return array */ function getDataStructures() { // Select all Data Structures in the PID and put into an array: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_templavoila_datastructure', 'pid>=0' . t3lib_BEfunc::deleteClause('tx_templavoila_datastructure'), '', 'title'); $dsRecords = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $row['_languageMode'] = $this->DSlanguageMode($row['dataprot']); if ($row['_languageMode'] != 'Disabled') { $dsRecords[$row['scope']][] = $row; } } // Select all static Data Structures and add to array: if (is_array($GLOBALS['TBE_MODULES_EXT']['xMOD_tx_templavoila_cm1']['staticDataStructures'])) { foreach ($GLOBALS['TBE_MODULES_EXT']['xMOD_tx_templavoila_cm1']['staticDataStructures'] as $staticDS) { $staticDS['_STATIC'] = 1; $fileReference = t3lib_div::getFileAbsFileName($staticDS['path']); if (@is_file($fileReference)) { $staticDS['_languageMode'] = $this->DSlanguageMode(t3lib_div::getUrl($fileReference)); } else { $staticDS['_languageMode'] = 'ERROR: File not found'; } if ($row['_languageMode'] != 'Disabled') { $dsRecords[$staticDS['scope']][] = $staticDS; } } } return $dsRecords; }
/** * Returns the configuration of jQuery Bootstrap * @return array */ function getJqueryBootstrapConfiguration($version = NULL) { if ($version === NULL) { $confArr = tx_t3jquery::getConf(); $version = $confArr['jQueryBootstrapVersion']; } $configuration = t3lib_div::xml2array(t3lib_div::getUrl(t3lib_div::getFileAbsFileName('EXT:t3jquery/res/jquery/bootstrap/' . $version . '/jquery.xml'))); return $configuration; }
tx_dam::register_indexingRule('tx_damindex_rule_devel', 'EXT:dam/components/class.tx_dam_index_rules.php:&tx_dam_index_rule_devel'); } // register navigation tree and select rule for nav tree. tx_dam::register_selection('txdamFolder', 'EXT:dam/components/class.tx_dam_selectionFolder.php:&tx_dam_selectionFolder'); tx_dam::register_selection('txdamCat', 'EXT:dam/components/class.tx_dam_selectionCategory.php:&tx_dam_selectionCategory'); tx_dam::register_selection('txdamMedia', 'EXT:dam/components/class.tx_dam_selectionMeTypes.php:&tx_dam_selectionMeTypes'); tx_dam::register_selection('txdamStatus', 'EXT:dam/components/class.tx_dam_selectionStatus.php:&tx_dam_selectionStatus'); tx_dam::register_selection('txdamIndexRun', 'EXT:dam/components/class.tx_dam_selectionIndexRun.php:&tx_dam_selectionIndexRun'); tx_dam::register_selection('txdamStrSearch', 'EXT:dam/components/class.tx_dam_selectionStringSearch.php:&tx_dam_selectionStringSearch'); tx_dam::register_selection('txdamRecords', 'EXT:dam/components/class.tx_dam_selectionRecords.php:&tx_dam_selectionRecords'); // register DAM internal db change trigger tx_dam::register_dbTrigger('tx_dam_dbTriggerMediaTypes', 'EXT:dam/components/class.tx_dam_dbTriggerMediaTypes.php:&tx_dam_dbTriggerMediaTypes'); // register special TCE tx_dam processing $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = 'EXT:dam/binding/tce/class.tx_dam_tce_process.php:&tx_dam_tce_process'; $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:dam/binding/tce/class.tx_dam_tce_process.php:&tx_dam_tce_process'; $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:dam/binding/tce/class.tx_dam_tce_filetracking.php:&tx_dam_tce_filetracking'; // <media> tag for BE and FE if ($TYPO3_CONF_VARS['EXTCONF']['dam']['setup']['mediatag']) { require_once PATH_txdam . 'binding/mediatag/ext_localconf.php'; } // user-defined soft reference parsers require_once PATH_txdam . 'binding/softref/ext_localconf.php'; // txdam attribute on img tag for FE require_once PATH_txdam . 'binding/imgtag/ext_localconf.php'; // FE stuff $pluginContent = t3lib_div::getUrl(PATH_txdam . 'pi/setup.txt'); t3lib_extMgm::addTypoScript('dam', 'setup', ' # Setting dam plugin TypoScript ' . $pluginContent); unset($pluginContent); $TYPO3_CONF_VARS['BE']['AJAX']['TYPO3_tcefile::process'] = PATH_txdam . 'lib/class.tx_dam_tce_file.php:tx_dam_tce_file->processAjaxRequest';
/** * Extracts the header of a CATXML file * * @param string $filepath Path to the file * @return bool */ protected function getXMLFileHead($filepath) { $fileContent = t3lib_div::getUrl($filepath); // For some reason PHP chokes on incoming in XML! $xmlNodes = t3lib_div::xml2tree(str_replace(' ', ' ', $fileContent), 3); if (!is_array($xmlNodes)) { throw new Exception($GLOBALS['LANG']->getLL('import.manager.error.parsing.xml2tree.message') . $xmlNodes, 1322480030); } $headerInformationNodes = $xmlNodes['TYPO3L10N'][0]['ch']['head'][0]['ch']; if (!is_array($headerInformationNodes)) { throw new Exception($GLOBALS['LANG']->getLL('import.manager.error.missing.head.message'), 1322480056); } return $headerInformationNodes; }
/** * Creates all files that are necessary for an extension * - ext_localconf.php * - ext_tables.php * - tca.php * - ext_tables.sql * - locallang.xml * - locallang_db.xml * - doc/wizard_form.html * - doc/wizard_form.dat * - ChangeLog * - README.txt * - ext_icon.gif * * @param string $extKey : the extension key * @return void */ function makeFilesArray($extKey) { $this->ext_localconf = array(); $this->ext_tables = array(); $this->fileArray = array(); foreach ($this->wizArray as $catID => $catData) { if ($this->sections[$catID]) { $path = t3lib_div::getFileAbsFileName($this->sections[$catID]['filepath']); if (is_file($path)) { require_once $path; $section = t3lib_div::makeInstance($this->sections[$catID]['classname']); $section->wizard =& $this; foreach ($catData as $k => $config) { $section->render_extPart($k, $config, $extKey); } } } } if (is_array($this->wizArray['sv'])) { reset($this->wizArray['sv']); while (list($k, $config) = each($this->wizArray['sv'])) { $this->EM_CONF_presets['clearCacheOnLoad'] = 1; } } // Write the ext_localconf.php file: if (count($this->ext_localconf)) { $this->addFileToFileArray('ext_localconf.php', trim($this->wrapBody(' <?php if (!defined(\'TYPO3_MODE\')) { die (\'Access denied.\'); } ', implode(chr(10), $this->ext_localconf), '?> ', 0))); } // Write the ext_tables.php file: if (count($this->ext_tables)) { $this->addFileToFileArray('ext_tables.php', trim($this->wrapBody(' <?php if (!defined(\'TYPO3_MODE\')) { die (\'Access denied.\'); } ', implode(chr(10), $this->ext_tables), ' ?> ', 0))); } // Write the tca.php file: if (count($this->ext_tca)) { $this->addFileToFileArray('tca.php', trim($this->wrapBody(' <?php if (!defined(\'TYPO3_MODE\')) { die (\'Access denied.\'); } ', implode(chr(10), $this->ext_tca), ' ?> ', 0))); } // Write the ext_tables.sql file: if (count($this->ext_tables_sql)) { $this->addFileToFileArray('ext_tables.sql', trim($this->sPS(implode(chr(10), $this->ext_tables_sql)))); } // Local lang file: if (count($this->ext_locallang)) { $this->addLocalLangFile($this->ext_locallang, 'locallang.xml', 'Language labels for extension \'' . $extKey . '\''); } // Local lang DB file: if (count($this->ext_locallang_db)) { $this->addLocalLangFile($this->ext_locallang_db, 'locallang_db.xml', 'Language labels for database tables/fields belonging to extension \'' . $extKey . '\'', 'database'); } // The form used to generate the extension: $this->dontPrintImages = 1; $this->addFileToFileArray('doc/wizard_form.html', trim($this->sPS(' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> ' . $this->totalForm() . ' </body> </html> '))); $this->addFileToFileArray('doc/wizard_form.dat', serialize($this->wizArray)); $this->addFileToFileArray('ChangeLog', date('Y-m-d') . ' ' . $this->userField('name') . ' <' . $this->userField('email') . '> * Initial code generated with kickstarter '); $this->addFileToFileArray('README.txt', ' Feel free to add some documentation or simply add a link to the online manual. '); // icon: $this->addFileToFileArray('ext_icon.gif', t3lib_div::getUrl(t3lib_extMgm::extPath('kickstarter') . 'res/notfound.gif')); }
print_r($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['cliKeys']); echo LF; exit; } } // ********************** // Check Hardcoded lock on BE: // ********************** if ($TYPO3_CONF_VARS['BE']['adminOnly'] < 0) { throw new RuntimeException('TYPO3 Backend locked: Backend and Install Tool are locked for maintenance. [BE][adminOnly] is set to "' . intval($TYPO3_CONF_VARS['BE']['adminOnly']) . '".'); } if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) && @is_file(PATH_typo3conf . 'LOCK_BACKEND')) { if (TYPO3_PROCEED_IF_NO_USER == 2) { // ajax poll for login, let him pass } else { $fContent = t3lib_div::getUrl(PATH_typo3conf . 'LOCK_BACKEND'); if ($fContent) { header('Location: ' . $fContent); // Redirect } else { throw new RuntimeException('TYPO3 Backend locked: Browser backend is locked for maintenance. Remove lock by removing the file "typo3conf/LOCK_BACKEND" or use CLI-scripts.'); } exit; } } // ********************** // Check IP // ********************** if (trim($TYPO3_CONF_VARS['BE']['IPmaskList']) && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI)) { if (!t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['BE']['IPmaskList'])) { header('Status: 404 Not Found');
/** * 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)); } }
/** * Outputs the display of a marked-up HTML file in the IFRAME * * @return void Exits before return * @see makeIframeForVisual() */ function main_display() { // Setting GPvars: $this->displayFile = t3lib_div::GPvar('file'); $this->show = t3lib_div::GPvar('show'); $this->preview = t3lib_div::GPvar('preview'); $this->limitTags = t3lib_div::GPvar('limitTags'); $this->path = t3lib_div::GPvar('path'); // Checking if the displayFile parameter is set: if (@is_file($this->displayFile) && t3lib_div::getFileAbsFileName($this->displayFile)) { // FUTURE: grabbing URLS?: .... || substr($this->displayFile,0,7)=='http://' $content = t3lib_div::getUrl($this->displayFile); if ($content) { $relPathFix = $GLOBALS['BACK_PATH'] . '../' . dirname(substr($this->displayFile, strlen(PATH_site))) . '/'; if ($this->preview) { // In preview mode, merge preview data into the template: // Add preview data to file: $content = $this->displayFileContentWithPreview($content, $relPathFix); } else { // Markup file: $content = $this->displayFileContentWithMarkup($content, $this->path, $relPathFix, $this->limitTags); } // Output content: echo $content; } else { $this->displayFrameError('No content found in file reference: <em>' . htmlspecialchars($this->displayFile) . '</em>'); } } else { $this->displayFrameError('No file to display'); } // Exit since a full page has been outputted now. exit; }
function _renderReadOnly() { $sPath = $this->_getPath(); if ($sPath !== FALSE || is_array($this->_navConf("/imageconf/")) && $this->defaultFalse("/imageconf/forcegeneration")) { $sTag = FALSE; $aSize = FALSE; $bExternal = FALSE; $bReprocess = FALSE; if (is_array($mConf = $this->_navConf("/imageconf/")) && tx_ameosformidable::isRunneable($mConf)) { $bReprocess = TRUE; } if ($this->oForm->isAbsServerPath($sPath)) { $sAbsServerPath = $sPath; $sRelWebPath = $this->oForm->_removeStartingSlash($this->oForm->toRelPath($sAbsServerPath)); $sAbsWebPath = $this->oForm->toWebPath($sRelWebPath); $sFileName = basename($sRelWebPath); $aSize = @getImageSize($sAbsServerPath); } else { if (!$this->oForm->isAbsWebPath($sPath)) { // relative web path given // turn it into absolute web path $sPath = $this->oForm->toWebPath($sPath); $aSize = @getImageSize($this->oForm->toServerPath($sPath)); } // absolute web path $sAbsWebPath = $sPath; $aInfosPath = parse_url($sAbsWebPath); $aInfosFile = t3lib_div::split_fileref($sAbsWebPath); #debug($aInfosPath); #debug($aInfosFile); if (strtolower($aInfosPath["host"]) !== strtolower(t3lib_div::getIndpEnv("TYPO3_HOST_ONLY"))) { // it's an external image $bExternal = TRUE; $sAbsServerPath = ""; if ($bReprocess === TRUE) { // we have to make a local copy of the image to enable TS processing $aHeaders = $this->oForm->div_getHeadersForUrl($sAbsWebPath); if (array_key_exists("ETag", $aHeaders)) { $sSignature = str_replace(array('"', ",", ":", "-", ".", "/", "\\", " "), "", $aHeaders["ETag"]); } elseif (array_key_exists("Last-Modified", $aHeaders)) { $sSignature = str_replace(array('"', ",", ":", "-", ".", "/", "\\", " "), "", $aHeaders["Last-Modified"]); } elseif (array_key_exists("Content-Length", $aHeaders)) { $sSignature = $aHeaders["Content-Length"]; } } $sTempFileName = $aInfosFile["filebody"] . $aInfosFile["fileext"] . "-" . $sSignature . "." . $aInfosFile["fileext"]; $sTempFilePath = PATH_site . "typo3temp/" . $sTempFileName; if (!file_exists($sTempFilePath)) { t3lib_div::writeFileToTypo3tempDir($sTempFilePath, t3lib_div::getUrl($sAbsWebPath)); } $sAbsServerPath = $sTempFilePath; $sAbsWebPath = $this->oForm->toWebPath($sAbsServerPath); $sRelWebPath = $this->oForm->toRelPath($sAbsServerPath); } else { // it's an local image given as an absolute web url // trying to convert pathes to handle the image as a local one $sAbsServerPath = PATH_site . $this->oForm->_removeStartingSlash($aInfosPath["path"]); $sRelWebPath = $this->oForm->_removeStartingSlash($aInfosPath["path"]); } $sFileName = $aInfosFile["file"]; } $sRelWebPath = $this->oForm->_removeStartingslash($sRelWebPath); $sContentAlt = ''; if (($mAlt = $this->_navConf("/alt")) !== FALSE) { if (tx_ameosformidable::isRunneable($mAlt)) { $mAlt = $this->callRunneable($mAlt); } $sContentAlt = $mAlt; } $sAlt = trim($sContentAlt) == '' ? '' : 'alt="' . $sContentAlt . '"'; $aHtmlBag = array("filepath" => $sAbsWebPath, "filepath." => array("rel" => $sRelWebPath, "web" => $this->oForm->toWebPath($this->oForm->toServerPath($sRelWebPath)), "original" => $sAbsWebPath, "original." => array("rel" => $sRelWebPath, "web" => $this->oForm->toWebPath($sAbsServerPath), "server" => $sAbsServerPath)), "filename" => $sFileName, "filename." => array("original" => $sFileName), "alt" => $sContentAlt); if ($aSize !== FALSE) { $aHtmlBag["filesize."]["width"] = $aSize[0]; $aHtmlBag["filesize."]["width."]["px"] = $aSize[0] . "px"; $aHtmlBag["filesize."]["height"] = $aSize[1]; $aHtmlBag["filesize."]["height."]["px"] = $aSize[1] . "px"; } if ($bReprocess === TRUE) { // require_once(PATH_t3lib . "class.t3lib_stdgraphic.php"); // require_once(PATH_tslib . "class.tslib_gifbuilder.php"); // expecting typoscript $aParams = array("filename" => $sFileName, "abswebpath" => $sAbsWebPath, "relwebpath" => $sRelWebPath); if ($this->oForm->oDataHandler->aObjectType["TYPE"] == "LISTER") { $aParams["row"] = $this->oForm->oDataHandler->__aListData; } elseif ($this->oForm->oDataHandler->aObjectType["TYPE"] == "DB") { $aParams["row"] = $this->oForm->oDataHandler->_getStoredData(); } $this->callRunneable($mConf, $aParams); $aImage = array_pop($this->oForm->aLastTs); if ($this->defaultFalse("/imageconf/generatetag") === TRUE) { $sTag = $GLOBALS["TSFE"]->cObj->IMAGE($aImage); } else { $sTag = FALSE; } $sNewPath = $GLOBALS["TSFE"]->cObj->IMG_RESOURCE($aImage); // IMG_RESOURCE always returns relative path $aHtmlBag["filepath"] = $this->oForm->toWebPath($sNewPath); $aHtmlBag["filepath."]["rel"] = $sNewPath; $aHtmlBag["filepath."]["web"] = $this->oForm->toWebPath($this->oForm->toServerPath($sNewPath)); $aHtmlBag["filename"] = basename($sNewPath); $aNewSize = @getImageSize($this->oForm->toServerPath($sNewPath)); $aHtmlBag["filesize."]["width"] = $aNewSize[0]; $aHtmlBag["filesize."]["width."]["px"] = $aNewSize[0] . "px"; $aHtmlBag["filesize."]["height"] = $aNewSize[1]; $aHtmlBag["filesize."]["height."]["px"] = $aNewSize[1] . "px"; } $sLabel = $this->getLabel(); if ($sTag === FALSE) { if (isset($aHtmlBag["filesize."]["width"])) { $sWidth = " width='" . $aHtmlBag["filesize."]["width"] . "' "; } if (isset($aHtmlBag["filesize."]["height"])) { $sHeight = " height='" . $aHtmlBag["filesize."]["height"] . "' "; } $aHtmlBag["imagetag"] = "<img src=\"" . $aHtmlBag["filepath"] . "\" id=\"" . $this->_getElementHtmlId() . "\" " . $this->_getAddInputParams() . " " . $sWidth . $sHeight . $sAlt . "/>"; #print_r($aHtmlBag["imagetag"]); } else { $aHtmlBag["imagetag"] = $sTag; } $aHtmlBag["__compiled"] = $this->_displayLabel($sLabel) . $aHtmlBag["imagetag"]; return $aHtmlBag; } return ""; }
/** * CLI engine * * @param array Command line arguments * @return string */ function cli_main($argv) { // Force user to admin state and set workspace to "Live": $GLOBALS['BE_USER']->user['admin'] = 1; $GLOBALS['BE_USER']->setWorkspace(0); // Print Howto: if ($this->cli_isArg('--showhowto')) { $howto = t3lib_div::getUrl(t3lib_extMgm::extPath('lowlevel') . 'HOWTO_clean_up_TYPO3_installations.txt'); echo wordwrap($howto, 120) . LF; exit; } // Print help $analysisType = (string) $this->cli_args['_DEFAULT'][1]; if (!$analysisType) { $this->cli_validateArgs(); $this->cli_help(); exit; } // Analysis type: switch ((string) $analysisType) { default: if (is_array($this->cleanerModules[$analysisType])) { $cleanerMode = t3lib_div::getUserObj($this->cleanerModules[$analysisType][0]); $cleanerMode->cli_validateArgs(); if ($this->cli_isArg('-r')) { // Run it... if (!$cleanerMode->checkRefIndex || $this->cli_referenceIndexCheck()) { $res = $cleanerMode->main(); $this->cli_printInfo($analysisType, $res); // Autofix... if ($this->cli_isArg('--AUTOFIX')) { if ($this->cli_isArg('--YES') || $this->cli_keyboardInput_yes("\n\nNOW Running --AUTOFIX on result. OK?" . ($this->cli_isArg('--dryrun') ? ' (--dryrun simulation)' : ''))) { $cleanerMode->main_autofix($res); } else { $this->cli_echo("ABORTING AutoFix...\n", 1); } } } } else { // Help only... $cleanerMode->cli_help(); exit; } } else { $this->cli_echo("ERROR: Analysis Type '" . $analysisType . "' is unknown.\n", 1); exit; } break; } }
/** * Filling in the field array * $this->exclude_array is used to filter fields if needed. * * @param string Table name * @param integer Record ID * @param array Default values, Preset $fieldArray with 'pid' maybe (pid and uid will be not be overridden anyway) * @param array $incomingFieldArray is which fields/values you want to set. There are processed and put into $fieldArray if OK * @param integer The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted. * @param string $status = 'new' or 'update' * @param integer $tscPID: TSconfig PID * @return array Field Array */ function fillInFieldArray($table, $id, $fieldArray, $incomingFieldArray, $realPid, $status, $tscPID) { global $TCA; // Initialize: t3lib_div::loadTCA($table); $originalLanguageRecord = NULL; $originalLanguage_diffStorage = NULL; $diffStorageFlag = FALSE; // Setting 'currentRecord' and 'checkValueRecord': if (strstr($id, 'NEW')) { $currentRecord = $checkValueRecord = $fieldArray; // must have the 'current' array - not the values after processing below... // IF $incomingFieldArray is an array, overlay it. // The point is that when new records are created as copies with flex type fields there might be a field containing information about which DataStructure to use and without that information the flexforms cannot be correctly processed.... This should be OK since the $checkValueRecord is used by the flexform evaluation only anyways... if (is_array($incomingFieldArray) && is_array($checkValueRecord)) { $checkValueRecord = t3lib_div::array_merge_recursive_overrule($checkValueRecord, $incomingFieldArray); } } else { $currentRecord = $checkValueRecord = $this->recordInfo($table, $id, '*'); // We must use the current values as basis for this! t3lib_BEfunc::fixVersioningPid($table, $currentRecord); // This is done to make the pid positive for offline versions; Necessary to have diff-view for pages_language_overlay in workspaces. // Get original language record if available: if (is_array($currentRecord) && $TCA[$table]['ctrl']['transOrigDiffSourceField'] && $TCA[$table]['ctrl']['languageField'] && $currentRecord[$TCA[$table]['ctrl']['languageField']] > 0 && $TCA[$table]['ctrl']['transOrigPointerField'] && intval($currentRecord[$TCA[$table]['ctrl']['transOrigPointerField']]) > 0) { $lookUpTable = $TCA[$table]['ctrl']['transOrigPointerTable'] ? $TCA[$table]['ctrl']['transOrigPointerTable'] : $table; $originalLanguageRecord = $this->recordInfo($lookUpTable, $currentRecord[$TCA[$table]['ctrl']['transOrigPointerField']], '*'); t3lib_BEfunc::workspaceOL($lookUpTable, $originalLanguageRecord); $originalLanguage_diffStorage = unserialize($currentRecord[$TCA[$table]['ctrl']['transOrigDiffSourceField']]); } } $this->checkValue_currentRecord = $checkValueRecord; /* In the following all incoming value-fields are tested: - Are the user allowed to change the field? - Is the field uid/pid (which are already set) - perms-fields for pages-table, then do special things... - If the field is nothing of the above and the field is configured in TCA, the fieldvalues are evaluated by ->checkValue If everything is OK, the field is entered into $fieldArray[] */ foreach ($incomingFieldArray as $field => $fieldValue) { if (!in_array($table . '-' . $field, $this->exclude_array) && !$this->data_disableFields[$table][$id][$field]) { // The field must be editable. // Checking if a value for language can be changed: $languageDeny = $TCA[$table]['ctrl']['languageField'] && !strcmp($TCA[$table]['ctrl']['languageField'], $field) && !$this->BE_USER->checkLanguageAccess($fieldValue); if (!$languageDeny) { // Stripping slashes - will probably be removed the day $this->stripslashes_values is removed as an option... if ($this->stripslashes_values) { if (is_array($fieldValue)) { t3lib_div::stripSlashesOnArray($fieldValue); } else { $fieldValue = stripslashes($fieldValue); } } switch ($field) { case 'uid': case 'pid': // Nothing happens, already set break; case 'perms_userid': case 'perms_groupid': case 'perms_user': case 'perms_group': case 'perms_everybody': // Permissions can be edited by the owner or the administrator if ($table == 'pages' && ($this->admin || $status == 'new' || $this->pageInfo($id, 'perms_userid') == $this->userid)) { $value = intval($fieldValue); switch ($field) { case 'perms_userid': $fieldArray[$field] = $value; break; case 'perms_groupid': $fieldArray[$field] = $value; break; default: if ($value >= 0 && $value < pow(2, 5)) { $fieldArray[$field] = $value; } break; } } break; case 't3ver_oid': case 't3ver_id': case 't3ver_wsid': case 't3ver_state': case 't3ver_swapmode': case 't3ver_count': case 't3ver_stage': case 't3ver_tstamp': // t3ver_label is not here because it CAN be edited as a regular field! break; default: if (isset($TCA[$table]['columns'][$field])) { // Evaluating the value $res = $this->checkValue($table, $field, $fieldValue, $id, $status, $realPid, $tscPID); if (isset($res['value'])) { $fieldArray[$field] = $res['value']; } // Add the value of the original record to the diff-storage content: if ($this->updateModeL10NdiffData && $TCA[$table]['ctrl']['transOrigDiffSourceField']) { $originalLanguage_diffStorage[$field] = $this->updateModeL10NdiffDataClear ? '' : $originalLanguageRecord[$field]; $diffStorageFlag = TRUE; } // If autoversioning is happening we need to perform a nasty hack. The case is parallel to a similar hack inside checkValue_group_select_file(). // When a copy or version is made of a record, a search is made for any RTEmagic* images in fields having the "images" soft reference parser applied. That should be true for RTE fields. If any are found they are duplicated to new names and the file reference in the bodytext is updated accordingly. // However, with auto-versioning the submitted content of the field will just overwrite the corrected values. This leaves a) lost RTEmagic files and b) creates a double reference to the old files. // The only solution I can come up with is detecting when auto versioning happens, then see if any RTEmagic images was copied and if so make a stupid string-replace of the content ! if ($this->autoVersioningUpdate === TRUE) { if (is_array($this->RTEmagic_copyIndex[$table][$id][$field])) { foreach ($this->RTEmagic_copyIndex[$table][$id][$field] as $oldRTEmagicName => $newRTEmagicName) { $fieldArray[$field] = str_replace(' src="' . $oldRTEmagicName . '"', ' src="' . $newRTEmagicName . '"', $fieldArray[$field]); } } } } elseif ($TCA[$table]['ctrl']['origUid'] === $field) { // Allow value for original UID to pass by... $fieldArray[$field] = $fieldValue; } break; } } // Checking language. } // Check exclude fields / disabled fields... } // Add diff-storage information: if ($diffStorageFlag && !isset($fieldArray[$TCA[$table]['ctrl']['transOrigDiffSourceField']])) { // If the field is set it would probably be because of an undo-operation - in which case we should not update the field of course... $fieldArray[$TCA[$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage); } // Checking for RTE-transformations of fields: $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table, $currentRecord); $theTypeString = t3lib_BEfunc::getTCAtypeValue($table, $currentRecord); if (is_array($types_fieldConfig)) { foreach ($types_fieldConfig as $vconf) { // Write file configuration: $eFile = t3lib_parsehtml_proc::evalWriteFile($vconf['spec']['static_write'], array_merge($currentRecord, $fieldArray)); // inserted array_merge($currentRecord,$fieldArray) 170502 // RTE transformations: if (!$this->dontProcessTransformations) { if (isset($fieldArray[$vconf['field']])) { // Look for transformation flag: switch ((string) $incomingFieldArray['_TRANSFORM_' . $vconf['field']]) { case 'RTE': $RTEsetup = $this->BE_USER->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($tscPID)); $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $table, $vconf['field'], $theTypeString); // Set alternative relative path for RTE images/links: $RTErelPath = is_array($eFile) ? dirname($eFile['relEditFile']) : ''; // Get RTE object, draw form and set flag: $RTEobj = t3lib_BEfunc::RTEgetObj(); if (is_object($RTEobj)) { $fieldArray[$vconf['field']] = $RTEobj->transformContent('db', $fieldArray[$vconf['field']], $table, $vconf['field'], $currentRecord, $vconf['spec'], $thisConfig, $RTErelPath, $currentRecord['pid']); } else { debug('NO RTE OBJECT FOUND!'); } break; } } } // Write file configuration: if (is_array($eFile)) { $mixedRec = array_merge($currentRecord, $fieldArray); $SW_fileContent = t3lib_div::getUrl($eFile['editFile']); $parseHTML = t3lib_div::makeInstance('t3lib_parsehtml_proc'); /* @var $parseHTML t3lib_parsehtml_proc */ $parseHTML->init('', ''); $eFileMarker = $eFile['markerField'] && trim($mixedRec[$eFile['markerField']]) ? trim($mixedRec[$eFile['markerField']]) : '###TYPO3_STATICFILE_EDIT###'; $insertContent = str_replace($eFileMarker, '', $mixedRec[$eFile['contentField']]); // must replace the marker if present in content! $SW_fileNewContent = $parseHTML->substituteSubpart($SW_fileContent, $eFileMarker, LF . $insertContent . LF, 1, 1); t3lib_div::writeFile($eFile['editFile'], $SW_fileNewContent); // Write status: if (!strstr($id, 'NEW') && $eFile['statusField']) { $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($id), array($eFile['statusField'] => $eFile['relEditFile'] . ' updated ' . date('d-m-Y H:i:s') . ', bytes ' . strlen($mixedRec[$eFile['contentField']]))); } } elseif ($eFile && is_string($eFile)) { $this->log($table, $id, 2, 0, 1, "Write-file error: '%s'", 13, array($eFile), $realPid); } } } // Return fieldArray return $fieldArray; }
/** * function to fetch all links from a page * by making a call to fetch the contents of the URL (via getURL) * and then applying certain regular expressions * * also takes "nofollow" into account (!) * * @param string $url * @return array the found URLs */ protected function fetchLinksFromPage($url) { $content = t3lib_div::getUrl($url); $foundLinks = array(); $result = array(); $regexp = '/<a\\s+(?:[^"\'>]+|"[^"]*"|\'[^\']*\')*href=("[^"]+"|\'[^\']+\'|[^<>\\s]+)([^>]+)/i'; preg_match_all($regexp, $content, $result); $baseUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL'); foreach ($result[1] as $pos => $link) { if (strpos($result[2][$pos], '"nofollow"') !== FALSE || strpos($result[0][$pos], '"nofollow"') !== FALSE) { continue; } $link = trim($link, '"'); list($link) = explode('#', $link); $linkParts = parse_url($link); if (!$linkParts['scheme']) { $link = $baseUrl . ltrim($link, '/'); } if ($linkParts['scheme'] == 'javascript') { continue; } if ($linkParts['scheme'] == 'mailto') { continue; } // dont include files $fileName = basename($linkParts['path']); if (strpos($fileName, '.') !== FALSE && file_exists(PATH_site . ltrim($linkParts['path'], '/'))) { continue; } if ($link != $url) { $foundLinks[$link] = $link; } } return $foundLinks; }
/** * This function initializes the to-ASCII conversion table for a charset other than UTF-8. * This function is automatically called by the ASCII transliteration functions. * * @param string Charset for which to initialize conversion. * @return integer Returns FALSE on error, a TRUE value on success: 1 table already loaded, 2, cached version, 3 table parsed (and cached). * @access private */ function initToASCII($charset) { // Only process if the case table is not yet loaded: if (is_array($this->toASCII[$charset])) { return 1; } // Use cached version if possible $cacheFile = t3lib_div::getFileAbsFileName('typo3temp/cs/csascii_' . $charset . '.tbl'); if ($cacheFile && @is_file($cacheFile)) { $this->toASCII[$charset] = unserialize(t3lib_div::getUrl($cacheFile)); return 2; } // init UTF-8 conversion for this charset if (!$this->initCharset($charset)) { return false; } // UTF-8/ASCII transliteration is used as the base conversion table if (!$this->initUnicodeData('ascii')) { return false; } $nochar = chr($this->noCharByteVal); foreach ($this->parsedCharsets[$charset]['local'] as $ci => $utf8) { // reconvert to charset (don't use chr() of numeric value, might be muli-byte) $c = $this->utf8_decode($utf8, $charset); if (isset($this->toASCII['utf-8'][$utf8])) { $this->toASCII[$charset][$c] = $this->toASCII['utf-8'][$utf8]; } } if ($cacheFile) { t3lib_div::writeFileToTypo3tempDir($cacheFile, serialize($this->toASCII[$charset])); } return 3; }
/** * Create visual difference view of two records. Using t3lib_diff library * * @param string Table name * @param array New version record (green) * @param array Old version record (red) * @return array Array with two keys (0/1) with HTML content / percentage integer (if -1, then it means N/A) indicating amount of change */ function createDiffView($table, $diff_1_record, $diff_2_record) { global $TCA, $LANG; // Initialize: $pctChange = 'N/A'; // Check that records are arrays: if (is_array($diff_1_record) && is_array($diff_2_record)) { // Load full table description and initialize diff-object: t3lib_div::loadTCA($table); $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff'); // Add header row: $tRows = array(); $tRows[] = ' <tr class="bgColor5 tableheader"> <td>' . $LANG->getLL('diffview_label_field_name') . '</td> <td width="98%" nowrap="nowrap">' . $LANG->getLL('diffview_label_colored_diff_view') . '</td> </tr> '; // Initialize variables to pick up string lengths in: $allStrLen = 0; $diffStrLen = 0; // Traversing the first record and process all fields which are editable: foreach ($diff_1_record as $fN => $fV) { if ($TCA[$table]['columns'][$fN] && $TCA[$table]['columns'][$fN]['config']['type'] != 'passthrough' && !t3lib_div::inList('t3ver_label', $fN)) { // Check if it is files: $isFiles = FALSE; if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN])) && $TCA[$table]['columns'][$fN]['config']['type'] == 'group' && $TCA[$table]['columns'][$fN]['config']['internal_type'] == 'file') { // Initialize: $uploadFolder = $TCA[$table]['columns'][$fN]['config']['uploadfolder']; $files1 = array_flip(t3lib_div::trimExplode(',', $diff_1_record[$fN], 1)); $files2 = array_flip(t3lib_div::trimExplode(',', $diff_2_record[$fN], 1)); // Traverse filenames and read their md5 sum: foreach ($files1 as $filename => $tmp) { $files1[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename; } foreach ($files2 as $filename => $tmp) { $files2[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename; } // Implode MD5 sums and set flag: $diff_1_record[$fN] = implode(' ', $files1); $diff_2_record[$fN] = implode(' ', $files2); $isFiles = TRUE; } // If there is a change of value: if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN]))) { // Get the best visual presentation of the value and present that: $val1 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_2_record[$fN], 0, 1); $val2 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_1_record[$fN], 0, 1); // Make diff result and record string lenghts: $diffres = $t3lib_diff_Obj->makeDiffDisplay($val1, $val2, $isFiles ? 'div' : 'span'); $diffStrLen .= $t3lib_diff_Obj->differenceLgd; $allStrLen .= strlen($val1 . $val2); // If the compared values were files, substituted MD5 hashes: if ($isFiles) { $allFiles = array_merge($files1, $files2); foreach ($allFiles as $filename => $token) { if (strlen($token) == 32 && strstr($diffres, $token)) { $filename = t3lib_BEfunc::thumbCode(array($fN => $filename), $table, $fN, $this->doc->backPath) . $filename; $diffres = str_replace($token, $filename, $diffres); } } } ############# new hook for post processing of DAM images if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'] as $classRef) { $hookObject =& t3lib_div::getUserObj($classRef); if (method_exists($hookObject, 'postProcessDiffView')) { $diffres = $hookObject->postProcessDiffView($table, $fN, $diff_2_record, $diff_1_record, $diffres, $this); } } } ############# // Add table row with result: $tRows[] = ' <tr class="bgColor4"> <td>' . htmlspecialchars($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fN))) . '</td> <td width="98%">' . $diffres . '</td> </tr> '; } else { // Add string lengths even if value matched - in this was the change percentage is not high if only a single field is changed: $allStrLen += strlen($diff_1_record[$fN] . $diff_2_record[$fN]); } } } // Calculate final change percentage: $pctChange = $allStrLen ? ceil($diffStrLen * 100 / $allStrLen) : -1; // Create visual representation of result: if (count($tRows) > 1) { $content .= '<table border="0" cellpadding="1" cellspacing="1" class="diffTable">' . implode('', $tRows) . '</table>'; } else { $content .= '<span class="nobr">' . $this->doc->icons(1) . $LANG->getLL('diffview_complete_match') . '</span>'; } } else { $content .= $this->doc->icons(3) . $LANG->getLL('diffview_cannot_find_records'); } // Return value: return array($content, $pctChange); }
function renderChildsCompiled($aChildsBag) { if ($this->_navConf("/childs/template/path") !== FALSE) { // templating childs // mechanism: // childs can be templated if name of parent renderlet is present in template as a subpart marker // like for instance with renderlet:BOX name="mybox", subpart will be <!-- ###mybox### begin--> My childs here <!-- ###mybox### end--> $aTemplate = $this->_navConf("/childs/template"); $sPath = $this->oForm->toServerPath($this->oForm->_navConf("/path", $aTemplate)); if (!file_exists($sPath)) { $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path (<b>'" . $sPath . "'</b>) doesn't exists."); } elseif (is_dir($sPath)) { $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path (<b>'" . $sPath . "'</b>) is a directory, and should be a file."); } elseif (!is_readable($sPath)) { $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path exists but is not readable."); } if (($sSubpart = $this->oForm->_navConf("/subpart", $aTemplate)) === FALSE) { $sSubpart = $this->getName(); } $mHtml = t3lib_parsehtml::getSubpart(t3lib_div::getUrl($sPath), $sSubpart); if (trim($mHtml) == "") { $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template (<b>'" . $sPath . "'</b> with subpart marquer <b>'" . $sSubpart . "'</b>) <b>returned an empty string</b> - Check your template"); } return $this->oForm->_parseTemplateCode($mHtml, $aChildsBag, array(), FALSE); } else { if ($this->oForm->oRenderer->_getType() === "TEMPLATE") { // child-template is not defined, but maybe is it implicitely the same as current template renderer ? if (($sSubpartName = $this->_navConf("/childs/template/subpart")) === FALSE) { $sSubpartName = $this->getName(); } $sSubpartName = str_replace("#", "", $sSubpartName); if (($sHtml = $this->getCustomRootHtml()) === FALSE) { $sHtml = $this->oForm->oRenderer->getTemplateHtml(); } $sSubpart = $this->oForm->oHtml->getSubpart($sHtml, "###" . $sSubpartName . "###"); $aTemplateErrors = array(); $aCompiledErrors = array(); $aDeepErrors = $this->getDeepErrorRelative(); reset($aDeepErrors); while (list($sKey, ) = each($aDeepErrors)) { $sTag = $this->oForm->oRenderer->wrapErrorMessage($aDeepErrors[$sKey]["message"]); $aCompiledErrors[] = $sTag; $aTemplateErrors[$sKey] = $aDeepErrors[$sKey]["message"]; $aTemplateErrors[$sKey . "."] = array("tag" => $sTag, "info" => $aDeepErrors[$sKey]["info"]); } $aChildsBag["errors"] = $aTemplateErrors; $aChildsBag["errors"]["__compiled"] = $this->oForm->oRenderer->compileErrorMessages($aCompiledErrors); if (!empty($sSubpart)) { $sRes = $this->oForm->_parseTemplateCode($sSubpart, $aChildsBag, array(), FALSE); return $sRes; } } $sCompiled = ""; reset($aChildsBag); while (list($sName, $aBag) = each($aChildsBag)) { if ($this->shouldAutowrap()) { $sCompiled .= "\n<div class='formidable-rdrstd-rdtwrap'>" . $aBag["__compiled"] . "</div>"; } else { $sCompiled .= "\n" . $aBag["__compiled"]; } } return $sCompiled; } }
/** * Renders the extension PHP code; this was * * @param string $k: module name key * @param array $config: module configuration * @param string $extKey: extension key * @return void */ function render_extPart($k, $config, $extKey) { $WOP = '[pi][' . $k . ']'; $cN = $this->returnName($extKey, 'class', 'pi' . $k); $pathSuffix = 'pi' . $k . '/'; $setType = ''; switch ($config['addType']) { case 'list_type': $setType = 'list_type'; $this->wizard->ext_tables[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\t\tt3lib_div::loadTCA('tt_content');\n\t\t\t\t\t\$TCA['tt_content']['types']['list']['subtypes_excludelist'][\$_EXTKEY.'_pi" . $k . "']='layout,select_key,pages';\n\t\t\t\t\t" . ($config['apply_extended'] ? "\$TCA['tt_content']['types']['list']['subtypes_addlist'][\$_EXTKEY.'_pi" . $k . "']='" . $this->wizard->_apply_extended_types[$config['apply_extended']] . "';" : "") . "\n\t\t\t\t"); // $this->wizard->ext_localconf[]=$this->sPS(' // '.$this->WOPcomment('WOP:'.$WOP.'[addType] / '.$WOP.'[tag_name]')." // ## Extending TypoScript from static template uid=43 to set up userdefined tag: // t3lib_extMgm::addTypoScript(\$_EXTKEY,'editorcfg',' // tt_content.CSS_editor.ch.".$cN." = < plugin.".$cN.".CSS_editor // ',43); // "); break; case 'textbox': $setType = 'splash_layout'; if ($config['apply_extended']) { $this->wizard->ext_tables[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\t\t\tt3lib_div::loadTCA('tt_content');\n\t\t\t\t\t\t\$TCA['tt_content']['types']['splash']['subtype_value_field']='splash_layout';\n\t\t\t\t\t\t\$TCA['tt_content']['types']['splash']['subtypes_addlist'][\$_EXTKEY.'_pi" . $k . "']='" . $this->wizard->_apply_extended_types[$config['apply_extended']] . "';\n\t\t\t\t\t"); } break; case 'menu_sitemap': $setType = 'menu_type'; if ($config['apply_extended']) { $this->wizard->ext_tables[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\t\t\tt3lib_div::loadTCA('tt_content');\n\t\t\t\t\t\t\$TCA['tt_content']['types']['menu']['subtype_value_field']='menu_type';\n\t\t\t\t\t\t\$TCA['tt_content']['types']['menu']['subtypes_addlist'][\$_EXTKEY.'_pi" . $k . "']='" . $this->wizard->_apply_extended_types[$config['apply_extended']] . "';\n\t\t\t\t\t"); } break; case 'ce': $setType = 'CType'; $tFields = array(); $tFields[] = 'CType;;4;button;1-1-1, header;;3;;2-2-2'; if ($config['apply_extended']) { $tFields[] = $this->wizard->_apply_extended_types[$config['apply_extended']]; } $this->wizard->ext_tables[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\t\tt3lib_div::loadTCA('tt_content');\n\t\t\t\t\t\$TCA['tt_content']['types'][\$_EXTKEY . '_pi" . $k . "']['showitem'] = '" . implode(', ', $tFields) . "';\n\t\t\t\t"); break; case 'header': $setType = 'header_layout'; break; case 'includeLib': if ($config['plus_user_ex']) { $setType = 'includeLib'; } break; case 'typotags': $tagName = preg_replace('/[^a-z0-9_]/', '', strtolower($config['tag_name'])); if ($tagName) { $this->wizard->ext_localconf[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[addType] / ' . $WOP . '[tag_name]') . "\n\t\t\t\t\t\t ## Extending TypoScript from static template uid=43 to set up userdefined tag:\n\t\t\t\t\t\tt3lib_extMgm::addTypoScript(\$_EXTKEY,'setup','\n\t\t\t\t\t\t\ttt_content.text.20.parseFunc.tags." . $tagName . " = < plugin.'.t3lib_extMgm::getCN(\$_EXTKEY).'_pi" . $k . "\n\t\t\t\t\t\t',43);\n\t\t\t\t\t"); } break; default: break; } $cache = $config['plus_user_obj'] ? 0 : 1; $this->wizard->ext_localconf[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\tt3lib_extMgm::addPItoST43(\$_EXTKEY, 'pi" . $k . "/class." . $cN . ".php', '_pi" . $k . "', '" . $setType . "', " . $cache . ");\n\t\t"); if ($setType && !t3lib_div::inList('typotags,includeLib', $setType)) { $this->wizard->ext_tables[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\tt3lib_extMgm::addPlugin(array(\n\t\t\t\t\t'" . addslashes($this->getSplitLabels_reference($config, 'title', 'tt_content.' . $setType . '_pi' . $k)) . "',\n\t\t\t\t\t\$_EXTKEY . '_pi" . $k . "',\n\t\t\t\t\tt3lib_extMgm::extRelPath(\$_EXTKEY) . 'ext_icon.gif'\n\t\t\t\t),'" . $setType . "');\n\t\t\t"); } // Make Plugin class: switch ($config['addType']) { case 'list_type': if ($config['list_default']) { if (is_array($this->wizard->wizArray['tables'][$config['list_default']])) { $tempTableConf = $this->wizard->wizArray['tables'][$config['list_default']]; $tableName = $this->returnName($extKey, 'tables', $tempTableConf['tablename']); $ll = array(); $theLines = array(); $theLines['getListRow'] = array(); $theLines['getListHeader'] = array(); $theLines['getFieldContent'] = array(); $theLines['getFieldHeader'] = array(); $theLines['singleRows'] = array(); $theLines['listItemRows'] = array(); $theLines['singleRows_section'] = array(); $P_classes = array(); $theLines['searchFieldList'] = array(); $theLines['orderByList'] = array(); $tcol = 'uid'; $theLines['getListRow'][$tcol] = '<td><p>\'.$this->getFieldContent(\'' . $tcol . '\').\'</p></td>'; $theLines['getListHeader'][$tcol] = '<td><p>\'.$this->getFieldHeader_sortLink(\'' . $tcol . '\').\'</p></td>'; $theLines['orderByList'][$tcol] = $tcol; if (is_array($tempTableConf['fields'])) { reset($tempTableConf['fields']); while (list(, $fC) = each($tempTableConf['fields'])) { $tcol = $fC['fieldname']; if ($tcol) { $theLines['singleRows'][$tcol] = trim($this->sPS(' <tr> <td nowrap="nowrap" valign="top"\'.$this->pi_classParam(\'singleView-HCell\').\'><p>\'.$this->getFieldHeader(\'' . $tcol . '\').\'</p></td> <td valign="top"><p>\'.$this->getFieldContent(\'' . $tcol . '\').\'</p></td> </tr> ')); if ($this->fieldIsRTE($fC)) { $theLines['singleRows_section'][$tcol] = trim($this->sPS(' \'.$this->getFieldContent(\'' . $tcol . '\').\' ')); } else { $tempN = 'singleViewField-' . str_replace('_', '-', $tcol); $theLines['singleRows_section'][$tcol] = trim($this->sPS(' <p\'.$this->pi_classParam("' . $tempN . '").\'><strong>\'.$this->getFieldHeader(\'' . $tcol . '\').\':</strong> \'.$this->getFieldContent(\'' . $tcol . '\').\'</p> ')); $P_classes['SV'][] = $tempN; } if (!strstr($fC['type'], 'textarea')) { $theLines['getListRow'][$tcol] = '<td valign="top"><p>\'.$this->getFieldContent(\'' . $tcol . '\').\'</p></td>'; $theLines['getListHeader'][$tcol] = '<td nowrap><p>\'.$this->getFieldHeader(\'' . $tcol . '\').\'</p></td>'; $tempN = 'listrowField-' . str_replace('_', '-', $tcol); $theLines['listItemRows'][$tcol] = trim($this->sPS(' <p\'.$this->pi_classParam(\'' . $tempN . '\').\'>\'.$this->getFieldContent(\'' . $tcol . '\').\'</p> ')); $P_classes['LV'][] = $tempN; } $this->addLocalConf($ll, array('listFieldHeader_' . $tcol => $fC['title']), 'listFieldHeader_' . $tcol, 'pi', $k, 1, 1); if ($tcol == 'title') { $theLines['getFieldContent'][$tcol] = trim($this->sPS(' case "' . $tcol . '": // This will wrap the title in a link. return $this->pi_list_linkSingle($this->internal[\'currentRow\'][\'' . $tcol . '\'],$this->internal[\'currentRow\'][\'uid\'],1); break; ')); $theLines['getFieldHeader'][$tcol] = trim($this->sPS(' case "' . $tcol . '": return $this->pi_getLL(\'listFieldHeader_' . $tcol . '\',\'<em>' . $tcol . '</em>\'); break; ')); } elseif ($this->fieldIsRTE($fC)) { $theLines['getFieldContent'][$tcol] = trim($this->sPS(' case "' . $tcol . '": return $this->pi_RTEcssText($this->internal[\'currentRow\'][\'' . $tcol . '\']); break; ')); } elseif ($fC['type'] == 'datetime') { $theLines['getFieldContent'][$tcol] = trim($this->sPS(' case "' . $tcol . '": return strftime(\'%d-%m-%y %H:%M:%S\',$this->internal[\'currentRow\'][\'' . $tcol . '\']); break; ')); } elseif ($fC['type'] == 'date') { $theLines['getFieldContent'][$tcol] = trim($this->sPS(' case "' . $tcol . '": // For a numbers-only date, use something like: %d-%m-%y return strftime(\'%A %e. %B %Y\',$this->internal[\'currentRow\'][\'' . $tcol . '\']); break; ')); } if (strstr($fC['type'], 'input')) { $theLines['getListHeader'][$tcol] = '<td><p>\'.$this->getFieldHeader_sortLink(\'' . $tcol . '\').\'</p></td>'; $theLines['orderByList'][$tcol] = $tcol; } if (strstr($fC['type'], 'input') || strstr($fC['type'], 'textarea')) { $theLines['searchFieldList'][$tcol] = $tcol; } } } } $theLines['singleRows']['tstamp'] = trim($this->sPS(' <tr> <td nowrap\'.$this->pi_classParam(\'singleView-HCell\').\'><p>Last updated:</p></td> <td valign="top"><p>\'.date(\'d-m-Y H:i\',$this->internal[\'currentRow\'][\'tstamp\']).\'</p></td> </tr> ')); $theLines['singleRows']['crdate'] = trim($this->sPS(' <tr> <td nowrap\'.$this->pi_classParam(\'singleView-HCell\').\'><p>Created:</p></td> <td valign="top"><p>\'.date(\'d-m-Y H:i\',$this->internal[\'currentRow\'][\'crdate\']).\'</p></td> </tr> ')); // Add title to local lang file $ll = $this->addStdLocalLangConf($ll, $k); $this->addLocalLangFile($ll, $pathSuffix . 'locallang.xml', 'Language labels for plugin "' . $cN . '"'); $innerMainContent = $this->sPS(' /** * Main method of your PlugIn * * @param string $content: The content of the PlugIn * @param array $conf: The PlugIn Configuration * @return The content that should be displayed on the website */ function main($content, $conf) { switch((string)$conf[\'CMD\']) { case \'singleView\': list($t) = explode(\':\',$this->cObj->currentRecord); $this->internal[\'currentTable\']=$t; $this->internal[\'currentRow\']=$this->cObj->data; return $this->pi_wrapInBaseClass($this->singleView($content, $conf)); break; default: if (strstr($this->cObj->currentRecord,\'tt_content\')) { $conf[\'pidList\'] = $this->cObj->data[\'pages\']; $conf[\'recursive\'] = $this->cObj->data[\'recursive\']; } return $this->pi_wrapInBaseClass($this->listView($content, $conf)); break; } } '); $innerMainContent .= $this->sPS(' /** * Shows a list of database entries * * @param string $content: content of the PlugIn * @param array $conf: PlugIn Configuration * @return HTML list of table entries */ function listView($content, $conf) { $this->conf = $conf; // Setting the TypoScript passed to this function in $this->conf $this->pi_setPiVarDefaults(); $this->pi_loadLL(); // Loading the LOCAL_LANG values ' . (!$cache ? '$this->pi_USER_INT_obj = 1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '') . ' $lConf = $this->conf[\'listView.\']; // Local settings for the listView function if (is_numeric($this->piVars[\'showUid\'])) { // If a single element should be displayed: $this->internal[\'currentTable\'] = \'' . $tableName . '\'; $this->internal[\'currentRow\'] = $this->pi_getRecord(\'' . $tableName . '\',$this->piVars[\'showUid\']); $content = $this->singleView($content, $conf); return $content; } else { $items=array( \'1\'=> $this->pi_getLL(\'list_mode_1\',\'Mode 1\'), \'2\'=> $this->pi_getLL(\'list_mode_2\',\'Mode 2\'), \'3\'=> $this->pi_getLL(\'list_mode_3\',\'Mode 3\'), ); if (!isset($this->piVars[\'pointer\'])) $this->piVars[\'pointer\']=0; if (!isset($this->piVars[\'mode\'])) $this->piVars[\'mode\']=1; // Initializing the query parameters: list($this->internal[\'orderBy\'],$this->internal[\'descFlag\']) = explode(\':\',$this->piVars[\'sort\']); $this->internal[\'results_at_a_time\']=t3lib_div::intInRange($lConf[\'results_at_a_time\'],0,1000,3); // Number of results to show in a listing. $this->internal[\'maxPages\']=t3lib_div::intInRange($lConf[\'maxPages\'],0,1000,2);; // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc. $this->internal[\'searchFieldList\']=\'' . implode(',', $theLines['searchFieldList']) . '\'; $this->internal[\'orderByList\']=\'' . implode(',', $theLines['orderByList']) . '\'; // Get number of records: $res = $this->pi_exec_query(\'' . $tableName . '\',1); list($this->internal[\'res_count\']) = $GLOBALS[\'TYPO3_DB\']->sql_fetch_row($res); // Make listing query, pass query to SQL database: $res = $this->pi_exec_query(\'' . $tableName . '\'); $this->internal[\'currentTable\'] = \'' . $tableName . '\'; // Put the whole list together: $fullTable=\'\'; // Clear var; # $fullTable.=t3lib_div::view_array($this->piVars); // DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line! // Adds the mode selector. $fullTable.=$this->pi_list_modeSelector($items); // Adds the whole list table $fullTable.=' . ($config['list_default_listmode'] ? '$this->makelist($res);' : '$this->pi_list_makelist($res);') . ' // Adds the search box: $fullTable.=$this->pi_list_searchBox(); // Adds the result browser: $fullTable.=$this->pi_list_browseresults(); // Returns the content from the plugin. return $fullTable; } } '); if ($config['list_default_listmode']) { $innerMainContent .= $this->wrapBody(' /** * Creates a list from a database query * * @param ressource $res: A database result ressource * @return A HTML list if result items */ function makelist($res) { $items=array(); // Make list table rows while($this->internal[\'currentRow\'] = $GLOBALS[\'TYPO3_DB\']->sql_fetch_assoc($res)) { $items[]=$this->makeListItem(); } $out = \'<div\'.$this->pi_classParam(\'listrow\').\'> \'.implode(chr(10),$items).\' </div>\'; return $out; } /** * Implodes a single row from a database to a single line * * @return Imploded column values */ function makeListItem() { $out=\' ', implode(chr(10), $theLines['listItemRows']), ' \'; return $out; } ', 3); } // Single display: if ($config['list_default_singlemode']) { $innerMainContent .= $this->wrapBody(' /** * Display a single item from the database * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return HTML of a single database entry */ function singleView($content, $conf) { $this->conf = $conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); ' . (!$cache ? '$this->pi_USER_INT_obj = 1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '') . ' // This sets the title of the page for use in indexed search results: if ($this->internal[\'currentRow\'][\'title\']) $GLOBALS[\'TSFE\']->indexedDocTitle=$this->internal[\'currentRow\'][\'title\']; $content=\'<div\'.$this->pi_classParam(\'singleView\').\'> <H2>Record "\'.$this->internal[\'currentRow\'][\'uid\'].\'" from table "\'.$this->internal[\'currentTable\'].\'":</H2> ', implode(chr(10), $theLines['singleRows_section']), ' <p>\'.$this->pi_list_linkSingle($this->pi_getLL(\'back\',\'Back\'),0).\'</p></div>\'. $this->pi_getEditPanel(); return $content; } ', 3); } else { $innerMainContent .= $this->wrapBody(' /** * Display a single item from the database * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return HTML of a single database entry */ function singleView($content, $conf) { $this->conf = $conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); ' . (!$cache ? '$this->pi_USER_INT_obj = 1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '') . ' // This sets the title of the page for use in indexed search results: if ($this->internal[\'currentRow\'][\'title\']) $GLOBALS[\'TSFE\']->indexedDocTitle=$this->internal[\'currentRow\'][\'title\']; $content=\'<div\'.$this->pi_classParam(\'singleView\').\'> <H2>Record "\'.$this->internal[\'currentRow\'][\'uid\'].\'" from table "\'.$this->internal[\'currentTable\'].\'":</H2> <table> ', implode(chr(10), $theLines['singleRows']), ' </table> <p>\'.$this->pi_list_linkSingle($this->pi_getLL(\'back\',\'Back\'),0).\'</p></div>\'. $this->pi_getEditPanel(); return $content; } ', 3); } $this->wizard->ext_localconf[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[...]') . ' t3lib_extMgm::addTypoScript($_EXTKEY,\'setup\',\' tt_content.shortcut.20.0.conf.' . $tableName . ' = < plugin.\'.t3lib_extMgm::getCN($_EXTKEY).\'_pi' . $k . ' tt_content.shortcut.20.0.conf.' . $tableName . '.CMD = singleView \',43); '); if (!$config['list_default_listmode']) { $innerMainContent .= $this->wrapBody(' /** * Returns a single table row for list view * * @param integer $c: Counter for odd / even behavior * @return A HTML table row */ function pi_list_row($c) { $editPanel = $this->pi_getEditPanel(); if ($editPanel) $editPanel=\'<TD>\'.$editPanel.\'</TD>\'; return \'<tr\'.($c%2 ? $this->pi_classParam(\'listrow-odd\') : \'\').\'> ', implode(chr(10), $theLines['getListRow']), ' ' . $editPanel . ' </tr>\'; } ', 3); $innerMainContent .= $this->wrapBody(' /** * Returns a table row with column names of the table * * @return A HTML table row */ function pi_list_header() { return \'<tr\'.$this->pi_classParam(\'listrow-header\').\'> ', implode(chr(10), $theLines['getListHeader']), ' </tr>\'; } ', 3); } $innerMainContent .= $this->wrapBody(' /** * Returns the content of a given field * * @param string $fN: name of table field * @return Value of the field */ function getFieldContent($fN) { switch($fN) { case \'uid\': return $this->pi_list_linkSingle($this->internal[\'currentRow\'][$fN],$this->internal[\'currentRow\'][\'uid\'],1); // The "1" means that the display of single items is CACHED! Set to zero to disable caching. break; ', implode(chr(10), $theLines['getFieldContent']), ' default: return $this->internal[\'currentRow\'][$fN]; break; } } ', 2); $innerMainContent .= $this->wrapBody(' /** * Returns the label for a fieldname from local language array * * @param [type] $fN: ... * @return [type] ... */ function getFieldHeader($fN) { switch($fN) { ', implode(chr(10), $theLines['getFieldHeader']), ' default: return $this->pi_getLL(\'listFieldHeader_\'.$fN,\'[\'.$fN.\']\'); break; } } ', 2); $innerMainContent .= $this->sPS(' /** * Returns a sorting link for a column header * * @param string $fN: Fieldname * @return The fieldlabel wrapped in link that contains sorting vars */ function getFieldHeader_sortLink($fN) { return $this->pi_linkTP_keepPIvars($this->getFieldHeader($fN),array(\'sort\'=>$fN.\':\'.($this->internal[\'descFlag\']?0:1))); } '); /* $CSS_editor_code = ''; $pCSSSel = str_replace('_','-',$cN); if ($config['list_default_listmode']) { $temp_merge=array(); if (is_array($P_classes['LV'])) { while(list($c,$LVc)=each($P_classes['LV'])) { $temp_merge[]=$this->sPS(' P_'.$c.' = ['.$LVc.'] P_'.$c.'.selector = +.'.$pCSSSel.'-'.$LVc.' P_'.$c.'.attribs = BODYTEXT P_'.$c.'.example = <p class="'.$pCSSSel.'-'.$LVc.'">['.$LVc.'] text <a href="#">with a link</a> in it.</p><p class="'.$pCSSSel.'-'.$LVc.'">In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p> P_'.$c.'.exampleStop = 1 P_'.$c.'.ch.links = < CSS_editor.ch.A ',1); } } $CSS_editor_code.=$this->wrapBody(' list = List display list.selector = .'.$pCSSSel.'-listrow list.example = <div class="'.$pCSSSel.'-listrow"><p>This is regular bodytext in the list display.</p><p>Viditque Deus cuncta quae fecit et erant valde bona et factum est vespere et mane dies sextus.</p></div> list.exampleWrap = <div class="'.$pCSSSel.'-listrow"> | </div> list.ch.P < .P list.ch.P.exampleStop = 0 list.ch.P.ch { ',implode(chr(10),$temp_merge),' } '); } else { $CSS_editor_code.=$this->sPS(' list = List display list.selector = .'.$pCSSSel.'-listrow list.example = <div class="'.$pCSSSel.'-listrow"><table><tr class="'.$pCSSSel.'-listrow-header"><td nowrap><p>Time / Date:</p></td><td><p><a HREF="#">Title:</a></p></td></tr><tr><td valign="top"><p>25-08-02</p></td><td valign="top"><p><a HREF="#">New company name...</a></p></td></tr><tr class="'.$pCSSSel.'-listrow-odd"><td valign="top"><p>16-08-02</p></td><td valign="top"><p><a HREF="#">Yet another headline here</a></p></td></tr><tr><td valign="top"><p>05-08-02</p></td><td valign="top"><p><a HREF="#">The third line - even row</a></p></td></tr></table></div> list.exampleStop = 1 list.ch { TABLE = Table TABLE.selector = TABLE TABLE.attribs = TABLE TD = Table cells TD.selector = TD TD.attribs = TD TD_header = Header row cells TD_header.selector = TR.'.$pCSSSel.'-listrow-header TD TD_header.attribs = TD TD_odd = Odd rows cells TD_odd.selector = TR.'.$pCSSSel.'-listrow-odd TD TD_odd.attribs = TD } list.ch.TD.ch.P < .P list.ch.TD_header.ch.P < .P list.ch.TD_odd.ch.P < .P '); } if ($config['list_default_singlemode']) { $temp_merge=array(); if (is_array($P_classes['SV'])) { while(list($c,$LVc)=each($P_classes['SV'])) { $temp_merge[]=$this->sPS(' P_'.$c.' = ['.$LVc.'] P_'.$c.'.selector = +.'.$pCSSSel.'-'.$LVc.' P_'.$c.'.attribs = BODYTEXT P_'.$c.'.example = <p class="'.$pCSSSel.'-'.$LVc.'">['.$LVc.'] text <a href="#">with a link</a> in it.</p><p class="'.$pCSSSel.'-'.$LVc.'">In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p> P_'.$c.'.exampleStop = 1 P_'.$c.'.ch.links = < CSS_editor.ch.A ',1); } } $CSS_editor_code.=$this->wrapBody(' single = Single display single.selector = .'.$pCSSSel.'-singleView single.example = <div class="'.$pCSSSel.'-singleView"><H2>Header, if any:</H2><p>This is regular bodytext in the list display.</p><p>Viditque Deus cuncta quae fecit et erant valde bona et factum est vespere et mane dies sextus.</p><p><a href="#">Back</a></p></div> single.exampleWrap = <div class="'.$pCSSSel.'-singleView"> | </div> single.ch.P < .P single.ch.P.exampleStop = 0 single.ch.P.ch { ',implode(chr(10),$temp_merge),' } '); } else { $CSS_editor_code.=$this->sPS(' single = Single display single.selector = .'.$pCSSSel.'-singleView single.example = <div class="'.$pCSSSel.'-singleView"><H2>Header, if any:</H2><table><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Date:</p></td><td valign="top"><p>13-09-02</p></td></tr><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Title:</p></td><td valign="top"><p><a HREF="#">New title line</a></p></td></tr><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Teaser text:</p></td><td valign="top"><p>Vocavitque Deus firmamentum caelum et factum est vespere et mane dies secundus dixit vero Deus congregentur.</p><p>Aquae quae sub caelo sunt in locum unum et appareat arida factumque est ita et vocavit Deus aridam terram congregationesque aquarum appellavit maria et vidit Deus quod esset bonum et ait germinet terra herbam virentem et facientem s***n et lignum pomiferum faciens fructum iuxta genus suum cuius s***n in semet ipso sit super terram et factum est ita et protulit terra herbam virentem et adferentem s***n iuxta genus suum lignumque faciens fructum et habens unumquodque sementem secundum speciem suam et vidit Deus quod esset bonum.</p></td></tr><tr><td nowrap class="'.$pCSSSel.'-singleView-HCell"><p>Last updated:</p></td><td valign="top"><p>25-08-2002 18:28</p></td></tr><tr><td nowrap class="'.$pCSSSel.'-singleView-HCell"><p>Created:</p></td><td valign="top"><p>25-08-2002 18:27</p></td></tr></table><p><a href="#">Back</a></p></div> single.exampleStop = 1 single.ch { TABLE = Table TABLE.selector = TABLE TABLE.attribs = TABLE TD = Table cells TD.selector = TD TD.attribs = TD TD.ch { TD = Header cells TD.selector = +.'.$pCSSSel.'-singleView-HCell TD.attribs = TD } } single.ch.P < .P single.ch.H2 < .H2 single.ch.TD.ch.P < .P single.ch.TD.ch.TD.ch.P < .P '); } $this->addFileToFileArray($config['plus_not_staticTemplate']?'ext_typoscript_editorcfg.txt':$pathSuffix.'static/editorcfg.txt',$this->wrapBody(' plugin.'.$cN.'.CSS_editor = Plugin: "'.$cN.'" plugin.'.$cN.'.CSS_editor.selector = .'.$pCSSSel.' plugin.'.$cN.'.CSS_editor.exampleWrap = <HR><strong>Plugin: "'.$cN.'"</strong><HR><div class="'.$pCSSSel.'"> | </div> plugin.'.$cN.'.CSS_editor.ch { P = Text P.selector = P P.attribs = BODYTEXT P.example = <p>General text wrapped in <P>:<br />This is text <a href="#">with a link</a> in it. In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p> P.exampleStop = 1 P.ch.links = < CSS_editor.ch.A H2 = Header 2 H2.selector = H2 H2.attribs = HEADER H2.example = <H2>Header 2 example <a href="#"> with link</a></H2><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p> H2.ch.links = < CSS_editor.ch.A H2.exampleStop = 1 H3 = Header 3 H3.selector = H3 H3.attribs = HEADER H3.example = <h3>Header 3 example <a href="#"> with link</a></h3><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p> H3.ch.links = < CSS_editor.ch.A H3.exampleStop = 1 ## LISTING: modeSelector = Mode selector modeSelector.selector = .'.$pCSSSel.'-modeSelector modeSelector.example = <div class="'.$pCSSSel.'-modeSelector"><table><tr><td class="'.$pCSSSel.'-modeSelector-SCell"><p><a HREF="#">Mode 1 (S)</a></p></td><td><p><a HREF="#">Mode 2</a></p></td><td><p><a HREF="#">Mode 3</a></p></td></tr></table></div> modeSelector.exampleStop = 1 modeSelector.ch.P < .P modeSelector.ch.TABLE = Table modeSelector.ch.TABLE.selector = TABLE modeSelector.ch.TABLE.attribs = TABLE modeSelector.ch.TD = Table cells modeSelector.ch.TD.selector = TD modeSelector.ch.TD.attribs = TD modeSelector.ch.TD.ch { TD = Selected table cells TD.selector = + .'.$pCSSSel.'-modeSelector-SCell TD.attribs = TD } modeSelector.ch.TD.ch.TD.ch.P < .P browsebox = Browsing box browsebox.selector = .'.$pCSSSel.'-browsebox browsebox.example = <div class="'.$pCSSSel.'-browsebox"><p>Displaying results <span class="'.$pCSSSel.'-browsebox-strong">1 to 3</span> out of <span class="'.$pCSSSel.'-browsebox-strong">4</span></p><table><tr><td class="'.$pCSSSel.'-browsebox-SCell"><p><a HREF="#">Page 1 (S)</a></p></td><td><p><a HREF="#">Page 2</a></p></td><td><p><a HREF="#">Next ></a></p></td></tr></table></div> browsebox.exampleStop = 1 browsebox.ch.P < .P browsebox.ch.P.ch.strong = Emphasized numbers browsebox.ch.P.ch.strong { selector = SPAN.'.$pCSSSel.'-browsebox-strong attribs = TEXT } browsebox.ch.TABLE = Table browsebox.ch.TABLE.selector = TABLE browsebox.ch.TABLE.attribs = TABLE browsebox.ch.TD = Table cells browsebox.ch.TD.selector = TD browsebox.ch.TD.attribs = TD browsebox.ch.TD.ch { TD = Selected table cells TD.selector = + .'.$pCSSSel.'-browsebox-SCell TD.attribs = TD } browsebox.ch.TD.ch.P < .P browsebox.ch.TD.ch.TD.ch.P < .P searchbox = Search box searchbox.selector = .'.$pCSSSel.'-searchbox searchbox.example = <div class="'.$pCSSSel.'-searchbox"><table><form action="#" method="POST"><tr><td><input type="text" name="'.$cN.'[sword]" value="Search word" class="'.$pCSSSel.'-searchbox-sword"></td><td><input type="submit" value="Search" class="'.$pCSSSel.'-searchbox-button"></td></tr></form></table></div> searchbox.exampleStop = 1 searchbox.ch { TABLE = Table TABLE.selector = TABLE TABLE.attribs = TABLE TD = Table cells TD.selector = TD TD.attribs = TD INPUT = Form fields INPUT.selector = INPUT INPUT.attribs = TEXT,background-color,width INPUT.ch { sword = Search word field sword.selector = +.'.$pCSSSel.'-searchbox-sword sword.attribs = TEXT,background-color,width button = Submit button button.selector = +.'.$pCSSSel.'-searchbox-button button.attribs = TEXT,background-color,width } } ',$CSS_editor_code,' } '),1); */ $this->addFileToFileArray($config['plus_not_staticTemplate'] ? 'ext_typoscript_setup.txt' : $pathSuffix . 'static/setup.txt', $this->sPS(' plugin.' . $cN . ' { CMD = pidList = recursive = } plugin.' . $cN . '.listView { results_at_a_time = maxPages = } # Example of default set CSS styles (these go into the document header): plugin.' . $cN . '._CSS_DEFAULT_STYLE ( .' . $pCSSSel . ' H2 { margin-top: 0px; margin-bottom: 0px; } ) # Example of how to overrule LOCAL_LANG values for the plugin: plugin.' . $cN . '._LOCAL_LANG.default { pi_list_searchBox_search = Search! } # Example of how to set default values from TS in the incoming array, $this->piVars of the plugin: plugin.' . $cN . '._DEFAULT_PI_VARS.test = test '), 1); $this->wizard->EM_CONF_presets['clearCacheOnLoad'] = 1; if (!$config['plus_not_staticTemplate']) { $this->wizard->ext_tables[] = $this->sPS(' t3lib_extMgm::addStaticFile($_EXTKEY,\'' . $pathSuffix . 'static/\',\'' . addslashes(trim($config['title'])) . '\'); '); } } } else { // Add title to local lang file $ll = $this->addStdLocalLangConf($ll, $k, 1); $this->addLocalConf($ll, array('submit_button_label' => 'Click here to submit value'), 'submit_button_label', 'pi', $k, 1, 1); $this->addLocalLangFile($ll, $pathSuffix . 'locallang.xml', 'Language labels for plugin "' . $cN . '"'); $innerMainContent = $this->sPS(' /** * The main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website */ function main($content, $conf) { $this->conf = $conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); ' . (!$cache ? '$this->pi_USER_INT_obj = 1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '') . ' $content=\' <strong>This is a few paragraphs:</strong><br /> <p>This is line 1</p> <p>This is line 2</p> <h3>This is a form:</h3> <form action="\'.$this->pi_getPageLink($GLOBALS[\'TSFE\']->id).\'" method="POST"> <input type="text" name="\'.$this->prefixId.\'[input_field]" value="\'.htmlspecialchars($this->piVars[\'input_field\']).\'"> <input type="submit" name="\'.$this->prefixId.\'[submit_button]" value="\'.htmlspecialchars($this->pi_getLL(\'submit_button_label\')).\'"> </form> <br /> <p>You can click here to \'.$this->pi_linkToPage(\'get to this page again\',$GLOBALS[\'TSFE\']->id).\'</p> \'; return $this->pi_wrapInBaseClass($content); } '); /* $CSS_editor_code=''; $pCSSSel = str_replace('_','-',$cN); $this->addFileToFileArray($config['plus_not_staticTemplate']?'ext_typoscript_editorcfg.txt':$pathSuffix.'static/editorcfg.txt',$this->sPS(' plugin.'.$cN.'.CSS_editor = Plugin: "'.$cN.'" plugin.'.$cN.'.CSS_editor.selector = .'.$pCSSSel.' plugin.'.$cN.'.CSS_editor.exampleWrap = <HR><strong>Plugin: "'.$cN.'"</strong><HR><div class="'.$pCSSSel.'"> | </div> plugin.'.$cN.'.CSS_editor.ch { P = Text P.selector = P P.attribs = BODYTEXT P.example = <p>General text wrapped in <P>:<br />This is text <a href="#">with a link</a> in it. In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p> P.exampleStop = 1 P.ch.links = < CSS_editor.ch.A H3 = Header 3 H3.selector = H3 H3.attribs = HEADER H3.example = <h3>Header 3 example <a href="#"> with link</a></h3><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p> H3.ch.links = < CSS_editor.ch.A H3.exampleStop = 1 } '),1); if (!$config['plus_not_staticTemplate']) { $this->wizard->ext_tables[]=$this->sPS(' t3lib_extMgm::addStaticFile($_EXTKEY, \''.$pathSuffix.'static/\', \''.addslashes(trim($config['title'])).'\'); '); } */ } break; case 'textbox': $this->wizard->ext_localconf[] = $this->sPS(' ## Setting TypoScript for the image in the textbox: t3lib_extMgm::addTypoScript($_EXTKEY,\'setup\',\' plugin.' . $cN . '_pi' . $k . '.IMAGEcObject { file.width=100 } \',43); '); $innerMainContent = $this->sPS(' /** * The main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website (Textbox) */ function main($content, $conf) { // Processes the image-field content: // $conf[\'IMAGEcObject.\'] is passed to the getImage() function as TypoScript // configuration for the image (except filename which is set automatically here) $imageFiles = explode(\',\',$this->cObj->data[\'image\']); // This returns an array with image-filenames, if many $imageRows=array(); // Accumulates the images reset($imageFiles); while(list(,$iFile)=each($imageFiles)) { $imageRows[] = \'<tr> <td>\'.$this->getImage($iFile,$conf[\'IMAGEcObject.\']).\'</td> </tr>\'; } $imageBlock = count($imageRows)?\'<table border=0 cellpadding=5 cellspacing=0>\'.implode(\'\',$imageRows).\'</table>\':\'<img src=clear.gif width=100 height=1>\'; // Sets bodytext $bodyText = nl2br($this->cObj->data[\'bodytext\']); // And compiles everything into a table: $finalContent = \'<table border=1> <tr> <td valign=top>\'.$imageBlock.\'</td> <td valign=top>\'.$bodyText.\'</td> </tr> </table>\'; // And returns content return $finalContent; } /** * This calls a function in the TypoScript API which will return an image tag with the image * processed according to the parsed TypoScript content in the $TSconf array. * * @param string $filename: The filename of the image * @param array $TSconf: The TS configuration for displaying the image * @return The image HTML code */ function getImage($filename,$TSconf) { list($theImage)=explode(\',\',$filename); $TSconf[\'file\'] = \'uploads/pics/\'.$theImage; $img = $this->cObj->IMAGE($TSconf); return $img; } '); break; case 'header': $innerMainContent = $this->sPS(' /** * The main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website (Header) */ function main($content, $conf) { return \'<H1>\'.$this->cObj->data[\'header\'].\'</H1>\'; } '); break; case 'menu_sitemap': $innerMainContent = $this->sPS(' /** * The main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website (Menu) */ function main($content, $conf) { // Get the PID from which to make the menu. // If a page is set as reference in the \'Startingpoint\' field, use that // Otherwise use the page\'s id-number from TSFE $menuPid = intval($this->cObj->data[\'pages\']?$this->cObj->data[\'pages\']:$GLOBALS[\'TSFE\']->id); // Now, get an array with all the subpages to this pid: // (Function getMenu() is found in class.t3lib_page.php) $menuItems_level1 = $GLOBALS[\'TSFE\']->sys_page->getMenu($menuPid); // Prepare vars: $tRows=array(); // Traverse menuitems: reset($menuItems_level1); while(list($uid,$pages_row)=each($menuItems_level1)) { $tRows[]=\'<tr bgColor="#cccccc"><td>\'.$this->pi_linkToPage( $pages_row[\'nav_title\']?$pages_row[\'nav_title\']:$pages_row[\'title\'], $pages_row[\'uid\'], $pages_row[\'target\'] ).\'</td></tr>\'; } $totalMenu = \'<table border=0 cellpadding=0 cellspacing=2> <tr><td>This is a menu. Go to your favourite page:</td></tr> \'.implode(\'\',$tRows). \'</table><br />(\'.$this->tellWhatToDo(\'Click here if you want to know where to change the menu design\').\')\'; return $totalMenu; } /** * Here you can do what ever you want * * @param string $str: The string that is processed * @return It\'s your decission */ function tellWhatToDo($str) { return \'<a href="#" onClick="alert(\\\'Open the PHP-file \'.t3lib_extMgm::siteRelPath(\'' . $extKey . '\').\'' . $pathSuffix . 'class.' . $cN . '.php and edit the function main()\\nto change how the menu is rendered! It is pure PHP coding!\\\')">\'.$str.\'</a>\'; } '); break; case 'typotags': $innerMainContent = $this->sPS(' /** * The main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website (TypoTag) */ function main($content, $conf) { $tag_content = $this->cObj->getCurrentVal(); return \'<b>\'.$this->tellWhatToDo(strtoupper($tag_content)).\'</b>\'; } /** * Here you can do what ever you want * * @param string $str: The string that is processed * @return It\'s your decission */ function tellWhatToDo($str) { return \'<a href="#" onClick="alert(\\\'Open the PHP-file \'.t3lib_extMgm::siteRelPath(\'' . $extKey . '\').\'' . $pathSuffix . 'class.' . $cN . '.php and edit the function main()\\nto change how the tag content is processed!\\\')">\'.$str.\'</a>\'; } '); break; default: $innerMainContent = $this->sPS(' /** * The main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website */ function main($content, $conf) { return \'Hello World!<HR> Here is the TypoScript passed to the method:\'. t3lib_div::view_array($conf); } '); break; } $indexRequire = 'require_once(PATH_tslib.\'class.tslib_pibase.php\');'; $indexContent = $this->wrapBody(' class ' . $cN . ' extends tslib_pibase { var $prefixId = \'' . $cN . '\'; // Same as class name var $scriptRelPath = \'' . ($pathSuffix . "class." . $cN . ".php") . '\'; // Path to this script relative to the extension dir. var $extKey = \'' . $extKey . '\'; // The extension key. ' . ($cache ? 'var $pi_checkCHash = true; ' : '') . ' ', $innerMainContent, ' } '); $this->addFileToFileArray($pathSuffix . 'class.' . $cN . '.php', $this->PHPclassFile($extKey, $pathSuffix . 'class.' . $cN . '.php', $indexContent, 'Plugin \'' . $config['title'] . '\' for the \'' . $extKey . '\' extension.', '', '', $indexRequire)); // Add wizard? if ($config['plus_wiz'] && $config['addType'] == 'list_type') { $this->addLocalConf($this->wizard->ext_locallang, $config, 'title', 'pi', $k); $this->addLocalConf($this->wizard->ext_locallang, $config, 'plus_wiz_description', 'pi', $k); $indexContent = $this->sPS('class ' . $cN . '_wizicon { /** * Processing the wizard items array * * @param array $wizardItems: The wizard items * @return Modified array with wizard items */ function proc($wizardItems) { global $LANG; $LL = $this->includeLocalLang(); $wizardItems[\'plugins_' . $cN . '\'] = array( \'icon\'=>t3lib_extMgm::extRelPath(\'' . $extKey . '\').\'' . $pathSuffix . 'ce_wiz.gif\', \'title\'=>$LANG->getLLL(\'pi' . $k . '_title\',$LL), \'description\'=>$LANG->getLLL(\'pi' . $k . '_plus_wiz_description\',$LL), \'params\'=>\'&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=' . $extKey . '_pi' . $k . '\' ); return $wizardItems; } /** * Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file. * * @return The array with language labels */ function includeLocalLang() { $llFile = t3lib_extMgm::extPath(\'' . $extKey . '\').\'locallang.xml\'; $LOCAL_LANG = t3lib_div::readLLXMLfile($llFile, $GLOBALS[\'LANG\']->lang); return $LOCAL_LANG; } } ', 0); $this->addFileToFileArray($pathSuffix . 'class.' . $cN . '_wizicon.php', $this->PHPclassFile($extKey, $pathSuffix . 'class.' . $cN . '_wizicon.php', $indexContent, 'Class that adds the wizard icon.')); // Add wizard icon $this->addFileToFileArray($pathSuffix . 'ce_wiz.gif', t3lib_div::getUrl(t3lib_extMgm::extPath('kickstarter') . 'res/wiz.gif')); // Add clear.gif $this->addFileToFileArray($pathSuffix . 'clear.gif', t3lib_div::getUrl(t3lib_extMgm::extPath('kickstarter') . 'res/clear.gif')); $this->wizard->ext_tables[] = $this->sPS(' ' . $this->WOPcomment('WOP:' . $WOP . '[plus_wiz]:') . ' if (TYPO3_MODE == \'BE\') { $TBE_MODULES_EXT[\'xMOD_db_new_content_el\'][\'addElClasses\'][\'' . $cN . '_wizicon\'] = t3lib_extMgm::extPath($_EXTKEY).\'pi' . $k . '/class.' . $cN . '_wizicon.php\'; } '); } }
/** * Render the excel XML export * * @param array Translation data for configuration * @return string HTML content */ function render() { global $LANG, $BE_USER; $sysLang = $this->sysLang; $accumObj = $this->l10ncfgObj->getL10nAccumulatedInformationsObjectForLanguage($sysLang); if ($this->forcedSourceLanguage) { $accumObj->setForcedPreviewLanguage($this->forcedSourceLanguage); } $accum = $accumObj->getInfoArray(); $output = array(); // Traverse the structure and generate HTML output: foreach ($accum as $pId => $page) { $output[] = ' <!-- Page header --> <Row> <Cell ss:Index="2" ss:StyleID="s35"><Data ss:Type="String">' . htmlspecialchars($page['header']['title'] . ' [' . $pId . ']') . '</Data></Cell> <Cell ss:StyleID="s35"></Cell> <Cell ss:StyleID="s35"></Cell> <Cell ss:StyleID="s35"></Cell> ' . ($page['header']['prevLang'] ? '<Cell ss:StyleID="s35"></Cell>' : '') . ' </Row>'; $output[] = ' <!-- Field list header --> <Row> <Cell ss:Index="2" ss:StyleID="s38"><Data ss:Type="String">Fieldname:</Data></Cell> <Cell ss:StyleID="s38"><Data ss:Type="String">Source language:</Data></Cell> <Cell ss:StyleID="s38"><Data ss:Type="String">Alternative source language:</Data></Cell> <Cell ss:StyleID="s38"><Data ss:Type="String">Translation:</Data></Cell> <Cell ss:StyleID="s38"><Data ss:Type="String">Difference since last tr.:</Data></Cell> </Row>'; foreach ($accum[$pId]['items'] as $table => $elements) { foreach ($elements as $elementUid => $data) { if (is_array($data['fields'])) { $fieldsForRecord = array(); foreach ($data['fields'] as $key => $tData) { if (is_array($tData)) { list(, $uidString, $fieldName) = explode(':', $key); list($uidValue) = explode('/', $uidString); //DZ if ($this->forcedSourceLanguage && isset($tData['previewLanguageValues'][$this->forcedSourceLanguage]) || $this->forcedSourceLanguage === false) { //DZ if ($this->forcedSourceLanguage) { $dataForTranslation = $tData['previewLanguageValues'][$this->forcedSourceLanguage]; $sourceColState = 'ss:Hidden="1" ss:AutoFitWidth="0"'; $altSourceColState = 'ss:AutoFitWidth="0" ss:Width="233.0"'; } else { $dataForTranslation = $tData['defaultValue']; $sourceColState = 'ss:AutoFitWidth="0" ss:Width="233.0"'; $altSourceColState = 'ss:Hidden="1" ss:AutoFitWidth="0"'; } $diff = ''; $noChangeFlag = !strcmp(trim($tData['diffDefaultValue']), trim($tData['defaultValue'])); if ($uidValue === 'NEW') { $diff = htmlspecialchars('[New value]'); } elseif (!$tData['diffDefaultValue']) { $diff = htmlspecialchars('[No diff available]'); } elseif ($noChangeFlag) { $diff = htmlspecialchars('[No change]'); } else { $diff = $this->diffCMP($tData['diffDefaultValue'], $tData['defaultValue']); $diff = str_replace('<span class="diff-r">', '<Font html:Color="#FF0000" xmlns="http://www.w3.org/TR/REC-html40">', $diff); $diff = str_replace('<span class="diff-g">', '<Font html:Color="#00FF00" xmlns="http://www.w3.org/TR/REC-html40">', $diff); $diff = str_replace('</span>', '</Font>', $diff); } $diff .= $tData['msg'] ? '[NOTE: ' . htmlspecialchars($tData['msg']) . ']' : ''; if (!$this->modeOnlyChanged || !$noChangeFlag) { reset($tData['previewLanguageValues']); $fieldsForRecord[] = ' <!-- Translation row: --> <Row ss:StyleID="s25"> <Cell><Data ss:Type="String">' . htmlspecialchars('translation[' . $table . '][' . $elementUid . '][' . $key . ']') . '</Data></Cell> <Cell ss:StyleID="s26"><Data ss:Type="String">' . htmlspecialchars($fieldName) . '</Data></Cell> <Cell ss:StyleID="s27"><Data ss:Type="String">' . str_replace(chr(10), ' ', htmlspecialchars($tData['defaultValue'])) . '</Data></Cell> <Cell ss:StyleID="s27"><Data ss:Type="String">' . str_replace(chr(10), ' ', htmlspecialchars(current($tData['previewLanguageValues']))) . '</Data></Cell> <Cell ss:StyleID="s39"><Data ss:Type="String">' . str_replace(chr(10), ' ', htmlspecialchars($tData['translationValue'])) . '</Data></Cell> <Cell ss:StyleID="s27"><Data ss:Type="String">' . $diff . '</Data></Cell> </Row> '; } } else { $fieldsForRecord[] = ' <!-- Translation row: --> <Row ss:StyleID="s25"> <Cell><Data ss:Type="String">' . htmlspecialchars('translation[' . $table . '][' . $elementUid . '][' . $key . ']') . '</Data></Cell> <Cell ss:StyleID="s26"><Data ss:Type="String">' . htmlspecialchars($fieldName) . '</Data></Cell> <Cell ss:StyleID="s40"><Data ss:Type="String">' . $LANG->getLL('export.process.error.empty.message') . '!</Data></Cell> <Cell ss:StyleID="s39"><Data ss:Type="String"></Data></Cell> <Cell ss:StyleID="s27"><Data ss:Type="String"></Data></Cell> ' . ($page['header']['prevLang'] ? '<Cell ss:StyleID="s27"><Data ss:Type="String">' . str_replace(chr(10), ' ', htmlspecialchars(current($tData['previewLanguageValues']))) . '</Data></Cell>' : '') . ' </Row> '; } } } if (count($fieldsForRecord)) { $output[] = ' <!-- Element header --> <Row> <Cell ss:Index="2" ss:StyleID="s37"><Data ss:Type="String">Element: ' . htmlspecialchars($table . ':' . $elementUid) . '</Data></Cell> <Cell ss:StyleID="s37"></Cell> <Cell ss:StyleID="s37"></Cell> <Cell ss:StyleID="s37"></Cell> ' . ($page['header']['prevLang'] ? '<Cell ss:StyleID="s37"></Cell>' : '') . ' </Row> '; $output = array_merge($output, $fieldsForRecord); } } } } $output[] = ' <!-- Spacer row --> <Row> <Cell ss:Index="2"><Data ss:Type="String"></Data></Cell> </Row> '; } // Provide a hook for specific manipulations before building the actual XML if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['l10nmgr']['exportExcelXmlPreProcess'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['l10nmgr']['exportExcelXmlPreProcess'] as $classReference) { $processingObject = t3lib_div::getUserObj($classReference); $output = $processingObject->processBeforeExportingExcelXml($output, $this); } } $excelXML = t3lib_div::getUrl(t3lib_extMgm::extPath('l10nmgr') . 'views/excelXML/excel_template.xml'); $excelXML = str_replace('###INSERT_ROWS###', implode('', $output), $excelXML); $excelXML = str_replace('###INSERT_ROW_COUNT###', count($output), $excelXML); $excelXML = str_replace('###SOURCE_COL_STATE###', $sourceColState, $excelXML); $excelXML = str_replace('###ALT_SOURCE_COL_STATE###', $altSourceColState, $excelXML); $excelXML = str_replace('###INSERT_INFORMATION###', $this->renderInternalMessage(), $excelXML); return $this->saveExportFile($excelXML); }
/** * Reading database structure * * @return void */ function xmlDB_readStructure() { $this->DBstructure = t3lib_div::xml2array(t3lib_div::getUrl($this->DBdir . '_STRUCTURE.xml')); }
/** * Processing of the content in $totalRecordcontent based on settings in the types-configuration * * @param array The array of values which has been processed according to their type (eg. "group" or "select") * @param array The "types" configuration for the current display of fields. * @param integer PAGE TSconfig PID * @param string Table name * @param integer PID value * @return array The processed version of $totalRecordContent * @access private */ function renderRecord_typesProc($totalRecordContent, $types_fieldConfig, $tscPID, $table, $pid) { foreach ($types_fieldConfig as $vconf) { // Find file to write to, if configured: $eFile = t3lib_parsehtml_proc::evalWriteFile($vconf['spec']['static_write'], $totalRecordContent); // Write file configuration: if (is_array($eFile)) { if ($eFile['loadFromFileField'] && $totalRecordContent[$eFile['loadFromFileField']]) { // Read the external file, and insert the content between the ###TYPO3_STATICFILE_EDIT### markers: $SW_fileContent = t3lib_div::getUrl($eFile['editFile']); $parseHTML = t3lib_div::makeInstance('t3lib_parsehtml_proc'); $parseHTML->init('', ''); $totalRecordContent[$vconf['field']] = $parseHTML->getSubpart($SW_fileContent, $eFile['markerField'] && trim($totalRecordContent[$eFile['markerField']]) ? trim($totalRecordContent[$eFile['markerField']]) : '###TYPO3_STATICFILE_EDIT###'); } } } return $totalRecordContent; }
/** * This function returns the mime type of the file specified by the url * (copied from t3lib_htmlmail of TYPO3 4.6 which got removed in TYPO3 4.7) * * @param string $url: the url * @return string $mimeType: the mime type found in the header */ protected function getMimeTypeByHttpRequest($url) { $mimeType = ''; $headers = trim(t3lib_div::getUrl($url, 2)); if ($headers) { $matches = array(); if (preg_match('/(Content-Type:[\\s]*)([a-zA-Z_0-9\\/\\-\\.\\+]*)([\\s]|$)/', $headers, $matches)) { $mimeType = trim($matches[2]); } } return $mimeType; }
/** * Adds the default TypoScript files for extensions if any. * * @param string A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records, "static" for "static_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion. * @param string The id of the current template. Same syntax as $idList ids, eg. "sys_123" * @param array The PID of the input template record * @param array A full TypoScript template record * @return void * @access private * @see includeStaticTypoScriptSources() */ function addExtensionStatics($idList, $templateID, $pid, $row) { global $TYPO3_LOADED_EXT; if ($row['static_file_mode'] == 1 || $row['static_file_mode'] == 0 && substr($templateID, 0, 4) == 'sys_' && $row['root']) { foreach ($TYPO3_LOADED_EXT as $extKey => $files) { if (is_array($files) && ($files['ext_typoscript_constants.txt'] || $files['ext_typoscript_setup.txt'] || $files['ext_typoscript_editorcfg.txt'])) { $mExtKey = str_replace('_', '', $extKey); $subrow = array('constants' => $files['ext_typoscript_constants.txt'] ? t3lib_div::getUrl($files['ext_typoscript_constants.txt']) : '', 'config' => $files['ext_typoscript_setup.txt'] ? t3lib_div::getUrl($files['ext_typoscript_setup.txt']) : '', 'editorcfg' => $files['ext_typoscript_editorcfg.txt'] ? t3lib_div::getUrl($files['ext_typoscript_editorcfg.txt']) : '', 'title' => $extKey, 'uid' => $mExtKey); $subrow = $this->prependStaticExtra($subrow); $this->processTemplate($subrow, $idList . ',ext_' . $mExtKey, $pid, 'ext_' . $mExtKey, $templateID); } } } }