Fixed bug #12604: fileNameASCIIPrefix got deprecated but is used in core (Thanks...
authorSusanne Moog <typo3@susannemoog.de>
Fri, 28 May 2010 15:15:30 +0000 (15:15 +0000)
committerSusanne Moog <typo3@susannemoog.de>
Fri, 28 May 2010 15:15:30 +0000 (15:15 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7720 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/class.tslib_gifbuilder.php

index eced6aa..5a2d771 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
 
        * Follow-up to bug #14465: Make use of the new Sprite API throughout the TYPO3 Core Backend
        * Fixed bug #1402: Text area / RTE fields can't be set to required at the moment.
+       * Fixed bug #12604: fileNameASCIIPrefix got deprecated but is used in core (Thanks to Steffen Gebert)
 
 2010-05-28  Christian Kuhn  <lolli@schwarzbu.ch>
 
index e307477..01671e4 100644 (file)
@@ -5372,7 +5372,13 @@ class tslib_cObj {
                                                        $gifCreator->init();
 
                                                        if ($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix'])     {
-                                                               $gifCreator->filenamePrefix = $GLOBALS['TSFE']->fileNameASCIIPrefix(preg_replace('/\.[[:alnum:]]+$/','',basename($theImage)),intval($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']),'_');
+                                                               $filename = basename($theImage);
+                                                                       // remove extension
+                                                               $filename = substr($filename, 0, strrpos($filename, '.'));
+                                                                       // strip everything non-ascii
+                                                               $filename = preg_replace('/[^A-Za-z0-9_-]/', '', trim($filename));
+                                                               $gifCreator->filenamePrefix = substr($filename, 0, intval($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix'])) . '_';
+                                                               unset($filename);
                                                        }
 
                                                        if ($fileArray['sample'])       {
index b24b161..fc9ab57 100644 (file)
@@ -4045,6 +4045,7 @@ if (version == "n3") {
         * @todo        Deprecated but still used in the Core!
         */
        function fileNameASCIIPrefix($inTitle,$titleChars,$mergeChar='.')       {
+               t3lib_div::logDeprecatedFunction();
                $out = $this->csConvObj->specCharsToASCII($this->renderCharset, $inTitle);
                        // Get replacement character
                $replacementChar = $this->config['config']['simulateStaticDocuments_replacementChar'];
index c6e31e4..1c47f09 100644 (file)
@@ -626,10 +626,19 @@ class tslib_gifBuilder extends t3lib_stdGraphic {
         */
        function fileName($pre) {
 
+               $meaningfulPrefix = '';
+
+               if ($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']) {
+                       $meaningfulPrefix = implode('_', array_merge($this->combinedTextStrings, $this->combinedFileNames));
+                               // strip everything non-ascii
+                       $meaningfulPrefix = preg_replace('/[^A-Za-z0-9_-]/', '', trim($meaningfulPrefix));
+                       $meaningfulPrefix = substr($meaningfulPrefix, 0, intval($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix'])) . '_';
+               }
+
                        // WARNING: In PHP5 I discovered that rendering with freetype of Japanese letters was totally corrupt. Not only the wrong glyphs are printed but also some memory stack overflow resulted in strange additional chars - and finally the reason for this investigation: The Bounding box data was changing all the time resulting in new images being generated all the time. With PHP4 it works fine.
                return $this->tempPath.
                                $pre.
-                               ($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix'] ? $GLOBALS['TSFE']->fileNameASCIIPrefix(implode('_',array_merge($this->combinedTextStrings,$this->combinedFileNames)),intval($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']),'_') : '').
+                               $meaningfulPrefix .
                                t3lib_div::shortMD5(serialize($this->setup)).
                                '.'.$this->extension();
        }