Bug #17905 » 0006924_v4_v2.patch
t3lib/class.t3lib_div.php (Arbeitskopie) | ||
---|---|---|
$fI['dirname'].= '/';
|
||
// Check parts:
|
||
if (t3lib_div::validPathStr($filepath) && $fI['basename'] && strlen($fI['basename'])<60) {
|
||
if (t3lib_div::validPathStr($filepath) && $fI['basename']) {
|
||
if (defined('PATH_site')) {
|
||
$dirName = PATH_site.'typo3temp/'; // Setting main temporary directory name (standard)
|
||
if (@is_dir($dirName)) {
|
||
... | ... | |
$origCharset = $csConvObj->parse_charset($csConvObj->charSetArray[$langKey] ? $csConvObj->charSetArray[$langKey] : 'iso-8859-1');
|
||
// Cache file name:
|
||
$hashSource = substr($fileRef,strlen(PATH_site)).'|'.date('d-m-Y H:i:s',filemtime($fileRef)).'|version=2.2';
|
||
$hashSource = substr($fileRef,strlen(PATH_site)).'|'.date('d-m-Y H:i:s',filemtime($fileRef)).'|version=2.3';
|
||
$cacheFileName = PATH_site.'typo3temp/llxml/'.
|
||
#str_replace('_','',ereg_replace('^.*\/','',dirname($fileRef))).
|
||
#'_'.basename($fileRef).
|
||
substr(basename($fileRef),10,15).
|
||
'_'.t3lib_div::shortMD5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
|
||
'_'.md5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
|
||
// Check if cache file exists...
|
||
if (!@is_file($cacheFileName)) { // ... if it doesn't, create content and write it:
|
||
... | ... | |
// If no entry is found for the language key, then force a value depending on meta-data setting. By default an automated filename will be used:
|
||
$LOCAL_LANG[$langKey] = t3lib_div::llXmlAutoFileName($fileRef, $langKey);
|
||
if (!$LOCAL_LANG[$langKey] && isset($xmlContent['data'][$langKey])) {
|
||
$l10nFileExists = @is_file(t3lib_div::getFileAbsFileName($LOCAL_LANG[$langKey]));
|
||
if (!$l10nFileExists && isset($xmlContent['data'][$langKey])) {
|
||
$LOCAL_LANG[$langKey] = $xmlContent['data'][$langKey];
|
||
}
|
||
... | ... | |
}
|
||
// Cache the content now:
|
||
$serContent = array('origFile'=>$hashSource, 'LOCAL_LANG'=>$LOCAL_LANG);
|
||
$serContent = array(
|
||
'origFile' => $hashSource,
|
||
'LOCAL_LANG' => $LOCAL_LANG,
|
||
'l10nFileExists' => $l10nFileExists
|
||
);
|
||
$res = t3lib_div::writeFileToTypo3tempDir($cacheFileName, serialize($serContent));
|
||
if ($res) die('ERROR: '.$res);
|
||
if ($res) {
|
||
die('ERROR: '.$res);
|
||
}
|
||
$loadedFromCache = false;
|
||
} else {
|
||
// Get content from cache:
|
||
$serContent = unserialize(t3lib_div::getUrl($cacheFileName));
|
||
$LOCAL_LANG = $serContent['LOCAL_LANG'];
|
||
$l10nFileExisted = (isset($serContent['l10nFileExists']) && $serContent['l10nFileExists']);
|
||
$loadedFromCache = true;
|
||
}
|
||
// Checking for EXTERNAL file for non-default language:
|
||
... | ... | |
$hashSource = substr($localized_file,strlen(PATH_site)).'|'.date('d-m-Y H:i:s',filemtime($localized_file));
|
||
$cacheFileName = PATH_site.'typo3temp/llxml/ext_'.
|
||
substr(basename($localized_file),10,15).
|
||
'_'.t3lib_div::shortMD5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
|
||
'_'.md5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
|
||
// Check if cache file exists...
|
||
if (!@is_file($cacheFileName)) { // ... if it doesn't, create content and write it:
|
||
... | ... | |
$LOCAL_LANG[$langKey] = $serContent['EXT_DATA'];
|
||
}
|
||
} else {
|
||
$LOCAL_LANG[$langKey] = array();
|
||
// If file in typo3conf/l10n once existed and now doesn't anymore - rewrite cached file:
|
||
if ($loadedFromCache && $l10nFileExisted) {
|
||
@unlink($cacheFileName);
|
||
$LOCAL_LANG = t3lib_div::readLLXMLfile($fileRef, $langKey);
|
||
// Otherwise, not localization for $langKey was found - set to an empty array:
|
||
} else {
|
||
$LOCAL_LANG[$langKey] = array();
|
||
}
|
||
}
|
||
}
|
||