Fixed bug #12336: Little Flaws with MediaCE
authorSteffen Kamper <info@sk-typo3.de>
Tue, 27 Oct 2009 10:19:41 +0000 (10:19 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Tue, 27 Oct 2009 10:19:41 +0000 (10:19 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6283 709f56b5-9817-0410-a4d7-c38de5d9e867

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

index a46264f..595c2b0 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2009-10-27  Steffen Kamper  <info@sk-typo3.de>
 
+       * Fixed bug #12336: Little Flaws with MediaCE
        * Fixed bug #12358: BE-user last-login field uses "date" instead of "datetime" (thanks to Steffen Gebert)
        * Fixed bug #12354: Remove t3lib_sqlengine from Core and move it to DBAL (thanks to Xavier Perseguers)
        * Cleanup: #12351: Clean-up SQL parser (thanks to Xavier Perseguers)
index d5ff01a..9dfa68f 100644 (file)
@@ -2664,14 +2664,15 @@ class tslib_cObj {
                        $url = $this->stdWrap($conf['file'], $conf['file.']);
                }
 
+               $url = rawurldecode($url);
+
                $mode = is_file(PATH_site . $url) ? 'file' : 'url';
                if ($mode === 'file') {
                        $filename = $GLOBALS['TSFE']->tmpl->getFileName($url);
                        $fileinfo = t3lib_div::split_fileref($filename);
-                       $conf['file'] = $url;
+                       $conf['file'] = rawurlencode($filename);
                } else {
-                       $conf['file'] = $url;
-
+                       $conf['file'] = rawurlencode($url);
                }
 
                $renderType = $conf['renderType'];
@@ -2691,7 +2692,8 @@ class tslib_cObj {
                }
 
                $conf['type'] = isset($conf['parameter.']['mmType']) ? $conf['parameter.']['mmType'] : $conf['type'];
-               $typeConf = $conf['mimeConf.'][$conf['type'] . '.'] ? $conf['mimeConf.'][$conf['type'] . '.'] : array();
+               $mime = $renderType . 'object';
+               $typeConf = $conf['mimeConf.'][$mime . '.'][$conf['type'] . '.'] ? $conf['mimeConf.'][$mime . '.'][$conf['type'] . '.'] : array();
                $conf['predefined'] = array();
 
                $width = intval($conf['parameter.']['mmWidth']);
@@ -2752,8 +2754,11 @@ class tslib_cObj {
                }
 
                        // render MEDIA
-               if ($mode == 'url' && $url != '' || !$forcePlayer) {
+               if ($mode == 'url' && !$forcePlayer) {
                                // url is called direct, not with player
+                       if ($url == '' && !$conf['allowEmptyUrl']) {
+                               return '<p style="background-color: yellow;">' . $GLOBALS['TSFE']->sL('LLL:EXT:cms/locallang_ttc.xml:media.noFile', true) . '</p>';
+                       }
                        $conf = array_merge($conf['mimeConf.']['swfobject.'], $conf);
                        if ($mode == 'url') {
                        $conf[$conf['type'] . '.']['player'] = strpos($url, '://') === false ? 'http://' . $url : $url;
@@ -2763,55 +2768,42 @@ class tslib_cObj {
                        $conf['file'] = '';
                        $conf['installUrl'] = 'null';
                        $conf['flashvars'] = array_merge((array) $conf['flashvars'], $conf['predefined']);
-                       if ($renderType == 'qt') {
+               }
+
+               switch ($renderType) {
+                       case 'swf':
+                               $conf[$conf['type'] . '.'] = array_merge($conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $typeConf);
+                               $conf = array_merge($conf['mimeConf.']['swfobject.'], $conf);
+                               unset($conf['mimeConf.']);
+                               $conf['flashvars.'] = array_merge((array) $conf['flashvars.'], $conf['predefined']);
+                               $content = $this->SWFOBJECT($conf);
+                       break;
+                       case 'qt':
+                               $conf[$conf['type'] . '.'] = array_merge($conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $typeConf);
                                $conf = array_merge($conf['mimeConf.']['qtobject.'], $conf);
                                unset($conf['mimeConf.']);
+                               $conf['params.'] = array_merge((array) $conf['params.'], $conf['predefined']);
                                $content = $this->QTOBJECT($conf);
-                       } else {
-                               $conf = array_merge($conf['mimeConf.']['swfobject.'], $conf);
-                               unset($conf['mimeConf.']);
-                       $content = $this->SWFOBJECT($conf);
-                       }
-
-               } else {
-                       if ($mode == 'url' && $url == '' && !$conf['allowEmptyUrl']) {
-                               return '<p style="background-color: yellow;">' . $GLOBALS['TSFE']->sL('LLL:EXT:cms/locallang_ttc.xml:media.noFile', true) . '</p>';
-                       }
-
-                       switch ($renderType) {
-                               case 'swf':
-                                       $conf[$conf['type'] . '.'] = array_merge($conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $typeConf);
-                                       $conf = array_merge($conf['mimeConf.']['swfobject.'], $conf);
-                                       unset($conf['mimeConf.']);
-                                       $conf['flashvars.'] = array_merge((array) $conf['flashvars.'], $conf['predefined']);
-                                       $content = $this->SWFOBJECT($conf);
-                               break;
-                               case 'qt':
-                                       $conf[$conf['type'] . '.'] = array_merge($conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $typeConf);
-                                       $conf = array_merge($conf['mimeConf.']['qtobject.'], $conf);
-                                       unset($conf['mimeConf.']);
-                                       $conf['params.'] = array_merge((array) $conf['params.'], $conf['predefined']);
-                                       $content = $this->QTOBJECT($conf);
-                               break;
-                               case 'media':
-                                       $paramsArray = array_merge((array) $typeConf['default.']['params.'], (array) $conf['params.'], $conf['predefined']);
-                                       $conf['params']= '';
-                                       foreach ($paramsArray as $key => $value) {
-                                               $conf['params'] .= $key . '=' . $value . chr(10);
-                                       }
-                                       $content = $this->MULTIMEDIA($conf);
-                               break;
-                               default:
-                                       if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRender'])) {
-                                               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRender'] as $classRef) {
-                                                       $hookObj = t3lib_div::getUserObj($classRef);
-                                                       $conf['file'] = $url;
-                                                       $conf['mode'] = $mode;
-                                                       $content = $hookObj->customMediaRender($renderType, $conf, $this);
-                                               }
+                       break;
+                       case 'media':
+                               $paramsArray = array_merge((array) $typeConf['default.']['params.'], (array) $conf['params.'], $conf['predefined']);
+                               $conf['params']= '';
+                               foreach ($paramsArray as $key => $value) {
+                                       $conf['params'] .= $key . '=' . $value . chr(10);
+                               }
+                               $content = $this->MULTIMEDIA($conf);
+                       break;
+                       default:
+                               if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRender'])) {
+                                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRender'] as $classRef) {
+                                               $hookObj = t3lib_div::getUserObj($classRef);
+                                               $conf['file'] = $url;
+                                               $conf['mode'] = $mode;
+                                               $content = $hookObj->customMediaRender($renderType, $conf, $this);
                                        }
                                }
                }
+
                return $content;
        }