Project

General

Profile

Bug #22410 » 14050_cleaning_t3lib_tcemain.patch

Administrator Admin, 2010-11-24 18:33

View differences:

t3lib/class.t3lib_tcemain.php (revision )
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2010 Kasper Sk?rh?j (kasperYYYY@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
* Copyright notice
*
* (c) 1999-2010 Kasper Sk?rh?j (kasperYYYY@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Contains the TYPO3 Core Engine
*
......
*
*
* 242: class t3lib_TCEmain
* 367: function start($data,$cmd,$altUserObject='')
* 367: function start($data,$cmd,$altUserObject='')
* 406: function setMirror($mirror)
* 406: function setMirror($mirror)
* 431: function setDefaultsFromUserTS($userTS)
* 431: function setDefaultsFromUserTS($userTS)
* 454: function process_uploads($postFiles)
* 454: function process_uploads($postFiles)
* 492: function process_uploads_traverseArray(&$outputArr,$inputArr,$keyToSet)
* 492: function process_uploads_traverseArray(&$outputArr,$inputArr,$keyToSet)
*
* SECTION: PROCESSING DATA
* SECTION: PROCESSING DATA
* 528: function process_datamap()
* 528: function process_datamap()
* 886: function placeholderShadowing($table,$id)
* 886: function placeholderShadowing($table,$id)
* 929: function fillInFieldArray($table,$id,$fieldArray,$incomingFieldArray,$realPid,$status,$tscPID)
* 929: function fillInFieldArray($table,$id,$fieldArray,$incomingFieldArray,$realPid,$status,$tscPID)
*
* SECTION: Evaluation of input values
* SECTION: Evaluation of input values
* 1152: function checkValue($table,$field,$value,$id,$status,$realPid,$tscPID)
* 1152: function checkValue($table,$field,$value,$id,$status,$realPid,$tscPID)
* 1212: function checkValue_SW($res,$value,$tcaFieldConf,$table,$id,$curValue,$status,$realPid,$recFID,$field,$uploadedFiles,$tscPID)
* 1212: function checkValue_SW($res,$value,$tcaFieldConf,$table,$id,$curValue,$status,$realPid,$recFID,$field,$uploadedFiles,$tscPID)
* 1261: function checkValue_input($res,$value,$tcaFieldConf,$PP,$field='')
* 1261: function checkValue_input($res,$value,$tcaFieldConf,$PP,$field='')
* 1299: function checkValue_check($res,$value,$tcaFieldConf,$PP)
* 1299: function checkValue_check($res,$value,$tcaFieldConf,$PP)
* 1322: function checkValue_radio($res,$value,$tcaFieldConf,$PP)
* 1322: function checkValue_radio($res,$value,$tcaFieldConf,$PP)
* 1348: function checkValue_group_select($res,$value,$tcaFieldConf,$PP,$uploadedFiles,$field)
* 1348: function checkValue_group_select($res,$value,$tcaFieldConf,$PP,$uploadedFiles,$field)
* 1458: function checkValue_group_select_file($valueArray,$tcaFieldConf,$curValue,$uploadedFileArray,$status,$table,$id,$recFID)
* 1458: function checkValue_group_select_file($valueArray,$tcaFieldConf,$curValue,$uploadedFileArray,$status,$table,$id,$recFID)
* 1632: function checkValue_flex($res,$value,$tcaFieldConf,$PP,$uploadedFiles,$field)
* 1632: function checkValue_flex($res,$value,$tcaFieldConf,$PP,$uploadedFiles,$field)
* 1709: function checkValue_flexArray2Xml($array, $addPrologue=FALSE)
* 1709: function checkValue_flexArray2Xml($array, $addPrologue=FALSE)
* 1721: function _DELETE_FLEX_FORMdata(&$valueArrayToRemoveFrom,$deleteCMDS)
* 1721: function _DELETE_FLEX_FORMdata(&$valueArrayToRemoveFrom,$deleteCMDS)
* 1743: function _MOVE_FLEX_FORMdata(&$valueArrayToMoveIn, $moveCMDS, $direction)
* 1743: function _MOVE_FLEX_FORMdata(&$valueArrayToMoveIn, $moveCMDS, $direction)
* 1783: function checkValue_inline($res,$value,$tcaFieldConf,$PP,$field)
* 1783: function checkValue_inline($res,$value,$tcaFieldConf,$PP,$field)
* 1825: function checkValue_checkMax($tcaFieldConf, $valueArray)
* 1825: function checkValue_checkMax($tcaFieldConf, $valueArray)
*
* SECTION: Helper functions for evaluation functions.
* SECTION: Helper functions for evaluation functions.
* 1877: function getUnique($table,$field,$value,$id,$newPid=0)
* 1877: function getUnique($table,$field,$value,$id,$newPid=0)
* 1915: function checkValue_input_Eval($value,$evalArray,$is_in)
* 1915: function checkValue_input_Eval($value,$evalArray,$is_in)
* 2012: function checkValue_group_select_processDBdata($valueArray,$tcaFieldConf,$id,$status,$type,$currentTable)
* 2012: function checkValue_group_select_processDBdata($valueArray,$tcaFieldConf,$id,$status,$type,$currentTable)
* 2058: function checkValue_group_select_explodeSelectGroupValue($value)
* 2058: function checkValue_group_select_explodeSelectGroupValue($value)
* 2082: function checkValue_flex_procInData($dataPart,$dataPart_current,$uploadedFiles,$dataStructArray,$pParams,$callBackFunc='')
* 2082: function checkValue_flex_procInData($dataPart,$dataPart_current,$uploadedFiles,$dataStructArray,$pParams,$callBackFunc='')
* 2121: function checkValue_flex_procInData_travDS(&$dataValues,$dataValues_current,$uploadedFiles,$DSelements,$pParams,$callBackFunc,$structurePath)
* 2121: function checkValue_flex_procInData_travDS(&$dataValues,$dataValues_current,$uploadedFiles,$DSelements,$pParams,$callBackFunc,$structurePath)
*
* SECTION: PROCESSING COMMANDS
* SECTION: PROCESSING COMMANDS
* 2267: function process_cmdmap()
* 2267: function process_cmdmap()
*
* SECTION: Cmd: Copying
* SECTION: Cmd: Copying
* 2407: function copyRecord($table,$uid,$destPid,$first=0,$overrideValues=array(),$excludeFields='')
* 2407: function copyRecord($table,$uid,$destPid,$first=0,$overrideValues=array(),$excludeFields='')
* 2529: function copyPages($uid,$destPid)
* 2529: function copyPages($uid,$destPid)
* 2583: function copySpecificPage($uid,$destPid,$copyTablesArray,$first=0)
* 2583: function copySpecificPage($uid,$destPid,$copyTablesArray,$first=0)
* 2617: function copyRecord_raw($table,$uid,$pid,$overrideArray=array())
* 2617: function copyRecord_raw($table,$uid,$pid,$overrideArray=array())
* 2681: function rawCopyPageContent($old_pid,$new_pid,$copyTablesArray)
* 2681: function rawCopyPageContent($old_pid,$new_pid,$copyTablesArray)
* 2705: function insertNewCopyVersion($table,$fieldArray,$realPid)
* 2705: function insertNewCopyVersion($table,$fieldArray,$realPid)
* 2757: function copyRecord_procBasedOnFieldType($table,$uid,$field,$value,$row,$conf,$realDestPid)
* 2757: function copyRecord_procBasedOnFieldType($table,$uid,$field,$value,$row,$conf,$realDestPid)
* 2836: function copyRecord_flexFormCallBack($pParams, $dsConf, $dataValue, $dataValue_ext1, $dataValue_ext2)
* 2836: function copyRecord_flexFormCallBack($pParams, $dsConf, $dataValue, $dataValue_ext1, $dataValue_ext2)
* 2864: function copyRecord_procFilesRefs($conf, $uid, $value)
* 2864: function copyRecord_procFilesRefs($conf, $uid, $value)
*
* SECTION: Cmd: Moving, Localizing
* SECTION: Cmd: Moving, Localizing
* 2933: function moveRecord($table,$uid,$destPid)
* 2933: function moveRecord($table,$uid,$destPid)
* 3128: function moveRecord_procFields($table,$uid,$destPid)
* 3128: function moveRecord_procFields($table,$uid,$destPid)
* 3148: function moveRecord_procBasedOnFieldType($table,$uid,$destPid,$field,$value,$conf)
* 3148: function moveRecord_procBasedOnFieldType($table,$uid,$destPid,$field,$value,$conf)
* 3182: function localize($table,$uid,$language)
* 3182: function localize($table,$uid,$language)
*
* SECTION: Cmd: Deleting
* SECTION: Cmd: Deleting
* 3296: function deleteAction($table, $id)
* 3296: function deleteAction($table, $id)
* 3343: function deleteEl($table, $uid, $noRecordCheck=FALSE, $forceHardDelete=FALSE)
* 3343: function deleteEl($table, $uid, $noRecordCheck=FALSE, $forceHardDelete=FALSE)
* 3360: function deleteVersionsForRecord($table, $uid, $forceHardDelete)
* 3360: function deleteVersionsForRecord($table, $uid, $forceHardDelete)
* 3382: function undeleteRecord($table,$uid)
* 3382: function undeleteRecord($table,$uid)
* 3399: function deleteRecord($table,$uid, $noRecordCheck=FALSE, $forceHardDelete=FALSE,$undeleteRecord=FALSE)
* 3399: function deleteRecord($table,$uid, $noRecordCheck=FALSE, $forceHardDelete=FALSE,$undeleteRecord=FALSE)
* 3512: function deleteRecord_flexFormCallBack($dsArr, $dataValue, $PA, $structurePath, &$pObj)
* 3512: function deleteRecord_flexFormCallBack($dsArr, $dataValue, $PA, $structurePath, &$pObj)
* 3539: function deletePages($uid,$force=FALSE,$forceHardDelete=FALSE)
* 3539: function deletePages($uid,$force=FALSE,$forceHardDelete=FALSE)
* 3567: function deleteSpecificPage($uid,$forceHardDelete=FALSE)
* 3567: function deleteSpecificPage($uid,$forceHardDelete=FALSE)
* 3592: function canDeletePage($uid)
* 3592: function canDeletePage($uid)
* 3619: function cannotDeleteRecord($table,$id)
* 3619: function cannotDeleteRecord($table,$id)
* 3638: function deleteRecord_procFields($table, $uid, $undeleteRecord = false)
* 3638: function deleteRecord_procFields($table, $uid, $undeleteRecord = false)
* 3661: function deleteRecord_procBasedOnFieldType($table, $uid, $field, $value, $conf, $undeleteRecord = false)
* 3661: function deleteRecord_procBasedOnFieldType($table, $uid, $field, $value, $conf, $undeleteRecord = false)
*
* SECTION: Cmd: Versioning
* SECTION: Cmd: Versioning
* 3722: function versionizeRecord($table,$id,$label,$delete=FALSE,$versionizeTree=-1)
* 3722: function versionizeRecord($table,$id,$label,$delete=FALSE,$versionizeTree=-1)
* 3798: function versionizePages($uid,$label,$versionizeTree)
* 3798: function versionizePages($uid,$label,$versionizeTree)
* 3861: function version_swap($table,$id,$swapWith,$swapIntoWS=0)
* 3861: function version_swap($table,$id,$swapWith,$swapIntoWS=0)
* 4032: function version_clearWSID($table,$id)
* 4032: function version_clearWSID($table,$id)
* 4066: function version_setStage($table,$id,$stageId,$comment='')
* 4066: function version_setStage($table,$id,$stageId,$comment='')
*
* SECTION: Cmd: Helper functions
* SECTION: Cmd: Helper functions
* 4111: function remapListedDBRecords()
* 4111: function remapListedDBRecords()
* 4192: function remapListedDBRecords_flexFormCallBack($pParams, $dsConf, $dataValue, $dataValue_ext1, $dataValue_ext2)
* 4192: function remapListedDBRecords_flexFormCallBack($pParams, $dsConf, $dataValue, $dataValue_ext1, $dataValue_ext2)
* 4219: function remapListedDBRecords_procDBRefs($conf, $value, $MM_localUid, $table)
* 4219: function remapListedDBRecords_procDBRefs($conf, $value, $MM_localUid, $table)
* 4265: function remapListedDBRecords_procInline($conf, $value, $uid, $table)
* 4265: function remapListedDBRecords_procInline($conf, $value, $uid, $table)
*
* SECTION: Access control / Checking functions
* SECTION: Access control / Checking functions
* 4308: function checkModifyAccessList($table)
* 4308: function checkModifyAccessList($table)
* 4320: function isRecordInWebMount($table,$id)
* 4320: function isRecordInWebMount($table,$id)
* 4334: function isInWebMount($pid)
* 4334: function isInWebMount($pid)
* 4348: function checkRecordUpdateAccess($table,$id)
* 4348: function checkRecordUpdateAccess($table,$id)
* 4372: function checkRecordInsertAccess($insertTable,$pid,$action=1)
* 4372: function checkRecordInsertAccess($insertTable,$pid,$action=1)
* 4406: function isTableAllowedForThisPage($page_uid, $checkTable)
* 4406: function isTableAllowedForThisPage($page_uid, $checkTable)
* 4439: function doesRecordExist($table,$id,$perms)
* 4439: function doesRecordExist($table,$id,$perms)
* 4504: function doesRecordExist_pageLookUp($id, $perms)
* 4504: function doesRecordExist_pageLookUp($id, $perms)
* 4530: function doesBranchExist($inList,$pid,$perms,$recurse)
* 4530: function doesBranchExist($inList,$pid,$perms,$recurse)
* 4564: function tableReadOnly($table)
* 4564: function tableReadOnly($table)
* 4576: function tableAdminOnly($table)
* 4576: function tableAdminOnly($table)
* 4590: function destNotInsideSelf($dest,$id)
* 4590: function destNotInsideSelf($dest,$id)
* 4622: function getExcludeListArray()
* 4622: function getExcludeListArray()
* 4645: function doesPageHaveUnallowedTables($page_uid,$doktype)
* 4645: function doesPageHaveUnallowedTables($page_uid,$doktype)
*
* SECTION: Information lookup
* SECTION: Information lookup
* 4694: function pageInfo($id,$field)
* 4694: function pageInfo($id,$field)
* 4714: function recordInfo($table,$id,$fieldList)
* 4714: function recordInfo($table,$id,$fieldList)
* 4735: function getRecordProperties($table,$id,$noWSOL=FALSE)
* 4735: function getRecordProperties($table,$id,$noWSOL=FALSE)
* 4751: function getRecordPropertiesFromRow($table,$row)
* 4751: function getRecordPropertiesFromRow($table,$row)
*
* SECTION: Storing data to Database Layer
* SECTION: Storing data to Database Layer
* 4794: function updateDB($table,$id,$fieldArray)
* 4794: function updateDB($table,$id,$fieldArray)
* 4846: function insertDB($table,$id,$fieldArray,$newVersion=FALSE,$suggestedUid=0,$dontSetNewIdIndex=FALSE)
* 4846: function insertDB($table,$id,$fieldArray,$newVersion=FALSE,$suggestedUid=0,$dontSetNewIdIndex=FALSE)
* 4919: function checkStoredRecord($table,$id,$fieldArray,$action)
* 4919: function checkStoredRecord($table,$id,$fieldArray,$action)
* 4956: function setHistory($table,$id,$logId)
* 4956: function setHistory($table,$id,$logId)
* 4989: function clearHistory($maxAgeSeconds=604800,$table)
* 4989: function clearHistory($maxAgeSeconds=604800,$table)
* 5003: function updateRefIndex($table,$id)
* 5003: function updateRefIndex($table,$id)
*
* SECTION: Misc functions
* SECTION: Misc functions
* 5035: function getSortNumber($table,$uid,$pid)
* 5035: function getSortNumber($table,$uid,$pid)
* 5108: function resorting($table,$pid,$sortRow, $return_SortNumber_After_This_Uid)
* 5108: function resorting($table,$pid,$sortRow, $return_SortNumber_After_This_Uid)
* 5139: function setTSconfigPermissions($fieldArray,$TSConfig_p)
* 5139: function setTSconfigPermissions($fieldArray,$TSConfig_p)
* 5156: function newFieldArray($table)
* 5156: function newFieldArray($table)
* 5188: function addDefaultPermittedLanguageIfNotSet($table,&$incomingFieldArray)
* 5188: function addDefaultPermittedLanguageIfNotSet($table,&$incomingFieldArray)
* 5212: function overrideFieldArray($table,$data)
* 5212: function overrideFieldArray($table,$data)
* 5228: function compareFieldArrayWithCurrentAndUnset($table,$id,$fieldArray)
* 5228: function compareFieldArrayWithCurrentAndUnset($table,$id,$fieldArray)
* 5274: function assemblePermissions($string)
* 5274: function assemblePermissions($string)
* 5291: function rmComma($input)
* 5291: function rmComma($input)
* 5301: function convNumEntityToByteValue($input)
* 5301: function convNumEntityToByteValue($input)
* 5323: function destPathFromUploadFolder($folder)
* 5323: function destPathFromUploadFolder($folder)
* 5333: function deleteClause($table)
* 5333: function deleteClause($table)
* 5349: function getTCEMAIN_TSconfig($tscPID)
* 5349: function getTCEMAIN_TSconfig($tscPID)
* 5364: function getTableEntries($table,$TSconfig)
* 5364: function getTableEntries($table,$TSconfig)
* 5377: function getPID($table,$uid)
* 5377: function getPID($table,$uid)
* 5390: function dbAnalysisStoreExec()
* 5390: function dbAnalysisStoreExec()
* 5406: function removeRegisteredFiles()
* 5406: function removeRegisteredFiles()
* 5418: function removeCacheFiles()
* 5418: function removeCacheFiles()
* 5432: function int_pageTreeInfo($CPtable,$pid,$counter, $rootID)
* 5432: function int_pageTreeInfo($CPtable,$pid,$counter, $rootID)
* 5453: function compileAdminTables()
* 5453: function compileAdminTables()
* 5470: function fixUniqueInPid($table,$uid)
* 5470: function fixUniqueInPid($table,$uid)
* 5506: function fixCopyAfterDuplFields($table,$uid,$prevUid,$update, $newData=array())
* 5506: function fixCopyAfterDuplFields($table,$uid,$prevUid,$update, $newData=array())
* 5531: function extFileFields($table)
* 5531: function extFileFields($table)
* 5552: function getUniqueFields($table)
* 5552: function getUniqueFields($table)
* 5577: function isReferenceField($conf)
* 5577: function isReferenceField($conf)
* 5588: function getInlineFieldType($conf)
* 5588: function getInlineFieldType($conf)
* 5611: function getCopyHeader($table,$pid,$field,$value,$count,$prevTitle='')
* 5611: function getCopyHeader($table,$pid,$field,$value,$count,$prevTitle='')
* 5640: function prependLabel($table)
* 5640: function prependLabel($table)
* 5657: function resolvePid($table,$pid)
* 5657: function resolvePid($table,$pid)
* 5687: function clearPrefixFromValue($table,$value)
* 5687: function clearPrefixFromValue($table,$value)
* 5702: function extFileFunctions($table,$field,$filelist,$func)
* 5702: function extFileFunctions($table,$field,$filelist,$func)
* 5732: function noRecordsFromUnallowedTables($inList)
* 5732: function noRecordsFromUnallowedTables($inList)
* 5758: function notifyStageChange($stat,$stageId,$table,$id,$comment)
* 5758: function notifyStageChange($stat,$stageId,$table,$id,$comment)
* 5853: function notifyStageChange_getEmails($listOfUsers,$noTablePrefix=FALSE)
* 5853: function notifyStageChange_getEmails($listOfUsers,$noTablePrefix=FALSE)
*
* SECTION: Clearing cache
* SECTION: Clearing cache
* 5899: function clear_cache($table,$uid)
* 5899: function clear_cache($table,$uid)
* 6009: function clear_cacheCmd($cacheCmd)
* 6009: function clear_cacheCmd($cacheCmd)
*
* SECTION: Logging
* SECTION: Logging
* 6113: function log($table,$recuid,$action,$recpid,$error,$details,$details_nr=-1,$data=array(),$event_pid=-1,$NEWid='')
* 6113: function log($table,$recuid,$action,$recpid,$error,$details,$details_nr=-1,$data=array(),$event_pid=-1,$NEWid='')
* 6130: function newlog($message, $error=0)
* 6130: function newlog($message, $error=0)
* 6140: function printLogErrorMessages($redirect)
* 6140: function printLogErrorMessages($redirect)
*
* SECTION: Internal (do not use outside Core!)
* SECTION: Internal (do not use outside Core!)
* 6202: function internal_clearPageCache()
* 6202: function internal_clearPageCache()
*
* TOTAL FUNCTIONS: 126
* (This index is automatically created/updated by the extension "extdeveval")
......
*/
/**
* This is the TYPO3 Core Engine class for manipulation of the database
* This class is used by eg. the tce_db.php script which provides an the interface for POST forms to this class.
......
* @package TYPO3
* @subpackage t3lib
*/
class t3lib_TCEmain {
class t3lib_TCEmain {
// *********************
// Public variables you can configure before using the class:
// *********************
// *********************
// Public variables you can configure before using the class:
// *********************
var $storeLogMessages = TRUE; // Boolean: If true, the default log-messages will be stored. This should not be necessary if the locallang-file for the log-display is properly configured. So disabling this will just save some database-space as the default messages are not saved.
var $storeLogMessages = TRUE; // Boolean: If true, the default log-messages will be stored. This should not be necessary if the locallang-file for the log-display is properly configured. So disabling this will just save some database-space as the default messages are not saved.
var $enableLogging = TRUE; // Boolean: If true, actions are logged to sys_log.
var $enableLogging = TRUE; // Boolean: If true, actions are logged to sys_log.
var $reverseOrder = FALSE; // Boolean: If true, the datamap array is reversed in the order, which is a nice thing if you're creating a whole new bunch of records.
var $reverseOrder = FALSE; // Boolean: If true, the datamap array is reversed in the order, which is a nice thing if you're creating a whole new bunch of records.
var $checkSimilar = TRUE; // Boolean: If true, only fields which are different from the database values are saved! In fact, if a whole input array is similar, it's not saved then.
var $checkSimilar = TRUE; // Boolean: If true, only fields which are different from the database values are saved! In fact, if a whole input array is similar, it's not saved then.
var $stripslashes_values = TRUE; // Boolean: If true, incoming values in the data-array have their slashes stripped. ALWAYS SET THIS TO ZERO and supply an unescaped data array instead. This switch may totally disappear in future versions of this class!
var $stripslashes_values = TRUE; // Boolean: If true, incoming values in the data-array have their slashes stripped. ALWAYS SET THIS TO ZERO and supply an unescaped data array instead. This switch may totally disappear in future versions of this class!
var $checkStoredRecords = TRUE; // Boolean: This will read the record after having updated or inserted it. If anything is not properly submitted an error is written to the log. This feature consumes extra time by selecting records
var $checkStoredRecords = TRUE; // Boolean: This will read the record after having updated or inserted it. If anything is not properly submitted an error is written to the log. This feature consumes extra time by selecting records
var $checkStoredRecords_loose = TRUE; // Boolean: If set, values '' and 0 will equal each other when the stored records are checked.
var $checkStoredRecords_loose = TRUE; // Boolean: If set, values '' and 0 will equal each other when the stored records are checked.
var $deleteTree = FALSE; // Boolean. If this is set, then a page is deleted by deleting the whole branch under it (user must have deletepermissions to it all). If not set, then the page is deleted ONLY if it has no branch
var $deleteTree = FALSE; // Boolean. If this is set, then a page is deleted by deleting the whole branch under it (user must have deletepermissions to it all). If not set, then the page is deleted ONLY if it has no branch
var $neverHideAtCopy = FALSE; // Boolean. If set, then the 'hideAtCopy' flag for tables will be ignored.
var $neverHideAtCopy = FALSE; // Boolean. If set, then the 'hideAtCopy' flag for tables will be ignored.
var $dontProcessTransformations = FALSE; // Boolean: If set, then transformations are NOT performed on the input.
var $dontProcessTransformations = FALSE; // Boolean: If set, then transformations are NOT performed on the input.
var $clear_flexFormData_vDEFbase = FALSE; // Boolean: If set, .vDEFbase values are unset in flexforms.
var $clear_flexFormData_vDEFbase = FALSE; // Boolean: If set, .vDEFbase values are unset in flexforms.
var $updateModeL10NdiffData = TRUE; // Boolean/Mixed: TRUE: (traditional) Updates when record is saved. For flexforms, updates if change is made to the localized value. FALSE: Will not update anything. "FORCE_FFUPD" (string): Like TRUE, but will force update to the FlexForm Field
var $updateModeL10NdiffData = TRUE; // Boolean/Mixed: TRUE: (traditional) Updates when record is saved. For flexforms, updates if change is made to the localized value. FALSE: Will not update anything. "FORCE_FFUPD" (string): Like TRUE, but will force update to the FlexForm Field
var $updateModeL10NdiffDataClear = FALSE; // Boolean: If true, the translation diff. fields will in fact be reset so that they indicate that all needs to change again! It's meant as the opposite of declaring the record translated.
var $updateModeL10NdiffDataClear = FALSE; // Boolean: If true, the translation diff. fields will in fact be reset so that they indicate that all needs to change again! It's meant as the opposite of declaring the record translated.
var $bypassWorkspaceRestrictions = FALSE; // Boolean: If true, workspace restrictions are bypassed on edit an create actions (process_datamap()). YOU MUST KNOW what you do if you use this feature!
var $bypassWorkspaceRestrictions = FALSE; // Boolean: If true, workspace restrictions are bypassed on edit an create actions (process_datamap()). YOU MUST KNOW what you do if you use this feature!
var $bypassFileHandling = FALSE; // Boolean: If true, file handling of attached files (addition, deletion etc) is bypassed - the value is saved straight away. YOU MUST KNOW what you are doing with this feature!
var $bypassFileHandling = FALSE; // Boolean: If true, file handling of attached files (addition, deletion etc) is bypassed - the value is saved straight away. YOU MUST KNOW what you are doing with this feature!
var $bypassAccessCheckForRecords = FALSE; // Boolean: If true, access check, check for deleted etc. for records is bypassed. YOU MUST KNOW what you are doing if you use this feature!
var $bypassAccessCheckForRecords = FALSE; // Boolean: If true, access check, check for deleted etc. for records is bypassed. YOU MUST KNOW what you are doing if you use this feature!
var $copyWhichTables = '*'; // String. Comma-list. This list of tables decides which tables will be copied. If empty then none will. If '*' then all will (that the user has permission to of course)
var $copyWhichTables = '*'; // String. Comma-list. This list of tables decides which tables will be copied. If empty then none will. If '*' then all will (that the user has permission to of course)
var $copyTree = 0; // Integer. If 0 then branch is NOT copied. If 1 then pages on the 1st level is copied. If 2 then pages on the second level is copied ... and so on
var $copyTree = 0; // Integer. If 0 then branch is NOT copied. If 1 then pages on the 1st level is copied. If 2 then pages on the second level is copied ... and so on
var $defaultValues = array(); // Array [table][fields]=value: New records are created with default values and you can set this array on the form $defaultValues[$table][$field] = $value to override the default values fetched from TCA. If ->setDefaultsFromUserTS is called UserTSconfig default values will overrule existing values in this array (thus UserTSconfig overrules externally set defaults which overrules TCA defaults)
var $defaultValues = array(); // Array [table][fields]=value: New records are created with default values and you can set this array on the form $defaultValues[$table][$field] = $value to override the default values fetched from TCA. If ->setDefaultsFromUserTS is called UserTSconfig default values will overrule existing values in this array (thus UserTSconfig overrules externally set defaults which overrules TCA defaults)
var $overrideValues = array(); // Array [table][fields]=value: You can set this array on the form $overrideValues[$table][$field] = $value to override the incoming data. You must set this externally. You must make sure the fields in this array are also found in the table, because it's not checked. All columns can be set by this array!
var $overrideValues = array(); // Array [table][fields]=value: You can set this array on the form $overrideValues[$table][$field] = $value to override the incoming data. You must set this externally. You must make sure the fields in this array are also found in the table, because it's not checked. All columns can be set by this array!
var $alternativeFileName = array(); // Array [filename]=alternative_filename: Use this array to force another name onto a file. Eg. if you set ['/tmp/blablabal'] = 'my_file.txt' and '/tmp/blablabal' is set for a certain file-field, then 'my_file.txt' will be used as the name instead.
var $alternativeFileName = array(); // Array [filename]=alternative_filename: Use this array to force another name onto a file. Eg. if you set ['/tmp/blablabal'] = 'my_file.txt' and '/tmp/blablabal' is set for a certain file-field, then 'my_file.txt' will be used as the name instead.
var $alternativeFilePath = array(); // Array [filename]=alternative_filepath: Same as alternativeFileName but with relative path to the file
var $alternativeFilePath = array(); // Array [filename]=alternative_filepath: Same as alternativeFileName but with relative path to the file
var $data_disableFields=array(); // If entries are set in this array corresponding to fields for update, they are ignored and thus NOT updated. You could set this array from a series of checkboxes with value=0 and hidden fields before the checkbox with 1. Then an empty checkbox will disable the field.
var $data_disableFields = array(); // If entries are set in this array corresponding to fields for update, they are ignored and thus NOT updated. You could set this array from a series of checkboxes with value=0 and hidden fields before the checkbox with 1. Then an empty checkbox will disable the field.
var $suggestedInsertUids=array(); // Use this array to validate suggested uids for tables by setting [table]:[uid]. This is a dangerous option since it will force the inserted record to have a certain UID. The value just have to be true, but if you set it to "DELETE" it will make sure any record with that UID will be deleted first (raw delete). The option is used for import of T3D files when synchronizing between two mirrored servers. As a security measure this feature is available only for Admin Users (for now)
var $suggestedInsertUids = array(); // Use this array to validate suggested uids for tables by setting [table]:[uid]. This is a dangerous option since it will force the inserted record to have a certain UID. The value just have to be true, but if you set it to "DELETE" it will make sure any record with that UID will be deleted first (raw delete). The option is used for import of T3D files when synchronizing between two mirrored servers. As a security measure this feature is available only for Admin Users (for now)
var $callBackObj; // Object. Call back object for flex form traversation. Useful when external classes wants to use the iteration functions inside tcemain for traversing a FlexForm structure.
var $callBackObj; // Object. Call back object for flex form traversation. Useful when external classes wants to use the iteration functions inside tcemain for traversing a FlexForm structure.
// *********************
// Internal variables (mapping arrays) which can be used (read-only) from outside
// *********************
// *********************
// Internal variables (mapping arrays) which can be used (read-only) from outside
// *********************
var $autoVersionIdMap = Array(); // Contains mapping of auto-versionized records.
var $substNEWwithIDs = Array(); // When new elements are created, this array contains a map between their "NEW..." string IDs and the eventual UID they got when stored in database
var $substNEWwithIDs_table = Array(); // Like $substNEWwithIDs, but where each old "NEW..." id is mapped to the table it was from.
var $newRelatedIDs = Array(); // Holds the tables and there the ids of newly created child records from IRRE
var $copyMappingArray_merged = Array(); // This array is the sum of all copying operations in this class. May be READ from outside, thus partly public.
var $copiedFileMap = Array(); // A map between input file name and final destination for files being attached to records.
var $RTEmagic_copyIndex = Array(); // Contains [table][id][field] of fiels where RTEmagic images was copied. Holds old filename as key and new filename as value.
var $errorLog = Array(); // Errors are collected in this variable.
var $autoVersionIdMap = array(); // Contains mapping of auto-versionized records.
var $substNEWwithIDs = array(); // When new elements are created, this array contains a map between their "NEW..." string IDs and the eventual UID they got when stored in database
var $substNEWwithIDs_table = array(); // Like $substNEWwithIDs, but where each old "NEW..." id is mapped to the table it was from.
var $newRelatedIDs = array(); // Holds the tables and there the ids of newly created child records from IRRE
var $copyMappingArray_merged = array(); // This array is the sum of all copying operations in this class. May be READ from outside, thus partly public.
var $copiedFileMap = array(); // A map between input file name and final destination for files being attached to records.
var $RTEmagic_copyIndex = array(); // Contains [table][id][field] of fiels where RTEmagic images was copied. Holds old filename as key and new filename as value.
var $errorLog = array(); // Errors are collected in this variable.
// *********************
// Internal Variables, do not touch.
// *********************
// *********************
// Internal Variables, do not touch.
// *********************
// Variables set in init() function:
// Variables set in init() function:
/**
* The user-object the script uses. If not set from outside, this is set to the current global $BE_USER.
*
* @var t3lib_beUserAuth
*/
var $BE_USER;
var $userid; // will be set to uid of be_user executing this script
var $userid; // will be set to uid of be_user executing this script
var $username; // will be set to username of be_user executing this script
var $username; // will be set to username of be_user executing this script
var $admin; // will be set if user is admin
var $admin; // will be set if user is admin
var $defaultPermissions = array( // Can be overridden from $TYPO3_CONF_VARS
var $defaultPermissions = array( // Can be overridden from $TYPO3_CONF_VARS
'user' => 'show,edit,delete,new,editcontent',
'group' => 'show,edit,new,editcontent',
'everybody' => ''
);
var $exclude_array; // The list of <table>-<fields> that cannot be edited by user. This is compiled from TCA/exclude-flag combined with non_exclude_fields for the user.
var $exclude_array; // The list of <table>-<fields> that cannot be edited by user. This is compiled from TCA/exclude-flag combined with non_exclude_fields for the user.
var $datamap = Array(); // Set with incoming data array
var $cmdmap = Array(); // Set with incoming cmd array
var $datamap = array(); // Set with incoming data array
var $cmdmap = array(); // Set with incoming cmd array
// Internal static:
var $pMap = Array( // Permission mapping
var $pMap = array( // Permission mapping
'show' => 1, // 1st bit
'show' => 1, // 1st bit
'edit' => 2, // 2nd bit
'edit' => 2, // 2nd bit
'delete' => 4, // 3rd bit
'delete' => 4, // 3rd bit
'new' => 8, // 4th bit
'new' => 8, // 4th bit
'editcontent' => 16 // 5th bit
'editcontent' => 16 // 5th bit
);
var $sortIntervals = 256; // Integer: The interval between sorting numbers used with tables with a 'sorting' field defined. Min 1
var $sortIntervals = 256; // Integer: The interval between sorting numbers used with tables with a 'sorting' field defined. Min 1
// Internal caching arrays
var $recUpdateAccessCache = Array(); // Used by function checkRecordUpdateAccess() to store whether a record is updateable or not.
var $recInsertAccessCache = Array(); // User by function checkRecordInsertAccess() to store whether a record can be inserted on a page id
var $recUpdateAccessCache = array(); // Used by function checkRecordUpdateAccess() to store whether a record is updateable or not.
var $recInsertAccessCache = array(); // User by function checkRecordInsertAccess() to store whether a record can be inserted on a page id
var $isRecordInWebMount_Cache=array(); // Caching array for check of whether records are in a webmount
var $isRecordInWebMount_Cache = array(); // Caching array for check of whether records are in a webmount
var $isInWebMount_Cache=array(); // Caching array for page ids in webmounts
var $isInWebMount_Cache = array(); // Caching array for page ids in webmounts
var $cachedTSconfig = array(); // Caching for collecting TSconfig for page ids
var $cachedTSconfig = array(); // Caching for collecting TSconfig for page ids
var $pageCache = Array(); // Used for caching page records in pageInfo()
var $checkWorkspaceCache = Array(); // Array caching workspace access for BE_USER
var $pageCache = array(); // Used for caching page records in pageInfo()
var $checkWorkspaceCache = array(); // Array caching workspace access for BE_USER
// Other arrays:
var $dbAnalysisStore=array(); // For accumulation of MM relations that must be written after new records are created.
var $dbAnalysisStore = array(); // For accumulation of MM relations that must be written after new records are created.
var $removeFilesStore=array(); // For accumulation of files which must be deleted after processing of all input content
var $removeFilesStore = array(); // For accumulation of files which must be deleted after processing of all input content
var $uploadedFileArray = array(); // Uploaded files, set by process_uploads()
var $uploadedFileArray = array(); // Uploaded files, set by process_uploads()
var $registerDBList=array(); // Used for tracking references that might need correction after operations
var $registerDBList = array(); // Used for tracking references that might need correction after operations
var $registerDBPids=array(); // Used for tracking references that might need correction in pid field after operations (e.g. IRRE)
var $registerDBPids = array(); // Used for tracking references that might need correction in pid field after operations (e.g. IRRE)
var $copyMappingArray = Array(); // Used by the copy action to track the ids of new pages so subpages are correctly inserted! THIS is internally cleared for each executed copy operation! DO NOT USE THIS FROM OUTSIDE! Read from copyMappingArray_merged instead which is accumulating this information.
var $copyMappingArray = array(); // Used by the copy action to track the ids of new pages so subpages are correctly inserted! THIS is internally cleared for each executed copy operation! DO NOT USE THIS FROM OUTSIDE! Read from copyMappingArray_merged instead which is accumulating this information.
var $remapStack = array(); // array used for remapping uids and values at the end of process_datamap
var $remapStack = array(); // array used for remapping uids and values at the end of process_datamap
var $remapStackRecords = array(); // array used for remapping uids and values at the end of process_datamap (e.g. $remapStackRecords[<table>][<uid>] = <index in $remapStack>)
var $remapStackRecords = array(); // array used for remapping uids and values at the end of process_datamap (e.g. $remapStackRecords[<table>][<uid>] = <index in $remapStack>)
protected $remapStackChildIds = array(); // array used for checking whether new children need to be remapped
protected $remapStackChildIds = array(); // array used for checking whether new children need to be remapped
protected $remapStackActions = array(); // array used for executing addition actions after remapping happened (sett processRemapStack())
protected $remapStackActions = array(); // array used for executing addition actions after remapping happened (sett processRemapStack())
protected $remapStackRefIndex = array(); // array used for executing post-processing on the reference index
protected $remapStackRefIndex = array(); // array used for executing post-processing on the reference index
var $updateRefIndexStack = array(); // array used for additional calls to $this->updateRefIndex
var $updateRefIndexStack = array(); // array used for additional calls to $this->updateRefIndex
var $callFromImpExp = false; // tells, that this TCEmain was called from tx_impext - this variable is set by tx_impexp
var $callFromImpExp = FALSE; // tells, that this TCEmain was called from tx_impext - this variable is set by tx_impexp
var $newIndexMap = array(); // Array for new flexform index mapping
var $newIndexMap = array(); // Array for new flexform index mapping
// Various
// Various
/**
* basicFileFunctions object
*
* @var t3lib_basicFileFunctions
*/
var $fileFunc; // For "singleTon" file-manipulation object
var $fileFunc; // For "singleTon" file-manipulation object
var $checkValue_currentRecord=array(); // Set to "currentRecord" during checking of values.
var $checkValue_currentRecord = array(); // Set to "currentRecord" during checking of values.
var $autoVersioningUpdate = FALSE; // A signal flag used to tell file processing that autoversioning has happend and hence certain action should be applied.
var $autoVersioningUpdate = FALSE; // A signal flag used to tell file processing that autoversioning has happend and hence certain action should be applied.
protected $disableDeleteClause = false; // Disable delete clause
protected $disableDeleteClause = FALSE; // Disable delete clause
protected $checkModifyAccessListHookObjects;
/**
* Initializing.
* For details, see 'TYPO3 Core API' document.
......
$this->deleteTree = 1;
}
if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation'] && $this->updateModeL10NdiffData===TRUE) {
if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation'] && $this->updateModeL10NdiffData === TRUE) {
$this->updateModeL10NdiffData = FALSE;
}
// Initializing default permissions for pages
$defaultPermissions = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPermissions'];
if (isset($defaultPermissions['user'])) {$this->defaultPermissions['user'] = $defaultPermissions['user'];}
if (isset($defaultPermissions['group'])) {$this->defaultPermissions['group'] = $defaultPermissions['group'];}
if (isset($defaultPermissions['everybody'])) {$this->defaultPermissions['everybody'] = $defaultPermissions['everybody'];}
if (isset($defaultPermissions['user'])) {
$this->defaultPermissions['user'] = $defaultPermissions['user'];
}
if (isset($defaultPermissions['group'])) {
$this->defaultPermissions['group'] = $defaultPermissions['group'];
}
if (isset($defaultPermissions['everybody'])) {
$this->defaultPermissions['everybody'] = $defaultPermissions['everybody'];
}
// generates the excludelist, based on TCA/exclude-flag and non_exclude_fields for the user:
$this->exclude_array = $this->admin ? array() : $this->getExcludeListArray();
......
reset($data);
$this->datamap = $data;
}
if (is_array($cmd)) {
if (is_array($cmd)) {
reset($cmd);
$this->cmdmap = $cmd;
}
......
* @param array This array has the syntax $mirror[table_name][uid] = [list of uids to copy data-value TO!]
* @return void
*/
function setMirror($mirror) {
function setMirror($mirror) {
if (is_array($mirror)) {
if (is_array($mirror)) {
foreach ($mirror as $table => $uid_array) {
if (isset($this->datamap[$table])) {
if (isset($this->datamap[$table])) {
reset($uid_array);
foreach ($uid_array as $id => $uidList) {
if (isset($this->datamap[$table][$id])) {
if (isset($this->datamap[$table][$id])) {
$theIdsInArray = t3lib_div::trimExplode(',',$uidList,1);
$theIdsInArray = t3lib_div::trimExplode(',', $uidList, 1);
foreach ($theIdsInArray as $copyToUid) {
$this->datamap[$table][$copyToUid] = $this->datamap[$table][$id];
}
......
* @param array User TSconfig array
* @return void
*/
function setDefaultsFromUserTS($userTS) {
function setDefaultsFromUserTS($userTS) {
global $TCA;
if (is_array($userTS)) {
if (is_array($userTS)) {
foreach($userTS as $k => $v) {
foreach ($userTS as $k => $v) {
$k = substr($k,0,-1);
$k = substr($k, 0, -1);
if ($k && is_array($v) && isset($TCA[$k])) {
if ($k && is_array($v) && isset($TCA[$k])) {
if (is_array($this->defaultValues[$k])) {
if (is_array($this->defaultValues[$k])) {
$this->defaultValues[$k] = array_merge($this->defaultValues[$k],$v);
$this->defaultValues[$k] = array_merge($this->defaultValues[$k], $v);
} else {
$this->defaultValues[$k] = $v;
}
......
* @param array $_FILES array
* @return void
*/
function process_uploads($postFiles) {
function process_uploads($postFiles) {
if (is_array($postFiles)) {
if (is_array($postFiles)) {
// Editing frozen:
if ($this->BE_USER->workspace!==0 && $this->BE_USER->workspaceRec['freeze']) {
if ($this->BE_USER->workspace !== 0 && $this->BE_USER->workspaceRec['freeze']) {
$this->newlog('All editing in this workspace has been frozen!',1);
$this->newlog('All editing in this workspace has been frozen!', 1);
return FALSE;
}
reset($postFiles);
$subA = current($postFiles);
if (is_array($subA)) {
if (is_array($subA)) {
if (is_array($subA['name']) && is_array($subA['type']) && is_array($subA['tmp_name']) && is_array($subA['size'])) {
if (is_array($subA['name']) && is_array($subA['type']) && is_array($subA['tmp_name']) && is_array($subA['size'])) {
// Initialize the uploadedFilesArray:
$this->uploadedFileArray=array();
$this->uploadedFileArray = array();
// For each entry:
foreach($subA as $key => $values) {
foreach ($subA as $key => $values) {
$this->process_uploads_traverseArray($this->uploadedFileArray,$values,$key);
$this->process_uploads_traverseArray($this->uploadedFileArray, $values, $key);
}
} else {
$this->uploadedFileArray=$subA;
$this->uploadedFileArray = $subA;
}
}
}
......
* @access private
* @see process_uploads()
*/
function process_uploads_traverseArray(&$outputArr,$inputArr,$keyToSet) {
function process_uploads_traverseArray(&$outputArr, $inputArr, $keyToSet) {
if (is_array($inputArr)) {
if (is_array($inputArr)) {
foreach($inputArr as $key => $value) {
foreach ($inputArr as $key => $value) {
$this->process_uploads_traverseArray($outputArr[$key],$inputArr[$key],$keyToSet);
$this->process_uploads_traverseArray($outputArr[$key], $inputArr[$key], $keyToSet);
}
} else {
$outputArr[$keyToSet]=$inputArr;
$outputArr[$keyToSet] = $inputArr;
}
}
/*********************************************
*
* HOOKS
......
function hook_processDatamap_afterDatabaseOperations(&$hookObjectsArr, &$status, &$table, &$id, &$fieldArray) {
// Process hook directly:
if (!isset($this->remapStackRecords[$table][$id])) {
foreach($hookObjectsArr as $hookObj) {
foreach ($hookObjectsArr as $hookObj) {
if (method_exists($hookObj, 'processDatamap_afterDatabaseOperations')) {
$hookObj->processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $this);
}
}
// If this record is in remapStack (e.g. when using IRRE), values will be updated/remapped later on. So the hook will also be called later:
// If this record is in remapStack (e.g. when using IRRE), values will be updated/remapped later on. So the hook will also be called later:
} else {
$this->remapStackRecords[$table][$id]['processDatamap_afterDatabaseOperations'] = array(
'status' => $status,
......
if (!isset($this->checkModifyAccessListHookObjects)) {
$this->checkModifyAccessListHookObjects = array();
if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'])) {
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'])) {
foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'] as $classData) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'] as $classData) {
$hookObject = t3lib_div::getUserObj($classData);
if(!($hookObject instanceof t3lib_TCEmain_checkModifyAccessListHook)) {
if (!($hookObject instanceof t3lib_TCEmain_checkModifyAccessListHook)) {
throw new UnexpectedValueException('$hookObject must implement interface t3lib_TCEmain_checkModifyAccessListHook', 1251892472);
}
......
}
/*********************************************
*
* PROCESSING DATA
......
$registerDBList = array();
// Editing frozen:
if ($this->BE_USER->workspace!==0 && $this->BE_USER->workspaceRec['freeze']) {
if ($this->BE_USER->workspace !== 0 && $this->BE_USER->workspaceRec['freeze']) {
$this->newlog('All editing in this workspace has been frozen!',1);
$this->newlog('All editing in this workspace has been frozen!', 1);
return FALSE;
}
// First prepare user defined objects (if any) for hooks which extend this function:
$hookObjectsArr = array();
if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'])) {
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'])) {
foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'] as $classRef) {
$hookObjectsArr[] = t3lib_div::getUserObj($classRef);
}
}
// Organize tables so that the pages-table is always processed first. This is required if you want to make sure that content pointing to a new page will be created.
$orderOfTables = Array();
$orderOfTables = array();
if (isset($this->datamap['pages'])) { // Set pages first.
if (isset($this->datamap['pages'])) { // Set pages first.
$orderOfTables[]='pages';
$orderOfTables[] = 'pages';
}
$orderOfTables = array_unique(array_merge($orderOfTables, array_keys($this->datamap)));
// Process the tables...
foreach($orderOfTables as $table) {
foreach ($orderOfTables as $table) {
/* Check if
- table is set in $TCA,
- table is NOT readOnly
- the table is set with content in the data-array (if not, there's nothing to process...)
- permissions for tableaccess OK
*/
/* Check if
- table is set in $TCA,
- table is NOT readOnly
- the table is set with content in the data-array (if not, there's nothing to process...)
- permissions for tableaccess OK
*/
$modifyAccessList = $this->checkModifyAccessList($table);
if (!$modifyAccessList) {
if (!$modifyAccessList) {
$id = 0;
$this->log($table,$id,2,0,1,"Attempt to modify table '%s' without permission",1,array($table));
$this->log($table, $id, 2, 0, 1, "Attempt to modify table '%s' without permission", 1, array($table));
}
if (isset($TCA[$table]) && !$this->tableReadOnly($table) && is_array($this->datamap[$table]) && $modifyAccessList) {
if (isset($TCA[$table]) && !$this->tableReadOnly($table) && is_array($this->datamap[$table]) && $modifyAccessList) {
if ($this->reverseOrder) {
if ($this->reverseOrder) {
$this->datamap[$table] = array_reverse($this->datamap[$table], 1);
}
// For each record from the table, do:
// $id is the record uid, may be a string if new records...
// $incomingFieldArray is the array of fields
foreach($this->datamap[$table] as $id => $incomingFieldArray) {
foreach ($this->datamap[$table] as $id => $incomingFieldArray) {
if (is_array($incomingFieldArray)) {
if (is_array($incomingFieldArray)) {
// Hook: processDatamap_preProcessFieldArray
foreach($hookObjectsArr as $hookObj) {
foreach ($hookObjectsArr as $hookObj) {
if (method_exists($hookObj, 'processDatamap_preProcessFieldArray')) {
$hookObj->processDatamap_preProcessFieldArray($incomingFieldArray, $table, $id, $this);
}
......
$old_pid_value = '';
$this->autoVersioningUpdate = FALSE;
if (!t3lib_div::testInt($id)) { // Is it a new record? (Then Id is a string)
if (!t3lib_div::testInt($id)) { // Is it a new record? (Then Id is a string)
$fieldArray = $this->newFieldArray($table); // Get a fieldArray with default values
$fieldArray = $this->newFieldArray($table); // Get a fieldArray with default values
if (isset($incomingFieldArray['pid'])) { // A pid must be set for new records.
if (isset($incomingFieldArray['pid'])) { // A pid must be set for new records.
// $value = the pid
$pid_value = $incomingFieldArray['pid'];
// Checking and finding numerical pid, it may be a string-reference to another value
$OK = 1;
if (strstr($pid_value,'NEW')) { // If a NEW... id
if (strstr($pid_value, 'NEW')) { // If a NEW... id
if (substr($pid_value,0,1)=='-') {$negFlag=-1;$pid_value=substr($pid_value,1);} else {$negFlag=1;}
if (substr($pid_value, 0, 1) == '-') {
$negFlag = -1;
$pid_value = substr($pid_value, 1);
} else {
$negFlag = 1;
}
if (isset($this->substNEWwithIDs[$pid_value])) { // Trying to find the correct numerical value as it should be mapped by earlier processing of another new record.
if (isset($this->substNEWwithIDs[$pid_value])) { // Trying to find the correct numerical value as it should be mapped by earlier processing of another new record.
if ($negFlag === 1) {
$old_pid_value = $this->substNEWwithIDs[$pid_value];
}
$pid_value=intval($negFlag*$this->substNEWwithIDs[$pid_value]);
$pid_value = intval($negFlag * $this->substNEWwithIDs[$pid_value]);
} else {$OK = 0;} // If not found in the substArray we must stop the process...
} else {
$OK = 0;
} // If not found in the substArray we must stop the process...
} elseif ($pid_value>=0 && $this->BE_USER->workspace!==0 && $TCA[$table]['ctrl']['versioning_followPages']) { // PID points to page, the workspace is an offline space and the table follows page during versioning: This means we must check if the PID page has a version in the workspace with swapmode set to 0 (zero = page+content) and if so, change the pid to the uid of that version.
} elseif ($pid_value >= 0 && $this->BE_USER->workspace !== 0 && $TCA[$table]['ctrl']['versioning_followPages']) { // PID points to page, the workspace is an offline space and the table follows page during versioning: This means we must check if the PID page has a version in the workspace with swapmode set to 0 (zero = page+content) and if so, change the pid to the uid of that version.
if ($WSdestPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($this->BE_USER->workspace, 'pages', $pid_value, 'uid,t3ver_swapmode')) { // Looks for workspace version of page.
if ($WSdestPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($this->BE_USER->workspace, 'pages', $pid_value, 'uid,t3ver_swapmode')) { // Looks for workspace version of page.
if ($WSdestPage['t3ver_swapmode']==0) { // if swapmode is zero, then change pid value.
if ($WSdestPage['t3ver_swapmode'] == 0) { // if swapmode is zero, then change pid value.
$pid_value = $WSdestPage['uid'];
}
}
......
$pid_value = intval($pid_value);
// The $pid_value is now the numerical pid at this point
if ($OK) {
if ($OK) {
$sortRow = $TCA[$table]['ctrl']['sortby'];
if ($pid_value>=0) { // Points to a page on which to insert the element, possibly in the top of the page
if ($pid_value >= 0) { // Points to a page on which to insert the element, possibly in the top of the page
if ($sortRow) { // If this table is sorted we better find the top sorting number
if ($sortRow) { // If this table is sorted we better find the top sorting number
$fieldArray[$sortRow] = $this->getSortNumber($table,0,$pid_value);
$fieldArray[$sortRow] = $this->getSortNumber($table, 0, $pid_value);
}
$fieldArray['pid'] = $pid_value; // The numerical pid is inserted in the data array
$fieldArray['pid'] = $pid_value; // The numerical pid is inserted in the data array
} else { // points to another record before ifself
} else { // points to another record before ifself
if ($sortRow) { // If this table is sorted we better find the top sorting number
if ($sortRow) { // If this table is sorted we better find the top sorting number
$tempArray=$this->getSortNumber($table,0,$pid_value); // Because $pid_value is < 0, getSortNumber returns an array
$tempArray = $this->getSortNumber($table, 0, $pid_value); // Because $pid_value is < 0, getSortNumber returns an array
$fieldArray['pid'] = $tempArray['pid'];
$fieldArray[$sortRow] = $tempArray['sortNumber'];
} else { // Here we fetch the PID of the record that we point to...
} else { // Here we fetch the PID of the record that we point to...
$tempdata = $this->recordInfo($table,abs($pid_value),'pid');
$tempdata = $this->recordInfo($table, abs($pid_value), 'pid');
$fieldArray['pid']=$tempdata['pid'];
$fieldArray['pid'] = $tempdata['pid'];
}
}
}
......
$theRealPid = $fieldArray['pid'];
// Now, check if we may insert records on this pid.
if ($theRealPid>=0) {
if ($theRealPid >= 0) {
$recordAccess = $this->checkRecordInsertAccess($table,$theRealPid); // Checks if records can be inserted on this $pid.
$recordAccess = $this->checkRecordInsertAccess($table, $theRealPid); // Checks if records can be inserted on this $pid.
if ($recordAccess) {
if ($recordAccess) {
$this->addDefaultPermittedLanguageIfNotSet($table,$incomingFieldArray);
$this->addDefaultPermittedLanguageIfNotSet($table, $incomingFieldArray);
$recordAccess = $this->BE_USER->recordEditAccessInternals($table,$incomingFieldArray,TRUE);
$recordAccess = $this->BE_USER->recordEditAccessInternals($table, $incomingFieldArray, TRUE);
if (!$recordAccess) {
if (!$recordAccess) {
$this->newlog("recordEditAccessInternals() check failed. [".$this->BE_USER->errorMsg."]",1);
$this->newlog("recordEditAccessInternals() check failed. [" . $this->BE_USER->errorMsg . "]", 1);
} elseif(!$this->bypassWorkspaceRestrictions) {
} elseif (!$this->bypassWorkspaceRestrictions) {
// Workspace related processing:
if ($res = $this->BE_USER->workspaceAllowLiveRecordsInPID($theRealPid,$table)) { // If LIVE records cannot be created in the current PID due to workspace restrictions, prepare creation of placeholder-record
if ($res = $this->BE_USER->workspaceAllowLiveRecordsInPID($theRealPid, $table)) { // If LIVE records cannot be created in the current PID due to workspace restrictions, prepare creation of placeholder-record
if ($res<0) {
if ($res < 0) {
$recordAccess = FALSE;
$this->newlog('Stage for versioning root point and users access level did not allow for editing',1);
$this->newlog('Stage for versioning root point and users access level did not allow for editing', 1);
}
} else { // So, if no live records were allowed, we have to create a new version of this record:
} else { // So, if no live records were allowed, we have to create a new version of this record:
if ($TCA[$table]['ctrl']['versioningWS']) {
if ($TCA[$table]['ctrl']['versioningWS']) {
$createNewVersion = TRUE;
} else {
$recordAccess = FALSE;
$this->newlog('Record could not be created in this workspace in this branch',1);
$this->newlog('Record could not be created in this workspace in this branch', 1);
}
}
}
......
} else {
debug('Internal ERROR: pid should not be less than zero!');
}
$status = 'new'; // Yes new record, change $record_status to 'insert'
$status = 'new'; // Yes new record, change $record_status to 'insert'
} else { // Nope... $id is a number
} else { // Nope... $id is a number
$fieldArray = array();
$recordAccess = $this->checkRecordUpdateAccess($table, $id, $incomingFieldArray, $hookObjectsArr);
if (!$recordAccess) {
if (!$recordAccess) {
$propArr = $this->getRecordProperties($table,$id);
$propArr = $this->getRecordProperties($table, $id);
$this->log($table,$id,2,0,1,"Attempt to modify record '%s' (%s) without permission. Or non-existing page.",2,array($propArr['header'],$table.':'.$id),$propArr['event_pid']);
$this->log($table, $id, 2, 0, 1, "Attempt to modify record '%s' (%s) without permission. Or non-existing page.", 2, array($propArr['header'], $table . ':' . $id), $propArr['event_pid']);
} else { // Next check of the record permissions (internals)
} else { // Next check of the record permissions (internals)
$recordAccess = $this->BE_USER->recordEditAccessInternals($table,$id);
$recordAccess = $this->BE_USER->recordEditAccessInternals($table, $id);
if (!$recordAccess) {
if (!$recordAccess) {
$propArr = $this->getRecordProperties($table,$id);
$propArr = $this->getRecordProperties($table, $id);
$this->newlog("recordEditAccessInternals() check failed. [".$this->BE_USER->errorMsg."]",1);
$this->newlog("recordEditAccessInternals() check failed. [" . $this->BE_USER->errorMsg . "]", 1);
} else { // Here we fetch the PID of the record that we point to...
} else { // Here we fetch the PID of the record that we point to...
$tempdata = $this->recordInfo($table,$id,'pid'.($TCA[$table]['ctrl']['versioningWS']?',t3ver_wsid,t3ver_stage':''));
$tempdata = $this->recordInfo($table, $id, 'pid' . ($TCA[$table]['ctrl']['versioningWS'] ? ',t3ver_wsid,t3ver_stage' : ''));
$theRealPid = $tempdata['pid'];
// Use the new id of the versionized record we're trying to write to:
// Use the new id of the versionized record we're trying to write to:
// (This record is a child record of a parent and has already been versionized.)
if ($this->autoVersionIdMap[$table][$id]) {
// For the reason that creating a new version of this record, automatically
......
$recordAccess = TRUE;
$this->autoVersioningUpdate = TRUE;
// Checking access in case of offline workspace:
// Checking access in case of offline workspace:
} elseif (!$this->bypassWorkspaceRestrictions && $errorCode = $this->BE_USER->workspaceCannotEditRecord($table,$tempdata)) {
} elseif (!$this->bypassWorkspaceRestrictions && $errorCode = $this->BE_USER->workspaceCannotEditRecord($table, $tempdata)) {
$recordAccess = FALSE; // Versioning is required and it must be offline version!
$recordAccess = FALSE; // Versioning is required and it must be offline version!
// Auto-creation of version: In offline workspace, test if versioning is enabled and look for workspace version of input record. If there is no versionized record found we will create one and save to that.
if ($this->BE_USER->workspaceAllowAutoCreation($table,$id,$theRealPid)) {
if ($this->BE_USER->workspaceAllowAutoCreation($table, $id, $theRealPid)) {
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
/* @var $tce t3lib_TCEmain */
$tce->stripslashes_values = 0;
......
$cmd = array();
$cmd[$table][$id]['version'] = array(
'action' => 'new',
'treeLevels' => -1, // Default is to create a version of the individual records... element versioning that is.
'treeLevels' => -1, // Default is to create a version of the individual records... element versioning that is.
'label' => 'Auto-created for WS #'.$this->BE_USER->workspace
'label' => 'Auto-created for WS #' . $this->BE_USER->workspace
);
$tce->start(array(),$cmd);
$tce->start(array(), $cmd);
$tce->process_cmdmap();
$this->errorLog = array_merge($this->errorLog,$tce->errorLog);
$this->errorLog = array_merge($this->errorLog, $tce->errorLog);
// If copying was successful, share the new uids (also of related children):
if ($tce->copyMappingArray[$table][$id]) {
if ($tce->copyMappingArray[$table][$id]) {
foreach ($tce->copyMappingArray as $origTable => $origIdArray) {
foreach ($origIdArray as $origId => $newId) {
$this->uploadedFileArray[$origTable][$newId] = $this->uploadedFileArray[$origTable][$origId];
$this->autoVersionIdMap[$origTable][$origId] = $newId;
}
}
$this->RTEmagic_copyIndex = t3lib_div::array_merge_recursive_overrule($this->RTEmagic_copyIndex, $tce->RTEmagic_copyIndex); // See where RTEmagic_copyIndex is used inside fillInFieldArray() for more information...
$this->RTEmagic_copyIndex = t3lib_div::array_merge_recursive_overrule($this->RTEmagic_copyIndex, $tce->RTEmagic_copyIndex); // See where RTEmagic_copyIndex is used inside fillInFieldArray() for more information...
// Update registerDBList, that holds the copied relations to child records:
$registerDBList = array_merge($registerDBList, $tce->registerDBList);
......
$id = $this->autoVersionIdMap[$table][$id];
$recordAccess = TRUE;
$this->autoVersioningUpdate = TRUE;
} else $this->newlog("Could not be edited in offline workspace in the branch where found (failure state: '".$errorCode."'). Auto-creation of version failed!",1);
} else $this->newlog("Could not be edited in offline workspace in the branch where found (failure state: '".$errorCode."'). Auto-creation of version not allowed in workspace!",1);
} else {
$this->newlog("Could not be edited in offline workspace in the branch where found (failure state: '" . $errorCode . "'). Auto-creation of version failed!", 1);
}
}
} else {
$this->newlog("Could not be edited in offline workspace in the branch where found (failure state: '" . $errorCode . "'). Auto-creation of version not allowed in workspace!", 1);
}
}
}
}
}
}
$status = 'update'; // the default is 'update'
$status = 'update'; // the default is 'update'
}
// If access was granted above, proceed to create or update record:
if ($recordAccess) {
if ($recordAccess) {
list($tscPID) = t3lib_BEfunc::getTSCpid($table,$id,$old_pid_value ? $old_pid_value : $fieldArray['pid']); // Here the "pid" is set IF NOT the old pid was a string pointing to a place in the subst-id array.
list($tscPID) = t3lib_BEfunc::getTSCpid($table, $id, $old_pid_value ? $old_pid_value : $fieldArray['pid']); // Here the "pid" is set IF NOT the old pid was a string pointing to a place in the subst-id array.
$TSConfig = $this->getTCEMAIN_TSconfig($tscPID);
if ($status=='new' && $table=='pages' && is_array($TSConfig['permissions.'])) {
if ($status == 'new' && $table == 'pages' && is_array($TSConfig['permissions.'])) {
$fieldArray = $this->setTSconfigPermissions($fieldArray,$TSConfig['permissions.']);
$fieldArray = $this->setTSconfigPermissions($fieldArray, $TSConfig['permissions.']);
}
if ($createNewVersion) {
if ($createNewVersion) {
$newVersion_placeholderFieldArray = $fieldArray;
}
// Processing of all fields in incomingFieldArray and setting them in $fieldArray
$fieldArray = $this->fillInFieldArray($table,$id,$fieldArray,$incomingFieldArray,$theRealPid,$status,$tscPID);
$fieldArray = $this->fillInFieldArray($table, $id, $fieldArray, $incomingFieldArray, $theRealPid, $status, $tscPID);
// NOTICE! All manipulation beyond this point bypasses both "excludeFields" AND possible "MM" relations / file uploads to field!
// Forcing some values unto field array:
$fieldArray = $this->overrideFieldArray($table,$fieldArray); // NOTICE: This overriding is potentially dangerous; permissions per field is not checked!!!
$fieldArray = $this->overrideFieldArray($table, $fieldArray); // NOTICE: This overriding is potentially dangerous; permissions per field is not checked!!!
if ($createNewVersion) {
if ($createNewVersion) {
$newVersion_placeholderFieldArray = $this->overrideFieldArray($table,$newVersion_placeholderFieldArray);
$newVersion_placeholderFieldArray = $this->overrideFieldArray($table, $newVersion_placeholderFieldArray);
}
// Setting system fields
if ($status=='new') {
if ($status == 'new') {
if ($TCA[$table]['ctrl']['crdate']) {
if ($TCA[$table]['ctrl']['crdate']) {
$fieldArray[$TCA[$table]['ctrl']['crdate']] = $GLOBALS['EXEC_TIME'];
if ($createNewVersion) {
$newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['crdate']] = $GLOBALS['EXEC_TIME'];
}
}
if ($TCA[$table]['ctrl']['cruser_id']) {
if ($TCA[$table]['ctrl']['cruser_id']) {
$fieldArray[$TCA[$table]['ctrl']['cruser_id']]=$this->userid;
$fieldArray[$TCA[$table]['ctrl']['cruser_id']] = $this->userid;
if ($createNewVersion) $newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['cruser_id']]=$this->userid;
if ($createNewVersion) {
$newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['cruser_id']] = $this->userid;
}
}
}
} elseif ($this->checkSimilar) { // Removing fields which are equal to the current value:
} elseif ($this->checkSimilar) { // Removing fields which are equal to the current value:
$fieldArray = $this->compareFieldArrayWithCurrentAndUnset($table,$id,$fieldArray);
$fieldArray = $this->compareFieldArrayWithCurrentAndUnset($table, $id, $fieldArray);
}
if ($TCA[$table]['ctrl']['tstamp'] && count($fieldArray)) {
if ($TCA[$table]['ctrl']['tstamp'] && count($fieldArray)) {
$fieldArray[$TCA[$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
if ($createNewVersion) {
$newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
......
}
// Hook: processDatamap_postProcessFieldArray
foreach($hookObjectsArr as $hookObj) {
foreach ($hookObjectsArr as $hookObj) {
if (method_exists($hookObj, 'processDatamap_postProcessFieldArray')) {
$hookObj->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $this);
}
......
// Performing insert/update. If fieldArray has been unset by some userfunction (see hook above), don't do anything
// Kasper: Unsetting the fieldArray is dangerous; MM relations might be saved already and files could have been uploaded that are now "lost"
if (is_array($fieldArray)) {
if ($status=='new') {
if ($status == 'new') {
if ($createNewVersion) { // This creates a new version of the record with online placeholder and offline version
if ($createNewVersion) { // This creates a new version of the record with online placeholder and offline version
$versioningType = $table==='pages' ? $this->BE_USER->workspaceVersioningTypeGetClosest(t3lib_div::intInRange($TYPO3_CONF_VARS['BE']['newPagesVersioningType'],-1,1)) : -1;
$versioningType = $table === 'pages' ? $this->BE_USER->workspaceVersioningTypeGetClosest(t3lib_div::intInRange($TYPO3_CONF_VARS['BE']['newPagesVersioningType'], -1, 1)) : -1;
if ($this->BE_USER->workspaceVersioningTypeAccess($versioningType)) {
if ($this->BE_USER->workspaceVersioningTypeAccess($versioningType)) {
$newVersion_placeholderFieldArray['t3ver_label'] = 'INITIAL PLACEHOLDER';
$newVersion_placeholderFieldArray['t3ver_state'] = 1; // Setting placeholder state value for temporary record
$newVersion_placeholderFieldArray['t3ver_state'] = 1; // Setting placeholder state value for temporary record
$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['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']] = '[PLACEHOLDER, WS#'.$this->BE_USER->workspace.']';
$newVersion_placeholderFieldArray[$TCA[$table]['ctrl']['label']] = '[PLACEHOLDER, WS#' . $this->BE_USER->workspace . ']';
$this->insertDB($table,$id,$newVersion_placeholderFieldArray,FALSE); // Saving placeholder as 'original'
$this->insertDB($table, $id, $newVersion_placeholderFieldArray, FALSE); // Saving placeholder as 'original'
// For the actual new offline version, set versioning values to point to placeholder:
$fieldArray['pid'] = -1;
$fieldArray['t3ver_oid'] = $this->substNEWwithIDs[$id];
$fieldArray['t3ver_id'] = 1;
$fieldArray['t3ver_state'] = -1; // Setting placeholder state value for version (so it can know it is currently a new version...)
$fieldArray['t3ver_state'] = -1; // Setting placeholder state value for version (so it can know it is currently a new version...)
$fieldArray['t3ver_label'] = 'First draft version';
$fieldArray['t3ver_wsid'] = $this->BE_USER->workspace;
if ($table==='pages') { // Swap mode set to "branch" so we can build branches for pages.
if ($table === 'pages') { // Swap mode set to "branch" so we can build branches for pages.
$fieldArray['t3ver_swapmode'] = $versioningType;
}
$phShadowId = $this->insertDB($table,$id,$fieldArray,TRUE,0,TRUE); // When inserted, $this->substNEWwithIDs[$id] will be changed to the uid of THIS version and so the interface will pick it up just nice!
$phShadowId = $this->insertDB($table, $id, $fieldArray, TRUE, 0, TRUE); // When inserted, $this->substNEWwithIDs[$id] will be changed to the uid of THIS version and so the interface will pick it up just nice!
if ($phShadowId) {
if ($phShadowId) {
// Processes fields of the placeholder record:
$this->triggerRemapAction(
$table,
......
// Hold auto-versionized ids of placeholders:
$this->autoVersionIdMap[$table][$this->substNEWwithIDs[$id]] = $phShadowId;
}
} else $this->newlog('Versioning type "'.$versioningType.'" was not allowed, so could not create new record.',1);
} else {
} else {
$this->newlog('Versioning type "' . $versioningType . '" was not allowed, so could not create new record.', 1);
}
} else {
$this->insertDB($table,$id,$fieldArray,FALSE,$incomingFieldArray['uid']);
$this->insertDB($table, $id, $fieldArray, FALSE, $incomingFieldArray['uid']);
}
} else {
$this->updateDB($table,$id,$fieldArray);
$this->updateDB($table, $id, $fieldArray);
$this->placeholderShadowing($table,$id);
$this->placeholderShadowing($table, $id);
}
}
/*
* Hook: processDatamap_afterDatabaseOperations
*
* Note: When using the hook after INSERT operations, you will only get the temporary NEW... id passed to your hook as $id,
* but you can easily translate it to the real uid of the inserted record using the $this->substNEWwithIDs array.
*/
/*
* Hook: processDatamap_afterDatabaseOperations
*
* Note: When using the hook after INSERT operations, you will only get the temporary NEW... id passed to your hook as $id,
* but you can easily translate it to the real uid of the inserted record using the $this->substNEWwithIDs array.
*/
$this->hook_processDatamap_afterDatabaseOperations($hookObjectsArr, $status, $table, $id, $fieldArray);
} // if ($recordAccess) {
} // if ($recordAccess) {
} // if (is_array($incomingFieldArray)) {
} // if (is_array($incomingFieldArray)) {
}
}
}
......
*
* Note: When this hook gets called, all operations on the submitted data have been finished.
*/
foreach($hookObjectsArr as $hookObj) {
foreach ($hookObjectsArr as $hookObj) {
if (method_exists($hookObj, 'processDatamap_afterAllOperations')) {
$hookObj->processDatamap_afterAllOperations($this);
}
......
* @param integer Record uid
* @return void
*/
function placeholderShadowing($table,$id) {
function placeholderShadowing($table, $id) {
global $TCA;
t3lib_div::loadTCA($table);
if ($liveRec = t3lib_BEfunc::getLiveVersionOfRecord($table,$id,'*')) {
if ($liveRec = t3lib_BEfunc::getLiveVersionOfRecord($table, $id, '*')) {
if ((int)$liveRec['t3ver_state']>0) {
if ((int) $liveRec['t3ver_state'] > 0) {
$justStoredRecord = t3lib_BEfunc::getRecord($table,$id);
$justStoredRecord = t3lib_BEfunc::getRecord($table, $id);
$newRecord = array();
$shadowCols = $TCA[$table]['ctrl']['shadowColumnsForNewPlaceholders'];
$shadowCols.= ','.$TCA[$table]['ctrl']['languageField'];
$shadowCols .= ',' . $TCA[$table]['ctrl']['languageField'];
$shadowCols.= ','.$TCA[$table]['ctrl']['transOrigPointerField'];
$shadowCols .= ',' . $TCA[$table]['ctrl']['transOrigPointerField'];
$shadowCols.= ','.$TCA[$table]['ctrl']['type'];
$shadowCols .= ',' . $TCA[$table]['ctrl']['type'];
$shadowCols.= ','.$TCA[$table]['ctrl']['label'];
$shadowCols .= ',' . $TCA[$table]['ctrl']['label'];
$shadowColumns = array_unique(t3lib_div::trimExplode(',', $shadowCols,1));
$shadowColumns = array_unique(t3lib_div::trimExplode(',', $shadowCols, 1));
foreach($shadowColumns as $fieldName) {
foreach ($shadowColumns as $fieldName) {
if (strcmp($justStoredRecord[$fieldName],$liveRec[$fieldName]) && isset($TCA[$table]['columns'][$fieldName]) && $fieldName!=='uid' && $fieldName!=='pid') {
if (strcmp($justStoredRecord[$fieldName], $liveRec[$fieldName]) && isset($TCA[$table]['columns'][$fieldName]) && $fieldName !== 'uid' && $fieldName !== 'pid') {
$newRecord[$fieldName] = $justStoredRecord[$fieldName];
}
}
if (count($newRecord)) {
if (count($newRecord)) {
$this->newlog2('Shadowing done on fields <i>'.implode(',',array_keys($newRecord)).'</i> in placeholder record '.$table.':'.$liveRec['uid'].' (offline version UID='.$id.')', $table, $liveRec['uid'], $liveRec['pid']);
$this->newlog2('Shadowing done on fields <i>' . implode(',', array_keys($newRecord)) . '</i> in placeholder record ' . $table . ':' . $liveRec['uid'] . ' (offline version UID=' . $id . ')', $table, $liveRec['uid'], $liveRec['pid']);
$this->updateDB($table,$liveRec['uid'],$newRecord);
$this->updateDB($table, $liveRec['uid'], $newRecord);
}
}
}
......
* @param integer $tscPID: TSconfig PID
* @return array Field Array
*/
function fillInFieldArray($table,$id,$fieldArray,$incomingFieldArray,$realPid,$status,$tscPID) {
function fillInFieldArray($table, $id, $fieldArray, $incomingFieldArray, $realPid, $status, $tscPID) {
global $TCA;
// Initialize:
......
$diffStorageFlag = FALSE;
// Setting 'currentRecord' and 'checkValueRecord':
if (strstr($id,'NEW')) {
if (strstr($id, 'NEW')) {
$currentRecord = $checkValueRecord = $fieldArray; // must have the 'current' array - not the values after processing below...
$currentRecord = $checkValueRecord = $fieldArray; // must have the 'current' array - not the values after processing below...
// IF $incomingFieldArray is an array, overlay it.
// The point is that when new records are created as copies with flex type fields there might be a field containing information about which DataStructure to use and without that information the flexforms cannot be correctly processed.... This should be OK since the $checkValueRecord is used by the flexform evaluation only anyways...
if (is_array($incomingFieldArray) && is_array($checkValueRecord)) {
if (is_array($incomingFieldArray) && is_array($checkValueRecord)) {
$checkValueRecord = t3lib_div::array_merge_recursive_overrule($checkValueRecord, $incomingFieldArray);
}
} else {
$currentRecord = $checkValueRecord = $this->recordInfo($table,$id,'*'); // We must use the current values as basis for this!
$currentRecord = $checkValueRecord = $this->recordInfo($table, $id, '*'); // We must use the current values as basis for this!
t3lib_BEfunc::fixVersioningPid($table,$currentRecord); // This is done to make the pid positive for offline versions; Necessary to have diff-view for pages_language_overlay in workspaces.
t3lib_BEfunc::fixVersioningPid($table, $currentRecord); // This is done to make the pid positive for offline versions; Necessary to have diff-view for pages_language_overlay in workspaces.
// Get original language record if available:
if (is_array($currentRecord)
&& $TCA[$table]['ctrl']['transOrigDiffSourceField']
&& $TCA[$table]['ctrl']['languageField']
&& $currentRecord[$TCA[$table]['ctrl']['languageField']] > 0
&& $TCA[$table]['ctrl']['transOrigPointerField']
&& $TCA[$table]['ctrl']['transOrigDiffSourceField']
&& $TCA[$table]['ctrl']['languageField']
&& $currentRecord[$TCA[$table]['ctrl']['languageField']] > 0
&& $TCA[$table]['ctrl']['transOrigPointerField']
&& intval($currentRecord[$TCA[$table]['ctrl']['transOrigPointerField']]) > 0) {
&& intval($currentRecord[$TCA[$table]['ctrl']['transOrigPointerField']]) > 0) {
$lookUpTable = $TCA[$table]['ctrl']['transOrigPointerTable'] ? $TCA[$table]['ctrl']['transOrigPointerTable'] : $table;
$originalLanguageRecord = $this->recordInfo($lookUpTable,$currentRecord[$TCA[$table]['ctrl']['transOrigPointerField']],'*');
$originalLanguageRecord = $this->recordInfo($lookUpTable, $currentRecord[$TCA[$table]['ctrl']['transOrigPointerField']], '*');
t3lib_BEfunc::workspaceOL($lookUpTable,$originalLanguageRecord);
t3lib_BEfunc::workspaceOL($lookUpTable, $originalLanguageRecord);
$originalLanguage_diffStorage = unserialize($currentRecord[$TCA[$table]['ctrl']['transOrigDiffSourceField']]);
}
}
$this->checkValue_currentRecord = $checkValueRecord;
/*
In the following all incoming value-fields are tested:
- Are the user allowed to change the field?
- Is the field uid/pid (which are already set)
- perms-fields for pages-table, then do special things...
- If the field is nothing of the above and the field is configured in TCA, the fieldvalues are evaluated by ->checkValue
/*
In the following all incoming value-fields are tested:
- Are the user allowed to change the field?
- Is the field uid/pid (which are already set)
- perms-fields for pages-table, then do special things...
- If the field is nothing of the above and the field is configured in TCA, the fieldvalues are evaluated by ->checkValue
If everything is OK, the field is entered into $fieldArray[]
*/
If everything is OK, the field is entered into $fieldArray[]
*/
foreach($incomingFieldArray as $field => $fieldValue) {
foreach ($incomingFieldArray as $field => $fieldValue) {
if (!in_array($table.'-'.$field, $this->exclude_array) && !$this->data_disableFields[$table][$id][$field]) { // The field must be editable.
if (!in_array($table . '-' . $field, $this->exclude_array) && !$this->data_disableFields[$table][$id][$field]) { // The field must be editable.
// Checking if a value for language can be changed:
$languageDeny = $TCA[$table]['ctrl']['languageField'] && !strcmp($TCA[$table]['ctrl']['languageField'], $field) && !$this->BE_USER->checkLanguageAccess($fieldValue);
if (!$languageDeny) {
if (!$languageDeny) {
// Stripping slashes - will probably be removed the day $this->stripslashes_values is removed as an option...
if ($this->stripslashes_values) {
if ($this->stripslashes_values) {
if (is_array($fieldValue)) {
if (is_array($fieldValue)) {
t3lib_div::stripSlashesOnArray($fieldValue);
} else $fieldValue = stripslashes($fieldValue);
} else {
$fieldValue = stripslashes($fieldValue);
}
}
}
switch ($field) {
switch ($field) {
case 'uid':
case 'pid':
// Nothing happens, already set
......
case 'perms_group':
case 'perms_everybody':
// Permissions can be edited by the owner or the administrator
if ($table=='pages' && ($this->admin || $status=='new' || $this->pageInfo($id,'perms_userid')==$this->userid) ) {
if ($table == 'pages' && ($this->admin || $status == 'new' || $this->pageInfo($id, 'perms_userid') == $this->userid)) {
$value=intval($fieldValue);
$value = intval($fieldValue);
switch($field) {
switch ($field) {
case 'perms_userid':
$fieldArray[$field]=$value;
$fieldArray[$field] = $value;
break;
case 'perms_groupid':
$fieldArray[$field]=$value;
$fieldArray[$field] = $value;
break;
default:
if ($value>=0 && $value<pow(2,5)) {
if ($value >= 0 && $value < pow(2, 5)) {
$fieldArray[$field]=$value;
$fieldArray[$field] = $value;
}
break;
}
......
// t3ver_label is not here because it CAN be edited as a regular field!
break;
default:
if (isset($TCA[$table]['columns'][$field])) {
if (isset($TCA[$table]['columns'][$field])) {
// Evaluating the value
$res = $this->checkValue($table,$field,$fieldValue,$id,$status,$realPid,$tscPID);
$res = $this->checkValue($table, $field, $fieldValue, $id, $status, $realPid, $tscPID);
if (isset($res['value'])) {
if (isset($res['value'])) {
$fieldArray[$field] = $res['value'];
}
// Add the value of the original record to the diff-storage content:
if ($this->updateModeL10NdiffData && $TCA[$table]['ctrl']['transOrigDiffSourceField']) {
if ($this->updateModeL10NdiffData && $TCA[$table]['ctrl']['transOrigDiffSourceField']) {
$originalLanguage_diffStorage[$field] = $this->updateModeL10NdiffDataClear ? '' : $originalLanguageRecord[$field];
$diffStorageFlag = TRUE;
}
......
// When a copy or version is made of a record, a search is made for any RTEmagic* images in fields having the "images" soft reference parser applied. That should be true for RTE fields. If any are found they are duplicated to new names and the file reference in the bodytext is updated accordingly.
// However, with auto-versioning the submitted content of the field will just overwrite the corrected values. This leaves a) lost RTEmagic files and b) creates a double reference to the old files.
// The only solution I can come up with is detecting when auto versioning happens, then see if any RTEmagic images was copied and if so make a stupid string-replace of the content !
if ($this->autoVersioningUpdate===TRUE) {
if ($this->autoVersioningUpdate === TRUE) {
if (is_array($this->RTEmagic_copyIndex[$table][$id][$field])) {
if (is_array($this->RTEmagic_copyIndex[$table][$id][$field])) {
foreach($this->RTEmagic_copyIndex[$table][$id][$field] as $oldRTEmagicName => $newRTEmagicName) {
foreach ($this->RTEmagic_copyIndex[$table][$id][$field] as $oldRTEmagicName => $newRTEmagicName) {
$fieldArray[$field] = str_replace(' src="'.$oldRTEmagicName.'"',' src="'.$newRTEmagicName.'"',$fieldArray[$field]);
$fieldArray[$field] = str_replace(' src="' . $oldRTEmagicName . '"', ' src="' . $newRTEmagicName . '"', $fieldArray[$field]);
}
}
}
} elseif ($TCA[$table]['ctrl']['origUid']===$field) { // Allow value for original UID to pass by...
} elseif ($TCA[$table]['ctrl']['origUid'] === $field) { // Allow value for original UID to pass by...
$fieldArray[$field] = $fieldValue;
}
break;
}
} // Checking language.
} // Checking language.
} // Check exclude fields / disabled fields...
} // Check exclude fields / disabled fields...
}
// Add diff-storage information:
if ($diffStorageFlag && !isset($fieldArray[$TCA[$table]['ctrl']['transOrigDiffSourceField']])) { // If the field is set it would probably be because of an undo-operation - in which case we should not update the field of course...
if ($diffStorageFlag && !isset($fieldArray[$TCA[$table]['ctrl']['transOrigDiffSourceField']])) { // If the field is set it would probably be because of an undo-operation - in which case we should not update the field of course...
$fieldArray[$TCA[$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage);
$fieldArray[$TCA[$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage);
}
// Checking for RTE-transformations of fields:
$types_fieldConfig = t3lib_BEfunc::getTCAtypes($table,$currentRecord);
$types_fieldConfig = t3lib_BEfunc::getTCAtypes($table, $currentRecord);
$theTypeString = t3lib_BEfunc::getTCAtypeValue($table,$currentRecord);
... This diff was truncated because it exceeds the maximum size that can be displayed.
(63-63/93)