Added SVN keywords: Id, Date, Revision and Author
[Packages/TYPO3.CMS.git] / typo3 / file_newfolder.php
old mode 100755 (executable)
new mode 100644 (file)
index 99e32e5..5727d86
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -52,8 +52,6 @@
 $BACK_PATH = '';
 require('init.php');
 require('template.php');
-require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
-require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
 
 
 
@@ -136,7 +134,7 @@ class SC_file_newfolder {
                $this->target = $this->basicff->is_directory($this->target);
                $key=$this->basicff->checkPathAgainstMounts($this->target.'/');
                if (!$this->target || !$key)    {
-                       t3lib_BEfunc::typo3PrintError ('Parameter Error','Target was not a directory!','');
+                       t3lib_BEfunc::typo3PrintError ($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', true), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', true), '');
                        exit;
                }
 
@@ -153,7 +151,7 @@ class SC_file_newfolder {
                $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
 
                        // Setting title:
-               $this->title = $this->icon.$GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
+               $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
 
                        // Setting template object
                $this->doc = t3lib_div::makeInstance('template');
@@ -202,10 +200,10 @@ class SC_file_newfolder {
                $this->number = t3lib_div::intInRange($this->number,1,10);
                $code .= '
                        <div id="c-select">
-                               <label for="number">' .
+                               <label for="number-of-new-folders">' .
                                $LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.number_of_folders') .
                                '</label>
-                               <select name="number" onchange="reload(this.options[this.selectedIndex].value);">';
+                               <select name="number" id="number-of-new-folders" onchange="reload(this.options[this.selectedIndex].value);">';
                for ($a=1;$a<=$this->folderNumber;$a++) {
                        $code .= '<option value="' . $a . '"' .
                                        ($this->number == $a ? ' selected="selected"' : '') .
@@ -240,7 +238,7 @@ class SC_file_newfolder {
                        ';
 
                        // CSH:
-               $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_newfolder', $GLOBALS['BACK_PATH'],'<br/>');
+               $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_newfolder', $GLOBALS['BACK_PATH'], '<br />');
 
                $pageContent.= $code;
 
@@ -253,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>
@@ -272,8 +278,10 @@ class SC_file_newfolder {
                        ';
 
                        // CSH:
-               $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_newfile', $GLOBALS['BACK_PATH'],'<br/>');
+               $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_newfile', $GLOBALS['BACK_PATH'], '<br />');
                $pageContent.= $this->doc->section($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.newfile'),$code);
+               $pageContent .= $this->doc->sectionEnd();
+               $pageContent .= '</form>';
 
                $docHeaderButtons = array();