*** empty log message ***
[Packages/TYPO3.CMS.git] / typo3 / tce_file.php
index 1f4f986..4183eda 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
+*  (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  * $Id$
  * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
  *
- *   76: class SC_tce_file
- *   96:     function init()
- *  116:     function initClipboard()
- *  137:     function main()
+ *   77: class SC_tce_file
+ *   97:     function init()
+ *  117:     function initClipboard()
+ *  138:     function main()
+ *  164:     function finish()
  *
- * TOTAL FUNCTIONS: 3
+ * TOTAL FUNCTIONS: 4
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
@@ -69,7 +70,7 @@ require_once (PATH_t3lib.'class.t3lib_extfilefunc.php');
 /**
  * Script Class, handling the calling of methods in the file admin classes.
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -84,7 +85,7 @@ class SC_tce_file {
 
                // Internal, dynamic:
        var $include_once=array();              // Used to set the classes to include after the init() function is called.
-
+       var $fileProcessor;                             // File processor object
 
 
 
@@ -104,7 +105,7 @@ class SC_tce_file {
 
                        // If clipboard is set, then include the clipboard class:
                if (is_array($this->CB))        {
-                       $this->include_once[]=PATH_t3lib.'class.t3lib_clipboard.php';
+                       $this->include_once[] = PATH_t3lib.'class.t3lib_clipboard.php';
                }
        }
 
@@ -138,22 +139,36 @@ class SC_tce_file {
                global $FILEMOUNTS,$TYPO3_CONF_VARS,$BE_USER;
 
                        // Initializing:
-               $fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
-               $fileProcessor->init($FILEMOUNTS, $TYPO3_CONF_VARS['BE']['fileExtensions']);
-               $fileProcessor->init_actionPerms($BE_USER->user['fileoper_perms']);
-               $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0;
+               $this->fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
+               $this->fileProcessor->init($FILEMOUNTS, $TYPO3_CONF_VARS['BE']['fileExtensions']);
+               $this->fileProcessor->init_actionPerms($BE_USER->user['fileoper_perms']);
+               $this->fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0;
 
                        // Checking referer / executing:
                $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
                $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
                if ($httpHost!=$refInfo['host'] && $this->vC!=$BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer'])    {
-                       $fileProcessor->writeLog(0,2,1,'Referer host "%s" and server host "%s" did not match!',array($refInfo['host'],$httpHost));
+                       $this->fileProcessor->writeLog(0,2,1,'Referer host "%s" and server host "%s" did not match!',array($refInfo['host'],$httpHost));
                } else {
-                       $fileProcessor->start($this->file);
-                       $fileProcessor->processData();
+                       $this->fileProcessor->start($this->file);
+                       $this->fileProcessor->processData();
                }
+       }
+
+       /**
+        * Redirecting the user after the processing has been done.
+        * Might also display error messages directly, if any.
+        *
+        * @return      void
+        */
+       function finish()       {
+                       // Prints errors, if...
+               $this->fileProcessor->printLogErrorMessages($this->redirect);
 
-               $fileProcessor->printLogErrorMessages($this->redirect);
+               t3lib_BEfunc::getSetUpdateSignal('updateFolderTree');
+               if ($this->redirect) {
+                       Header('Location: '.t3lib_div::locationHeaderUrl($this->redirect));
+               }
        }
 }
 
@@ -182,4 +197,5 @@ foreach($SOBE->include_once as $INC_FILE)   include_once($INC_FILE);
 
 $SOBE->initClipboard();
 $SOBE->main();
+$SOBE->finish();
 ?>