Updated htmlArea RTE version to 2.2.0
[Packages/TYPO3.CMS.git] / typo3 / tce_db.php
index eb3ce68..7e883e7 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -30,9 +30,9 @@
  * For syntax and API information, see the document 'TYPO3 Core APIs'
  *
  * $Id$
- * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
+ * Revised for TYPO3 3.6 July/2003 by Kasper Skårhøj
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
@@ -53,7 +53,6 @@
 
 require ('init.php');
 require ('template.php');
-require_once (PATH_t3lib.'class.t3lib_tcemain.php');
 
 
 
@@ -71,7 +70,7 @@ require_once (PATH_t3lib.'class.t3lib_tcemain.php');
  * Is not used by alt_doc.php though (main form rendering script) - that uses the same class (TCEmain) but makes its own initialization (to save the redirect request).
  * For all other cases than alt_doc.php it is recommended to use this script for submitting your editing forms - but the best solution in any case would probably be to link your application to alt_doc.php, that will give you easy form-rendering as well.
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -93,7 +92,13 @@ class SC_tce_db {
 
                // Internal, dynamic:
        var $include_once=array();              // Files to include after init() function is called:
-       var $tce;                                               // TCEmain object
+
+       /**
+        * TYPO3 Core Engine
+        *
+        * @var t3lib_TCEmain
+        */
+       var $tce;
 
 
 
@@ -112,7 +117,7 @@ class SC_tce_db {
                $this->cmd = t3lib_div::_GP('cmd');
                $this->mirror = t3lib_div::_GP('mirror');
                $this->cacheCmd = t3lib_div::_GP('cacheCmd');
-               $this->redirect = t3lib_div::_GP('redirect');
+               $this->redirect = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('redirect'));
                $this->prErr = t3lib_div::_GP('prErr');
                $this->_disableRTE = t3lib_div::_GP('_disableRTE');
                $this->CB = t3lib_div::_GP('CB');
@@ -204,7 +209,7 @@ class SC_tce_db {
 
                                // Update page tree?
                        if ($this->uPT && (isset($this->data['pages'])||isset($this->cmd['pages'])))    {
-                               t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
+                               t3lib_BEfunc::setUpdateSignal('updatePageTree');
                        }
                }
        }
@@ -222,19 +227,15 @@ class SC_tce_db {
                }
 
                if ($this->redirect && !$this->tce->debug) {
-                       Header('Location: '.t3lib_div::locationHeaderUrl($this->redirect));
+                       t3lib_utility_Http::redirect($this->redirect);
                }
        }
 }
 
-// Include extension?
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/tce_db.php'])       {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/tce_db.php']);
-}
-
-
-
 
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/tce_db.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/tce_db.php']);
+}
 
 
 
@@ -245,7 +246,23 @@ $SOBE->init();
 // Include files?
 foreach($SOBE->include_once as $INC_FILE)      include_once($INC_FILE);
 
-$SOBE->initClipboard();
-$SOBE->main();
+$formprotection = t3lib_formprotection_Factory::get();
+
+if ($formprotection->validateToken(t3lib_div::_GP('formToken'), 'tceAction')) {
+       $SOBE->initClipboard();
+       $SOBE->main();
+
+               // This is done for the clear cache menu, so that it gets a new token
+               // making it possible to clear cache several times.
+       if (t3lib_div::_GP('ajaxCall')) {
+               $token = array();
+               $token['value'] = $formprotection->generateToken('tceAction');
+               $token['name'] = 'formToken';
+                       // This will be used by clearcachemenu.js to replace the token for the next call
+               echo t3lib_BEfunc::getUrlToken('tceAction');
+       }
+}
+$formprotection->persistTokens();
 $SOBE->finish();
+
 ?>