/**
  * Entry method
  *
  * @return array As defined in initializeResultArray() of AbstractNode
  */
 public function render()
 {
     $table = $this->globalOptions['table'];
     $row = $this->globalOptions['databaseRow'];
     $list = $this->globalOptions['fieldListToRender'];
     if (!$GLOBALS['TCA'][$table]) {
         return $this->initializeResultArray();
     }
     $languageService = $this->getLanguageService();
     // Load the description content for the table if requested
     if ($GLOBALS['TCA'][$table]['interface']['always_description']) {
         $languageService->loadSingleTableDescription($table);
     }
     // If this is a localized record, stuff data from original record to local registry, will then be given to child elements
     $this->registerDefaultLanguageData($table, $row);
     $list = array_unique(GeneralUtility::trimExplode(',', $list, TRUE));
     $typesFieldConfig = BackendUtility::getTCAtypes($table, $row, 1);
     $finalFieldsConfiguration = array();
     foreach ($list as $singleField) {
         if (!is_array($GLOBALS['TCA'][$table]['columns'][$singleField])) {
             continue;
         }
         if (isset($typesFieldConfig[$singleField]['origString'])) {
             $fieldConfiguration = $this->explodeSingleFieldShowItemConfiguration($typesFieldConfig[$singleField]['origString']);
             // Fields of sub palettes should not be rendered
             $fieldConfiguration['paletteName'] = '';
         } else {
             $fieldConfiguration = array('fieldName' => $singleField);
         }
         $finalFieldsConfiguration[] = implode(';', $fieldConfiguration);
     }
     $options = $this->globalOptions;
     $options['fieldsArray'] = $finalFieldsConfiguration;
     $options['renderType'] = 'paletteAndSingleContainer';
     $options['recordTypeValue'] = $this->getRecordTypeValue($table, $row);
     /** @var NodeFactory $nodeFactory */
     $nodeFactory = $this->globalOptions['nodeFactory'];
     return $nodeFactory->create($options)->render();
 }
Beispiel #2
0
 /**
  * Filling in the field array
  * $this->excludedTablesAndFields is used to filter fields if needed.
  *
  * @param string $table Table name
  * @param int $id Record ID
  * @param array $fieldArray Default values, Preset $fieldArray with 'pid' maybe (pid and uid will be not be overridden anyway)
  * @param array $incomingFieldArray Is which fields/values you want to set. There are processed and put into $fieldArray if OK
  * @param int $realPid The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
  * @param string $status Is 'new' or 'update'
  * @param int $tscPID TSconfig PID
  * @return array Field Array
  */
 public function fillInFieldArray($table, $id, $fieldArray, $incomingFieldArray, $realPid, $status, $tscPID)
 {
     // Initialize:
     $originalLanguageRecord = null;
     $originalLanguage_diffStorage = null;
     $diffStorageFlag = false;
     // Setting 'currentRecord' and 'checkValueRecord':
     if (strstr($id, 'NEW')) {
         // Must have the 'current' array - not the values after processing below...
         $currentRecord = $checkValueRecord = $fieldArray;
         // 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)) {
             ArrayUtility::mergeRecursiveWithOverrule($checkValueRecord, $incomingFieldArray);
         }
     } else {
         // We must use the current values as basis for this!
         $currentRecord = $checkValueRecord = $this->recordInfo($table, $id, '*');
         // This is done to make the pid positive for offline versions; Necessary to have diff-view for pages_language_overlay in workspaces.
         BackendUtility::fixVersioningPid($table, $currentRecord);
         // Get original language record if available:
         if (is_array($currentRecord) && $GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField'] && $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0 && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] && (int) $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] > 0) {
             $lookUpTable = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'] ?: $table;
             $originalLanguageRecord = $this->recordInfo($lookUpTable, $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']], '*');
             BackendUtility::workspaceOL($lookUpTable, $originalLanguageRecord);
             $originalLanguage_diffStorage = unserialize($currentRecord[$GLOBALS['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
     // If everything is OK, the field is entered into $fieldArray[]
     foreach ($incomingFieldArray as $field => $fieldValue) {
         if (isset($this->excludedTablesAndFields[$table . '-' . $field]) || $this->data_disableFields[$table][$id][$field]) {
             continue;
         }
         // The field must be editable.
         // Checking if a value for language can be changed:
         $languageDeny = $GLOBALS['TCA'][$table]['ctrl']['languageField'] && (string) $GLOBALS['TCA'][$table]['ctrl']['languageField'] === (string) $field && !$this->BE_USER->checkLanguageAccess($fieldValue);
         if ($languageDeny) {
             continue;
         }
         // Stripping slashes - will probably be removed the day $this->stripslashes_values is removed as an option...
         // @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         if ($this->stripslashes_values) {
             GeneralUtility::deprecationLog('The option stripslash_values is typically set to FALSE as data should be properly prepared before sending to DataHandler. Do not rely on DataHandler removing extra slashes. The option will be removed in TYPO3 CMS 8.');
             if (is_array($fieldValue)) {
                 GeneralUtility::stripSlashesOnArray($fieldValue);
             } else {
                 $fieldValue = stripslashes($fieldValue);
             }
         }
         switch ($field) {
             case 'uid':
             case 'pid':
                 // Nothing happens, already set
                 break;
             case 'perms_userid':
             case 'perms_groupid':
             case 'perms_user':
             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)) {
                     $value = (int) $fieldValue;
                     switch ($field) {
                         case 'perms_userid':
                             $fieldArray[$field] = $value;
                             break;
                         case 'perms_groupid':
                             $fieldArray[$field] = $value;
                             break;
                         default:
                             if ($value >= 0 && $value < pow(2, 5)) {
                                 $fieldArray[$field] = $value;
                             }
                     }
                 }
                 break;
             case 't3ver_oid':
             case 't3ver_id':
             case 't3ver_wsid':
             case 't3ver_state':
             case 't3ver_count':
             case 't3ver_stage':
             case 't3ver_tstamp':
                 // t3ver_label is not here because it CAN be edited as a regular field!
                 break;
             default:
                 if (isset($GLOBALS['TCA'][$table]['columns'][$field])) {
                     // Evaluating the value
                     $res = $this->checkValue($table, $field, $fieldValue, $id, $status, $realPid, $tscPID);
                     if (array_key_exists('value', $res)) {
                         $fieldArray[$field] = $res['value'];
                     }
                     // Add the value of the original record to the diff-storage content:
                     if ($this->updateModeL10NdiffData && $GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']) {
                         $originalLanguage_diffStorage[$field] = $this->updateModeL10NdiffDataClear ? '' : $originalLanguageRecord[$field];
                         $diffStorageFlag = true;
                     }
                     // If autoversioning is happening we need to perform a nasty hack. The case is parallel to a similar hack inside checkValue_group_select_file().
                     // 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 (is_array($this->RTEmagic_copyIndex[$table][$id][$field])) {
                             foreach ($this->RTEmagic_copyIndex[$table][$id][$field] as $oldRTEmagicName => $newRTEmagicName) {
                                 $fieldArray[$field] = str_replace(' src="' . $oldRTEmagicName . '"', ' src="' . $newRTEmagicName . '"', $fieldArray[$field]);
                             }
                         }
                     }
                 } elseif ($GLOBALS['TCA'][$table]['ctrl']['origUid'] === $field) {
                     // Allow value for original UID to pass by...
                     $fieldArray[$field] = $fieldValue;
                 }
         }
     }
     // Add diff-storage information:
     if ($diffStorageFlag && !isset($fieldArray[$GLOBALS['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[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage);
     }
     // Checking for RTE-transformations of fields:
     $types_fieldConfig = BackendUtility::getTCAtypes($table, $currentRecord);
     $theTypeString = null;
     if (is_array($types_fieldConfig)) {
         foreach ($types_fieldConfig as $vconf) {
             // RTE transformations:
             if ($this->dontProcessTransformations || !isset($fieldArray[$vconf['field']])) {
                 continue;
             }
             // Look for transformation flag:
             if ((string) $incomingFieldArray['_TRANSFORM_' . $vconf['field']] === 'RTE') {
                 if ($theTypeString === null) {
                     $theTypeString = BackendUtility::getTCAtypeValue($table, $currentRecord);
                 }
                 $RTEsetup = $this->BE_USER->getTSConfig('RTE', BackendUtility::getPagesTSconfig($tscPID));
                 $thisConfig = BackendUtility::RTEsetup($RTEsetup['properties'], $table, $vconf['field'], $theTypeString);
                 $fieldArray[$vconf['field']] = $this->transformRichtextContentToDatabase($fieldArray[$vconf['field']], $table, $vconf['field'], $vconf['spec'], $thisConfig, $currentRecord['pid']);
             }
         }
     }
     // Return fieldArray
     return $fieldArray;
 }
Beispiel #3
0
 /**
  * Returns "special" configuration from the "types" configuration in TCA for the record given by tablename/fieldname.
  * Used by isRTEforField() in the process of finding whether a field has RTE enabled or not.
  *
  * @param string $table Table name
  * @param array $row Record array
  * @param string $field Field name
  * @return array Spec. conf (if available)
  * @access private
  * @see isRTEforField()
  * @todo Define visibility
  */
 public function getSpecConfForField($table, $row, $field)
 {
     // Get types-configuration for the record:
     $types_fieldConfig = BackendUtility::getTCAtypes($table, $row);
     // Find the given field and return the spec key value if found:
     if (is_array($types_fieldConfig)) {
         foreach ($types_fieldConfig as $vConf) {
             if ($vConf['field'] == $field) {
                 return $vConf['spec'];
             }
         }
     }
     return array();
 }
Beispiel #4
0
 /**
  * Returns the "special" configuration (from the "types" "showitem" list) for a fieldname based on input table/record
  * (Not used anywhere...?)
  *
  * @param string $table The table name
  * @param array $row The table row (Should at least contain the "uid" value, even if "NEW..." string. The "pid" field is important as well, and negative values will be intepreted as pointing to a record from the same table.)
  * @param string $field Specify the field name.
  * @return array|NULL
  * @see getSpecConfFromString(), BackendUtility::getTCAtypes()
  * @todo Define visibility
  * @deprecated since 6.3 - will be removed two versions later; unused in Core
  */
 public function getSpecConfForField($table, $row, $field)
 {
     GeneralUtility::logDeprecatedFunction();
     // Finds the current "types" configuration for the table/row:
     $types_fieldConfig = BackendUtility::getTCAtypes($table, $row);
     // If this is an array, then traverse it:
     if (is_array($types_fieldConfig)) {
         foreach ($types_fieldConfig as $vconf) {
             // If the input field name matches one found in the 'types' list, then return the 'special' configuration.
             if ($vconf['field'] == $field) {
                 return $vconf['spec'];
             }
         }
     }
     return NULL;
 }
Beispiel #5
0
 /**
  * Filling in the field array
  * $this->exclude_array is used to filter fields if needed.
  *
  * @param string $table Table name
  * @param integer $id Record ID
  * @param array $fieldArray Default values, Preset $fieldArray with 'pid' maybe (pid and uid will be not be overridden anyway)
  * @param array $incomingFieldArray Is which fields/values you want to set. There are processed and put into $fieldArray if OK
  * @param integer $realPid The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
  * @param string $status Is 'new' or 'update'
  * @param integer $tscPID TSconfig PID
  * @return array Field Array
  * @todo Define visibility
  */
 public function fillInFieldArray($table, $id, $fieldArray, $incomingFieldArray, $realPid, $status, $tscPID)
 {
     // Initialize:
     \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
     $originalLanguageRecord = NULL;
     $originalLanguage_diffStorage = NULL;
     $diffStorageFlag = FALSE;
     // Setting 'currentRecord' and 'checkValueRecord':
     if (strstr($id, 'NEW')) {
         // Must have the 'current' array - not the values after processing below...
         $currentRecord = $checkValueRecord = $fieldArray;
         // 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)) {
             $checkValueRecord = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($checkValueRecord, $incomingFieldArray);
         }
     } else {
         // We must use the current values as basis for this!
         $currentRecord = $checkValueRecord = $this->recordInfo($table, $id, '*');
         // This is done to make the pid positive for offline versions; Necessary to have diff-view for pages_language_overlay in workspaces.
         \TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid($table, $currentRecord);
         // Get original language record if available:
         if (is_array($currentRecord) && $GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField'] && $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0 && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] && intval($currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]) > 0) {
             $lookUpTable = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'] ? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'] : $table;
             $originalLanguageRecord = $this->recordInfo($lookUpTable, $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']], '*');
             \TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL($lookUpTable, $originalLanguageRecord);
             $originalLanguage_diffStorage = unserialize($currentRecord[$GLOBALS['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
     // If everything is OK, the field is entered into $fieldArray[]
     foreach ($incomingFieldArray as $field => $fieldValue) {
         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 = $GLOBALS['TCA'][$table]['ctrl']['languageField'] && !strcmp($GLOBALS['TCA'][$table]['ctrl']['languageField'], $field) && !$this->BE_USER->checkLanguageAccess($fieldValue);
             if (!$languageDeny) {
                 // Stripping slashes - will probably be removed the day $this->stripslashes_values is removed as an option...
                 if ($this->stripslashes_values) {
                     if (is_array($fieldValue)) {
                         \TYPO3\CMS\Core\Utility\GeneralUtility::stripSlashesOnArray($fieldValue);
                     } else {
                         $fieldValue = stripslashes($fieldValue);
                     }
                 }
                 switch ($field) {
                     case 'uid':
                     case 'pid':
                         // Nothing happens, already set
                         break;
                     case 'perms_userid':
                     case 'perms_groupid':
                     case 'perms_user':
                     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)) {
                             $value = intval($fieldValue);
                             switch ($field) {
                                 case 'perms_userid':
                                     $fieldArray[$field] = $value;
                                     break;
                                 case 'perms_groupid':
                                     $fieldArray[$field] = $value;
                                     break;
                                 default:
                                     if ($value >= 0 && $value < pow(2, 5)) {
                                         $fieldArray[$field] = $value;
                                     }
                                     break;
                             }
                         }
                         break;
                     case 't3ver_oid':
                     case 't3ver_id':
                     case 't3ver_wsid':
                     case 't3ver_state':
                     case 't3ver_count':
                     case 't3ver_stage':
                     case 't3ver_tstamp':
                         // t3ver_label is not here because it CAN be edited as a regular field!
                         break;
                     default:
                         if (isset($GLOBALS['TCA'][$table]['columns'][$field])) {
                             // Evaluating the value
                             $res = $this->checkValue($table, $field, $fieldValue, $id, $status, $realPid, $tscPID);
                             if (isset($res['value'])) {
                                 $fieldArray[$field] = $res['value'];
                             }
                             // Add the value of the original record to the diff-storage content:
                             if ($this->updateModeL10NdiffData && $GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']) {
                                 $originalLanguage_diffStorage[$field] = $this->updateModeL10NdiffDataClear ? '' : $originalLanguageRecord[$field];
                                 $diffStorageFlag = TRUE;
                             }
                             // If autoversioning is happening we need to perform a nasty hack. The case is parallel to a similar hack inside checkValue_group_select_file().
                             // 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 (is_array($this->RTEmagic_copyIndex[$table][$id][$field])) {
                                     foreach ($this->RTEmagic_copyIndex[$table][$id][$field] as $oldRTEmagicName => $newRTEmagicName) {
                                         $fieldArray[$field] = str_replace(' src="' . $oldRTEmagicName . '"', ' src="' . $newRTEmagicName . '"', $fieldArray[$field]);
                                     }
                                 }
                             }
                         } elseif ($GLOBALS['TCA'][$table]['ctrl']['origUid'] === $field) {
                             // Allow value for original UID to pass by...
                             $fieldArray[$field] = $fieldValue;
                         }
                         break;
                 }
             }
         }
     }
     // Add diff-storage information:
     if ($diffStorageFlag && !isset($fieldArray[$GLOBALS['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[$GLOBALS['TCA'][$table]['ctrl']['transOrigDiffSourceField']] = serialize($originalLanguage_diffStorage);
     }
     // Checking for RTE-transformations of fields:
     $types_fieldConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCAtypes($table, $currentRecord);
     $theTypeString = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCAtypeValue($table, $currentRecord);
     if (is_array($types_fieldConfig)) {
         foreach ($types_fieldConfig as $vconf) {
             // Write file configuration:
             // inserted array_merge($currentRecord,$fieldArray) 170502
             $eFile = \TYPO3\CMS\Core\Html\RteHtmlParser::evalWriteFile($vconf['spec']['static_write'], array_merge($currentRecord, $fieldArray));
             // RTE transformations:
             if (!$this->dontProcessTransformations) {
                 if (isset($fieldArray[$vconf['field']])) {
                     // Look for transformation flag:
                     switch ((string) $incomingFieldArray['_TRANSFORM_' . $vconf['field']]) {
                         case 'RTE':
                             $RTEsetup = $this->BE_USER->getTSConfig('RTE', \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($tscPID));
                             $thisConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::RTEsetup($RTEsetup['properties'], $table, $vconf['field'], $theTypeString);
                             // Set alternative relative path for RTE images/links:
                             $RTErelPath = is_array($eFile) ? dirname($eFile['relEditFile']) : '';
                             // Get RTE object, draw form and set flag:
                             $RTEobj = \TYPO3\CMS\Backend\Utility\BackendUtility::RTEgetObj();
                             if (is_object($RTEobj)) {
                                 $fieldArray[$vconf['field']] = $RTEobj->transformContent('db', $fieldArray[$vconf['field']], $table, $vconf['field'], $currentRecord, $vconf['spec'], $thisConfig, $RTErelPath, $currentRecord['pid']);
                             } else {
                                 debug('NO RTE OBJECT FOUND!');
                             }
                             break;
                     }
                 }
             }
             // Write file configuration:
             if (is_array($eFile)) {
                 $mixedRec = array_merge($currentRecord, $fieldArray);
                 $SW_fileContent = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($eFile['editFile']);
                 $parseHTML = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\RteHtmlParser');
                 /** @var $parseHTML \TYPO3\CMS\Core\Html\RteHtmlParser */
                 $parseHTML->init('', '');
                 $eFileMarker = $eFile['markerField'] && trim($mixedRec[$eFile['markerField']]) ? trim($mixedRec[$eFile['markerField']]) : '###TYPO3_STATICFILE_EDIT###';
                 // Must replace the marker if present in content!
                 $insertContent = str_replace($eFileMarker, '', $mixedRec[$eFile['contentField']]);
                 $SW_fileNewContent = $parseHTML->substituteSubpart($SW_fileContent, $eFileMarker, LF . $insertContent . LF, 1, 1);
                 \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($eFile['editFile'], $SW_fileNewContent);
                 // Write status:
                 if (!strstr($id, 'NEW') && $eFile['statusField']) {
                     $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($id), array($eFile['statusField'] => $eFile['relEditFile'] . ' updated ' . date('d-m-Y H:i:s') . ', bytes ' . strlen($mixedRec[$eFile['contentField']])));
                 }
             } elseif ($eFile && is_string($eFile)) {
                 $this->log($table, $id, 2, 0, 1, 'Write-file error: \'%s\'', 13, array($eFile), $realPid);
             }
         }
     }
     // Return fieldArray
     return $fieldArray;
 }
 /**
  * This function performs processing on the input $row array and stores internally a corresponding array which contains processed values, ready to pass on to the TCEforms rendering in the frontend!
  * The objective with this function is to prepare the content for handling in TCEforms.
  * In opposite to renderRecord() this function do not prepare things like fetching TSconfig and others.
  * The resulting, processed row will be returned.
  *
  * @param string $table The table name
  * @param string $id The uid value of the record (integer). Can also be a string (NEW-something) if the record is a NEW record.
  * @param integer $pid The pid integer. For existing records this is of course the row's "pid" field. For new records it can be either a page id (positive) or a pointer to another record from the SAME table (negative) after which the record should be inserted (or on same page)
  * @param array $row The row of the current record. If NEW record, then it may be loaded with default values (by eg. fetchRecord()).
  * @param array $TSconfig Tsconfig array
  * @param integer $tscPID PAGE TSconfig pid
  * @return array Processed record data
  * @see renderRecord()
  * @todo Define visibility
  */
 public function renderRecordRaw($table, $id, $pid, $row, $TSconfig = '', $tscPID = 0)
 {
     if (!is_array($TSconfig)) {
         $TSconfig = array();
     }
     // Create blank accumulation array:
     $totalRecordContent = array();
     // Traverse the configured columns for the table (TCA):
     // For each column configured, we will perform processing if needed based on the type (eg. for "group" and "select" types this is needed)
     $copyOfColumns = $GLOBALS['TCA'][$table]['columns'];
     foreach ($copyOfColumns as $field => $fieldConfig) {
         // Set $data variable for the field, either inputted value from $row - or if not found, the default value as defined in the "config" array
         if (isset($row[$field])) {
             $data = (string) $row[$field];
         } elseif (!empty($fieldConfig['config']['eval']) && GeneralUtility::inList($fieldConfig['config']['eval'], 'null')) {
             // Field exists but is set to NULL
             if (array_key_exists($field, $row)) {
                 $data = NULL;
                 // Only use NULL if default value was explicitly set to be backward compatible.
             } elseif (array_key_exists('default', $fieldConfig['config']) && $fieldConfig['config']['default'] === NULL) {
                 $data = NULL;
             } else {
                 $data = (string) $fieldConfig['config']['default'];
             }
         } else {
             $data = (string) $fieldConfig['config']['default'];
         }
         $data = $this->renderRecord_SW($data, $fieldConfig, $TSconfig, $table, $row, $field);
         $totalRecordContent[$field] = $data;
     }
     // Further processing may apply for each field in the record depending on the settings in the "types" configuration (the list of fields to currently display for a record in TCEforms).
     // For instance this could be processing instructions for the Rich Text Editor.
     $types_fieldConfig = BackendUtility::getTCAtypes($table, $totalRecordContent);
     if (is_array($types_fieldConfig)) {
         $totalRecordContent = $this->renderRecord_typesProc($totalRecordContent, $types_fieldConfig, $tscPID, $table, $pid);
     }
     // Register items, mostly for external use (overriding the regItem() function)
     foreach ($totalRecordContent as $field => $data) {
         $this->regItem($table, $id, $field, $data);
     }
     // Finally, store the result:
     reset($totalRecordContent);
     return $totalRecordContent;
 }
Beispiel #7
0
 /**
  * Check if the field is an RTE in the Backend, for a given row of data
  *
  * @param  string $key Key is a combination of table, uid, field and structure path, identifying the field
  * @param  array $TCEformsCfg TCA configuration for field
  * @param  array $contentRow The table row being handled
  * @return boolean
  */
 protected function _isRTEField($key, $TCEformsCfg, $contentRow)
 {
     $isRTE = false;
     if (is_array($contentRow)) {
         list($table, $uid, $field) = explode(':', $key);
         // Check if the RTE is explicitly declared in the defaultExtras configuration
         if (isset($TCEformsCfg['defaultExtras']) && strpos($TCEformsCfg['defaultExtras'], 'richtext') !== false) {
             $isRTE = true;
             // If not, then we must check per type configuration
         } else {
             $typesDefinition = BackendUtility::getTCAtypes($table, $contentRow, true);
             $isRTE = !empty($typesDefinition[$field]['spec']['richtext']);
         }
     }
     return $isRTE;
 }