[BUGFIX] Quickedit mode: RTE has no user CSS
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / Classes / RteHtmlAreaBase.php
index 4139b30..efa783a 100644 (file)
@@ -526,11 +526,10 @@ class RteHtmlAreaBase extends \TYPO3\CMS\Backend\Rte\AbstractRte {
                $contentCssFiles = array();
                if (count($contentCss)) {
                        foreach ($contentCss as $contentCssKey => $contentCssfile) {
-                               $fileName = trim($contentCssfile) ? $this->getFullFileName($contentCssfile) : '';
-                               $backPathResolvedFileName = $fileName ? GeneralUtility::resolveBackPath(($this->is_FE() || $this->isFrontendEditActive() ? '' : TYPO3_mainDir) . $fileName) : '';
-                               $absolutePath = $fileName ? GeneralUtility::getFileAbsFileName($backPathResolvedFileName) : '';
+                               $fileName = trim($contentCssfile);
+                               $absolutePath = GeneralUtility::getFileAbsFileName($fileName);
                                if (file_exists($absolutePath) && filesize($absolutePath)) {
-                                       $contentCssFiles[$contentCssKey] = $fileName;
+                                       $contentCssFiles[$contentCssKey] = $this->getFullFileName($fileName);
                                }
                        }
                }
@@ -1320,6 +1319,12 @@ class RteHtmlAreaBase extends \TYPO3\CMS\Backend\Rte\AbstractRte {
                return GeneralUtility::quoteJSvalue($str);
        }
 
+       /**
+        * Make a file name relative to the PATH_site or to the PATH_typo3
+        *
+        * @param string $filename: a file name of the form EXT:.... or relative to the PATH_site
+        * @return string the file name relative to the PATH_site if in frontend or relative to the PATH_typo3 if in backend
+        */
        public function getFullFileName($filename) {
                if (substr($filename, 0, 4) == 'EXT:') {
                        // extension
@@ -1328,10 +1333,9 @@ class RteHtmlAreaBase extends \TYPO3\CMS\Backend\Rte\AbstractRte {
                        if ((string)$extKey !== '' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey) && (string)$local !== '') {
                                $newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey) : $this->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($extKey)) . $local;
                        }
-               } elseif ($filename[0] !== '/') {
-                       $newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? '' : $this->backPath . '../') . $filename;
                } else {
-                       $newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? '' : $this->backPath . '../') . substr($filename, 1);
+                       $path = ($this->is_FE() || $this->isFrontendEditActive() ? '' : $this->backPath . '../');
+                       $newFilename = $path . ($filename[0] === '/' ? substr($filename, 1) : $filename);
                }
                return GeneralUtility::resolveBackPath($newFilename);
        }