/** * Constructor * * @param object $parentObject */ public function __construct($parentObject = NULL) { $this->parentObject = $parentObject; $this->api = t3lib_div::makeInstance('tx_em_API'); $this->install = t3lib_div::makeInstance('tx_em_Install', $this); $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('em') . 'language/locallang.xml'); $this->categories = array('be' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_BE'), 'module' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_BE_modules'), 'fe' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_FE'), 'plugin' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_FE_plugins'), 'misc' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_miscellanous'), 'services' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_services'), 'templates' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_templates'), 'example' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_examples'), 'doc' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_documentation')); $this->states = tx_em_Tools::getStates(); }
/** * Constructor * * @param object $parentObject * @return void */ public function __construct($parentObject = NULL) { $this->parentObject = $parentObject; $this->install = t3lib_div::makeInstance('tx_em_Install', $this); $this->xmlHandler = t3lib_div::makeInstance('tx_em_Tools_XmlHandler'); $this->categories = array('be' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_BE'), 'module' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_BE_modules'), 'fe' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_FE'), 'plugin' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_FE_plugins'), 'misc' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_miscellanous'), 'services' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_services'), 'templates' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_templates'), 'example' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_examples'), 'doc' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:category_documentation')); $this->types = array('S' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:type_system'), 'G' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:type_global'), 'L' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:type_local')); $this->states = tx_em_Tools::getStates(); }
/** * Parses content of mirrors.xml into a suitable array * * @param string XML data file to parse * @return string HTLML output informing about result */ function parseExtensionsXML($filename) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'utf-8'); xml_set_element_handler($parser, array(&$this, 'startElement'), array(&$this, 'endElement')); xml_set_character_data_handler($parser, array(&$this, 'characterData')); $fp = gzopen($filename, 'rb'); if (!$fp) { return 'Error opening XML extension file "' . $filename . '"'; } $string = gzread($fp, 0xffff); // Read 64KB $idx = 0; $defaultCategories = tx_em_Tools::getDefaultCategory(); foreach ($defaultCategories as $catKey => $tmp) { $this->revCatArr[$catKey] = $idx++; } $idx = 0; $states = tx_em_Tools::getStates(); foreach ($states as $state => $tmp) { $this->revStateArr[$state] = $idx++; } $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_extensions'); $extcount = 0; $content = ''; @ini_set('pcre.backtrack_limit', 500000); do { if (preg_match('/.*(<extension\\s+extensionkey="[^"]+">.*<\\/extension>)/suU', $string, $match)) { // Parse content: if (!xml_parse($parser, $match[0], 0)) { $content .= 'Error in XML parser while decoding extensions XML file. Line ' . xml_get_current_line_number($parser) . ': ' . xml_error_string(xml_get_error_code($parser)); $error = TRUE; break; } $this->storeXMLResult(); $this->extXMLResult = array(); $extcount++; $string = substr($string, strlen($match[0])); } elseif (function_exists('preg_last_error') && preg_last_error()) { $errorcodes = array(0 => 'PREG_NO_ERROR', 1 => 'PREG_INTERNAL_ERROR', 2 => 'PREG_BACKTRACK_LIMIT_ERROR', 3 => 'PREG_RECURSION_LIMIT_ERROR', 4 => 'PREG_BAD_UTF8_ERROR'); $content .= 'Error in regular expression matching, code: ' . $errorcodes[preg_last_error()] . '<br />See <a href="http://www.php.net/manual/en/function.preg-last-error.php" target="_blank">http://www.php.net/manual/en/function.preg-last-error.php</a>'; $error = TRUE; break; } else { if (gzeof($fp)) { break; } // Nothing more can be read $string .= gzread($fp, 0xffff); // Read another 64KB } } while (TRUE); xml_parser_free($parser); gzclose($fp); if (!$error) { /** @var $flashMessage t3lib_FlashMessage */ $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('ext_import_extlist_updated'), $extcount), $GLOBALS['LANG']->getLL('ext_import_extlist_updated_header')); $content .= $flashMessage->render(); } return $content; }
/** * Standard init function of a module. * * @return void */ function init() { global $BE_USER, $LANG, $BACK_PATH, $TYPO3_CONF_VARS; /** * Extension Categories (static var) * Content must be redundant with the same internal variable as in class.tx_extrep.php! */ $this->categories = array('be' => $GLOBALS['LANG']->getLL('category_BE'), 'module' => $GLOBALS['LANG']->getLL('category_BE_modules'), 'fe' => $GLOBALS['LANG']->getLL('category_FE'), 'plugin' => $GLOBALS['LANG']->getLL('category_FE_plugins'), 'misc' => $GLOBALS['LANG']->getLL('category_miscellanous'), 'services' => $GLOBALS['LANG']->getLL('category_services'), 'templates' => $GLOBALS['LANG']->getLL('category_templates'), 'example' => $GLOBALS['LANG']->getLL('category_examples'), 'doc' => $GLOBALS['LANG']->getLL('category_documentation')); /** * Extension States * Content must be redundant with the same internal variable as in class.tx_extrep.php! */ $this->states = tx_em_Tools::getStates(); $this->script = 'mod.php?M=tools_em'; $this->privacyNotice = $GLOBALS['LANG']->getLL('privacy_notice'); $securityMessage = $GLOBALS['LANG']->getLL('security_warning_extensions') . '<br /><br />' . sprintf($GLOBALS['LANG']->getLL('security_descr'), '<a href="http://typo3.org/teams/security/" target="_blank">', '</a>'); $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $securityMessage, $GLOBALS['LANG']->getLL('security_header'), t3lib_FlashMessage::INFO); $this->securityHint = $flashMessage->render(); $this->excludeForPackaging = $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging']; // Setting module configuration: $this->MCONF = $GLOBALS['MCONF']; // Setting GPvars: $this->CMD = is_array(t3lib_div::_GP('CMD')) ? t3lib_div::_GP('CMD') : array(); $this->lookUpStr = trim(t3lib_div::_GP('lookUp')); $this->listRemote = t3lib_div::_GP('ter_connect'); $this->listRemote_search = trim(t3lib_div::_GP('ter_search')); $this->noDocHeader = intval(t3lib_div::_GP('nodoc') > 0); $this->settings = t3lib_div::makeInstance('tx_em_Settings'); $this->install = t3lib_div::makeInstance('tx_em_Install', $this); if (t3lib_div::_GP('silentMode') || $this->noDocHeader) { $this->CMD['silentMode'] = 1; $this->noDocHeader = 1; } if ($this->CMD['silentMode']) { $this->install->setSilentMode(TRUE); } // Configure menu $this->menuConfig(); // Setting internal static: $this->requiredExt = t3lib_div::trimExplode(',', t3lib_extMgm::getRequiredExtensionList(), TRUE); // Initialize Document Template object: $this->doc = t3lib_div::makeInstance('template'); $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('templates/em_index.html'); // Initialize helper objects $this->api = t3lib_div::makeInstance('tx_em_API'); $this->terConnection = t3lib_div::makeInstance('tx_em_Connection_Ter', $this); $this->terConnection->wsdlURL = $TYPO3_CONF_VARS['EXT']['em_wsdlURL']; $this->xmlHandler = t3lib_div::makeInstance('tx_em_Tools_XmlHandler'); $this->xmlHandler->emObj = $this; $this->xmlHandler->useObsolete = $this->MOD_SETTINGS['display_obsolete']; // Initialize newListing if (isset($this->MOD_MENU['function']['extensionmanager'])) { $this->extensionmanager = t3lib_div::makeInstance('tx_em_ExtensionManager', $this); } else { $this->extensionmanager =& $this; } // Output classes $this->extensionList = t3lib_div::makeInstance('tx_em_Extensions_List', $this); $this->extensionDetails = t3lib_div::makeInstance('tx_em_Extensions_Details', $this); $this->translations = t3lib_div::makeInstance('tx_em_Translations', $this); // the id is needed for getting same styles TODO: general table styles $this->doc->bodyTagId = 'typo3-mod-tools-em-index-php'; // JavaScript $this->doc->JScode = $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { // window.location.href = URL; } '); // Reload left frame menu if ($this->CMD['refreshMenu']) { $this->doc->JScode .= $this->doc->wrapScriptTags(' if(top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); } '); } // Descriptions: $this->descrTable = '_MOD_' . $this->MCONF['name']; if ($BE_USER->uc['edit_showFieldHelp']) { $LANG->loadSingleTableDescription($this->descrTable); } // Setting username/password etc. for upload-user: $this->fe_user['username'] = $this->MOD_SETTINGS['fe_u']; $this->fe_user['password'] = $this->MOD_SETTINGS['fe_p']; parent::init(); $this->handleExternalFunctionValue('singleDetails'); }