Fixed #8802: Fileadmin: extensions of new files should only show allowed extensions...
authorBenni Mack <benni.mack@typo3.org>
Fri, 25 Sep 2009 13:42:22 +0000 (13:42 +0000)
committerBenni Mack <benni.mack@typo3.org>
Fri, 25 Sep 2009 13:42:22 +0000 (13:42 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6054 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/file_newfolder.php

index 648e88c..d5d4f4e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2009-09-25  Benjamin Mack  <benni@typo3.org>
 
+       * Fixed #8802: Fileadmin: extensions of new files should only show allowed extensions (Thanks to Steffen Gebert)
        * Cleanup #11357: Make use of new t3lib_div::redirect function throughout the core
 
 2009-09-25  Oliver Hader  <oliver@typo3.org>
index 775ad2c..3d73fe9 100644 (file)
@@ -251,10 +251,18 @@ class SC_file_newfolder {
                $pageContent.= $this->doc->sectionEnd();
                $pageContent.= '</form><form action="tce_file.php" method="post" name="editform2">';
 
+                       // Create a list of allowed file extensions with the nice format "*.jpg, *.gif" etc.
+               $fileExtList = array();
+               $textfileExt = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE);
+               foreach ($textfileExt as $fileExt) {
+                       if (!preg_match('/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] . '/i', '.' . $fileExt)) {
+                               $fileExtList[] = '*.' . $fileExt;
+                       }
+               }
                        // Add form fields for creation of a new, blank text file:
                $code='
                        <div id="c-newFile">
-                               <p>['.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext']).']</p>
+                               <p>[' . htmlspecialchars(implode(', ', $fileExtList)) . ']</p>
                                <input'.$this->doc->formWidth(20).' type="text" name="file[newfile][0][data]" onchange="changed=true;" />
                                <input type="hidden" name="file[newfile][0][target]" value="'.htmlspecialchars($this->target).'" />
                        </div>