[BUGFIX] Remove ElementBrowser::isReadOnlyFolder 58/25358/4
authorMarkus Klein <klein.t3@mfc-linz.at>
Wed, 27 Nov 2013 22:20:25 +0000 (23:20 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Wed, 18 Dec 2013 10:22:34 +0000 (11:22 +0100)
ElementBrowser::isReadOnlyFolder is not required any more because the
check if the folder is writable has been moved to the methods that
create the file upload and folder creation forms.

The method and the parts where it was used were removed.

Additionally the check if the user is allowed to create folders
by TSConfig was moved to the createFolder method to reduce the amount
of duplicate code.

Resolves: #47648
Releases: 6.2, 6.1, 6.0
Change-Id: Ic6504c8def80012cbe420fc83539cfa859a53c0d
Reviewed-on: https://review.typo3.org/25358
Reviewed-by: DANIEL Rémy
Tested-by: DANIEL Rémy
Reviewed-by: Fabien Udriot
Tested-by: Fabien Udriot
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/rtehtmlarea/Classes/BrowseLinks.php
typo3/sysext/rtehtmlarea/Classes/SelectImage.php

index 334eeb4..711e639 100644 (file)
@@ -845,11 +845,9 @@ class ElementBrowser {
                                // Build the file upload and folder creation form
                                $uploadForm = '';
                                $createFolder = '';
-                               if ($selectedFolder && !$this->isReadOnlyFolder($selectedFolder)) {
+                               if ($selectedFolder) {
                                        $uploadForm = ($this->act === 'file') ? $this->uploadForm($selectedFolder) : '';
-                                       if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
-                                               $createFolder = $this->createFolder($selectedFolder);
-                                       }
+                                       $createFolder = $this->createFolder($selectedFolder);
                                }
                                // Insert the upload form on top, if so configured
                                if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
@@ -1214,17 +1212,9 @@ class ElementBrowser {
                        // Build the file upload and folder creation form
                $uploadForm = '';
                $createFolder = '';
-               if ($this->selectedFolder && !$this->isReadOnlyFolder($this->selectedFolder)) {
-                       $uploadForm = ($this->act === 'file') ? $this->uploadForm($this->selectedFolder) : '';
-                       if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
-                               $createFolder =  $this->createFolder($this->selectedFolder);
-                       }
-               }
                if ($this->selectedFolder) {
                        $uploadForm = $this->uploadForm($this->selectedFolder);
                        $createFolder = $this->createFolder($this->selectedFolder);
-               } else {
-                       $uploadForm = $createFolder = '';
                }
                // Insert the upload form on top, if so configured
                if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
@@ -1298,7 +1288,7 @@ class ElementBrowser {
                if ($this->expandFolder) {
                        $this->selectedFolder = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($this->expandFolder);
                }
-               if ($this->selectedFolder && !$this->isReadOnlyFolder($this->selectedFolder)) {
+               if ($this->selectedFolder) {
                        $createFolder = $this->createFolder($this->selectedFolder);
                } else {
                        $createFolder = '';
@@ -1328,9 +1318,7 @@ class ElementBrowser {
                        </table>
                        ';
                // Adding create folder if applicable:
-               if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
-                       $content .= $createFolder;
-               }
+               $content .= $createFolder;
                // Add some space
                $content .= '<br /><br />';
                // Ending page, returning content:
@@ -1923,17 +1911,6 @@ class ElementBrowser {
        }
 
        /**
-        * Checks, if a path is within a read-only mountpoint of the backend user
-        *
-        * @param string $folder Absolute filepath
-        * @return boolean If the input path is found in the backend users filemounts and if the filemount is of type readonly, then return TRUE.
-        * @todo Define visibility
-        */
-       public function isReadOnlyFolder($folder) {
-               return $GLOBALS['FILEMOUNTS'][$this->fileProcessor->checkPathAgainstMounts(rtrim($folder, '/') . '/')]['type'] == 'readonly';
-       }
-
-       /**
         * Prints a 'header' where string is in a tablecell
         *
         * @param string $str The string to print in the header. The value is htmlspecialchars()'ed before output.
@@ -2177,6 +2154,9 @@ class ElementBrowser {
                if (!$folderObject->checkActionPermission('write')) {
                        return '';
                }
+               if (!($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB'))) {
+                       return '';
+               }
                // Don't show Folder-create form if it's denied
                if ($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.hideCreateFolder')) {
                        return '';
index 3e136c4..dfdbb6c 100644 (file)
@@ -577,11 +577,9 @@ class BrowseLinks extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                                // Build the file upload and folder creation forms
                                $uploadForm = '';
                                $createFolder = '';
-                               if ($selectedFolder && !$this->isReadOnlyFolder($selectedFolder)) {
-                                       $uploadForm = $this->act === 'file' ? $this->uploadForm($selectedFolder) : '';
-                                       if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
-                                               $createFolder = $this->createFolder($selectedFolder);
-                                       }
+                               if ($selectedFolder) {
+                                       $uploadForm = ($this->act === 'file') ? $this->uploadForm($selectedFolder) : '';
+                                       $createFolder = $this->createFolder($selectedFolder);
                                }
                                // Insert the upload form on top, if so configured
                                if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
index 3e7e5b3..01c2ce3 100644 (file)
@@ -743,11 +743,9 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                                // Build the file upload and folder creation form
                                $uploadForm = '';
                                $createFolder = '';
-                               if ($selectedFolder && !$this->isReadOnlyFolder($selectedFolder)) {
+                               if ($selectedFolder) {
                                        $uploadForm = $this->uploadForm($selectedFolder);
-                                       if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
-                                               $createFolder = $this->createFolder($selectedFolder);
-                                       }
+                                       $createFolder = $this->createFolder($selectedFolder);
                                }
                                // Insert the upload form on top, if so configured
                                if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {