[BUGFIX] Download link for absolute file path
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / ContentElement / ElementInformationController.php
1 <?php
2 namespace TYPO3\CMS\Backend\Controller\ContentElement;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the text file GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 use TYPO3\CMS\Backend\Utility\BackendUtility;
31 use TYPO3\CMS\Backend\Utility\IconUtility;
32 use TYPO3\CMS\Core\Resource\ProcessedFile;
33 use TYPO3\CMS\Core\Utility\GeneralUtility;
34
35 /**
36 * Script Class for showing information about an item.
37 *
38 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
39 */
40 class ElementInformationController {
41
42 /**
43 * Record table name
44 *
45 * @var string
46 */
47 public $table;
48
49 /**
50 * Record uid
51 *
52 * @var int
53 */
54 public $uid;
55
56 /**
57 * @var string
58 */
59 protected $permsClause;
60
61 /**
62 * @var boolean
63 */
64 public $access = FALSE;
65
66 /**
67 * Which type of element:
68 * - "file"
69 * - "db"
70 *
71 * @var string
72 */
73 public $type = '';
74
75 /**
76 * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
77 */
78 public $doc;
79
80 /**
81 * @var string
82 */
83 protected $content = '';
84
85 /**
86 * For type "db": Set to page record of the parent page of the item set
87 * (if type="db")
88 *
89 * @var array
90 * @todo Define visibility
91 */
92 public $pageinfo;
93
94 /**
95 * Database records identified by table/uid
96 *
97 * @var array
98 */
99 protected $row;
100
101 /**
102 * @var \TYPO3\CMS\Core\Resource\File
103 */
104 protected $fileObject;
105
106 /**
107 * @var \TYPO3\CMS\Core\Resource\Folder
108 */
109 protected $folderObject;
110
111 /**
112 * Constructor
113 */
114 public function __construct() {
115 $GLOBALS['BACK_PATH'] = '';
116 $GLOBALS['SOBE'] = $this;
117
118 $this->init();
119 }
120
121 /**
122 * Determines if table/uid point to database record or file and
123 * if user has access to view information
124 *
125 * @return void
126 */
127 public function init() {
128 $this->table = GeneralUtility::_GET('table');
129 $this->uid = GeneralUtility::_GET('uid');
130
131 $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
132 $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
133
134 if (isset($GLOBALS['TCA'][$this->table])) {
135 $this->initDatabaseRecord();
136 } elseif ($this->table == '_FILE' || $this->table == '_FOLDER' || $this->table == 'sys_file') {
137 $this->initFileOrFolderRecord();
138 }
139 }
140
141 /**
142 * Init database records (table)
143 */
144 protected function initDatabaseRecord() {
145 $this->type = 'db';
146 $this->uid = (int)$this->uid;
147
148 // Check permissions and uid value:
149 if ($this->uid && $GLOBALS['BE_USER']->check('tables_select', $this->table)) {
150 if ((string) $this->table == 'pages') {
151 $this->pageinfo = BackendUtility::readPageAccess($this->uid, $this->perms_clause);
152 $this->access = is_array($this->pageinfo) ? 1 : 0;
153 $this->row = $this->pageinfo;
154 } else {
155 $this->row = BackendUtility::getRecordWSOL($this->table, $this->uid);
156 if ($this->row) {
157 $this->pageinfo = BackendUtility::readPageAccess($this->row['pid'], $this->perms_clause);
158 $this->access = is_array($this->pageinfo) ? 1 : 0;
159 }
160 }
161 /** @var $treatData \TYPO3\CMS\Backend\Form\DataPreprocessor */
162 $treatData = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\DataPreprocessor');
163 $treatData->renderRecord($this->table, $this->uid, 0, $this->row);
164 }
165 }
166
167 /**
168 * Init file/folder parameters
169 */
170 protected function initFileOrFolderRecord() {
171 $fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->
172 retrieveFileOrFolderObject($this->uid);
173
174 if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
175 $this->folderObject = $fileOrFolderObject;
176 $this->access = $this->folderObject->checkActionPermission('read');
177 $this->type = 'folder';
178 } else {
179 $this->fileObject = $fileOrFolderObject;
180 $this->access = $this->fileObject->checkActionPermission('read');
181 $this->type = 'file';
182 $this->table = 'sys_file_metadata';
183
184 try {
185 $metaData = $fileOrFolderObject->_getMetaData();
186 $this->row = BackendUtility::getRecordWSOL($this->table, $metaData['uid']);
187 } catch (\Exception $e) {
188 $this->row = array();
189 }
190 }
191 }
192
193 /**
194 * @return void
195 */
196 public function main() {
197 if (!$this->access) {
198 return;
199 }
200
201 // render type by user func
202 $typeRendered = FALSE;
203 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'])) {
204 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] as $classRef) {
205 $typeRenderObj = GeneralUtility::getUserObj($classRef);
206 // @TODO should have an interface
207 if (is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render')) {
208 if ($typeRenderObj->isValid($this->type, $this)) {
209 $this->content .= $typeRenderObj->render($this->type, $this);
210 $typeRendered = TRUE;
211 break;
212 }
213 }
214 }
215 }
216
217 if (!$typeRendered) {
218 $this->content .= $this->renderPageTitle();
219 $this->content .= $this->renderPreview();
220 $this->content .= $this->renderPropertiesAsTable();
221 $this->content .= $this->renderReferences();
222 }
223 }
224
225 /**
226 * Render page title with icon, table title and record title
227 *
228 * @return string
229 */
230 protected function renderPageTitle() {
231 if ($this->type === 'folder') {
232 $table = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:folder');
233 $title = $this->doc->getResourceHeader($this->folderObject, array(' ', ''));
234 } elseif ($this->type === 'file') {
235 $table = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']);
236 $title = $this->doc->getResourceHeader($this->fileObject, array(' ', ''));
237 } else {
238 $table = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']);
239 $title = $this->doc->getHeader($this->table, $this->row, $this->pageinfo['_thePath'], 1, array(' ', ''));
240 }
241
242 return '<h1>' .
243 ($table ? '<small>' . $table . '</small><br />' : '') .
244 $title .
245 '</h1>';
246 }
247
248 /**
249 * Render preview for current record
250 *
251 * @return string
252 */
253 protected function renderPreview() {
254 // Perhaps @TODO in future: Also display preview for records - without fileObject
255 if (!$this->fileObject) {
256 return;
257 }
258 $imageTag = '';
259 $downloadLink = '';
260
261 // check if file is marked as missing
262 if ($this->fileObject->isMissing()) {
263 $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($this->fileObject);
264 $imageTag .= $flashMessage->render();
265
266 } else {
267
268 $fileExtension = $this->fileObject->getExtension();
269 $thumbUrl = '';
270 if (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
271 $thumbUrl = $this->fileObject->process(
272 ProcessedFile::CONTEXT_IMAGEPREVIEW,
273 array(
274 'width' => '400m',
275 'height' => '400m'
276 )
277 )->getPublicUrl(TRUE);
278 }
279
280 // Create thumbnail image?
281 if ($thumbUrl) {
282 $imageTag .= '<img src="' . $thumbUrl . '" ' .
283 'alt="' . htmlspecialchars(trim($this->fileObject->getName())) . '" ' .
284 'title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" />';
285 }
286
287 // Display download link?
288 $url = $this->fileObject->getPublicUrl(TRUE);
289
290 if ($url) {
291 $downloadLink .= '<a href="' . htmlspecialchars($url) . '" target="_blank" class="t3-button">' .
292 IconUtility::getSpriteIcon('actions-edit-download') . ' ' .
293 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:download', TRUE) .
294 '</a>';
295 }
296 }
297
298 return ($imageTag ? '<p>' . $imageTag . '</p>' : '') .
299 ($downloadLink ? '<p>' . $downloadLink . '</p>' : '');
300 }
301
302 /**
303 * Render property array as html table
304 *
305 * @return string
306 */
307 protected function renderPropertiesAsTable() {
308 $tableRows = array();
309 $extraFields = array();
310
311 if ($this->type !== 'folder') {
312 $extraFields = array(
313 'crdate' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', TRUE),
314 'cruser_id' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationUserId', TRUE),
315 'tstamp' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', TRUE)
316 );
317 }
318
319 foreach ($extraFields as $name => $value) {
320 $rowValue = BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
321 if ($name === 'cruser_id' && $rowValue) {
322 $userTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('username, realName', 'be_users', 'uid = ' . (int)$rowValue);
323 if ($userTemp[0]['username'] !== '') {
324 $rowValue = $userTemp[0]['username'];
325 if ($userTemp[0]['realName'] !== '') {
326 $rowValue .= ' - ' . $userTemp[0]['realName'];
327 }
328 }
329 }
330 $tableRows[] = '
331 <tr>
332 <td><strong>' . rtrim($value, ':') . '</strong></td>
333 <td>' . htmlspecialchars($rowValue) . '</td>
334 </tr>';
335 }
336
337 // Traverse the list of fields to display for the record:
338 $fieldList = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], TRUE);
339 foreach ($fieldList as $name) {
340 $name = trim($name);
341 $uid = $this->row['uid'];
342
343 if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
344 continue;
345 }
346
347 $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name));
348 if ($isExcluded) {
349 continue;
350 }
351
352 $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid);
353 $itemLabel = $GLOBALS['LANG']->sL(BackendUtility::getItemLabel($this->table, $name), TRUE);
354 $tableRows[] = '
355 <tr>
356 <td><strong>' . $itemLabel . '</strong></td>
357 <td>' . htmlspecialchars($itemValue) . '</td>
358 </tr>';
359 }
360
361 return '<table class="t3-table">' . implode('', $tableRows) . '</table>';
362 }
363
364 /*
365 * Render references section (references from and references to current record)
366 *
367 * @return string
368 */
369 protected function renderReferences() {
370 $content = '';
371
372 switch ($this->type) {
373 case 'db': {
374 $references = $this->makeRef($this->table, $this->row['uid']);
375 if (!empty($references)) {
376 $content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesToThisItem'), $references);
377 }
378
379 $referencesFrom = $this->makeRefFrom($this->table, $this->row['uid']);
380 if (!empty($referencesFrom)) {
381 $content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesFromThisItem'), $referencesFrom);
382 }
383 break;
384 }
385
386 case 'file': {
387 if ($this->fileObject && $this->fileObject->isIndexed()) {
388 $references = $this->makeRef('_FILE', $this->fileObject);
389
390 if (!empty($references)) {
391 $header = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesToThisItem');
392 $content .= $this->doc->section($header, $references);
393 }
394 }
395 break;
396 }
397 }
398
399 return $content;
400 }
401
402 /**
403 * Renders file properties as html table
404 *
405 * @param array $fieldList
406 * @return string
407 */
408 protected function renderFileInformationAsTable($fieldList) {
409 $tableRows = array();
410 foreach ($fieldList as $name) {
411 if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
412 continue;
413 }
414 $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name));
415 if ($isExcluded) {
416 continue;
417 }
418 $uid = $this->row['uid'];
419 $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid);
420 $itemLabel = $GLOBALS['LANG']->sL(BackendUtility::getItemLabel($this->table, $name), TRUE);
421 $tableRows[] = '
422 <tr>
423 <td><strong>' . $itemLabel . '</strong></td>
424 <td>' . htmlspecialchars($itemValue) . '</td>
425 </tr>';
426 }
427
428 if (!$tableRows) {
429 return '';
430 }
431
432 return '<table id="typo3-showitem" class="t3-table-info">' .
433 implode('', $tableRows) .
434 '</table>';
435 }
436
437 /**
438 * End page and print content
439 *
440 * @return void
441 */
442 public function printContent() {
443 echo $this->doc->startPage('') .
444 $this->doc->insertStylesAndJS($this->content) .
445 $this->doc->endPage();
446 }
447
448 /**
449 * Get field name for specified table/column name
450 *
451 * @param string $tableName Table name
452 * @param string $fieldName Column name
453 * @return string label
454 */
455 public function getLabelForTableColumn($tableName, $fieldName) {
456 if ($GLOBALS['TCA'][$tableName]['columns'][$fieldName]['label'] !== NULL) {
457 $field = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$tableName]['columns'][$fieldName]['label']);
458 if (trim($field) === '') {
459 $field = $fieldName;
460 }
461 } else {
462 $field = $fieldName;
463 }
464 return $field;
465 }
466
467 /**
468 * Returns the rendered record actions
469 *
470 * @param string $table
471 * @param integer $uid
472 * @return string
473 */
474 protected function getRecordActions($table, $uid) {
475 if ($table === '' || $uid < 0) {
476 return '';
477 }
478
479 $editOnClick = BackendUtility::editOnClick('&edit[' . $table . '][' . $uid . ']=edit', $GLOBALS['BACK_PATH']);
480 $icon = IconUtility::getSpriteIcon('actions-document-open');
481 $pageActionIcons = '<a href="#" onclick="' . htmlspecialchars($editOnClick) . '">' . $icon . '</a>';
482 $historyOnClick = 'window.location.href=\'show_rechis.php?element=' . $table . '%3A' .
483 $uid . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\'; return false;';
484
485 $icon = IconUtility::getSpriteIcon('actions-document-history-open');
486 $pageActionIcons .= '<a href="#" onclick="' . $historyOnClick . '">' . $icon . '</a>';
487 if ($table === 'pages') {
488 $pageActionIcons .= $this->doc->viewPageIcon($uid, '');
489 }
490 return $pageActionIcons;
491 }
492
493 /**
494 * Make reference display
495 *
496 * @param string $table Table name
497 * @param string|\TYPO3\CMS\Core\Resource\File $ref Filename or uid
498 * @return string HTML
499 */
500 protected function makeRef($table, $ref) {
501 // Files reside in sys_file table
502 if ($table === '_FILE') {
503 $selectTable = 'sys_file';
504 $selectUid = $ref->getUid();
505 } else {
506 $selectTable = $table;
507 $selectUid = $ref;
508 }
509 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
510 '*',
511 'sys_refindex',
512 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($selectTable, 'sys_refindex') . ' AND ref_uid=' . (int)$selectUid . ' AND deleted=0'
513 );
514
515 // Compile information for title tag:
516 $infoData = array();
517 if (count($rows)) {
518 $infoDataHeader = '<tr>' . '<td>&nbsp;</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.table') . '</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.title') . '</td>' . '<td>[uid]</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.field') . '</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.flexpointer') . '</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.softrefKey') . '</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.sorting') . '</td>' . '</tr>';
519 }
520 foreach ($rows as $row) {
521 if ($row['tablename'] === 'sys_file_reference') {
522 $row = $this->transformFileReferenceToRecordReference($row);
523 }
524 $record = BackendUtility::getRecord($row['tablename'], $row['recuid']);
525 $parentRecord = BackendUtility::getRecord('pages', $record['pid']);
526 $actions = $this->getRecordActions($row['tablename'], $row['recuid']);
527 $infoData[] = '<tr class="db_list_normal">' .
528 '<td style="white-space:nowrap;">' . $actions . '</td>' .
529 '<td>' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$row['tablename']]['ctrl']['title'], TRUE) . '</td>' .
530 '<td>' . BackendUtility::getRecordTitle($row['tablename'], $record, TRUE) . '</td>' .
531 '<td><span title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:page') . ': ' .
532 htmlspecialchars(BackendUtility::getRecordTitle('pages', $parentRecord)) . ' (uid=' . $record['pid'] . ')">' .
533 $record['uid'] . '</span></td>' .
534 '<td>' . htmlspecialchars($this->getLabelForTableColumn($row['tablename'], $row['field'])) . '</td>' .
535 '<td>' . htmlspecialchars($row['flexpointer']) . '</td>' . '<td>' . htmlspecialchars($row['softref_key']) . '</td>' .
536 '<td>' . htmlspecialchars($row['sorting']) . '</td>' .
537 '</tr>';
538 }
539 $referenceLine = '';
540 if (count($infoData)) {
541 $referenceLine = '<table class="t3-table">' .
542 '<thead>' . $infoDataHeader . '</thead>' .
543 '<tbody>' .
544 implode('', $infoData) .
545 '</tbody></table>';
546 }
547 return $referenceLine;
548 }
549
550 /**
551 * Make reference display (what this elements points to)
552 *
553 * @param string $table Table name
554 * @param string $ref Filename or uid
555 * @return string HTML
556 */
557 protected function makeRefFrom($table, $ref) {
558 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
559 '*',
560 'sys_refindex',
561 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') . ' AND recuid=' . (int)$ref
562 );
563
564 // Compile information for title tag:
565 $infoData = array();
566 if (count($rows)) {
567 $infoDataHeader = '<tr class="t3-row-header">' .
568 '<td>&nbsp;</td>' .
569 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.field') . '</td>' .
570 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.flexpointer') . '</td>' .
571 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.softrefKey') . '</td>' .
572 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.sorting') . '</td>' .
573 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.refTable') . '</td>' .
574 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.refUid') . '</td>' .
575 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.refString') . '</td>' .
576 '</tr>';
577 }
578 foreach ($rows as $row) {
579 $actions = $this->getRecordActions($row['ref_table'], $row['ref_uid']);
580 $infoData[] = '<tr class="db_list_normal">' .
581 '<td style="white-space:nowrap;">' . $actions . '</td>' .
582 '<td>' . htmlspecialchars($this->getLabelForTableColumn($table, $row['field'])) . '</td>' .
583 '<td>' . htmlspecialchars($row['flexpointer']) . '</td>' .
584 '<td>' . htmlspecialchars($row['softref_key']) . '</td>' .
585 '<td>' . htmlspecialchars($row['sorting']) . '</td>' .
586 '<td>' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$row['ref_table']]['ctrl']['title'], TRUE) . '</td>' .
587 '<td>' . htmlspecialchars($row['ref_uid']) . '</td>' .
588 '<td>' . htmlspecialchars($row['ref_string']) . '</td>' .
589 '</tr>';
590 }
591
592 if (empty($infoData)) {
593 return;
594 }
595
596 return '<table class="t3-table">' .
597 '<thead>' . $infoDataHeader . '</thead>' .
598 '<tbody>' .
599 implode('', $infoData) .
600 '</tbody></table>';
601 }
602
603 /**
604 * Convert FAL file reference (sys_file_reference) to reference index (sys_refindex) table format
605 *
606 * @param array $referenceRecord
607 * @return array
608 */
609 protected function transformFileReferenceToRecordReference(array $referenceRecord) {
610 $fileReference = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
611 '*',
612 'sys_file_reference',
613 'uid=' . (int)$referenceRecord['recuid']
614 );
615 return array(
616 'recuid' => $fileReference['uid_foreign'],
617 'tablename' => $fileReference['tablenames'],
618 'field' => $fileReference['fieldname'],
619 'flexpointer' => '',
620 'softref_key' => '',
621 'sorting' => $fileReference['sorting_foreign']
622 );
623 }
624
625 }