Project

General

Profile

Bug #17340 » 0005704_v4_trunk.patch

Administrator Admin, 2007-07-06 08:21

View differences:

t3lib/class.t3lib_tceforms_inline.php (Arbeitskopie)
$inlineView = unserialize($GLOBALS['BE_USER']->uc['inlineView']);
$this->inlineView = $inlineView[$table][$row['uid']];
}
// if pid is negative, fetch the previous record and take its pid
if ($row['pid'] < 0) {
// If the parent is a page, use the uid(!) of the (new?) page as pid for the child records:
if ($table == 'pages') {
$this->inlineFirstPid = $row['uid'];
// If pid is negative, fetch the previous record and take its pid:
} elseif ($row['pid'] < 0) {
$prevRec = t3lib_BEfunc::getRecord($table, abs($row['pid']));
$this->inlineFirstPid = $prevRec['pid'];
// take the pid as it is
// Take the pid as it is:
} else {
$this->inlineFirstPid = $row['pid'];
}
......
// If the command is to create a NEW record...:
if ($cmd=='new') {
$calcPRec = t3lib_BEfunc::getRecord('pages',$this->inlineFirstPid);
if(!is_array($calcPRec)) {
return false;
}
$CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec); // Permissions for the parent page
if ($table=='pages') { // If pages:
$hasAccess = $CALC_PERMS&8 ? 1 : 0; // Are we allowed to create new subpages?
// If the pid is numerical, check if it's possible to write to this page:
if (t3lib_div::testInt($this->inlineFirstPid)) {
$calcPRec = t3lib_BEfunc::getRecord('pages', $this->inlineFirstPid);
if(!is_array($calcPRec)) {
return false;
}
$CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec); // Permissions for the parent page
if ($table=='pages') { // If pages:
$hasAccess = $CALC_PERMS&8 ? 1 : 0; // Are we allowed to create new subpages?
} else {
$hasAccess = $CALC_PERMS&16 ? 1 : 0; // Are we allowed to edit content on this page?
}
// If the pid is a NEW... value, the access will be checked on creating the page:
// (if the page with the same NEW... value could be created in TCEmain, this child record can neither)
} else {
$hasAccess = $CALC_PERMS&16 ? 1 : 0; // Are we allowed to edit content on this page?
$hasAccess = 1;
}
} else { // Edit:
$calcPRec = t3lib_BEfunc::getRecord($table,$theUid);
t3lib/class.t3lib_tcemain.php (Arbeitskopie)
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 $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 $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 $remapStackRecords = array(); // array used for remapping uids and values at the end of process_datamap (e.g. $remapStackRecords[<table>][<uid>] = <index in $remapStack>)
......
} else {
$newId = $this->copyRecord_raw($v['table'], $v['id'], $realDestPid);
}
// If the current field is set on a page record, update the pid of related child records:
if ($table == 'pages') {
$this->registerDBPids[$v['table']][$v['id']] = $uid;
// If the current field has ancestors that have a field on a page record, update the pid of related child records:
} elseif (isset($this->registerDBPids[$table][$uid])) {
$this->registerDBPids[$v['table']][$v['id']] = $this->registerDBPids[$table][$uid];
}
$dbAnalysis->itemArray[$k]['id'] = $newId;
}
......
* @param string $value: Field value
* @param integer $uid: The uid of the ORIGINAL record
* @param string $table: Table name
* @return string The value to be updated on the table field in the database
* @return void
*/
function remapListedDBRecords_procInline($conf, $value, $uid, $table) {
$theUidToUpdate = $this->copyMappingArray_merged[$table][$uid];
......
if ($conf['foreign_table']) {
$inlineType = $this->getInlineFieldType($conf);
if ($inlineType == 'field') {
if ($inlineType == 'mm') {
$this->remapListedDBRecords_procDBRefs($conf, $value, $theUidToUpdate, $table);
} elseif ($inlineType !== false) {
$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
$dbAnalysis->start($value, $conf['foreign_table'], $conf['MM'], 0, $table, $conf);
$dbAnalysis->start($value, $conf['foreign_table'], '', 0, $table, $conf);
$dbAnalysis->writeForeignField($conf, $uid, $theUidToUpdate);
} elseif ($inlineType == 'mm') {
$vArray = $this->remapListedDBRecords_procDBRefs($conf, $value, $theUidToUpdate, $table);
}
// If the current field is set on a page record, update the pid of related child records:
if ($table == 'pages') {
$thePidToUpdate = $theUidToUpdate;
// If the current field has ancestors that have a field on a page record, update the pid of related child records:
} elseif (isset($this->registerDBPids[$table][$uid])) {
$thePidToUpdate = $this->registerDBPids[$table][$uid];
$thePidToUpdate = $this->copyMappingArray_merged['pages'][$thePidToUpdate];
}
// Update child records if using pointer fields ('foreign_field'):
if ($inlineType == 'field') {
$dbAnalysis->writeForeignField($conf, $uid, $theUidToUpdate);
}
// Update child records if change to pid is required:
if ($thePidToUpdate) {
$updateValues = array('pid' => $thePidToUpdate);
foreach ($dbAnalysis->itemArray as $v) {
if ($v['id'] && $v['table']) {
$GLOBALS['TYPO3_DB']->exec_UPDATEquery($v['table'], 'uid='.intval($v['id']), $updateValues);
}
}
}
}
}
}
(3-3/3)