0006924_v4_v2.patch

Administrator Admin, 2007-12-12 17:57

Download (3.86 KB)

View differences:

t3lib/class.t3lib_div.php (Arbeitskopie)
2523 2523
		$fI['dirname'].= '/';
2524 2524

  
2525 2525
			// Check parts:
2526
		if (t3lib_div::validPathStr($filepath) && $fI['basename'] && strlen($fI['basename'])<60)	{
2526
		if (t3lib_div::validPathStr($filepath) && $fI['basename'])	{
2527 2527
			if (defined('PATH_site'))	{
2528 2528
				$dirName = PATH_site.'typo3temp/';	// Setting main temporary directory name (standard)
2529 2529
				if (@is_dir($dirName))	{
......
3714 3714
			$origCharset = $csConvObj->parse_charset($csConvObj->charSetArray[$langKey] ? $csConvObj->charSetArray[$langKey] : 'iso-8859-1');
3715 3715

  
3716 3716
				// Cache file name:
3717
			$hashSource = substr($fileRef,strlen(PATH_site)).'|'.date('d-m-Y H:i:s',filemtime($fileRef)).'|version=2.2';
3717
			$hashSource = substr($fileRef,strlen(PATH_site)).'|'.date('d-m-Y H:i:s',filemtime($fileRef)).'|version=2.3';
3718 3718
			$cacheFileName = PATH_site.'typo3temp/llxml/'.
3719 3719
							#str_replace('_','',ereg_replace('^.*\/','',dirname($fileRef))).
3720 3720
							#'_'.basename($fileRef).
3721 3721
							substr(basename($fileRef),10,15).
3722
							'_'.t3lib_div::shortMD5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
3722
							'_'.md5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
3723 3723

  
3724 3724
				// Check if cache file exists...
3725 3725
			if (!@is_file($cacheFileName))	{	// ... if it doesn't, create content and write it:
......
3752 3752

  
3753 3753
						// 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:
3754 3754
					$LOCAL_LANG[$langKey] = t3lib_div::llXmlAutoFileName($fileRef, $langKey);
3755
					if (!$LOCAL_LANG[$langKey] && isset($xmlContent['data'][$langKey]))	{
3755
					$l10nFileExists = @is_file(t3lib_div::getFileAbsFileName($LOCAL_LANG[$langKey]));
3756
					if (!$l10nFileExists && isset($xmlContent['data'][$langKey]))	{
3756 3757
						$LOCAL_LANG[$langKey] = $xmlContent['data'][$langKey];
3757 3758
					}
3758 3759

  
......
3765 3766
				}
3766 3767

  
3767 3768
					// Cache the content now:
3768
				$serContent = array('origFile'=>$hashSource, 'LOCAL_LANG'=>$LOCAL_LANG);
3769
				$serContent = array(
3770
					'origFile' => $hashSource,
3771
					'LOCAL_LANG' => $LOCAL_LANG,
3772
					'l10nFileExists' => $l10nFileExists
3773
				);
3769 3774
				$res = t3lib_div::writeFileToTypo3tempDir($cacheFileName, serialize($serContent));
3770
				if ($res)	die('ERROR: '.$res);
3775
				if ($res) {
3776
					die('ERROR: '.$res);
3777
				}
3778
				$loadedFromCache = false;
3771 3779
			} else {
3772 3780
					// Get content from cache:
3773 3781
				$serContent = unserialize(t3lib_div::getUrl($cacheFileName));
3774 3782
				$LOCAL_LANG = $serContent['LOCAL_LANG'];
3783
				$l10nFileExisted = (isset($serContent['l10nFileExists']) && $serContent['l10nFileExists']);
3784
				$loadedFromCache = true;
3775 3785
			}
3776 3786

  
3777 3787
				// Checking for EXTERNAL file for non-default language:
......
3785 3795
					$hashSource = substr($localized_file,strlen(PATH_site)).'|'.date('d-m-Y H:i:s',filemtime($localized_file));
3786 3796
					$cacheFileName = PATH_site.'typo3temp/llxml/ext_'.
3787 3797
									substr(basename($localized_file),10,15).
3788
									'_'.t3lib_div::shortMD5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
3798
									'_'.md5($hashSource).'.'.$langKey.'.'.$origCharset.'.cache';
3789 3799

  
3790 3800
						// Check if cache file exists...
3791 3801
					if (!@is_file($cacheFileName))	{	// ... if it doesn't, create content and write it:
......
3812 3822
						$LOCAL_LANG[$langKey] = $serContent['EXT_DATA'];
3813 3823
					}
3814 3824
				} else {
3815
					$LOCAL_LANG[$langKey] = array();
3825
						// If file in typo3conf/l10n once existed and now doesn't anymore - rewrite cached file:
3826
					if ($loadedFromCache && $l10nFileExisted) {
3827
						@unlink($cacheFileName);
3828
						$LOCAL_LANG = t3lib_div::readLLXMLfile($fileRef, $langKey);
3829
						// Otherwise, not localization for $langKey was found - set to an empty array:
3830
					} else {
3831
						$LOCAL_LANG[$langKey] = array();
3832
					}
3816 3833
				}
3817 3834
			}
3818 3835