[BUGFIX] Fix usage of fileadminDir
authorHelmut Hummel <helmut.hummel@typo3.org>
Sun, 28 Oct 2012 13:00:47 +0000 (14:00 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 28 Oct 2012 19:09:06 +0000 (20:09 +0100)
#41120 introduced a regression, as
$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']
has a trailing backslash.

Fix that by removing the trailing slash and quoting
the value of the global for the case it contains
further path segments.

Fixes: #42454
Relates: #41120
Releases: 6.0, 4.7

Change-Id: I17455374ab2b9824bee9ceeaccbee7ea959b4841
Reviewed-on: http://review.typo3.org/15987
Reviewed-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
typo3/sysext/impexp/classes/ImportExport.php

index 1d89dc3..63a5653 100644 (file)
@@ -98,7 +98,7 @@ class SoftReferenceIndex {
         *
         */
        public function __construct() {
-               $this->fileAdminDir = !empty($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) ? $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] : 'fileadmin';
+               $this->fileAdminDir = !empty($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) ? rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') : 'fileadmin';
        }
 
        /**
@@ -529,7 +529,7 @@ class SoftReferenceIndex {
         */
        public function fileadminReferences($content, &$elements) {
                // Fileadmin files are found
-               $parts = preg_split('/([^[:alnum:]]+)(' . $this->fileAdminDir . '\\/[^[:space:]"\'<>]*)/', ' ' . $content . ' ', 10000, PREG_SPLIT_DELIM_CAPTURE);
+               $parts = preg_split('/([^[:alnum:]]+)(' . preg_quote($this->fileAdminDir, '/') . '\\/[^[:space:]"\'<>]*)/', ' ' . $content . ' ', 10000, PREG_SPLIT_DELIM_CAPTURE);
                // Traverse files:
                foreach ($parts as $idx => $value) {
                        if ($idx % 3 == 2) {
index 2a3a035..8617f6a 100644 (file)
@@ -310,7 +310,7 @@ class ImportExport {
                $this->compress = function_exists('gzcompress');
                $this->dontCompress = $dontCompress;
                $this->mode = $mode;
-               $this->fileadminFolderName = !empty($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) ? $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] : 'fileadmin';
+               $this->fileadminFolderName = !empty($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) ? rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') : 'fileadmin';
        }
 
        /**************************