Fixed bug #12508: Log usage of XLLfile to deprecation log (thanks to Steffen Gebert)
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_tcemain.php
index 7a56f5b..b992415 100644 (file)
@@ -2733,99 +2733,106 @@ class t3lib_TCEmain    {
                                // Now, the $uid is the actual record we will copy while $origUid is the record we asked to get copied - but that could be a live version.
 */
                        if ($this->doesRecordExist($table,$uid,'show')) {               // This checks if the record can be selected which is all that a copy action requires.
-                               $data = Array();
+                               if ($this->BE_USER->recordEditAccessInternals($table,$uid, false, false, true)) { //Used to check language and general editing rights
+                                       $data = Array();
 
-                               $nonFields = array_unique(t3lib_div::trimExplode(',','uid,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,t3ver_oid,t3ver_wsid,t3ver_id,t3ver_label,t3ver_state,t3ver_swapmode,t3ver_count,t3ver_stage,t3ver_tstamp,'.$excludeFields,1));
+                                       $nonFields = array_unique(t3lib_div::trimExplode(',','uid,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,t3ver_oid,t3ver_wsid,t3ver_id,t3ver_label,t3ver_state,t3ver_swapmode,t3ver_count,t3ver_stage,t3ver_tstamp,'.$excludeFields,1));
 
-                               // $row = $this->recordInfo($table,$uid,'*');
-                               $row = t3lib_BEfunc::getRecordWSOL($table,$uid);        // So it copies (and localized) content from workspace...
-                               if (is_array($row))     {
-
-                                               // Initializing:
-                                       $theNewID = uniqid('NEW');
-                                       $enableField = isset($TCA[$table]['ctrl']['enablecolumns']) ? $TCA[$table]['ctrl']['enablecolumns']['disabled'] : '';
-                                       $headerField = $TCA[$table]['ctrl']['label'];
-
-                                               // Getting default data:
-                                       $defaultData = $this->newFieldArray($table);
-
-                                               // Getting "copy-after" fields if applicable:
-                                       $copyAfterFields = $destPid<0 ? $this->fixCopyAfterDuplFields($table,$uid,abs($destPid),0) : array();
-
-                                               // Page TSconfig related:
-                                       $tscPID = t3lib_BEfunc::getTSconfig_pidValue($table,$uid,$destPid);     // NOT using t3lib_BEfunc::getTSCpid() because we need the real pid - not the ID of a page, if the input is a page...
-                                       $TSConfig = $this->getTCEMAIN_TSconfig($tscPID);
-                                       $tE = $this->getTableEntries($table,$TSConfig);
-
-                                               // Traverse ALL fields of the selected record:
-                                       foreach($row as $field => $value)       {
-                                               if (!in_array($field,$nonFields))       {
-
-                                                               // Get TCA configuration for the field:
-                                                       $conf = $TCA[$table]['columns'][$field]['config'];
+                                       // $row = $this->recordInfo($table,$uid,'*');
+                                       $row = t3lib_BEfunc::getRecordWSOL($table,$uid);        // So it copies (and localized) content from workspace...
+                                       if (is_array($row))     {
 
-                                                               // Preparation/Processing of the value:
-                                                       if ($field=='pid')      {       // "pid" is hardcoded of course:
-                                                               $value = $destPid;
-                                                       } elseif (isset($overrideValues[$field]))       {       // Override value...
-                                                               $value = $overrideValues[$field];
-                                                       } elseif (isset($copyAfterFields[$field]))      {       // Copy-after value if available:
-                                                               $value = $copyAfterFields[$field];
-                                                       } elseif ($TCA[$table]['ctrl']['setToDefaultOnCopy'] && t3lib_div::inList($TCA[$table]['ctrl']['setToDefaultOnCopy'],$field))   {       // Revert to default for some fields:
-                                                               $value = $defaultData[$field];
-                                                       } else {
-                                                                       // Hide at copy may override:
-                                                               if ($first && $field==$enableField && $TCA[$table]['ctrl']['hideAtCopy'] && !$this->neverHideAtCopy && !$tE['disableHideAtCopy'])       {
-                                                                       $value=1;
-                                                               }
-                                                                       // Prepend label on copy:
-                                                               if ($first && $field==$headerField && $TCA[$table]['ctrl']['prependAtCopy'] && !$tE['disablePrependAtCopy'])    {
-                                                                       $value = $this->getCopyHeader($table,$this->resolvePid($table,$destPid),$field,$this->clearPrefixFromValue($table,$value),0);
+                                                       // Initializing:
+                                               $theNewID = uniqid('NEW');
+                                               $enableField = isset($TCA[$table]['ctrl']['enablecolumns']) ? $TCA[$table]['ctrl']['enablecolumns']['disabled'] : '';
+                                               $headerField = $TCA[$table]['ctrl']['label'];
+
+                                                       // Getting default data:
+                                               $defaultData = $this->newFieldArray($table);
+
+                                                       // Getting "copy-after" fields if applicable:
+                                               $copyAfterFields = $destPid<0 ? $this->fixCopyAfterDuplFields($table,$uid,abs($destPid),0) : array();
+
+                                                       // Page TSconfig related:
+                                               $tscPID = t3lib_BEfunc::getTSconfig_pidValue($table,$uid,$destPid);     // NOT using t3lib_BEfunc::getTSCpid() because we need the real pid - not the ID of a page, if the input is a page...
+                                               $TSConfig = $this->getTCEMAIN_TSconfig($tscPID);
+                                               $tE = $this->getTableEntries($table,$TSConfig);
+
+                                                       // Traverse ALL fields of the selected record:
+                                               foreach($row as $field => $value)       {
+                                                       if (!in_array($field,$nonFields))       {
+
+                                                                       // Get TCA configuration for the field:
+                                                               $conf = $TCA[$table]['columns'][$field]['config'];
+
+                                                                       // Preparation/Processing of the value:
+                                                               if ($field=='pid')      {       // "pid" is hardcoded of course:
+                                                                       $value = $destPid;
+                                                               } elseif (isset($overrideValues[$field]))       {       // Override value...
+                                                                       $value = $overrideValues[$field];
+                                                               } elseif (isset($copyAfterFields[$field]))      {       // Copy-after value if available:
+                                                                       $value = $copyAfterFields[$field];
+                                                               } elseif ($TCA[$table]['ctrl']['setToDefaultOnCopy'] && t3lib_div::inList($TCA[$table]['ctrl']['setToDefaultOnCopy'],$field))   {       // Revert to default for some fields:
+                                                                       $value = $defaultData[$field];
+                                                               } else {
+                                                                               // Hide at copy may override:
+                                                                       if ($first && $field == $enableField && $TCA[$table]['ctrl']['hideAtCopy'] && !$this->neverHideAtCopy && !$tE['disableHideAtCopy']) {
+                                                                               $value = 1;
+                                                                       }
+                                                                               // Prepend label on copy:
+                                                                       if ($first && $field == $headerField && $TCA[$table]['ctrl']['prependAtCopy'] && !$tE['disablePrependAtCopy']) {
+                                                                               $value = $this->getCopyHeader($table,$this->resolvePid($table,$destPid),$field,$this->clearPrefixFromValue($table,$value),0);
+                                                                       }
+                                                                               // Processing based on the TCA config field type (files, references, flexforms...)
+                                                                       $value = $this->copyRecord_procBasedOnFieldType($table, $uid, $field, $value, $row, $conf, $tscPID, $language);
                                                                }
-                                                                       // Processing based on the TCA config field type (files, references, flexforms...)
-                                                               $value = $this->copyRecord_procBasedOnFieldType($table, $uid, $field, $value, $row, $conf, $tscPID, $language);
-                                                       }
 
-                                                               // Add value to array.
-                                                       $data[$table][$theNewID][$field] = $value;
+                                                                       // Add value to array.
+                                                               $data[$table][$theNewID][$field] = $value;
+                                                       }
+                                               }
+                                                       // Overriding values:
+                                               if ($TCA[$table]['ctrl']['editlock']) {
+                                                       $data[$table][$theNewID][$TCA[$table]['ctrl']['editlock']] = 0;
                                                }
-                                       }
-
-                                               // Overriding values:
-                                       if ($TCA[$table]['ctrl']['editlock'])   {
-                                               $data[$table][$theNewID][$TCA[$table]['ctrl']['editlock']] = 0;
-                                       }
-
-                                               // Setting original UID:
-                                       if ($TCA[$table]['ctrl']['origUid'])    {
-                                               $data[$table][$theNewID][$TCA[$table]['ctrl']['origUid']] = $uid;
-                                       }
 
-                                               // Do the copy by simply submitting the array through TCEmain:
-                                       $copyTCE = t3lib_div::makeInstance('t3lib_TCEmain');
-                                       /* @var $copyTCE t3lib_TCEmain  */
-                                       $copyTCE->stripslashes_values = 0;
-                                       $copyTCE->copyTree = $this->copyTree;
-                                       $copyTCE->cachedTSconfig = $this->cachedTSconfig;       // Copy forth the cached TSconfig
-                                       $copyTCE->dontProcessTransformations=1;         // Transformations should NOT be carried out during copy
+                                                       // Setting original UID:
+                                               if ($TCA[$table]['ctrl']['origUid']) {
+                                                       $data[$table][$theNewID][$TCA[$table]['ctrl']['origUid']] = $uid;
+                                               }
 
-                                       $copyTCE->start($data,'',$this->BE_USER);
-                                       $copyTCE->process_datamap();
+                                                       // Do the copy by simply submitting the array through TCEmain:
+                                               $copyTCE = t3lib_div::makeInstance('t3lib_TCEmain');
+                                               /* @var $copyTCE t3lib_TCEmain  */
+                                               $copyTCE->stripslashes_values = 0;
+                                               $copyTCE->copyTree = $this->copyTree;
+                                               $copyTCE->cachedTSconfig = $this->cachedTSconfig;       // Copy forth the cached TSconfig
+                                               $copyTCE->dontProcessTransformations=1;         // Transformations should NOT be carried out during copy
+
+                                               $copyTCE->start($data,'',$this->BE_USER);
+                                               $copyTCE->process_datamap();
+
+                                                       // Getting the new UID:
+                                               $theNewSQLID = $copyTCE->substNEWwithIDs[$theNewID];
+                                               if ($theNewSQLID) {
+                                                       $this->copyRecord_fixRTEmagicImages($table, t3lib_BEfunc::wsMapId($table, $theNewSQLID));
+                                                       $this->copyMappingArray[$table][$origUid] = $theNewSQLID;
+                                               }
 
-                                               // Getting the new UID:
-                                       $theNewSQLID = $copyTCE->substNEWwithIDs[$theNewID];
-                                       if ($theNewSQLID)       {
-                                               $this->copyRecord_fixRTEmagicImages($table,t3lib_BEfunc::wsMapId($table,$theNewSQLID));
-                                               $this->copyMappingArray[$table][$origUid] = $theNewSQLID;
-                                       }
+                                                       // Copy back the cached TSconfig
+                                               $this->cachedTSconfig = $copyTCE->cachedTSconfig;
+                                               $this->errorLog = array_merge($this->errorLog, $copyTCE->errorLog);
+                                               unset($copyTCE);
 
-                                               // Copy back the cached TSconfig
-                                       $this->cachedTSconfig = $copyTCE->cachedTSconfig;
-                                       $this->errorLog = array_merge($this->errorLog,$copyTCE->errorLog);
-                                       unset($copyTCE);
+                                               if($language == 0) {
+                                                               //repointing the new translation records to the parent record we just created
+                                                       $overrideValues[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] = $theNewSQLID;
+                                                       $this->copyL10nOverlayRecords($table, $uid, $destPid, $first, $overrideValues, $excludeFields);
+                                               }
 
-                                       return $theNewSQLID;
-                               } else $this->log($table,$uid,3,0,1,'Attempt to copy record that did not exist!');
+                                               return $theNewSQLID;
+                                       } else $this->log($table,$uid,3,0,1,'Attempt to copy record that did not exist!');
+                               }  else $this->log($table,$uid,3,0,1,'Attempt to copy record without having permissions to do so. ['.$this->BE_USER->errorMsg.'].');
                        } else $this->log($table,$uid,3,0,1,'Attempt to copy record without permission');
                }
        }
@@ -3368,7 +3375,28 @@ class t3lib_TCEmain      {
 
 
 
+       /**
+        * Find l10n-overlay records and perform the requested move action for these records.
+        *
+        * @param       string          $table: Record Table
+        * @param       string          $uid: Record UID
+        * @param       string          $destPid: Position to move to
+        * @return      void
+        */
+       function copyL10nOverlayRecords($table, $uid, $destPid, $first=0, $overrideValues=array(), $excludeFields='') {
+                       //there's no need to perform this for page-records
+               if (!t3lib_BEfunc::isTableLocalizable($table) || !empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable'])) {
+                       return;
+               }
+               t3lib_div::loadTCA($table);
 
+               $l10nRecords = t3lib_BEfunc::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid);
+               if (is_array($l10nRecords)) {
+                       foreach ($l10nRecords as $record) {
+                               $this->copyRecord($table, $record['uid'], $destPid, $first, $overrideValues, $excludeFields, $record[$GLOBALS['TCA'][$table]['ctrl']['languageField']]);
+                       }
+               }
+       }
 
 
 
@@ -3425,7 +3453,7 @@ class t3lib_TCEmain       {
                        }
 
                                // Checking if there is anything else disallowing moving the record by checking if editing is allowed
-                       $mayEditAccess = $this->BE_USER->recordEditAccessInternals($table,$uid);
+                       $mayEditAccess = $this->BE_USER->recordEditAccessInternals($table, $uid, false, false, true);
 
                                // If moving is allowed, begin the processing:
                        if ($mayEditAccess)     {
@@ -3540,6 +3568,14 @@ class t3lib_TCEmain      {
                        $newVersion_placeholderFieldArray['t3ver_wsid'] = $this->BE_USER->workspace;    // Setting workspace - only so display of place holders can filter out those from other workspaces.
                        $newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['label']] = '[MOVE-TO PLACEHOLDER for #'.$uid.', WS#'.$this->BE_USER->workspace.']';
 
+                               // moving localized records requires to keep localization-settings for the placeholder too
+                       if (array_key_exists('languageField', $GLOBALS['TCA'][$table]['ctrl']) && array_key_exists('transOrigPointerField', $GLOBALS['TCA'][$table]['ctrl'])) {
+                               $l10nParentRec = t3lib_BEfunc::getRecord($table, $uid);
+                               $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['languageField']] = $l10nParentRec[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
+                               $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] = $l10nParentRec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']];
+                               unset($l10nParentRec);
+                       }
+
                        $newVersion_placeholderFieldArray['pid'] = 0;   // Initially, create at root level.
                        $id = 'NEW_MOVE_PLH';
                        $this->insertDB($table,$id,$newVersion_placeholderFieldArray,FALSE);    // Saving placeholder as 'original'
@@ -3552,6 +3588,9 @@ class t3lib_TCEmain       {
                        $updateFields['t3ver_state'] = 4;       // Setting placeholder state value for version (so it can know it is currently a new version...)
                        $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($wsUid), $updateFields);
                }
+
+                       //check for the localizations of that element and move them as well
+               $this->moveL10nOverlayRecords($table, $uid, $destPid);
        }
 
        /**
@@ -3609,6 +3648,8 @@ class t3lib_TCEmain       {
                                $this->moveRecord_procFields($table,$uid,$destPid);
                                        // Create query for update:
                                $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), $updateFields);
+                                       // check for the localizations of that element
+                               $this->moveL10nOverlayRecords($table, $uid, $destPid);
 
                                        // Call post processing hooks:
                                foreach($hookObjectsArr as $hookObj) {
@@ -3652,6 +3693,8 @@ class t3lib_TCEmain       {
                                                $this->moveRecord_procFields($table,$uid,$destPid);
                                                        // Create query for update:
                                                $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), $updateFields);
+                                                       // check for the localizations of that element
+                                               $this->moveL10nOverlayRecords($table, $uid, $destPid);
 
                                                        // Call post processing hooks:
                                                foreach($hookObjectsArr as $hookObj) {
@@ -3750,6 +3793,29 @@ class t3lib_TCEmain      {
        }
 
        /**
+        * Find l10n-overlay records and perform the requested move action for these records.
+        *
+        * @param       string          $table: Record Table
+        * @param       string          $uid: Record UID
+        * @param       string          $destPid: Position to move to
+        * @return      void
+        */
+       function moveL10nOverlayRecords($table, $uid, $destPid) {
+                       //there's no need to perform this for page-records or not localizeable tables
+               if (!t3lib_BEfunc::isTableLocalizable($table) || !empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable'])) {
+                       return;
+               }
+               t3lib_div::loadTCA($table);
+
+               $l10nRecords = t3lib_BEfunc::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid);
+               if (is_array($l10nRecords)) {
+                       foreach ($l10nRecords as $record) {
+                               $this->moveRecord($table, $record['uid'], $destPid);
+                       }
+               }
+       }
+
+       /**
         * Localizes a record to another system language
         * In reality it only works if transOrigPointerTable is not set. For "pages" the implementation is hardcoded
         *
@@ -4014,6 +4080,7 @@ class t3lib_TCEmain       {
                        } else {
                                // Otherwise, try to delete by versioning:
                                $this->versionizeRecord($table,$id,'DELETED!',TRUE);
+                               $this->deleteL10nOverlayRecords($table, $id);
                        }
                }
        }
@@ -4089,7 +4156,7 @@ class t3lib_TCEmain       {
                global $TCA;
 
                        // Checking if there is anything else disallowing deleting the record by checking if editing is allowed
-               $mayEditAccess = $this->BE_USER->recordEditAccessInternals($table, $uid, FALSE, $undeleteRecord);
+               $mayEditAccess = $this->BE_USER->recordEditAccessInternals($table, $uid, FALSE, $undeleteRecord, TRUE);
 
                $uid = intval($uid);
                if ($TCA[$table] && $uid)       {
@@ -4119,6 +4186,11 @@ class t3lib_TCEmain      {
                                                        // before (un-)deleting this record, check for child records or references
                                                $this->deleteRecord_procFields($table, $uid, $undeleteRecord);
                                                $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), $updateFields);
+
+                                                        // delete all l10n records aswell, impossible during undelete because it might bring too many records back to life
+                                               if (!$undeleteRecord) {
+                                                       $this->deleteL10nOverlayRecords($table, $uid);
+                                               }
                                        } else {
 
                                                        // Fetches all fields with flexforms and look for files to delete:
@@ -4150,6 +4222,8 @@ class t3lib_TCEmain       {
 
                                                        // Delete the hard way...:
                                                $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid='.intval($uid));
+
+                                               $this->deleteL10nOverlayRecords($table, $uid);
                                        }
 
                                        $state = $undeleteRecord ? 1 : 3;       // 1 means insert, 3 means delete
@@ -4414,7 +4488,26 @@ class t3lib_TCEmain      {
                }
        }
 
+       /**
+        * Find l10n-overlay records and perform the requested delete action for these records.
+        *
+        * @param       string          $table: Record Table
+        * @param       string          $uid: Record UID
+        * @return      void
+        */
+       function deleteL10nOverlayRecords($table, $uid) {
+                       // Check whether table can be localized or has a different table defined to store localizations:
+               if (!t3lib_BEfunc::isTableLocalizable($table) || !empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable'])) {
+                       return;
+               }
 
+               $l10nRecords = t3lib_BEfunc::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid);
+               if (is_array($l10nRecords)) {
+                       foreach($l10nRecords as $record) {
+                               $this->deleteAction($table, intval($record['t3ver_oid']) > 0 ? intval($record['t3ver_oid']) : intval($record['uid']));
+                       }
+               }
+       }
 
 
 
@@ -4621,6 +4714,10 @@ class t3lib_TCEmain      {
                                                                                if ($TCA[$table]['ctrl']['sortby'])     {
                                                                                        $keepFields[] = $TCA[$table]['ctrl']['sortby'];
                                                                                }
+                                                                                       // l10n-fields must be kept otherwise the localization will be lost during the publishing
+                                                                               if ($TCA[$table]['ctrl']['transOrigPointerField']) {
+                                                                                       $keepFields[] = $TCA[$table]['ctrl']['transOrigPointerField'];
+                                                                               }
 
                                                                                        // Swap "keepfields"
                                                                                foreach($keepFields as $fN)     {
@@ -4687,6 +4784,10 @@ class t3lib_TCEmain      {
                                                                                        // Registering and swapping MM relations in current and swap records:
                                                                                $this->version_remapMMForVersionSwap($table,$id,$swapWith);
 
+                                                                                       // Generating proper history data to prepare logging
+                                                                               $this->compareFieldArrayWithCurrentAndUnset($table, $id, $swapVersion);
+                                                                               $this->compareFieldArrayWithCurrentAndUnset($table, $swapWith, $curVersion);
+
                                                                                        // Execute swapping:
                                                                                $sqlErrors = array();
                                                                                $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table,'uid='.intval($id),$swapVersion);
@@ -4720,9 +4821,29 @@ class t3lib_TCEmain      {
 
                                                                                        $this->newlog2(($swapIntoWS ? 'Swapping' : 'Publishing').' successful for table "'.$table.'" uid '.$id.'=>'.$swapWith, $table, $id, $swapVersion['pid']);
 
-                                                                                               // Update reference index:
+                                                                                               // Update reference index of the live record:
                                                                                        $this->updateRefIndex($table,$id);
+                                                                                               // Set log entry for live record:
+                                                                                       $propArr = $this->getRecordPropertiesFromRow($table, $swapVersion);
+                                                                                       if ( $propArr['_ORIG_pid'] == -1) {
+                                                                                               $label = $GLOBALS['LANG']->sL ('LLL:EXT:lang/locallang_tcemain.xml:version_swap.offline_record_updated');
+                                                                                       } else {
+                                                                                               $label = $GLOBALS['LANG']->sL ('LLL:EXT:lang/locallang_tcemain.xml:version_swap.online_record_updated');
+                                                                                       }
+                                                                                       $theLogId = $this->log($table, $id, 2, $propArr['pid'], 0, $label , 10, array($propArr['header'], $table . ':' . $id), $propArr['event_pid']);
+                                                                                       $this->setHistory($table, $id, $theLogId);
+
+                                                                                               // Update reference index of the offline record:
                                                                                        $this->updateRefIndex($table,$swapWith);
+                                                                                               // Set log entry for offline record:
+                                                                                       $propArr = $this->getRecordPropertiesFromRow($table, $curVersion);
+                                                                                       if ( $propArr['_ORIG_pid'] == -1) {
+                                                                                               $label = $GLOBALS['LANG']->sL ('LLL:EXT:lang/locallang_tcemain.xml:version_swap.offline_record_updated');
+                                                                                       } else {
+                                                                                               $label = $GLOBALS['LANG']->sL ('LLL:EXT:lang/locallang_tcemain.xml:version_swap.online_record_updated');
+                                                                                       }
+                                                                                       $theLogId = $this->log($table, $swapWith, 2, $propArr['pid'], 0, $label , 10, array($propArr['header'], $table . ':'. $swapWith), $propArr['event_pid']);
+                                                                                       $this->setHistory($table, $swapWith, $theLogId);
 
                                                                                                // SWAPPING pids for subrecords:
                                                                                        if ($table=='pages' && $swapVersion['t3ver_swapmode']>=0)       {
@@ -7390,49 +7511,19 @@ State was change by %s (username: %s)
                                        'sys_log',
                                        'type=1 AND userid='.intval($this->BE_USER->user['uid']).' AND tstamp='.intval($GLOBALS['EXEC_TIME']).' AND error!=0'
                                );
-               $errorJS = array();
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_log)) {
                        $log_data = unserialize($row['log_data']);
-                       $errorJS[] = $row['error'].': '.sprintf($row['details'], $log_data[0],$log_data[1],$log_data[2],$log_data[3],$log_data[4]);
+                       $msg = $row['error'] . ': ' . sprintf($row['details'], $log_data[0], $log_data[1], $log_data[2], $log_data[3], $log_data[4]);
+                       $flashMessage = t3lib_div::makeInstance(
+                                               't3lib_FlashMessage',
+                                               $msg,
+                                               '',
+                                               t3lib_FlashMessage::ERROR,
+                                               TRUE
+                               );
+                       t3lib_FlashMessageQueue::addMessage($flashMessage);
                }
                $GLOBALS['TYPO3_DB']->sql_free_result($res_log);
-
-               if (count($errorJS))    {
-                       $error_doc = t3lib_div::makeInstance('template');
-                       $error_doc->backPath = $GLOBALS['BACK_PATH'];
-
-                       $content.= $error_doc->startPage('tce_db.php Error output');
-
-                       $lines[] = '
-                                       <tr class="bgColor5">
-                                               <td colspan="2" align="center"><strong>Errors:</strong></td>
-                                       </tr>';
-
-                       foreach($errorJS as $line)      {
-                               $lines[] = '
-                                       <tr class="bgColor4">
-                                               <td valign="top"><img'.t3lib_iconWorks::skinImg($error_doc->backPath,'gfx/icon_fatalerror.gif','width="18" height="16"').' alt="" /></td>
-                                               <td>'.htmlspecialchars($line).'</td>
-                                       </tr>';
-                       }
-
-                       $lines[] = '
-                                       <tr>
-                                               <td colspan="2" align="center"><br />'.
-                                               '<form action=""><input type="submit" value="Continue" onclick="'.htmlspecialchars('window.location.href=\''.$redirect.'\';return false;').'"></form>'.
-                                               '</td>
-                                       </tr>';
-
-                       $content.= '
-                               <br/><br/>
-                               <table border="0" cellpadding="1" cellspacing="1" width="300" align="center">
-                                       '.implode('',$lines).'
-                               </table>';
-
-                       $content.= $error_doc->endPage();
-                       echo $content;
-                       exit;
-               }
        }
 
        /*****************************