Fixed bug #9748: Some extensions do not work anymore in the frontend
[Packages/TYPO3.CMS.git] / typo3 / file_newfolder.php
index af387fa..4a63921 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -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!','');
@@ -137,16 +148,15 @@ class SC_file_newfolder {
                }
 
                $this->icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$this->icon,'width="18" height="16"').' title="" alt="" />';
-               
+
                        // Relative path to filemount, $key:
                $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
 
                        // Setting title:
                $this->title = $this->icon.$GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
-               
+
                        // 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;
+                                       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;
                                }
                        }
@@ -173,11 +185,11 @@ class SC_file_newfolder {
         */
        function main() {
                global $LANG;
-               
+
                        // start content compilation
                $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle'));
-               
-               
+
+
                        // Make page header:
                $pageContent='';
                $pageContent.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle'));
@@ -267,9 +279,9 @@ class SC_file_newfolder {
                        'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
                        'CONTENT' => $pageContent,
                        'PATH' => $this->title,
-               );      
+               );
 
-               $this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);      
+               $this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
                $this->content.= $this->doc->endPage();
 
                $this->content = $this->doc->insertStylesAndJS($this->content);
@@ -285,25 +297,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