Fixed bug #9860: Fileadmin: New folders: Singular and plural are the same ("folders")
[Packages/TYPO3.CMS.git] / typo3 / file_newfolder.php
index 3d4b478..99e32e5 100755 (executable)
@@ -94,6 +94,13 @@ class SC_file_newfolder {
        var $shortPath;         // Relative path to current found filemount
        var $title;                     // Name of the filemount
 
+       /**
+        * Charset processing object
+        *
+        * @var t3lib_cs
+        */
+       protected $charsetConversion;
+
                // Internal, static (GPVar):
        var $number;
        var $target;            // Set with the target path inputted in &target
@@ -121,8 +128,12 @@ class SC_file_newfolder {
                $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
                $this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
 
+                       // Init basic-charset-functions object:
+               $this->charsetConversion = t3lib_div::makeInstance('t3lib_cs');
+
                        // Cleaning and checking target
-               $this->target=$this->basicff->is_directory($this->target);
+               $this->target = $this->charsetConversion->conv($this->target, 'utf-8', $GLOBALS['LANG']->charSet);
+               $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!','');
@@ -146,7 +157,6 @@ class SC_file_newfolder {
 
                        // Setting template object
                $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->docType = 'xhtml_trans';
                $this->doc->setModuleTemplate('templates/file_newfolder.html');
                $this->doc->backPath = $BACK_PATH;
                $this->doc->JScode=$this->doc->wrapScriptTags('
@@ -154,7 +164,9 @@ class SC_file_newfolder {
 
                        function reload(a)      {       //
                                if (!changed || (changed && confirm('.$LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')).')))  {
-                                       var params = "&target="+escape(path)+"&number="+a+"&returnUrl="+escape("' . $this->returnUrl . '");
+                                       var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl='
+                                                       . urlencode($this->charsetConversion->conv($this->returnUrl, $GLOBALS['LANG']->charSet, 'utf-8'))
+                                                       . '";
                                        window.location.href = "file_newfolder.php?"+params;
                                }
                        }
@@ -190,10 +202,14 @@ class SC_file_newfolder {
                $this->number = t3lib_div::intInRange($this->number,1,10);
                $code .= '
                        <div id="c-select">
+                               <label for="number">' .
+                               $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);">';
                for ($a=1;$a<=$this->folderNumber;$a++) {
-                       $code.='
-                                       <option value="'.$a.'"'.($this->number==$a?' selected="selected"':'').'>'.$a.' '.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.folders',1).'</option>';
+                       $code .= '<option value="' . $a . '"' .
+                                       ($this->number == $a ? ' selected="selected"' : '') .
+                                       '>' . $a . '</option>';
                }
                $code.='
                                </select>
@@ -285,25 +301,17 @@ class SC_file_newfolder {
        }
 }
 
-// Include extension?
+
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_newfolder.php'])       {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_newfolder.php']);
 }
 
 
 
-
-
-
-
-
-
-
-
-
 // Make instance:
 $SOBE = t3lib_div::makeInstance('SC_file_newfolder');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
+
 ?>
\ No newline at end of file