Project

General

Profile

Bug #24174 » 16528_v2.patch

Administrator Admin, 2010-11-26 00:15

View differences:

typo3/sysext/em/classes/connection/class.tx_em_connection_extdirectserver.php (revision )
* @return void
*/
public function __construct() {
$GLOBALS['TBE_TEMPLATE'] = t3lib_div::makeInstance('template');
}
typo3/sysext/em/classes/index.php (revision )
} elseif ($this->CMD['importExt'] || $this->CMD['uploadExt']) { // Imports an extension from online rep.
$err = $this->importExtFromRep($this->CMD['importExt'], $this->CMD['extVersion'], $this->CMD['loc'], $this->CMD['uploadExt']);
if ($err) {
$this->content .= $this->doc->section('', $GLOBALS['TBE_TEMPLATE']->rfw($err));
$this->content .= $this->doc->section('', tx_em_Tools::rfw($err));
}
if (!$err && $this->CMD['importExt']) {
$this->translations->installTranslationsForExtension($this->CMD['importExt'], $this->getMirrorURL());
......
'SET[singleDetails]' => 'info'
))) . '">' . tx_em_Tools::installButton() . '</a>';
if (in_array($extKey, $this->requiredExt)) {
$loadUnloadLink = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
$loadUnloadLink = '<strong>' . tx_em_Tools::rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
}
$lines[] = $this->extensionList->extensionListRow($extKey, $inst_list[$extKey], array('<td class="bgColor">' . $loadUnloadLink . '</td>'), t3lib_extMgm::isLoaded($extKey) ? 'em-listbg1' : 'em-listbg2');
}
......
'<strong>' . $saveMD5 . '</strong>'
) . '<br />';
if ($fileMD5 != $saveMD5) {
$info .= $GLOBALS['TBE_TEMPLATE']->rfw(
$info .= tx_em_Tools::rfw(
'<br /><strong>' . $GLOBALS['LANG']->getLL('ext_details_saving_failed_changes_lost') . '</strong>'
) . '<br />';
}
else {
$info .= $GLOBALS['TBE_TEMPLATE']->rfw(
$info .= tx_em_Tools::rfw(
'<br /><strong>' . $GLOBALS['LANG']->getLL('ext_details_file_saved') . '</strong>'
) . '<br />';
}
......
$GLOBALS['LANG']->getLL('ext_details_file_save_button') . '" />';
}
else {
$outCode .= $GLOBALS['TBE_TEMPLATE']->rfw(
$outCode .= tx_em_Tools::rfw(
'<br />' . $GLOBALS['LANG']->getLL('ext_details_saving_disabled') . ' '
);
}
......
<td nowrap="nowrap">
<input type="radio" name="em[upload][mode]" id="new_dev" value="new_dev" checked="checked" />
<label for="new_dev">' . sprintf($GLOBALS['LANG']->getLL('repositoryUploadForm_new_bugfix'),
'x.x.<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw('x+1') . '</strong>'
'x.x.<strong>' . tx_em_Tools::rfw('x+1') . '</strong>'
) . '</label><br />
<input type="radio" name="em[upload][mode]" id="new_sub" value="new_sub" />
<label for="new_sub">' . sprintf($GLOBALS['LANG']->getLL('repositoryUploadForm_new_sub_version'),
'x.<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw('x+1') . '</strong>.0'
'x.<strong>' . tx_em_Tools::rfw('x+1') . '</strong>.0'
) . '</label><br />
<input type="radio" name="em[upload][mode]" id="new_main" value="new_main" />
<label for="new_main">' . sprintf($GLOBALS['LANG']->getLL('repositoryUploadForm_new_main_version'),
'<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw('x+1') . '</strong>.0.0'
'<strong>' . tx_em_Tools::rfw('x+1') . '</strong>.0.0'
) . '</label><br />
</td>
</tr>
typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php (revision )
foreach ($extEkeys as $extKey => $data) {
if (array_key_exists($extKey, $TYPO3_LOADED_EXT) && ($this->parentObject->MOD_SETTINGS['display_shy'] || !$list[$extKey]['EM_CONF']['shy']) && $this->parentObject->searchExtension($extKey, $list[$extKey])) {
if (in_array($extKey, $this->parentObject->requiredExt)) {
$loadUnloadLink = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
$loadUnloadLink = '<strong>' . tx_em_Tools::rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
} else {
$loadUnloadLink = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
'CMD[showExt]' => $extKey,
......
'SET[singleDetails]' => 'info'
))) . '">' . tx_em_Tools::installButton() . '</a>';
if (in_array($extKey, $this->parentObject->requiredExt)) {
$loadUnloadLink = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
$loadUnloadLink = '<strong>' . tx_em_Tools::rfw($GLOBALS['LANG']->getLL('extension_required_short')) . '</strong>';
}
$theRowClass = t3lib_extMgm::isLoaded($extKey) ? 'em-listbg1' : 'em-listbg2';
$extensions[] = $this->extensionListRow($extKey, $list[$extKey], array('<td class="bgColor">' . $loadUnloadLink . '</td>'), $theRowClass);
......
$cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['moduleNames']) ? implode('<br />', $techInfo['moduleNames']) : '') . '</td>';
$cells[] = '<td nowrap="nowrap">' . ($techInfo['conf'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>';
$cells[] = '<td>' .
$GLOBALS['TBE_TEMPLATE']->rfw((t3lib_extMgm::isLoaded($extKey) && $techInfo['tables_error'] ?
tx_em_Tools::rfw((t3lib_extMgm::isLoaded($extKey) && $techInfo['tables_error'] ?
'<strong>' . $GLOBALS['LANG']->getLL('extInfoArray_table_error') . '</strong><br />' .
$GLOBALS['LANG']->getLL('extInfoArray_missing_fields') : '') .
(t3lib_extMgm::isLoaded($extKey) && $techInfo['static_error'] ?
......
$cells[] = '<td>' . (is_array($techInfo['locallang']) ? implode('<br />', $techInfo['locallang']) : '') . '</td>';
$cells[] = '<td>' . (is_array($techInfo['classes']) ? implode('<br />', $techInfo['classes']) : '') . '</td>';
$cells[] = '<td>' . (is_array($techInfo['errors']) ? $GLOBALS['TBE_TEMPLATE']->rfw(implode('<hr />', $techInfo['errors'])) : '') . '</td>';
$cells[] = '<td>' . (is_array($techInfo['errors']) ? tx_em_Tools::rfw(implode('<hr />', $techInfo['errors'])) : '') . '</td>';
$cells[] = '<td>' . (is_array($techInfo['NSerrors']) ?
(!t3lib_div::inList($this->parentObject->nameSpaceExceptions, $extKey) ?
t3lib_utility_Debug::viewarray($techInfo['NSerrors']) :
$GLOBALS['TBE_TEMPLATE']->dfw($GLOBALS['LANG']->getLL('extInfoArray_exception'))) : '') . '</td>';
tx_em_Tools::dfw($GLOBALS['LANG']->getLL('extInfoArray_exception'))) : '') . '</td>';
} elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 5) {
$currentMd5Array = $this->parentObject->extensionDetails->serverExtensionMD5array($extKey, $extInfo);
$affectedFiles = '';
$msgLines = array();
$msgLines[] = $GLOBALS['LANG']->getLL('listRow_files') . ' ' . count($currentMd5Array);
if (strcmp($extInfo['EM_CONF']['_md5_values_when_last_written'], serialize($currentMd5Array))) {
$msgLines[] = $GLOBALS['TBE_TEMPLATE']->rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_difference_detected') . '</strong>');
$msgLines[] = tx_em_Tools::rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_difference_detected') . '</strong>');
$affectedFiles = tx_em_Tools::findMD5ArrayDiff($currentMd5Array, unserialize($extInfo['EM_CONF']['_md5_values_when_last_written']));
if (count($affectedFiles)) {
$msgLines[] = '<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_modified_files') . '</strong><br />' .
$GLOBALS['TBE_TEMPLATE']->rfw(implode('<br />', $affectedFiles));
tx_em_Tools::rfw(implode('<br />', $affectedFiles));
}
}
$cells[] = '<td>' . implode('<br />', $msgLines) . '</td>';
......
$verDiff = $inst_list[$extKey] && tx_em_Tools::versionDifference($extInfo['EM_CONF']['version'], $inst_list[$extKey]['EM_CONF']['version'], $this->parentObject->versionDiffFactor);
$cells[] = '<td nowrap="nowrap"><em>' . $extKey . '</em></td>';
$cells[] = '<td nowrap="nowrap">' . ($verDiff ? '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw(htmlspecialchars($extInfo['EM_CONF']['version'])) . '</strong>' : $extInfo['EM_CONF']['version']) . '</td>';
$cells[] = '<td nowrap="nowrap">' . ($verDiff ? '<strong>' . tx_em_Tools::rfw(htmlspecialchars($extInfo['EM_CONF']['version'])) . '</strong>' : $extInfo['EM_CONF']['version']) . '</td>';
if (!$import) { // Listing extension on LOCAL server:
// Extension Download:
$cells[] = '<td nowrap="nowrap"><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array(
......
$usedExtension,
$overriddenExtensions
);
$doubleInstall = ' <strong><abbr title="' . $doubleInstallTitle . '">' . $GLOBALS['TBE_TEMPLATE']->rfw($extInfo['doubleInstall']) . '</abbr></strong>';
$doubleInstall = ' <strong><abbr title="' . $doubleInstallTitle . '">' . tx_em_Tools::rfw($extInfo['doubleInstall']) . '</abbr></strong>';
}
$cells[] = '<td nowrap="nowrap">' . $this->parentObject->typeLabels[$extInfo['type']] . $doubleInstall . '</td>';
} else { // Listing extensions from REMOTE repository:
$inst_curVer = $inst_list[$extKey]['EM_CONF']['version'];
if (isset($inst_list[$extKey])) {
if ($verDiff) {
$inst_curVer = '<strong>' . $GLOBALS['TBE_TEMPLATE']->rfw($inst_curVer) . '</strong>';
$inst_curVer = '<strong>' . tx_em_Tools::rfw($inst_curVer) . '</strong>';
}
}
$cells[] = '<td nowrap="nowrap">' . t3lib_befunc::date($extInfo['EM_CONF']['lastuploaddate']) . '</td>';
$cells[] = '<td nowrap="nowrap">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['author'], $GLOBALS['BE_USER']->uc[titleLen])) . '</td>';
$cells[] = '<td nowrap="nowrap">' . $inst_curVer . '</td>';
$cells[] = '<td nowrap="nowrap">' . $this->parentObject->typeLabels[$inst_list[$extKey]['type']] . (strlen($inst_list[$extKey]['doubleInstall']) > 1 ? '<strong> ' . $GLOBALS['TBE_TEMPLATE']->rfw($inst_list[$extKey]['doubleInstall']) . '</strong>' : '') . '</td>';
$cells[] = '<td nowrap="nowrap">' . $this->parentObject->typeLabels[$inst_list[$extKey]['type']] . (strlen($inst_list[$extKey]['doubleInstall']) > 1 ? '<strong> ' . tx_em_Tools::rfw($inst_list[$extKey]['doubleInstall']) . '</strong>' : '') . '</td>';
$cells[] = '<td nowrap="nowrap">' . ($extInfo['downloadcounter_all'] ? $extInfo['downloadcounter_all'] : '&nbsp;&nbsp;') . '/' . ($extInfo['downloadcounter'] ? $extInfo['downloadcounter'] : '&nbsp;') . '</td>';
}
$cells[] = '<td nowrap="nowrap" class="extstate" style="background-color:' . $this->parentObject->stateColors[$extInfo['EM_CONF']['state']] . ';">' . $this->parentObject->states[$extInfo['EM_CONF']['state']] . '</td>';
......
}
$warn = '';
if (strcmp(serialize($currentMD5Array), serialize($serverMD5Array))) {
$warn = '<tr class="bgColor4" style="color:red"><td colspan="7">' . $GLOBALS['TBE_TEMPLATE']->rfw('<br /><strong>' . $name . ': ' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:msg_warn_diff') . '</strong>') . '</td></tr>' . LF;
$warn = '<tr class="bgColor4" style="color:red"><td colspan="7">' . tx_em_Tools::rfw('<br /><strong>' . $name . ': ' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:msg_warn_diff') . '</strong>') . '</td></tr>' . LF;
if ($this->parentObject->MOD_SETTINGS['display_files'] == 1) {
$affectedFiles = tx_em_Tools::findMD5ArrayDiff($serverMD5Array, $currentMD5Array);
if (count($affectedFiles)) {
$warn .= '<tr class="bgColor4"><td colspan="7"><strong>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:msg_modified') . '</strong><br />' . $GLOBALS['TBE_TEMPLATE']->rfw(implode('<br />', $affectedFiles)) . '</td></tr>' . LF;
$warn .= '<tr class="bgColor4"><td colspan="7"><strong>' . $LANG->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:msg_modified') . '</strong><br />' . tx_em_Tools::rfw(implode('<br />', $affectedFiles)) . '</td></tr>' . LF;
}
}
}
......
'<td valign="top">' . $name . '</td>' .
'<td valign="top" align="right">' . $data[EM_CONF][version] . '</td>' .
'<td valign="top" align="right">' . $lastversion . '</td>' .
'<td valign="top" nowrap="nowrap">' . $this->parentObject->typeLabels[$data['type']] . (strlen($data['doubleInstall']) > 1 ? '<strong> ' . $GLOBALS['TBE_TEMPLATE']->rfw($extInfo['doubleInstall']) . '</strong>' : '') . '</td>' .
'<td valign="top" nowrap="nowrap">' . $this->parentObject->typeLabels[$data['type']] . (strlen($data['doubleInstall']) > 1 ? '<strong> ' . tx_em_Tools::rfw($extInfo['doubleInstall']) . '</strong>' : '') . '</td>' .
'<td valign="top">' . $comment . '</td></tr>' . LF .
$warn .
'<tr class="bgColor4"><td colspan="7"><hr style="margin:0px" /></td></tr>' . LF;
typo3/sysext/em/classes/install/class.tx_em_install.php (revision )
}
}
if ($depError || $depIgnore) {
$content .= $GLOBALS['TBE_TEMPLATE']->section(
$content .= $this->parentObject->doc->section(
$GLOBALS['LANG']->getLL('removeExtFromList_dependency_error'),
implode('<br />', $msg), 0, 1, 2
);
......
}
}
if ($conflictError || $conflictIgnore) {
$content .= $GLOBALS['TBE_TEMPLATE']->section(
$content .= $this->parentObject->doc->section(
$GLOBALS['LANG']->getLL('checkDependencies_conflict_error'), implode('<br />', $msg), 0, 1, 2
);
}
......
}
}
if ($suggestion || $suggestionIgnore) {
$content .= $GLOBALS['TBE_TEMPLATE']->section(
$content .= $this->parentObject->doc->section(
sprintf($GLOBALS['LANG']->getLL('checkDependencies_exts_suggested_by_ext'), $extKey),
implode('<br />', $msg), 0, 1, 1
);
typo3/sysext/em/classes/tools/class.tx_em_tools.php (revision )
*
* @var array
*/
static protected $defaultCategories = array('be' => 0,
protected static $defaultCategories = array(
'be' => 0,
'module' => 1,
'fe' => 2,
'plugin' => 3,
......
*
* @var array
*/
static protected $defaultStates = array('alpha' => 0,
protected static $defaultStates = array(
'alpha' => 0,
'beta' => 1,
'stable' => 2,
'experimental' => 3,
......
* @param string $path Path to change to before extracting
* @return boolean True on success, false in failure
*/
public function unzip($file, $path) {
public static function unzip($file, $path) {
if (strlen($GLOBALS['TYPO3_CONF_VARS']['BE']['unzip_path'])) {
chdir($path);
$cmd = $GLOBALS['TYPO3_CONF_VARS']['BE']['unzip_path'] . ' -o ' . escapeshellarg($file);
exec($cmd, $list, $ret);
return ($ret === 0);
} else {
// we use a pure PHP unzip
// we use a pure PHP unzip
$unzip = t3lib_div::makeInstance('tx_em_Tools_Unzip', $file);
$ret = $unzip->extract(array('add_path' => $path));
return (is_array($ret));
......
*
* @return void
*/
function refreshGlobalExtList() {
public static function refreshGlobalExtList() {
global $TYPO3_LOADED_EXT;
$TYPO3_LOADED_EXT = t3lib_extMgm::typo3_loadExtensions();
......
* @param string Extension key
* @return array Modified category index array
*/
public function setCat(&$cat, $listArrayPart, $extKey) {
public static function setCat(&$cat, $listArrayPart, $extKey) {
// Getting extension title:
// Getting extension title:
$extTitle = $listArrayPart['EM_CONF']['title'];
// Category index:
// Category index:
$index = $listArrayPart['EM_CONF']['category'];
$cat['cat'][$index][$extKey] = $extTitle;
// Author index:
// Author index:
$index = $listArrayPart['EM_CONF']['author'] . ($listArrayPart['EM_CONF']['author_company'] ? ', ' . $listArrayPart['EM_CONF']['author_company'] : '');
$cat['author_company'][$index][$extKey] = $extTitle;
// State index:
// State index:
$index = $listArrayPart['EM_CONF']['state'];
$cat['state'][$index][$extKey] = $extTitle;
// Type index:
// Type index:
$index = $listArrayPart['type'];
$cat['type'][$index][$extKey] = $extTitle;
// Return categories:
// Return categories:
return $cat;
}
......
* @param string Extension key
* @return string Upload folder for extension
*/
public function uploadFolder($extKey) {
public static function uploadFolder($extKey) {
return 'uploads/tx_' . str_replace('_', '', $extKey) . '/';
}
......
*
* @return string <img> tag
*/
public function removeButton() {
public static function removeButton() {
return t3lib_iconWorks::getSpriteIcon('actions-system-extension-uninstall', array('title' => $GLOBALS['LANG']->getLL('ext_details_remove_ext')));
}
......
*
* @return string <img> tag
*/
public function installButton() {
public static function installButton() {
return t3lib_iconWorks::getSpriteIcon('actions-system-extension-install', array('title' => $GLOBALS['LANG']->getLL('helperFunction_install_extension')));
}
......
*
* @return string <img> + text string.
*/
public function noImportMsg() {
public static function noImportMsg() {
return t3lib_iconWorks::getSpriteIcon('status-dialog-warning') .
'<strong>' . $GLOBALS['LANG']->getLL('helperFunction_import_not_possible') . '</strong>';
'<strong>' . $GLOBALS['LANG']->getLL('helperFunction_import_not_possible') . '</strong>';
}
......
* @param array $emConf
* @return array
*/
public function fixEMCONF($emConf) {
public static function fixEMCONF($emConf) {
if (!isset($emConf['constraints']) || !isset($emConf['constraints']['depends']) || !isset($emConf['constraints']['conflicts']) || !isset($emConf['constraints']['suggests'])) {
if (!isset($emConf['constraints']) || !isset($emConf['constraints']['depends'])) {
$emConf['constraints']['depends'] = self::stringToDep($emConf['dependencies']);
......
$emConf['conflicts'] = self::depToString($emConf['constraints'], 'conflicts');
}
// sanity check for version numbers, intentionally only checks php and typo3
// sanity check for version numbers, intentionally only checks php and typo3
if (isset($emConf['constraints']['depends']) && isset($emConf['constraints']['depends']['php'])) {
$versionRange = self::splitVersionRange($emConf['constraints']['depends']['php']);
if (version_compare($versionRange[0], '3.0.0', '<')) {
......
* @param string Extension key.
* @return array EMconf array values.
*/
public function includeEMCONF($path, $_EXTKEY) {
public static function includeEMCONF($path, $_EXTKEY) {
$EM_CONF = NULL;
@include($path);
if (is_array($EM_CONF[$_EXTKEY])) {
return self::fixEMCONF($EM_CONF[$_EXTKEY]);
}
return false;
return FALSE;
}
......
* @param array Array of files / directories
* @return array Array of directories from the input array.
*/
function extractDirsFromFileList($files) {
public static function extractDirsFromFileList($files) {
$dirs = array();
if (is_array($files)) {
// Traverse files / directories array:
// Traverse files / directories array:
foreach ($files as $file) {
if (substr($file, -1) == '/') {
$dirs[$file] = $file;
......
* @param string $ver A string with a version range.
* @return array
*/
public function splitVersionRange($ver) {
public static function splitVersionRange($ver) {
$versionRange = array();
if (strstr($ver, '-')) {
$versionRange = explode('-', $ver, 2);
......
* @param string $type The dependency type to list if $dep is an array
* @return string A simple dependency list for display
*/
public function depToString($dep, $type = 'depends') {
public static function depToString($dep, $type = 'depends') {
if (is_array($dep)) {
unset($dep[$type]['php']);
unset($dep[$type]['typo3']);
......
* @param string $type The dependency type to list if $dep is an array
* @return string A simple dependency list for display
*/
public function stringToDep($dep) {
public static function stringToDep($dep) {
$constraint = array();
if (is_string($dep) && strlen($dep)) {
$dep = explode(',', $dep);
......
* @return string
* @see renderVersion()
*/
public function makeVersion($v, $mode) {
public static function makeVersion($v, $mode) {
$vDat = self::renderVersion($v);
return $vDat['version_' . $mode];
}
......
* @param string Increase version part: "main", "sub", "dev"
* @return string
*/
public function renderVersion($v, $raise = '') {
public static function renderVersion($v, $raise = '') {
$parts = t3lib_div::intExplode('.', $v . '..');
$parts[0] = t3lib_div::intInRange($parts[0], 0, 999);
$parts[1] = t3lib_div::intInRange($parts[1], 0, 999);
......
* @param integer Tolerance factor. For instance, set to 1000 to ignore difference in dev-version (third part)
* @return boolean True if version 1 is greater than version 2
*/
public function versionDifference($v1, $v2, $div = 1) {
public static function versionDifference($v1, $v2, $div = 1) {
return floor(self::makeVersion($v1, 'int') / $div) > floor(self::makeVersion($v2, 'int') / $div);
}
......
* @param boolean If set, the test is case insensitive
* @return boolean True if found.
*/
public function first_in_array($str, $array, $caseInsensitive = FALSE) {
public static function first_in_array($str, $array, $caseInsensitive = FALSE) {
if ($caseInsensitive) {
$str = strtolower($str);
}
......
$cl = strtolower($cl);
}
if (t3lib_div::isFirstPartOfStr($cl, $str)) {
return true;
return TRUE;
}
}
}
return false;
return FALSE;
}
/**
......
* @param array Past values
* @return array Affected files
*/
function findMD5ArrayDiff($current, $past) {
public static function findMD5ArrayDiff($current, $past) {
if (!is_array($current)) {
$current = array();
}
......
* @param string Help text.
* @return string title="" attribute prepended with a single space
*/
public function labelInfo($str) {
public static function labelInfo($str) {
return ' title="' . htmlspecialchars($str) . '" style="cursor:help;"';
}
......
* @param string Install scope type: L, G, S
* @return string Returns the absolute path to the install scope given by input $type variable. It is checked if the path is a directory. Slash is appended.
*/
public function getExtPath($extKey, $type, $returnWithoutExtKey = FALSE) {
public static function getExtPath($extKey, $type, $returnWithoutExtKey = FALSE) {
$typePath = self::typePath($type);
if ($typePath) {
......
*
* @param string $path
*/
public function getExtTypeFromPath($path) {
if (strpos($path, TYPO3_mainDir . 'sysext/') !== false) {
public static function getExtTypeFromPath($path) {
if (strpos($path, TYPO3_mainDir . 'sysext/') !== FALSE) {
return 'S';
} elseif (strpos($path, TYPO3_mainDir . 'ext/') !== false) {
} elseif (strpos($path, TYPO3_mainDir . 'ext/') !== FALSE) {
return 'G';
} elseif (strpos($path, 'typo3conf/ext/') !== false) {
} elseif (strpos($path, 'typo3conf/ext/') !== FALSE) {
return 'L';
}
}
......
*
* @param string $type S/G/L
*/
public function typePath($type) {
public static function typePath($type) {
if ($type === 'S') {
return PATH_typo3 . 'sysext/';
} elseif ($type === 'G') {
......
*
* @param string $type S/G/L
*/
public function typeRelPath($type) {
public static function typeRelPath($type) {
if ($type === 'S') {
return 'sysext/';
} elseif ($type === 'G') {
......
*
* @param string $type S/G/L
*/
public function typeBackPath($type) {
public static function typeBackPath($type) {
if ($type === 'L') {
return '../../../../' . TYPO3_mainDir;
} else {
return '../../../';
return '../../../';
}
}
......
*
* @param $file
*/
public function getArrayFromLocallang($file, $key = 'default') {
public static function getArrayFromLocallang($file, $key = 'default') {
$content = t3lib_div::getURL($file);
$array = t3lib_div::xml2array($content);
return $array['data'][$key];
......
* @return array Array with header/content as key 0/1
* @see makeUploadarray()
*/
function getSerializedLocalLang($file, $content) {
public static function getSerializedLocalLang($file, $content) {
$LOCAL_LANG = NULL;
$returnParts = explode('$LOCAL_LANG', $content, 2);
......
* @param unknown_type $level
* @return unknown
*/
function arrayToCode($array, $level = 0) {
public static function arrayToCode($array, $level = 0) {
$lines = 'array(' . LF;
$level++;
foreach ($array as $k => $v) {
......
* @return array Modified array of extention keys as values
* @see addExtToList()
*/
function managesPriorities($listArr, $instExtInfo) {
public static function managesPriorities($listArr, $instExtInfo) {
// Initialize:
// Initialize:
$levels = array(
'top' => array(),
'middle' => array(),
'bottom' => array(),
);
// Traverse list of extensions:
// Traverse list of extensions:
foreach ($listArr as $ext) {
$prio = trim($instExtInfo[$ext]['EM_CONF']['priority']);
switch ((string) $prio) {
......
* @param mixed $cat category title or category index
* @return mixed
*/
static public function getDefaultCategory($cat = NULL) {
public static function getDefaultCategory($cat = NULL) {
if (is_null($cat)) {
return self::$defaultCategories;
} else {
if (is_string($cat)) {
// default category
// default category
$catIndex = 4;
if (array_key_exists(strtolower($cat), self::$defaultCategories)) {
$catIndex = self::$defaultCategories[strtolower($cat)];
......
} else {
if (is_int($cat) && $cat >= 0) {
$catTitle = array_search($cat, self::$defaultCategories);
// default category
// default category
if (!$catTitle) {
$catTitle = 'misc';
}
......
* @param mixed $state state title or state index
* @return mixed
*/
static public function getDefaultState($state = NULL) {
public static function getDefaultState($state = NULL) {
if (is_null($state)) {
return self::$defaultStates;
} else {
if (is_string($state)) {
// default state
// default state
$stateIndex = 999;
if (array_key_exists(strtolower($state), self::$defaultStates)) {
$stateIndex = self::$defaultStates[strtolower($state)];
......
} else {
if (is_int($state) && $state >= 0) {
$stateTitle = array_search($state, self::$defaultStates);
// default state
// default state
if (!$stateTitle) {
$stateTitle = 'n/a';
}
......
* @param string Extension lock-type (eg. "L" or "G")
* @return boolean True if installation is allowed.
*/
function importAsType($type, $lockType = '') {
public static function importAsType($type, $lockType = '') {
switch ($type) {
case 'G':
return $GLOBALS['TYPO3_CONF_VARS']['EXT']['allowGlobalInstall'] && (!$lockType || !strcmp($lockType, $type));
break;
break;
case 'L':
return $GLOBALS['TYPO3_CONF_VARS']['EXT']['allowLocalInstall'] && (!$lockType || !strcmp($lockType, $type));
break;
break;
case 'S':
return $this->systemInstall;
return isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['allowSystemInstall']) && $GLOBALS['TYPO3_CONF_VARS']['EXT']['allowSystemInstall'];
break;
break;
default:
return false;
return FALSE;
}
}
......
* @param string Scope: "G" or "L"
* @return boolean True if possible.
*/
function deleteAsType($type) {
public static function deleteAsType($type) {
switch ($type) {
case 'G':
return $GLOBALS['TYPO3_CONF_VARS']['EXT']['allowGlobalInstall'];
break;
break;
case 'L':
return $GLOBALS['TYPO3_CONF_VARS']['EXT']['allowLocalInstall'];
break;
break;
default:
return false;
return FALSE;
}
}
......
* @param string Absolute path to directory.
* @return mixed Returns false on success or an error string
*/
function createDirsInPath($dirs, $extDirPath) {
public static function createDirsInPath($dirs, $extDirPath) {
if (is_array($dirs)) {
foreach ($dirs as $dir) {
$error = t3lib_div::mkdir_deep($extDirPath, $dir);
......
}
}
return false;
return FALSE;
}
/**
......
* @return array Information array.
* @see makeDetailedExtensionAnalysis()
*/
function getClassIndexLocallangFiles($absPath, $table_class_prefix, $extKey) {
$filesInside = t3lib_div::removePrefixPathFromList(t3lib_div::getAllFilesAndFoldersInPath(array(), $absPath, 'php,inc', 0, 99, $this->excludeForPackaging), $absPath);
public static function getClassIndexLocallangFiles($absPath, $table_class_prefix, $extKey) {
$excludeForPackaging = $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging'];
$filesInside = t3lib_div::removePrefixPathFromList(t3lib_div::getAllFilesAndFoldersInPath(array(), $absPath, 'php,inc', 0, 99, $excludeForPackaging), $absPath);
$out = array();
$reg = array();
......
unset($reg);
if (preg_match('/\n[[:space:]]*class[[:space:]]*([[:alnum:]_]+)([[:alnum:][:space:]_]*)/', $fContent, $reg)) {
// Find classes:
// Find classes:
$lines = explode(LF, $fContent);
foreach ($lines as $l) {
$line = trim($l);
......
if (preg_match('/^class[[:space:]]*([[:alnum:]_]+)([[:alnum:][:space:]_]*)/', $line, $reg)) {
$out['classes'][] = $reg[1];
$out['files'][$fileName]['classes'][] = $reg[1];
if ($reg[1]!=='ext_update' && substr($reg[1], 0, 3) != 'ux_' && !t3lib_div::isFirstPartOfStr($reg[1], $table_class_prefix) && strcmp(substr($table_class_prefix, 0, -1), $reg[1])) {
if ($reg[1] !== 'ext_update' && substr($reg[1], 0, 3) != 'ux_' && !t3lib_div::isFirstPartOfStr($reg[1], $table_class_prefix) && strcmp(substr($table_class_prefix, 0, -1), $reg[1])) {
$out['NSerrors']['classname'][] = $reg[1];
} else {
$out['NSok']['classname'][] = $reg[1];
}
}
}
// If class file prefixed 'class.'....
// If class file prefixed 'class.'....
if (substr($baseName, 0, 6) == 'class.') {
$fI = pathinfo($baseName);
$testName = substr($baseName, 6, -(1 + strlen($fI['extension'])));
if ($testName!=='ext_update' && substr($testName, 0, 3) != 'ux_' && !t3lib_div::isFirstPartOfStr($testName, $table_class_prefix) && strcmp(substr($table_class_prefix, 0, -1), $testName)) {
if ($testName !== 'ext_update' && substr($testName, 0, 3) != 'ux_' && !t3lib_div::isFirstPartOfStr($testName, $table_class_prefix) && strcmp(substr($table_class_prefix, 0, -1), $testName)) {
$out['NSerrors']['classfilename'][] = $baseName;
} else {
$out['NSok']['classfilename'][] = $baseName;
if (is_array($out['files'][$fileName]['classes']) && tx_em_Tools::first_in_array($testName, $out['files'][$fileName]['classes'], 1)) {
$out['msg'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_class_ok'),
$fileName, $testName
$fileName, $testName
);
} else {
$out['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_class_not_ok'),
$fileName, $testName
$fileName, $testName
);
}
}
}
// Check for proper XCLASS definition
// Match $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS'] with single or doublequotes
// Check for proper XCLASS definition
// Match $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS'] with single or doublequotes
$XclassSearch = '\$TYPO3_CONF_VARS\[TYPO3_MODE\]\[[\'"]XCLASS[\'"]\]';
$XclassParts = preg_split('/if \(defined\([\'"]TYPO3_MODE[\'"]\) && ' . $XclassSearch . '/', $fContent, 2);
if (count($XclassParts) !== 2) {
// Match $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS'] with single or doublequotes
// Match $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS'] with single or doublequotes
$XclassSearch = '\$GLOBALS\[[\'"]TYPO3_CONF_VARS[\'"]\]\[TYPO3_MODE\]\[[\'"]XCLASS[\'"]\]';
$XclassParts = preg_split('/if \(defined\([\'"]TYPO3_MODE[\'"]\) && ' . $XclassSearch . '/', $fContent, 2);
}
......
}
} else {
$out['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_xclass_incorrect'),
$reg[1], $cmpF
$reg[1], $cmpF
);
}
} else {
$out['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_no_xclass_filename'), $fileName);
}
} elseif (!tx_em_Tools::first_in_array('ux_', $out['files'][$fileName]['classes'])) {
// No Xclass definition required if classname starts with 'ux_'
// No Xclass definition required if classname starts with 'ux_'
$out['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_no_xclass_found'), $fileName);
}
}
......
* @return string Returns message about the status.
* @see modConfFileAnalysis()
*/
function writeTYPO3_MOD_PATH($confFilePath, $type, $mP) {
public static function writeTYPO3_MOD_PATH($confFilePath, $type, $mP) {
$lines = explode(LF, t3lib_div::getUrl($confFilePath));
$confFileInfo = array();
$confFileInfo['lines'] = $lines;
......
unset($reg);
if (preg_match('/^\$BACK_PATH[[:space:]]*=[[:space:]]*["\']([[:alnum:]_\/\.]+)["\'][[:space:]]*;/', $line, $reg)) {
$lines[$k] = str_replace($reg[0], '$BACK_PATH=\'' . self::typeBackPath($type) . '\';', $lines[$k]);
$lines[$k] = str_replace($reg[0], '$BACK_PATH=\'' . self::typeBackPath($type) . '\';', $lines[$k]);
$flag_B = $k + 1;
}
// Check if this module uses new API (see http://bugs.typo3.org/view.php?id=5278)
// where TYPO3_MOD_PATH and BACK_PATH are not required
// Check if this module uses new API (see http://bugs.typo3.org/view.php?id=5278)
// where TYPO3_MOD_PATH and BACK_PATH are not required
unset($reg);
if (preg_match('/^\$MCONF\[["\']script["\']\][[:space:]]*=[[:space:]]*["\']_DISPATCH["\'][[:space:]]*;/', $line, $reg)) {
$flag_Dispatch = $k + 1;
......
if ($flag_B && $flag_M) {
t3lib_div::writeFile($confFilePath, implode(LF, $lines));
return sprintf($GLOBALS['LANG']->getLL('writeModPath_ok'),
substr($confFilePath, strlen(PATH_site)));
substr($confFilePath, strlen(PATH_site)));
} elseif ($flag_Dispatch) {
return sprintf(
$GLOBALS['LANG']->getLL('writeModPath_notRequired'),
substr($confFilePath, strlen(PATH_site))
);
} else {
return $GLOBALS["TBE_TEMPLATE"]->rfw(
return self::rfw(
sprintf($GLOBALS['LANG']->getLL('writeModPath_error'),
$confFilePath)
$confFilePath)
);
}
}
......
* @param string Email address for use in link.
* @return string Output
*/
function wrapEmail($str, $email) {
public static function wrapEmail($str, $email) {
if ($email) {
$str = '<a href="mailto:' . htmlspecialchars($email) . '">' . htmlspecialchars($str) . '</a>';
}
......
* @param string Input string
* @return string Output string
*/
function rfw($string) {
public static function rfw($string) {
return '<span class="typo3-red">' . $string . '</span>';
}
......
* @param string Input string
* @return string Output string
*/
function dfw($string) {
public static function dfw($string) {
return '<span class="typo3-dimmed">' . $string . '</span>';
}
}
(2-2/2)