Fixed bug #11268: Optimize initialization of frontend editing
authorOliver Hader <oliver.hader@typo3.org>
Mon, 8 Jun 2009 11:05:30 +0000 (11:05 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Mon, 8 Jun 2009 11:05:30 +0000 (11:05 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5572 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_frontendedit.php
t3lib/class.t3lib_tsfebeuserauth.php

index d637366..f84bf94 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-06-08  Oliver Hader  <oliver@typo3.org>
 
        * Fixed bug #11033: Optimize hook to indexed_search that checks for a running crawler task
+       * Fixed bug #11268: Optimize initialization of frontend editing
 
 2009-06-08  Steffen Kamper  <info@sk-typo3.de>
 
index 5add530..3b68b0d 100644 (file)
@@ -45,16 +45,6 @@ class t3lib_frontendedit {
        protected $tce;
 
        /**
-        * Creates and initializes the TCEmain object.
-        *
-        * @return      void
-        */
-       public function __construct() {
-               $this->tce = t3lib_div::makeInstance('t3lib_TCEmain');
-               $this->tce->stripslashes_values=0;
-       }
-
-       /**
         * Initializes configuration options.
         *
         * @return      void
@@ -260,6 +250,8 @@ class t3lib_frontendedit {
                if ($hideField) {
                        $recData = array();
                        $recData[$table][$uid][$hideField] = 1;
+
+                       $this->initializeTceMain();
                        $this->tce->start($recData, array());
                        $this->tce->process_datamap();
                }
@@ -277,6 +269,8 @@ class t3lib_frontendedit {
                if ($hideField) {
                        $recData = array();
                        $recData[$table][$uid][$hideField] = 0;
+
+                       $this->initializeTceMain();
                        $this->tce->start($recData, array());
                        $this->tce->process_datamap();
                }
@@ -383,6 +377,7 @@ class t3lib_frontendedit {
                                }
                        }
                        if (!empty($cmdData)) {
+                               $this->initializeTceMain();
                                $this->tce->start(array(), $cmdData);
                                $this->tce->process_cmdmap();
                        }
@@ -399,6 +394,7 @@ class t3lib_frontendedit {
        public function doDelete($table, $uid) {
                $cmdData[$table][$uid]['delete'] = 1;
                if (count($cmdData)) {
+                       $this->initializeTceMain();
                        $this->tce->start(array(), $cmdData);
                        $this->tce->process_cmdmap();
                }
@@ -415,6 +411,7 @@ class t3lib_frontendedit {
                $data = $this->TSFE_EDIT['data'];
 
                if (!empty($data)) {
+                       $this->initializeTceMain();
                        $this->tce->start($data, array());
                        $this->tce->process_uploads($_FILES);
                        $this->tce->process_datamap();
@@ -600,6 +597,18 @@ class t3lib_frontendedit {
                        // No special hidden fields needed.
                return array();
        }
+
+       /**
+        * Initializes t3lib_TCEmain since it is used on modification actions.
+        *
+        * @return      void
+        */
+       protected function initializeTceMain() {
+               if (!isset($this->tce)) {
+                       $this->tce = t3lib_div::makeInstance('t3lib_TCEmain');
+                       $this->tce->stripslashes_values=0;
+               }
+       }
 }
 
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_frontendedit.php']) {
index 9571661..bbb6e37 100644 (file)
@@ -207,7 +207,7 @@ class t3lib_tsfeBeUserAuth extends t3lib_beUserAuth {
         * @return      void
         */
        public function initializeFrontendEdit() {
-               if (isset($this->extAdminConfig['enable.'])) {
+               if (isset($this->extAdminConfig['enable.']) && $this->isFrontendEditingActive()) {
                        foreach($this->extAdminConfig['enable.'] as $key => $value) {
                                if ($value) {
                                        if ($GLOBALS['TSFE'] instanceof tslib_fe) {