[TASK] Add tool-function to strip PATH_site-part of paths
[Packages/TYPO3.CMS.git] / typo3 / sysext / recordlist / Classes / Browser / ElementBrowser.php
index 9002748..27ce173 100644 (file)
@@ -307,7 +307,7 @@ class ElementBrowser {
                                        $currentLinkParts[0] = rawurldecode(substr($this->curUrlArray['href'], 5));
                                } elseif (file_exists(PATH_site . rawurldecode($this->curUrlArray['href']))) {
                                        if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($this->curUrlArray['href'], PATH_site)) {
-                                               $currentLinkParts[0] = substr($this->curUrlArray['href'], strlen(PATH_site));
+                                               $currentLinkParts[0] = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($this->curUrlArray['href']);
                                        }
                                        $this->curUrlInfo = $this->parseCurUrl($this->siteURL . $this->curUrlArray['href'], $this->siteURL);
                                } elseif (strstr($this->curUrlArray['href'], '@')) {
@@ -516,7 +516,7 @@ class ElementBrowser {
                        function jumpToUrl(URL,anchor) {        //
                                var add_act = URL.indexOf("act=")==-1 ? "&act=' . $this->act . '" : "";
                                var add_mode = URL.indexOf("mode=")==-1 ? "&mode=' . $this->mode . '" : "";
-                               var theLocation = URL + add_act + add_mode + add_href + add_target + add_class + add_title + add_params' . ($addPassOnParams ? '+"' . $addPassOnParams . '"' : '') . '+(anchor?anchor:"");
+                               var theLocation = URL + add_act + add_mode + add_href + add_target + add_class + add_title + add_params' . ($addPassOnParams ? '+"' . $addPassOnParams . '"' : '') . '+(typeof(anchor)=="string"?anchor:"");
                                window.location.href = theLocation;
                                return false;
                        }
@@ -708,7 +708,7 @@ class ElementBrowser {
                // Starting content:
                $content = $this->doc->startPage('RTE link');
                // Initializing the action value, possibly removing blinded values etc:
-               $allowedItems = array_diff(explode(',', 'page,file,folder,url,mail,spec'), GeneralUtility::trimExplode(',', $this->thisConfig['blindLinkOptions'], 1));
+               $allowedItems = array_diff(explode(',', 'page,file,folder,url,mail,spec'), GeneralUtility::trimExplode(',', $this->thisConfig['blindLinkOptions'], TRUE));
                $allowedItems = array_diff($allowedItems, GeneralUtility::trimExplode(',', $this->P['params']['blindLinkOptions']));
                // Call hook for extra options
                foreach ($this->hookObjects as $hookObject) {
@@ -724,43 +724,43 @@ class ElementBrowser {
                $menuDef = array();
                if (!$wiz) {
                        $menuDef['removeLink']['isActive'] = $this->act == 'removeLink';
-                       $menuDef['removeLink']['label'] = $GLOBALS['LANG']->getLL('removeLink', 1);
+                       $menuDef['removeLink']['label'] = $GLOBALS['LANG']->getLL('removeLink', TRUE);
                        $menuDef['removeLink']['url'] = '#';
                        $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
                }
                if (in_array('page', $allowedItems)) {
                        $menuDef['page']['isActive'] = $this->act == 'page';
-                       $menuDef['page']['label'] = $GLOBALS['LANG']->getLL('page', 1);
+                       $menuDef['page']['label'] = $GLOBALS['LANG']->getLL('page', TRUE);
                        $menuDef['page']['url'] = '#';
                        $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
                }
                if (in_array('file', $allowedItems)) {
                        $menuDef['file']['isActive'] = $this->act == 'file';
-                       $menuDef['file']['label'] = $GLOBALS['LANG']->getLL('file', 1);
+                       $menuDef['file']['label'] = $GLOBALS['LANG']->getLL('file', TRUE);
                        $menuDef['file']['url'] = '#';
                        $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
                }
                if (in_array('folder', $allowedItems)) {
                        $menuDef['folder']['isActive'] = $this->act == 'folder';
-                       $menuDef['folder']['label'] = $GLOBALS['LANG']->getLL('folder', 1);
+                       $menuDef['folder']['label'] = $GLOBALS['LANG']->getLL('folder', TRUE);
                        $menuDef['folder']['url'] = '#';
                        $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(\'?act=folder\');return false;"';
                }
                if (in_array('url', $allowedItems)) {
                        $menuDef['url']['isActive'] = $this->act == 'url';
-                       $menuDef['url']['label'] = $GLOBALS['LANG']->getLL('extUrl', 1);
+                       $menuDef['url']['label'] = $GLOBALS['LANG']->getLL('extUrl', TRUE);
                        $menuDef['url']['url'] = '#';
                        $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
                }
                if (in_array('mail', $allowedItems)) {
                        $menuDef['mail']['isActive'] = $this->act == 'mail';
-                       $menuDef['mail']['label'] = $GLOBALS['LANG']->getLL('email', 1);
+                       $menuDef['mail']['label'] = $GLOBALS['LANG']->getLL('email', TRUE);
                        $menuDef['mail']['url'] = '#';
                        $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
                }
                if (is_array($this->thisConfig['userLinks.']) && in_array('spec', $allowedItems)) {
                        $menuDef['spec']['isActive'] = $this->act == 'spec';
-                       $menuDef['spec']['label'] = $GLOBALS['LANG']->getLL('special', 1);
+                       $menuDef['spec']['label'] = $GLOBALS['LANG']->getLL('special', TRUE);
                        $menuDef['spec']['url'] = '#';
                        $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
                }
@@ -782,8 +782,8 @@ class ElementBrowser {
                                                <form action="" name="lurlform" id="lurlform">
                                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
                                                                <tr>
-                                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('emailAddress', 1) . ':</td>
-                                                                       <td><input type="text" name="lemail"' . $this->doc->formWidth(20) . ' value="' . htmlspecialchars(($this->curUrlInfo['act'] == 'mail' ? $this->curUrlInfo['info'] : '')) . '" /> ' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', 1) . '" onclick="browse_links_setTarget(\'\');browse_links_setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
+                                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('emailAddress', TRUE) . ':</td>
+                                                                       <td><input type="text" name="lemail"' . $this->doc->formWidth(20) . ' value="' . htmlspecialchars(($this->curUrlInfo['act'] == 'mail' ? $this->curUrlInfo['info'] : '')) . '" /> ' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', TRUE) . '" onclick="browse_links_setTarget(\'\');browse_links_setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
                                                                </tr>
                                                        </table>
                                                </form>';
@@ -799,7 +799,7 @@ class ElementBrowser {
                                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
                                                                <tr>
                                                                        <td style="width: 96px;">URL:</td>
-                                                                       <td><input type="text" name="lurl"' . $this->doc->formWidth(30) . ' value="' . htmlspecialchars(($this->curUrlInfo['act'] == 'url' ? $this->curUrlInfo['info'] : 'http://')) . '" /> ' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', 1) . '" onclick="browse_links_setValue(document.lurlform.lurl.value); return link_current();" /></td>
+                                                                       <td><input type="text" name="lurl"' . $this->doc->formWidth(30) . ' value="' . htmlspecialchars(($this->curUrlInfo['act'] == 'url' ? $this->curUrlInfo['info'] : 'http://')) . '" /> ' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', TRUE) . '" onclick="browse_links_setValue(document.lurlform.lurl.value); return link_current();" /></td>
                                                                </tr>
                                                        </table>
                                                </form>';
@@ -822,7 +822,10 @@ class ElementBrowser {
                                // Create upload/create folder forms, if a path is given
                                if ($this->expandFolder) {
                                        $selectedFolder = FALSE;
-                                       $fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->expandFolder);
+                                       try {
+                                               $fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->expandFolder);
+                                       } catch (\Exception $e) {
+                                       }
 
                                        if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
                                                // It's a folder
@@ -842,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')) {
@@ -893,7 +894,7 @@ class ElementBrowser {
                                                                $title = $GLOBALS['LANG']->sL($title);
                                                        }
                                                        // Description:
-                                                       $description = $v[$k2i . '.']['description'] ? $GLOBALS['LANG']->sL($v[($k2i . '.')]['description'], 1) . '<br />' : '';
+                                                       $description = $v[$k2i . '.']['description'] ? $GLOBALS['LANG']->sL($v[($k2i . '.')]['description'], TRUE) . '<br />' : '';
                                                        // URL + onclick event:
                                                        $onClickEvent = '';
                                                        if (isset($v[$k2i . '.']['target'])) {
@@ -924,7 +925,7 @@ class ElementBrowser {
                                -->
                                                        <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
                                                                <tr>
-                                                                       <td class="bgColor5" class="c-wCell" valign="top"><strong>' . $GLOBALS['LANG']->getLL('special', 1) . '</strong></td>
+                                                                       <td class="bgColor5" class="c-wCell" valign="top"><strong>' . $GLOBALS['LANG']->getLL('special', TRUE) . '</strong></td>
                                                                </tr>
                                                                ' . implode('', $subcats) . '
                                                        </table>
@@ -941,7 +942,7 @@ class ElementBrowser {
                                $cElements = $this->expandPage();
                                // Outputting Temporary DB mount notice:
                                if (intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'))) {
-                                       $link = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xlf:labels.temporaryDBmount', 1) . '</a>';
+                                       $link = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xlf:labels.temporaryDBmount', TRUE) . '</a>';
                                        $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $link, '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
                                        $dbmount = $flashMessage->render();
                                }
@@ -972,7 +973,7 @@ class ElementBrowser {
                                <form action="" name="lparamsform" id="lparamsform">
                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkParams">
                                                <tr>
-                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('params', 1) . '</td>
+                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('params', TRUE) . '</td>
                                                        <td><input type="text" name="lparams" class="typo3-link-input" onchange="browse_links_setParams(this.value);" value="' . htmlspecialchars($this->setParams) . '" /></td>
                                                </tr>
                                        </table>
@@ -987,7 +988,7 @@ class ElementBrowser {
                                <form action="" name="lclassform" id="lclassform">
                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass">
                                                <tr>
-                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('class', 1) . '</td>
+                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('class', TRUE) . '</td>
                                                        <td><input type="text" name="lclass" class="typo3-link-input" onchange="browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass) . '" /></td>
                                                </tr>
                                        </table>
@@ -1002,7 +1003,7 @@ class ElementBrowser {
                                <form action="" name="ltitleform" id="ltitleform">
                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle">
                                                <tr>
-                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('title', 1) . '</td>
+                                                       <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('title', TRUE) . '</td>
                                                        <td><input type="text" name="ltitle" class="typo3-link-input" onchange="browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle) . '" /></td>
                                                </tr>
                                        </table>
@@ -1029,19 +1030,19 @@ class ElementBrowser {
                                <form action="" name="ltargetform" id="ltargetform">
                                        <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
                                                <tr>
-                                                       <td>' . $GLOBALS['LANG']->getLL('target', 1) . ':</td>
+                                                       <td>' . $GLOBALS['LANG']->getLL('target', TRUE) . ':</td>
                                                        <td><input type="text" name="ltarget" onchange="browse_links_setTarget(this.value);" value="' . htmlspecialchars($this->setTarget) . '"' . $this->doc->formWidth(10) . ' /></td>
                                                        <td>
                                                                <select name="ltarget_type" onchange="browse_links_setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
                                                                        <option></option>
-                                                                       <option value="_top">' . $GLOBALS['LANG']->getLL('top', 1) . '</option>
-                                                                       <option value="_blank">' . $GLOBALS['LANG']->getLL('newWindow', 1) . '</option>
+                                                                       <option value="_top">' . $GLOBALS['LANG']->getLL('top', TRUE) . '</option>
+                                                                       <option value="_blank">' . $GLOBALS['LANG']->getLL('newWindow', TRUE) . '</option>
                                                                </select>
                                                        </td>
                                                        <td>';
                        if (($this->curUrlInfo['act'] == 'page' || $this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $this->curUrlArray['href'] && $this->curUrlInfo['act'] == $this->act) {
                                $ltarget .= '
-                                                       <input type="submit" value="' . $GLOBALS['LANG']->getLL('update', 1) . '" onclick="return link_current();" />';
+                                                       <input type="submit" value="' . $GLOBALS['LANG']->getLL('update', TRUE) . '" onclick="return link_current();" />';
                        }
                        $selectJS = '
                                if (document.ltargetform.popup_width.options[document.ltargetform.popup_width.selectedIndex].value>0 && document.ltargetform.popup_height.options[document.ltargetform.popup_height.selectedIndex].value>0) {
@@ -1057,10 +1058,10 @@ class ElementBrowser {
                        $ltarget .= '           </td>
                                                </tr>
                                                <tr>
-                                                       <td>' . $GLOBALS['LANG']->getLL('target_popUpWindow', 1) . ':</td>
+                                                       <td>' . $GLOBALS['LANG']->getLL('target_popUpWindow', TRUE) . ':</td>
                                                        <td colspan="3">
                                                                <select name="popup_width" onchange="' . htmlspecialchars($selectJS) . '">
-                                                                       <option value="0">' . $GLOBALS['LANG']->getLL('target_popUpWindow_width', 1) . '</option>
+                                                                       <option value="0">' . $GLOBALS['LANG']->getLL('target_popUpWindow_width', TRUE) . '</option>
                                                                        <option value="300">300</option>
                                                                        <option value="400">400</option>
                                                                        <option value="500">500</option>
@@ -1070,7 +1071,7 @@ class ElementBrowser {
                                                                </select>
                                                                x
                                                                <select name="popup_height" onchange="' . htmlspecialchars($selectJS) . '">
-                                                                       <option value="0">' . $GLOBALS['LANG']->getLL('target_popUpWindow_height', 1) . '</option>
+                                                                       <option value="0">' . $GLOBALS['LANG']->getLL('target_popUpWindow_height', TRUE) . '</option>
                                                                        <option value="200">200</option>
                                                                        <option value="300">300</option>
                                                                        <option value="400">400</option>
@@ -1211,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')) {
@@ -1242,10 +1235,14 @@ class ElementBrowser {
                $foldertree->ext_noTempRecyclerDirs = $this->mode == 'filedrag';
                $tree = $foldertree->getBrowsableTree();
                list(, , $specUid) = explode('_', $this->PM);
-               if ($this->mode == 'filedrag') {
-                       $files = $this->TBE_dragNDrop($this->selectedFolder, $pArr[3]);
+               if ($this->selectedFolder) {
+                       if ($this->mode == 'filedrag') {
+                               $files = $this->TBE_dragNDrop($this->selectedFolder, $pArr[3]);
+                       } else {
+                               $files = $this->TBE_expandFolder($this->selectedFolder, $pArr[3], $noThumbs);
+                       }
                } else {
-                       $files = $this->TBE_expandFolder($this->selectedFolder, $pArr[3], $noThumbs);
+                       $files = '';
                }
                // Putting the parts together, side by side:
                $content .= '
@@ -1295,7 +1292,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 = '';
@@ -1325,9 +1322,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:
@@ -1411,7 +1406,7 @@ class ElementBrowser {
                        if (!strcmp(trim($tables), '*')) {
                                $tablesArr = array_keys($GLOBALS['TCA']);
                        } else {
-                               $tablesArr = GeneralUtility::trimExplode(',', $tables, 1);
+                               $tablesArr = GeneralUtility::trimExplode(',', $tables, TRUE);
                        }
                        reset($tablesArr);
                        // Headline for selecting records:
@@ -1504,7 +1499,7 @@ class ElementBrowser {
        /**
         * For RTE: This displays all files from folder. No thumbnails shown
         *
-        * @param string $folder The folder path to expand
+        * @param \TYPO3\CMS\Core\Resource\Folder $folder The folder path to expand
         * @param string $extensionList List of fileextensions to show
         * @return string HTML output
         * @todo Define visibility
@@ -1533,11 +1528,7 @@ class ElementBrowser {
                        if ($renderFolders) {
                                $items = $folder->getSubfolders();
                        } else {
-                               $filter = new \TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter();
-                               $filter->setAllowedFileExtensions($extensionList);
-                               $folder->getStorage()->setFileAndFolderNameFilters(array(array($filter, 'filterFileList')));
-
-                               $items = $folder->getFiles();
+                               $items = $this->getFilesInFolder($folder, $extensionList);
                        }
                        $c = 0;
                        $totalItems = count($items);
@@ -1578,16 +1569,13 @@ class ElementBrowser {
         * @return string HTML output
         * @todo Define visibility
         */
-       public function TBE_expandFolder(\TYPO3\CMS\Core\Resource\Folder $folder, $extensionList = '', $noThumbs = 0) {
-               $extensionList = $extensionList == '*' ? '' : $extensionList;
-               $content = '';
-               if ($folder->checkActionPermission('read')) {
-                       // Listing the files:
-                       $files = $folder->getFiles($extensionList);
-                       $content = $this->fileList($files, $folder, $noThumbs);
+       public function TBE_expandFolder(\TYPO3\CMS\Core\Resource\Folder $folder, $extensionList = '', $noThumbs = FALSE) {
+               if (!$folder->checkActionPermission('read')) {
+                       return '';
                }
-               // Return accumulated content for filelisting:
-               return $content;
+               $extensionList = $extensionList == '*' ? '' : $extensionList;
+               $files = $this->getFilesInFolder($folder, $extensionList);
+               return $this->fileList($files, $folder, $noThumbs);
        }
 
        /**
@@ -1637,7 +1625,7 @@ class ElementBrowser {
                                        $imageUrl = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 64, 'height' => 64))->getPublicUrl(TRUE);
                                        $imgInfo = $imgObj->getImageDimensions($fileObject->getForLocalProcessing(FALSE));
                                        $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
-                                       $clickIcon = '<img src="' . $imageUrl . '" hspace="5" vspace="5" border="1"';
+                                       $clickIcon = '<img src="' . $imageUrl . '" hspace="5" vspace="5" border="1" />';
                                } else {
                                        $clickIcon = '';
                                        $pDim = '';
@@ -1672,8 +1660,8 @@ class ElementBrowser {
                                        $lines[] = '
                                                <tr class="file_list_normal">
                                                        <td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
-                                                       <td>' . $ATag . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />' . $ATag_e . '</td>
-                                                       <td nowrap="nowrap">' . ($ATag2 . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->getLL('info', 1) . '" alt="" /> ' . $GLOBALS['LANG']->getLL('info', 1) . $ATag2_e) . '</td>
+                                                       <td>' . $ATag . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', TRUE) . '" alt="" />' . $ATag_e . '</td>
+                                                       <td nowrap="nowrap">' . ($ATag2 . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->getLL('info', TRUE) . '" alt="" /> ' . $GLOBALS['LANG']->getLL('info', TRUE) . $ATag2_e) . '</td>
                                                        <td nowrap="nowrap">&nbsp;' . $pDim . '</td>
                                                </tr>';
                                        $lines[] = '
@@ -1684,8 +1672,8 @@ class ElementBrowser {
                                        $lines[] = '
                                                <tr class="file_list_normal">
                                                        <td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
-                                                       <td>' . $ATag . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />' . $ATag_e . '</td>
-                                                       <td nowrap="nowrap">' . ($ATag2 . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->getLL('info', 1) . '" alt="" /> ' . $GLOBALS['LANG']->getLL('info', 1) . $ATag2_e) . '</td>
+                                                       <td>' . $ATag . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', TRUE) . '" alt="" />' . $ATag_e . '</td>
+                                                       <td nowrap="nowrap">' . ($ATag2 . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->getLL('info', TRUE) . '" alt="" /> ' . $GLOBALS['LANG']->getLL('info', TRUE) . $ATag2_e) . '</td>
                                                        <td>&nbsp;</td>
                                                </tr>';
                                }
@@ -1773,7 +1761,7 @@ class ElementBrowser {
                                                $lines[] = '
                                                        <tr class="bgColor4">
                                                                <td nowrap="nowrap">' . $foldernameAndIcon . '&nbsp;</td>
-                                                               <td>' . $aTag . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />' . $aTag_e . ' </td>
+                                                               <td>' . $aTag . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', TRUE) . '" alt="" />' . $aTag_e . ' </td>
                                                                <td>&nbsp;</td>
                                                        </tr>';
                                        }
@@ -1807,86 +1795,85 @@ class ElementBrowser {
         * @todo Define visibility
         */
        public function TBE_dragNDrop(\TYPO3\CMS\Core\Resource\Folder $folder, $extensionList = '') {
-               $extensionList = $extensionList == '*' ? '' : $extensionList;
+               if (!$folder) {
+                       return '';
+               }
                $out = '';
-               if ($folder) {
-                       if ($folder->getStorage()->isPublic()) {
-                               // Read files from directory:
-                               $files = $folder->getFiles($extensionList);
-                               if (is_array($files)) {
-                                       $out .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('files') . ' (%s):', count($files)));
-                                       $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
-                                       $picon = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
-                                       $picon .= htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(basename($folder->getName()), $titleLen));
-                                       $out .= $picon . '<br />';
-                                       // Init row-array:
-                                       $lines = array();
-                                       // Add "drag-n-drop" message:
+               if ($folder->getStorage()->isPublic()) {
+                       // Read files from directory:
+                       $extensionList = $extensionList == '*' ? '' : $extensionList;
+                       $files = $this->getFilesInFolder($folder, $extensionList);
+                       $out .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('files') . ' (%s):', count($files)));
+                       $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
+                       $picon = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
+                       $picon .= htmlspecialchars(GeneralUtility::fixed_lgd_cs(basename($folder->getName()), $titleLen));
+                       $out .= $picon . '<br />';
+                       // Init row-array:
+                       $lines = array();
+                       // Add "drag-n-drop" message:
+                       $lines[] = '
+                               <tr>
+                                       <td colspan="2">' . $this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')) . '</td>
+                               </tr>';
+                       // Traverse files:
+                       foreach ($files as $fileObject) {
+                               $fileInfo = $fileObject->getStorage()->getFileInfo($fileObject);
+                               // URL of image:
+                               $iUrl = GeneralUtility::rawurlencodeFP($fileObject->getPublicUrl(TRUE));
+                               // Show only web-images
+                               $fileExtension = strtolower($fileObject->getExtension());
+                               if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('gif,jpeg,jpg,png', $fileExtension)) {
+                                       $imgInfo = @getimagesize($fileObject->getForLocalProcessing(FALSE));
+                                       $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
+                                       $size = ' (' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
+                                       $filenameAndIcon = IconUtility::getSpriteIconForFile($fileExtension, array('title' => $fileObject->getName() . $size));
+                                       if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('noLimit')) {
+                                               $maxW = 10000;
+                                               $maxH = 10000;
+                                       } else {
+                                               $maxW = 380;
+                                               $maxH = 500;
+                                       }
+                                       $IW = $imgInfo[0];
+                                       $IH = $imgInfo[1];
+                                       if ($IW > $maxW) {
+                                               $IH = ceil($IH / $IW * $maxW);
+                                               $IW = $maxW;
+                                       }
+                                       if ($IH > $maxH) {
+                                               $IW = ceil($IW / $IH * $maxH);
+                                               $IH = $maxH;
+                                       }
+                                       // Make row:
+                                       $lines[] = '
+                                               <tr class="bgColor4">
+                                                       <td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
+                                                       <td nowrap="nowrap">' . ($imgInfo[0] != $IW ? '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('noLimit' => '1'))) . '">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/icon_warning2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('clickToRedrawFullSize', TRUE) . '" alt="" />' . '</a>' : '') . $pDim . '&nbsp;</td>
+                                               </tr>';
                                        $lines[] = '
                                                <tr>
-                                                       <td colspan="2">' . $this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')) . '</td>
+                                                       <td colspan="2"><img src="' . $iUrl . '" data-htmlarea-file-uid="' . $fileObject->getUid() . '" width="' . $IW . '" height="' . $IH . '" border="1" alt="" /></td>
+                                               </tr>';
+                                       $lines[] = '
+                                               <tr>
+                                                       <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
                                                </tr>';
-                                       // Traverse files:
-                                       foreach ($files as $fileObject) {
-                                               $fileInfo = $fileObject->getStorage()->getFileInfo($fileObject);
-                                               // URL of image:
-                                               $iUrl = GeneralUtility::rawurlencodeFP($fileObject->getPublicUrl(TRUE));
-                                               // Show only web-images
-                                               $fileExtension = strtolower($fileObject->getExtension());
-                                               if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('gif,jpeg,jpg,png', $fileExtension)) {
-                                                       $imgInfo = @getimagesize($fileObject->getForLocalProcessing(FALSE));
-                                                       $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
-                                                       $size = ' (' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
-                                                       $filenameAndIcon = IconUtility::getSpriteIconForFile($fileExtension, array('title' => $fileObject->getName() . $size));
-                                                       if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('noLimit')) {
-                                                               $maxW = 10000;
-                                                               $maxH = 10000;
-                                                       } else {
-                                                               $maxW = 380;
-                                                               $maxH = 500;
-                                                       }
-                                                       $IW = $imgInfo[0];
-                                                       $IH = $imgInfo[1];
-                                                       if ($IW > $maxW) {
-                                                               $IH = ceil($IH / $IW * $maxW);
-                                                               $IW = $maxW;
-                                                       }
-                                                       if ($IH > $maxH) {
-                                                               $IW = ceil($IW / $IH * $maxH);
-                                                               $IH = $maxH;
-                                                       }
-                                                       // Make row:
-                                                       $lines[] = '
-                                                               <tr class="bgColor4">
-                                                                       <td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
-                                                                       <td nowrap="nowrap">' . ($imgInfo[0] != $IW ? '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('noLimit' => '1'))) . '">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/icon_warning2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('clickToRedrawFullSize', 1) . '" alt="" />' . '</a>' : '') . $pDim . '&nbsp;</td>
-                                                               </tr>';
-                                                       $lines[] = '
-                                                               <tr>
-                                                                       <td colspan="2"><img src="' . $iUrl . '" data-htmlarea-file-uid="' . $fileObject->getUid() . '" width="' . $IW . '" height="' . $IH . '" border="1" alt="" /></td>
-                                                               </tr>';
-                                                       $lines[] = '
-                                                               <tr>
-                                                                       <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
-                                                               </tr>';
-                                               }
-                                       }
-                                       // Finally, wrap all rows in a table tag:
-                                       $out .= '
-
-
-                       <!--
-                               File listing / Drag-n-drop
-                       -->
-                                               <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
-                                                       ' . implode('', $lines) . '
-                                               </table>';
                                }
-                       } else {
-                               // Print this warning if the folder is NOT a web folder:
-                               $out .= $this->barheader($GLOBALS['LANG']->getLL('files'));
-                               $out .= $this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'), 'icon_warning2');
                        }
+                       // Finally, wrap all rows in a table tag:
+                       $out .= '
+
+
+       <!--
+               File listing / Drag-n-drop
+       -->
+                               <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
+                                       ' . implode('', $lines) . '
+                               </table>';
+               } else {
+                       // Print this warning if the folder is NOT a web folder:
+                       $out .= $this->barheader($GLOBALS['LANG']->getLL('files'));
+                       $out .= $this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'), 'icon_warning2');
                }
                return $out;
        }
@@ -1920,17 +1907,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.
@@ -1992,7 +1968,7 @@ class ElementBrowser {
                                <!-- Print current URL -->
                                <table border="0" cellpadding="0" cellspacing="0" id="typo3-curUrl">
                                        <tr>
-                                               <td>' . $GLOBALS['LANG']->getLL('currentLink', 1) . ': ' . htmlspecialchars(rawurldecode($str)) . '</td>
+                                               <td>' . $GLOBALS['LANG']->getLL('currentLink', TRUE) . ': ' . htmlspecialchars(rawurldecode($str)) . '</td>
                                        </tr>
                                </table>';
                } else {
@@ -2060,7 +2036,7 @@ class ElementBrowser {
                                                }
                                                $pageRow = BackendUtility::getRecordWSOL('pages', $id);
                                                $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
-                                               $info['value'] = ((((($GLOBALS['LANG']->getLL('page', 1) . ' \'') . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($pageRow['title'], $titleLen))) . '\' (ID:') . $id) . ($uP['fragment'] ? ', #' . $uP['fragment'] : '')) . ')';
+                                               $info['value'] = ((((($GLOBALS['LANG']->getLL('page', TRUE) . ' \'') . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($pageRow['title'], $titleLen))) . '\' (ID:') . $id) . ($uP['fragment'] ? ', #' . $uP['fragment'] : '')) . ')';
                                                $info['pageid'] = $id;
                                                $info['cElement'] = $uP['fragment'];
                                                $info['act'] = 'page';
@@ -2133,10 +2109,10 @@ class ElementBrowser {
                        <form action="' . $GLOBALS['BACK_PATH'] . 'tce_file.php" method="post" name="editform" id="typo3-uplFilesForm" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">
                                <table border="0" cellpadding="0" cellspacing="0" id="typo3-uplFiles">
                                        <tr>
-                                               <td>' . $this->barheader(($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle', 1) . ':')) . '</td>
+                                               <td>' . $this->barheader(($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.pagetitle', TRUE) . ':')) . '</td>
                                        </tr>
                                        <tr>
-                                               <td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', 1) . ':</strong> ' . htmlspecialchars($header) . '</td>
+                                               <td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', TRUE) . ':</strong> ' . htmlspecialchars($header) . '</td>
                                        </tr>
                                        <tr>
                                                <td class="c-wCell c-hCell">';
@@ -2151,9 +2127,9 @@ class ElementBrowser {
                $code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />';
                $code .= '
                        <div id="c-override">
-                               <label><input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:overwriteExistingFiles', 1) . '</label>
+                               <label><input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:overwriteExistingFiles', TRUE) . '</label>
                        </div>
-                       <input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.submit', 1) . '" />
+                       <input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_upload.php.submit', TRUE) . '" />
                ';
                $code .= '</td>
                                        </tr>
@@ -2174,6 +2150,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 '';
@@ -2191,7 +2170,7 @@ class ElementBrowser {
                                                <td>' . $this->barheader(($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle') . ':')) . '</td>
                                        </tr>
                                        <tr>
-                                               <td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', 1) . ':</strong> ' . htmlspecialchars($header) . '</td>
+                                               <td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', TRUE) . ':</strong> ' . htmlspecialchars($header) . '</td>
                                        </tr>
                                        <tr>
                                                <td class="c-wCell c-hCell">';
@@ -2200,7 +2179,7 @@ class ElementBrowser {
                $code .= '<input' . $this->doc->formWidth(20) . ' type="text" name="file[newfolder][' . $a . '][data]" />' . '<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($folderObject->getCombinedIdentifier()) . '" />';
                // Make footer of upload form, including the submit button:
                $redirectValue = $this->thisScript . '?act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams);
-               $code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />' . '<input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', 1) . '" />';
+               $code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />' . '<input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.submit', TRUE) . '" />';
                $code .= '</td>
                                        </tr>
                                </table>
@@ -2217,8 +2196,8 @@ class ElementBrowser {
         */
        public function getBulkSelector($filesCount) {
                if ($filesCount) {
-                       $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:toggleSelection', 1);
-                       $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:importSelection', 1);
+                       $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:toggleSelection', TRUE);
+                       $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:importSelection', TRUE);
                        // Getting flag for showing/not showing thumbnails:
                        $noThumbsInEB = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
                        $out = $this->doc->spacer(10) . '<div>' . '<a href="#" onclick="BrowseLinks.Selector.handle()">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/import.gif', 'width="12" height="12"') . ' title="' . $labelImportSelection . '" alt="" /> ' . $labelImportSelection . '</a>&nbsp;&nbsp;&nbsp;' . '<a href="#" onclick="BrowseLinks.Selector.toggle()">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/clip_select.gif', 'width="12" height="12"') . ' title="' . $labelToggleSelection . '" alt="" /> ' . $labelToggleSelection . '</a>' . '</div>';
@@ -2229,7 +2208,7 @@ class ElementBrowser {
                                $_MCONF['name'] = 'file_list';
                                $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
                                $addParams = '&act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($this->selectedFolder->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams);
-                               $thumbNailCheck = BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', 1) . '</label>';
+                               $thumbNailCheck = BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', TRUE) . '</label>';
                                $out .= $this->doc->spacer(5) . $thumbNailCheck . $this->doc->spacer(15);
                        } else {
                                $out .= $this->doc->spacer(15);
@@ -2266,7 +2245,21 @@ class ElementBrowser {
                return $result;
        }
 
-}
-
+       /**
+        * Get a list of Files in a folder filtered by extension
+        *
+        * @param \TYPO3\CMS\Core\Resource\Folder $folder
+        * @param string $extensionList
+        * @return \TYPO3\CMS\Core\Resource\File[]
+        */
+       protected function getFilesInFolder(\TYPO3\CMS\Core\Resource\Folder $folder, $extensionList) {
+               if ($extensionList !== '') {
+                       /** @var \TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter $filter */
+                       $filter = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter');
+                       $filter->setAllowedFileExtensions($extensionList);
+                       $folder->setFileAndFolderNameFilters(array(array($filter, 'filterFileList')));
+               }
+               return $folder->getFiles();
+       }
 
-?>
+}