375c66a15fd31f47fbfe8b8e731842cfd8e3d8d6
[Packages/TYPO3.CMS.git] / typo3 / sysext / filelist / Classes / FileList.php
1 <?php
2 namespace TYPO3\CMS\Filelist;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Backend\Clipboard\Clipboard;
18 use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider;
19 use TYPO3\CMS\Backend\RecordList\AbstractRecordList;
20 use TYPO3\CMS\Backend\Utility\BackendUtility;
21 use TYPO3\CMS\Core\Database\ConnectionPool;
22 use TYPO3\CMS\Core\Database\Query\QueryContextType;
23 use TYPO3\CMS\Core\Imaging\Icon;
24 use TYPO3\CMS\Core\Imaging\IconFactory;
25 use TYPO3\CMS\Core\Messaging\FlashMessage;
26 use TYPO3\CMS\Core\Messaging\FlashMessageService;
27 use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException;
28 use TYPO3\CMS\Core\Resource\File;
29 use TYPO3\CMS\Core\Resource\Folder;
30 use TYPO3\CMS\Core\Resource\FolderInterface;
31 use TYPO3\CMS\Core\Resource\InaccessibleFolder;
32 use TYPO3\CMS\Core\Resource\ProcessedFile;
33 use TYPO3\CMS\Core\Resource\ResourceFactory;
34 use TYPO3\CMS\Core\Resource\Utility\ListUtility;
35 use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
36 use TYPO3\CMS\Core\Utility\GeneralUtility;
37 use TYPO3\CMS\Core\Utility\MathUtility;
38 use TYPO3\CMS\Filelist\Controller\FileListController;
39
40 /**
41 * Class for rendering of File>Filelist
42 */
43 class FileList extends AbstractRecordList
44 {
45 /**
46 * Default Max items shown
47 *
48 * @var int
49 */
50 public $iLimit = 40;
51
52 /**
53 * Thumbnails on records containing files (pictures)
54 *
55 * @var bool
56 */
57 public $thumbs = false;
58
59 /**
60 * Space icon used for alignment when no button is available
61 *
62 * @var string
63 */
64 public $spaceIcon;
65
66 /**
67 * Max length of strings
68 *
69 * @var int
70 */
71 public $fixedL = 30;
72
73 /**
74 * If TRUE click menus are generated on files and folders
75 *
76 * @var bool
77 */
78 public $clickMenus = 1;
79
80 /**
81 * The field to sort by
82 *
83 * @var string
84 */
85 public $sort = '';
86
87 /**
88 * Reverse sorting flag
89 *
90 * @var bool
91 */
92 public $sortRev = 1;
93
94 /**
95 * @var int
96 */
97 public $firstElementNumber = 0;
98
99 /**
100 * @var bool
101 */
102 public $clipBoard = 0;
103
104 /**
105 * @var bool
106 */
107 public $bigControlPanel = 0;
108
109 /**
110 * @var string
111 */
112 public $JScode = '';
113
114 /**
115 * @var string
116 */
117 public $HTMLcode = '';
118
119 /**
120 * @var int
121 */
122 public $totalbytes = 0;
123
124 /**
125 * @var array
126 */
127 public $dirs = array();
128
129 /**
130 * @var array
131 */
132 public $files = array();
133
134 /**
135 * @var string
136 */
137 public $path = '';
138
139 /**
140 * @var Folder
141 */
142 protected $folderObject;
143
144 /**
145 * Counting the elements no matter what
146 *
147 * @var int
148 */
149 public $eCounter = 0;
150
151 /**
152 * @var string
153 */
154 public $totalItems = '';
155
156 /**
157 * @var array
158 */
159 public $CBnames = array();
160
161 /**
162 * @var Clipboard $clipObj
163 */
164 public $clipObj;
165
166 /**
167 * @var ResourceFactory
168 */
169 protected $resourceFactory;
170
171 /**
172 * @param ResourceFactory $resourceFactory
173 */
174 public function injectResourceFactory(ResourceFactory $resourceFactory)
175 {
176 $this->resourceFactory = $resourceFactory;
177 }
178
179 /**
180 * @var IconFactory
181 */
182 protected $iconFactory;
183
184 /**
185 * @var FileListController
186 */
187 protected $fileListController;
188
189 /**
190 * Construct
191 *
192 * @param FileListController $fileListController
193 */
194 public function __construct(FileListController $fileListController)
195 {
196 parent::__construct();
197 $this->fileListController = $fileListController;
198 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
199
200 $modTSconfig = BackendUtility::getModTSconfig(0, 'mod.file_list');
201 if (!empty($modTSconfig['properties']['filesPerPage'])) {
202 $this->iLimit = MathUtility::forceIntegerInRange($modTSconfig['properties']['filesPerPage'], 1);
203 }
204 }
205
206 /**
207 * Initialization of class
208 *
209 * @param Folder $folderObject The folder to work on
210 * @param int $pointer Pointer
211 * @param bool $sort Sorting column
212 * @param bool $sortRev Sorting direction
213 * @param bool $clipBoard
214 * @param bool $bigControlPanel Show clipboard flag
215 * @return void
216 */
217 public function start(Folder $folderObject, $pointer, $sort, $sortRev, $clipBoard = false, $bigControlPanel = false)
218 {
219 $this->folderObject = $folderObject;
220 $this->counter = 0;
221 $this->totalbytes = 0;
222 $this->JScode = '';
223 $this->HTMLcode = '';
224 $this->path = $folderObject->getReadablePath();
225 $this->sort = $sort;
226 $this->sortRev = $sortRev;
227 $this->firstElementNumber = $pointer;
228 $this->clipBoard = $clipBoard;
229 $this->bigControlPanel = $bigControlPanel;
230 // Setting the maximum length of the filenames to the user's settings or minimum 30 (= $this->fixedL)
231 $this->fixedL = max($this->fixedL, $this->getBackendUser()->uc['titleLen']);
232 $this->getLanguageService()->includeLLFile('EXT:lang/locallang_common.xlf');
233 $this->resourceFactory = ResourceFactory::getInstance();
234 }
235
236 /**
237 * Reading files and directories, counting elements and generating the list in ->HTMLcode
238 *
239 * @return void
240 */
241 public function generateList()
242 {
243 $this->HTMLcode .= $this->getTable('fileext,tstamp,size,rw,_REF_');
244 }
245
246 /**
247 * Wrapping input string in a link with clipboard command.
248 *
249 * @param string $string String to be linked - must be htmlspecialchar'ed / prepared before.
250 * @param string $_ unused
251 * @param string $cmd "cmd" value
252 * @param string $warning Warning for JS confirm message
253 * @return string Linked string
254 */
255 public function linkClipboardHeaderIcon($string, $_, $cmd, $warning = '')
256 {
257 $jsCode = 'document.dblistForm.cmd.value=' . GeneralUtility::quoteJSvalue($cmd)
258 . ';document.dblistForm.submit();';
259
260 $attributes = [];
261 if ($warning) {
262 $attributes['class'] = 'btn btn-default t3js-modal-trigger';
263 $attributes['data-href'] = 'javascript:' . $jsCode;
264 $attributes['data-severity'] = 'warning';
265 $attributes['data-content'] = $warning;
266 } else {
267 $attributes['class'] = 'btn btn-default';
268 $attributes['onclick'] = $jsCode . 'return false;';
269 }
270
271 $attributesString = '';
272 foreach ($attributes as $key => $value) {
273 $attributesString .= ' ' . $key . '="' . htmlspecialchars($value) . '"';
274 }
275 return '<a href="#" ' . $attributesString . '>' . $string . '</a>';
276 }
277
278 /**
279 * Returns a table with directories and files listed.
280 *
281 * @param array $rowlist Array of files from path
282 * @return string HTML-table
283 */
284 public function getTable($rowlist)
285 {
286 // prepare space icon
287 $this->spaceIcon = '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
288
289 // @todo use folder methods directly when they support filters
290 $storage = $this->folderObject->getStorage();
291 $storage->resetFileAndFolderNameFiltersToDefault();
292
293 // Only render the contents of a browsable storage
294 if ($this->folderObject->getStorage()->isBrowsable()) {
295 try {
296 $foldersCount = $storage->countFoldersInFolder($this->folderObject);
297 $filesCount = $storage->countFilesInFolder($this->folderObject);
298 } catch (InsufficientFolderAccessPermissionsException $e) {
299 $foldersCount = 0;
300 $filesCount = 0;
301 }
302
303 if ($foldersCount <= $this->firstElementNumber) {
304 $foldersFrom = false;
305 $foldersNum = false;
306 } else {
307 $foldersFrom = $this->firstElementNumber;
308 if ($this->firstElementNumber + $this->iLimit > $foldersCount) {
309 $foldersNum = $foldersCount - $this->firstElementNumber;
310 } else {
311 $foldersNum = $this->iLimit;
312 }
313 }
314 if ($foldersCount >= $this->firstElementNumber + $this->iLimit) {
315 $filesFrom = false;
316 $filesNum = false;
317 } else {
318 if ($this->firstElementNumber <= $foldersCount) {
319 $filesFrom = 0;
320 $filesNum = $this->iLimit - $foldersNum;
321 } else {
322 $filesFrom = $this->firstElementNumber - $foldersCount;
323 if ($filesFrom + $this->iLimit > $filesCount) {
324 $filesNum = $filesCount - $filesFrom;
325 } else {
326 $filesNum = $this->iLimit;
327 }
328 }
329 }
330
331 $folders = $storage->getFoldersInFolder($this->folderObject, $foldersFrom, $foldersNum, true, false, trim($this->sort), (bool)$this->sortRev);
332 $files = $this->folderObject->getFiles($filesFrom, $filesNum, Folder::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, false, trim($this->sort), (bool)$this->sortRev);
333 $this->totalItems = $foldersCount + $filesCount;
334 // Adds the code of files/dirs
335 $out = '';
336 $titleCol = 'file';
337 // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
338 $rowlist = '_LOCALIZATION_,' . $rowlist;
339 $rowlist = GeneralUtility::rmFromList($titleCol, $rowlist);
340 $rowlist = GeneralUtility::uniqueList($rowlist);
341 $rowlist = $rowlist ? $titleCol . ',' . $rowlist : $titleCol;
342 if ($this->clipBoard) {
343 $rowlist = str_replace('_LOCALIZATION_,', '_LOCALIZATION_,_CLIPBOARD_,', $rowlist);
344 $this->addElement_tdCssClass['_CLIPBOARD_'] = 'col-clipboard';
345 }
346 if ($this->bigControlPanel) {
347 $rowlist = str_replace('_LOCALIZATION_,', '_LOCALIZATION_,_CONTROL_,', $rowlist);
348 $this->addElement_tdCssClass['_CONTROL_'] = 'col-control';
349 }
350 $this->fieldArray = explode(',', $rowlist);
351
352 // Add classes to table cells
353 $this->addElement_tdCssClass[$titleCol] = 'col-title';
354 $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa';
355
356 $folders = ListUtility::resolveSpecialFolderNames($folders);
357
358 $iOut = '';
359 // Directories are added
360 $this->eCounter = $this->firstElementNumber;
361 list(, $code) = $this->fwd_rwd_nav();
362 $iOut .= $code;
363
364 $iOut .= $this->formatDirList($folders);
365 // Files are added
366 $iOut .= $this->formatFileList($files);
367
368 $this->eCounter = $this->firstElementNumber + $this->iLimit < $this->totalItems
369 ? $this->firstElementNumber + $this->iLimit
370 : -1;
371 list(, $code) = $this->fwd_rwd_nav();
372 $iOut .= $code;
373
374 // Header line is drawn
375 $theData = array();
376 foreach ($this->fieldArray as $v) {
377 if ($v == '_CLIPBOARD_' && $this->clipBoard) {
378 $cells = array();
379 $table = '_FILE';
380 $elFromTable = $this->clipObj->elFromTable($table);
381 if (!empty($elFromTable) && $this->folderObject->checkActionPermission('write')) {
382 $addPasteButton = true;
383 $elToConfirm = array();
384 foreach ($elFromTable as $key => $element) {
385 $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
386 if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder($clipBoardElement, $this->folderObject)) {
387 $addPasteButton = false;
388 }
389 $elToConfirm[$key] = $clipBoardElement->getName();
390 }
391 if ($addPasteButton) {
392 $cells[] = '<a class="btn btn-default t3js-modal-trigger"' .
393 ' href="' . htmlspecialchars($this->clipObj->pasteUrl(
394 '_FILE',
395 $this->folderObject->getCombinedIdentifier()
396 )) . '"'
397 . ' data-content="' . htmlspecialchars($this->clipObj->confirmMsgText(
398 '_FILE',
399 $this->path,
400 'into',
401 $elToConfirm
402 )) . '"'
403 . ' data-severity="warning"'
404 . ' data-title="' . $this->getLanguageService()->getLL('clip_paste', true) . '"'
405 . ' title="' . $this->getLanguageService()->getLL('clip_paste', true) . '">'
406 . $this->iconFactory->getIcon('actions-document-paste-after', Icon::SIZE_SMALL)
407 ->render()
408 . '</a>';
409 }
410 }
411 if ($this->clipObj->current !== 'normal' && $iOut) {
412 $cells[] = $this->linkClipboardHeaderIcon('<span title="' . $this->getLanguageService()->getLL('clip_selectMarked', true) . '">' . $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL)->render() . '</span>', $table, 'setCB');
413 $cells[] = $this->linkClipboardHeaderIcon('<span title="' . $this->getLanguageService()->getLL('clip_deleteMarked', true) . '">' . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render(), $table, 'delete', $this->getLanguageService()->getLL('clip_deleteMarkedWarning'));
414 $onClick = 'checkOffCB(' . GeneralUtility::quoteJSvalue(implode(',', $this->CBnames)) . ', this); return false;';
415 $cells[] = '<a class="btn btn-default" rel="" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('clip_markRecords', true) . '">' . $this->iconFactory->getIcon('actions-document-select', Icon::SIZE_SMALL)->render() . '</a>';
416 }
417 $theData[$v] = implode('', $cells);
418 } else {
419 // Normal row:
420 $theT = $this->linkWrapSort($this->getLanguageService()->getLL('c_' . $v, true), $this->folderObject->getCombinedIdentifier(), $v);
421 $theData[$v] = $theT;
422 }
423 }
424
425 $out .= '<thead>' . $this->addElement(1, '', $theData, '', '', '', 'th') . '</thead>';
426 $out .= '<tbody>' . $iOut . '</tbody>';
427 // half line is drawn
428 // finish
429 $out = '
430 <!--
431 Filelist table:
432 -->
433 <div class="table-fit">
434 <table class="table table-striped table-hover" id="typo3-filelist">
435 ' . $out . '
436 </table>
437 </div>';
438 } else {
439 /** @var $flashMessage FlashMessage */
440 $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('storageNotBrowsableMessage'), $this->getLanguageService()->getLL('storageNotBrowsableTitle'), FlashMessage::INFO);
441 /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
442 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
443 /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
444 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
445 $defaultFlashMessageQueue->enqueue($flashMessage);
446 $out = '';
447 }
448 return $out;
449 }
450
451 /**
452 * If there is a parent folder and user has access to it, return an icon
453 * which is linked to the filelist of the parent folder.
454 *
455 * @param Folder $currentFolder
456 * @return string
457 */
458 protected function getLinkToParentFolder(Folder $currentFolder)
459 {
460 $levelUp = '';
461 try {
462 $currentStorage = $currentFolder->getStorage();
463 $parentFolder = $currentFolder->getParentFolder();
464 if ($parentFolder->getIdentifier() !== $currentFolder->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) {
465 $levelUp = $this->linkWrapDir(
466 '<span title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.upOneLevel', true) . '">'
467 . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render()
468 . '</span>',
469 $parentFolder
470 );
471 }
472 } catch (\Exception $e) {
473 }
474 return $levelUp;
475 }
476
477 /**
478 * Gets the number of files and total size of a folder
479 *
480 * @return string
481 */
482 public function getFolderInfo()
483 {
484 if ($this->counter == 1) {
485 $fileLabel = $this->getLanguageService()->getLL('file', true);
486 } else {
487 $fileLabel = $this->getLanguageService()->getLL('files', true);
488 }
489 return $this->counter . ' ' . $fileLabel . ', ' . GeneralUtility::formatSize($this->totalbytes, $this->getLanguageService()->getLL('byteSizeUnits', true));
490 }
491
492 /**
493 * This returns tablerows for the directories in the array $items['sorting'].
494 *
495 * @param Folder[] $folders Folders of \TYPO3\CMS\Core\Resource\Folder
496 * @return string HTML table rows.
497 */
498 public function formatDirList(array $folders)
499 {
500 $out = '';
501 foreach ($folders as $folderName => $folderObject) {
502 $role = $folderObject->getRole();
503 if ($role === FolderInterface::ROLE_PROCESSING) {
504 // don't show processing-folder
505 continue;
506 }
507 if ($role !== FolderInterface::ROLE_DEFAULT) {
508 $displayName = '<strong>' . htmlspecialchars($folderName) . '</strong>';
509 } else {
510 $displayName = htmlspecialchars($folderName);
511 }
512
513 $isLocked = $folderObject instanceof InaccessibleFolder;
514 $isWritable = $folderObject->checkActionPermission('write');
515
516 // Initialization
517 $this->counter++;
518
519 // The icon with link
520 $theIcon = '<span title="' . htmlspecialchars($folderName) . '">' . $this->iconFactory->getIconForResource($folderObject, Icon::SIZE_SMALL)->render() . '</span>';
521 if (!$isLocked && $this->clickMenus) {
522 $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, $folderObject->getCombinedIdentifier());
523 }
524
525 // Preparing and getting the data-array
526 $theData = array();
527 if ($isLocked) {
528 foreach ($this->fieldArray as $field) {
529 $theData[$field] = '';
530 }
531 $theData['file'] = $displayName;
532 } else {
533 foreach ($this->fieldArray as $field) {
534 switch ($field) {
535 case 'size':
536 try {
537 $numFiles = $folderObject->getFileCount();
538 } catch (InsufficientFolderAccessPermissionsException $e) {
539 $numFiles = 0;
540 }
541 $theData[$field] = $numFiles . ' ' . $this->getLanguageService()->getLL(($numFiles === 1 ? 'file' : 'files'), true);
542 break;
543 case 'rw':
544 $theData[$field] = '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', true) . '</strong>' . (!$isWritable ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', true) . '</strong>');
545 break;
546 case 'fileext':
547 $theData[$field] = $this->getLanguageService()->getLL('folder', true);
548 break;
549 case 'tstamp':
550 $tstamp = $folderObject->getModificationTime();
551 $theData[$field] = $tstamp ? BackendUtility::date($tstamp) : '-';
552 break;
553 case 'file':
554 $theData[$field] = $this->linkWrapDir($displayName, $folderObject);
555 break;
556 case '_CONTROL_':
557 $theData[$field] = $this->makeEdit($folderObject);
558 break;
559 case '_CLIPBOARD_':
560 $theData[$field] = $this->makeClip($folderObject);
561 break;
562 case '_REF_':
563 $theData[$field] = $this->makeRef($folderObject);
564 break;
565 default:
566 $theData[$field] = GeneralUtility::fixed_lgd_cs($theData[$field], $this->fixedL);
567 }
568 }
569 }
570 $out .= $this->addElement(1, $theIcon, $theData);
571 }
572 return $out;
573 }
574
575 /**
576 * Wraps the directory-titles
577 *
578 * @param string $title String to be wrapped in links
579 * @param Folder $folderObject Folder to work on
580 * @return string HTML
581 */
582 public function linkWrapDir($title, Folder $folderObject)
583 {
584 $href = BackendUtility::getModuleUrl('file_FilelistList', ['id' => $folderObject->getCombinedIdentifier()]);
585 $onclick = ' onclick="' . htmlspecialchars(('top.document.getElementsByName("navigation")[0].contentWindow.Tree.highlightActiveItem("file","folder' . GeneralUtility::md5int($folderObject->getCombinedIdentifier()) . '_"+top.fsMod.currentBank)')) . '"';
586 // Sometimes $code contains plain HTML tags. In such a case the string should not be modified!
587 if ((string)$title === strip_tags($title)) {
588 return '<a href="' . htmlspecialchars($href) . '"' . $onclick . ' title="' . htmlspecialchars($title) . '">' . GeneralUtility::fixed_lgd_cs($title, $this->fixedL) . '</a>';
589 } else {
590 return '<a href="' . htmlspecialchars($href) . '"' . $onclick . '>' . $title . '</a>';
591 }
592 }
593
594 /**
595 * Wraps filenames in links which opens the metadata editor.
596 *
597 * @param string $code String to be wrapped in links
598 * @param File $fileObject File to be linked
599 * @return string HTML
600 */
601 public function linkWrapFile($code, File $fileObject)
602 {
603 try {
604 if ($fileObject instanceof File && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) {
605 $metaData = $fileObject->_getMetaData();
606 $urlParameters = [
607 'edit' => [
608 'sys_file_metadata' => [
609 $metaData['uid'] => 'edit'
610 ]
611 ],
612 'returnUrl' => $this->listURL()
613 ];
614 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
615 $title = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata'));
616 $code = '<a href="' . htmlspecialchars($url) . '" title="' . $title . '">' . GeneralUtility::fixed_lgd_cs($code, $this->fixedL) . '</a>';
617 }
618 } catch (\Exception $e) {
619 // intentional fall-through
620 }
621 return $code;
622 }
623
624 /**
625 * Returns list URL; This is the URL of the current script with id and imagemode parameters, that's all.
626 * The URL however is not relative, otherwise GeneralUtility::sanitizeLocalUrl() would say that
627 * the URL would be invalid
628 *
629 * @param string $altId
630 * @param string $table Table name to display. Enter "-1" for the current table.
631 * @param string $exclList Comma separated list of fields NOT to include ("sortField", "sortRev" or "firstElementNumber")
632 *
633 * @return string URL
634 */
635 public function listURL($altId = '', $table = '-1', $exclList = '')
636 {
637 return GeneralUtility::linkThisScript(array(
638 'target' => rawurlencode($this->folderObject->getCombinedIdentifier()),
639 'imagemode' => $this->thumbs
640 ));
641 }
642
643 /**
644 * This returns tablerows for the files in the array $items['sorting'].
645 *
646 * @param File[] $files File items
647 * @return string HTML table rows.
648 */
649 public function formatFileList(array $files)
650 {
651 $out = '';
652 // first two keys are "0" (default) and "-1" (multiple), after that comes the "other languages"
653 $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages();
654 $systemLanguages = array_filter($allSystemLanguages, function ($languageRecord) {
655 if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord['uid'])) {
656 return false;
657 } else {
658 return true;
659 }
660 });
661
662 foreach ($files as $fileObject) {
663 // Initialization
664 $this->counter++;
665 $this->totalbytes += $fileObject->getSize();
666 $ext = $fileObject->getExtension();
667 $fileName = trim($fileObject->getName());
668 // The icon with link
669 $theIcon = '<span title="' . htmlspecialchars($fileName . ' [' . (int)$fileObject->getUid() . ']') . '">'
670 . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() . '</span>';
671 if ($this->clickMenus) {
672 $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier());
673 }
674 // Preparing and getting the data-array
675 $theData = array();
676 foreach ($this->fieldArray as $field) {
677 switch ($field) {
678 case 'size':
679 $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $this->getLanguageService()->getLL('byteSizeUnits', true));
680 break;
681 case 'rw':
682 $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', true) . '</strong>') . (!$fileObject->checkActionPermission('write') ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', true) . '</strong>');
683 break;
684 case 'fileext':
685 $theData[$field] = strtoupper($ext);
686 break;
687 case 'tstamp':
688 $theData[$field] = BackendUtility::date($fileObject->getModificationTime());
689 break;
690 case '_CONTROL_':
691 $theData[$field] = $this->makeEdit($fileObject);
692 break;
693 case '_CLIPBOARD_':
694 $theData[$field] = $this->makeClip($fileObject);
695 break;
696 case '_LOCALIZATION_':
697 if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) {
698 $metaDataRecord = $fileObject->_getMetaData();
699 $translations = $this->getTranslationsForMetaData($metaDataRecord);
700 $languageCode = '';
701
702 foreach ($systemLanguages as $language) {
703 $languageId = $language['uid'];
704 $flagIcon = $language['flagIcon'];
705 if (array_key_exists($languageId, $translations)) {
706 $title = htmlspecialchars(sprintf($this->getLanguageService()->getLL('editMetadataForLanguage'), $language['title']));
707 // @todo the overlay for the flag needs to be added ($flagIcon . '-overlay')
708 $urlParameters = [
709 'edit' => [
710 'sys_file_metadata' => [
711 $translations[$languageId]['uid'] => 'edit'
712 ]
713 ],
714 'returnUrl' => $this->listURL()
715 ];
716 $flagButtonIcon = $this->iconFactory->getIcon($flagIcon, Icon::SIZE_SMALL, 'overlay-edit')->render();
717 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
718 $languageCode .= '<a href="' . htmlspecialchars($url) . '" class="btn btn-default" title="' . $title . '">'
719 . $flagButtonIcon . '</a>';
720 } else {
721 $parameters = [
722 'justLocalized' => 'sys_file_metadata:' . $metaDataRecord['uid'] . ':' . $languageId,
723 'returnUrl' => $this->listURL()
724 ];
725 $returnUrl = BackendUtility::getModuleUrl('record_edit', $parameters);
726 $href = BackendUtility::getLinkToDataHandlerAction(
727 '&cmd[sys_file_metadata][' . $metaDataRecord['uid'] . '][localize]=' . $languageId,
728 $returnUrl
729 );
730 $flagButtonIcon = '<span title="' . htmlspecialchars(sprintf($this->getLanguageService()->getLL('createMetadataForLanguage'), $language['title'])) . '">' . $this->iconFactory->getIcon($flagIcon, Icon::SIZE_SMALL, 'overlay-new')->render() . '</span>';
731 $languageCode .= '<a href="' . htmlspecialchars($href) . '" class="btn btn-default">' . $flagButtonIcon . '</a> ';
732 }
733 }
734
735 // Hide flag button bar when not translated yet
736 $theData[$field] = ' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() . '"' .
737 (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
738 $theData[$field] .= '<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' .
739 '<span title="' . $this->getLanguageService()->getLL('translateMetadata', true) . '">'
740 . $this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)->render() . '</span>'
741 . '</a>';
742 }
743 break;
744 case '_REF_':
745 $theData[$field] = $this->makeRef($fileObject);
746 break;
747 case 'file':
748 // Edit metadata of file
749 $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
750
751 if ($fileObject->isMissing()) {
752 $theData[$field] .= '<span class="label label-danger label-space-left">'
753 . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'))
754 . '</span>';
755 // Thumbnails?
756 } elseif ($this->thumbs && ($this->isImage($ext) || $this->isMediaFile($ext))) {
757 $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
758 if ($processedFile) {
759 $thumbUrl = $processedFile->getPublicUrl(true);
760 $theData[$field] .= '<br /><img src="' . $thumbUrl . '" ' .
761 'width="' . $processedFile->getProperty('width') . '" ' .
762 'height="' . $processedFile->getProperty('height') . '" ' .
763 'title="' . htmlspecialchars($fileName) . '" alt="" />';
764 }
765 }
766 break;
767 default:
768 $theData[$field] = '';
769 if ($fileObject->hasProperty($field)) {
770 $theData[$field] = htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getProperty($field), $this->fixedL));
771 }
772 }
773 }
774 $out .= $this->addElement(1, $theIcon, $theData);
775 }
776 return $out;
777 }
778
779 /**
780 * Fetch the translations for a sys_file_metadata record
781 *
782 * @param $metaDataRecord
783 * @return array keys are the sys_language uids, values are the $rows
784 */
785 protected function getTranslationsForMetaData($metaDataRecord)
786 {
787 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_file_metadata');
788 $queryBuilder->getQueryContext()->setContext(QueryContextType::UNRESTRICTED);
789 $translationRecords = $queryBuilder->select('*')
790 ->from('sys_file_metadata')
791 ->where($queryBuilder->expr()->eq($GLOBALS['TCA']['sys_file_metadata']['ctrl']['transOrigPointerField'], (int)$metaDataRecord['uid']))
792 ->andWhere($queryBuilder->expr()->gt($GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField'], 0))
793 ->execute()
794 ->fetchAll();
795
796 $translations = array();
797 foreach ($translationRecords as $record) {
798 $translations[$record[$GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField']]] = $record;
799 }
800 return $translations;
801 }
802
803 /**
804 * Returns TRUE if $ext is an image-extension according to $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
805 *
806 * @param string $ext File extension
807 * @return bool
808 */
809 public function isImage($ext)
810 {
811 return GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], strtolower($ext));
812 }
813
814 /**
815 * Returns TRUE if $ext is an media-extension according to $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext']
816 *
817 * @param string $ext File extension
818 * @return bool
819 */
820 public function isMediaFile($ext)
821 {
822 return GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'], strtolower($ext));
823 }
824
825 /**
826 * Wraps the directory-titles ($code) in a link to filelist/Modules/Filelist/index.php (id=$path) and sorting commands...
827 *
828 * @param string $code String to be wrapped
829 * @param string $folderIdentifier ID (path)
830 * @param string $col Sorting column
831 * @return string HTML
832 */
833 public function linkWrapSort($code, $folderIdentifier, $col)
834 {
835 $params = ['id' => $folderIdentifier, 'SET' => [ 'sort' => $col ]];
836
837 if ($this->sort === $col) {
838 // Check reverse sorting
839 $params['SET']['reverse'] = ($this->sortRev ? '0' : '1');
840 $sortArrow = $this->iconFactory->getIcon('status-status-sorting-light-' . ($this->sortRev ? 'desc' : 'asc'), Icon::SIZE_SMALL)->render();
841 } else {
842 $params['SET']['reverse'] = 0;
843 $sortArrow = '';
844 }
845 $href = BackendUtility::getModuleUrl('file_FilelistList', $params);
846 return '<a href="' . htmlspecialchars($href) . '">' . $code . ' ' . $sortArrow . '</a>';
847 }
848
849 /**
850 * Creates the clipboard control pad
851 *
852 * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
853 * @return string HTML-table
854 */
855 public function makeClip($fileOrFolderObject)
856 {
857 if (!$fileOrFolderObject->checkActionPermission('read')) {
858 return '';
859 }
860 $cells = array();
861 $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
862 $fullName = $fileOrFolderObject->getName();
863 $md5 = GeneralUtility::shortMD5($fullIdentifier);
864 // For normal clipboard, add copy/cut buttons:
865 if ($this->clipObj->current === 'normal') {
866 $isSel = $this->clipObj->isSelected('_FILE', $md5);
867 $copyTitle = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', true);
868 $cutTitle = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', true);
869 $copyIcon = $this->iconFactory->getIcon('actions-edit-copy', Icon::SIZE_SMALL)->render();
870 $cutIcon = $this->iconFactory->getIcon('actions-edit-cut', Icon::SIZE_SMALL)->render();
871
872 if ($isSel === 'copy') {
873 $copyIcon = $this->iconFactory->getIcon('actions-edit-copy-release', Icon::SIZE_SMALL)->render();
874 } elseif ($isSel === 'cut') {
875 $cutIcon = $this->iconFactory->getIcon('actions-edit-cut-release', Icon::SIZE_SMALL)->render();
876 }
877
878 $cells[] = '<a class="btn btn-default"" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 1, ($isSel === 'copy'))) . '" title="' . $copyTitle . '">' . $copyIcon . '</a>';
879 // we can only cut if file can be moved
880 if ($fileOrFolderObject->checkActionPermission('move')) {
881 $cells[] = '<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 0, ($isSel === 'cut'))) . '" title="' . $cutTitle . '">' . $cutIcon . '</a>';
882 } else {
883 $cells[] = $this->spaceIcon;
884 }
885 } else {
886 // For numeric pads, add select checkboxes:
887 $n = '_FILE|' . $md5;
888 $this->CBnames[] = $n;
889 $checked = $this->clipObj->isSelected('_FILE', $md5) ? ' checked="checked"' : '';
890 $cells[] = '<input type="hidden" name="CBH[' . $n . ']" value="0" /><label class="btn btn-default btn-checkbox"><input type="checkbox" name="CBC[' . $n . ']" value="' . htmlspecialchars($fullIdentifier) . '" ' . $checked . ' /><span class="t3-icon fa"></span></label>';
891 }
892 // Display PASTE button, if directory:
893 $elFromTable = $this->clipObj->elFromTable('_FILE');
894 if ($fileOrFolderObject instanceof Folder && !empty($elFromTable) && $fileOrFolderObject->checkActionPermission('write')) {
895 $addPasteButton = true;
896 $elToConfirm = array();
897 foreach ($elFromTable as $key => $element) {
898 $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
899 if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder($clipBoardElement, $fileOrFolderObject)) {
900 $addPasteButton = false;
901 }
902 $elToConfirm[$key] = $clipBoardElement->getName();
903 }
904 if ($addPasteButton) {
905 $cells[] = '<a class="btn btn-default t3js-modal-trigger" '
906 . ' href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $fullIdentifier)) . '"'
907 . ' data-content="' . htmlspecialchars($this->clipObj->confirmMsgText('_FILE', $fullName, 'into', $elToConfirm)) . '"'
908 . ' data-severity="warning"'
909 . ' data-title="' . $this->getLanguageService()->getLL('clip_pasteInto', true) . '"'
910 . ' title="' . $this->getLanguageService()->getLL('clip_pasteInto', true) . '"'
911 . '>'
912 . $this->iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL)->render()
913 . '</a>';
914 }
915 }
916 // Compile items into a DIV-element:
917 return ' <div class="btn-group" role="group">' . implode('', $cells) . '</div>';
918 }
919
920 /**
921 * Creates the edit control section
922 *
923 * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the edit control section for the listing.
924 * @return string HTML-table
925 */
926 public function makeEdit($fileOrFolderObject)
927 {
928 $cells = array();
929 $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
930
931 // Edit file content (if editable)
932 if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission('write') && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileOrFolderObject->getExtension())) {
933 $url = BackendUtility::getModuleUrl('file_edit', array('target' => $fullIdentifier));
934 $editOnClick = 'top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
935 $cells['edit'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.editcontent') . '">'
936 . $this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL)->render()
937 . '</a>';
938 } else {
939 $cells['edit'] = $this->spaceIcon;
940 }
941 if ($fileOrFolderObject instanceof File) {
942 $fileUrl = $fileOrFolderObject->getPublicUrl(true);
943 if ($fileUrl) {
944 $aOnClick = 'return top.openUrlInWindow(' . GeneralUtility::quoteJSvalue($fileUrl) . ', \'WebFile\');';
945 $cells['view'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.view') . '">' . $this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>';
946 } else {
947 $cells['view'] = $this->spaceIcon;
948 }
949 } else {
950 $cells['view'] = $this->spaceIcon;
951 }
952
953 // replace file
954 if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission('replace')) {
955 $url = BackendUtility::getModuleUrl('file_replace', array('target' => $fullIdentifier, 'uid' => $fileOrFolderObject->getUid()));
956 $replaceOnClick = 'top.content.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
957 $cells['replace'] = '<a href="#" class="btn btn-default" onclick="' . $replaceOnClick . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.replace') . '">' . $this->iconFactory->getIcon('actions-edit-replace', Icon::SIZE_SMALL)->render() . '</a>';
958 }
959
960 // rename the file
961 if ($fileOrFolderObject->checkActionPermission('rename')) {
962 $url = BackendUtility::getModuleUrl('file_rename', array('target' => $fullIdentifier));
963 $renameOnClick = 'top.content.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
964 $cells['rename'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($renameOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.rename') . '">' . $this->iconFactory->getIcon('actions-edit-rename', Icon::SIZE_SMALL)->render() . '</a>';
965 } else {
966 $cells['rename'] = $this->spaceIcon;
967 }
968 if ($fileOrFolderObject->checkActionPermission('read')) {
969 $infoOnClick = '';
970 if ($fileOrFolderObject instanceof Folder) {
971 $infoOnClick = 'top.launchView( \'_FOLDER\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
972 } elseif ($fileOrFolderObject instanceof File) {
973 $infoOnClick = 'top.launchView( \'_FILE\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) . ');return false;';
974 }
975 $cells['info'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($infoOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.info') . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '</a>';
976 } else {
977 $cells['info'] = $this->spaceIcon;
978 }
979
980 // delete the file
981 if ($fileOrFolderObject->checkActionPermission('delete')) {
982 $identifier = $fileOrFolderObject->getIdentifier();
983 if ($fileOrFolderObject instanceof Folder) {
984 $referenceCountText = BackendUtility::referenceCount('_FILE', $identifier, ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToFolder'));
985 $deleteType = 'delete_folder';
986 } else {
987 $referenceCountText = BackendUtility::referenceCount('sys_file', $fileOrFolderObject->getUid(), ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToFile'));
988 $deleteType = 'delete_file';
989 }
990
991 if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
992 $confirmationCheck = '1';
993 } else {
994 $confirmationCheck = '0';
995 }
996
997 $deleteUrl = BackendUtility::getModuleUrl('tce_file');
998 $confirmationMessage = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText;
999 $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete');
1000 $cells['delete'] = '<a href="#" class="btn btn-default t3js-filelist-delete" data-content="' . htmlspecialchars($confirmationMessage)
1001 . '" data-check="' . $confirmationCheck
1002 . '" data-delete-url="' . htmlspecialchars($deleteUrl)
1003 . '" data-title="' . htmlspecialchars($title)
1004 . '" data-identifier="' . htmlspecialchars($fileOrFolderObject->getCombinedIdentifier())
1005 . '" data-veri-code="' . $this->getBackendUser()->veriCode()
1006 . '" data-delete-type="' . $deleteType
1007 . '" title="' . htmlspecialchars($title) . '">'
1008 . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
1009 } else {
1010 $cells['delete'] = $this->spaceIcon;
1011 }
1012
1013 // Hook for manipulating edit icons.
1014 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
1015 $cells['__fileOrFolderObject'] = $fileOrFolderObject;
1016 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
1017 $hookObject = GeneralUtility::getUserObj($classData);
1018 if (!$hookObject instanceof FileListEditIconHookInterface) {
1019 throw new \UnexpectedValueException(
1020 '$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface',
1021 1235225797
1022 );
1023 }
1024 $hookObject->manipulateEditIcons($cells, $this);
1025 }
1026 unset($cells['__fileOrFolderObject']);
1027 }
1028 // Compile items into a DIV-element:
1029 return '<div class="btn-group">' . implode('', $cells) . '</div>';
1030 }
1031
1032 /**
1033 * Make reference count
1034 *
1035 * @param File|Folder $fileOrFolderObject Array with information about the file/directory for which to make the clipboard panel for the listing.
1036 * @return string HTML
1037 */
1038 public function makeRef($fileOrFolderObject)
1039 {
1040 if ($fileOrFolderObject instanceof FolderInterface) {
1041 return '-';
1042 }
1043 // Look up the file in the sys_refindex.
1044 // Exclude sys_file_metadata records as these are no use references
1045 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_refindex');
1046 $referenceCount = $queryBuilder->count('*')
1047 ->from('sys_refindex')
1048 ->where($queryBuilder->expr()->eq('ref_table', $queryBuilder->quote('sys_file')))
1049 ->andWhere($queryBuilder->expr()->eq('ref_uid', (int)$fileOrFolderObject->getUid()))
1050 ->andWhere($queryBuilder->expr()->neq('tablename', $queryBuilder->quote('sys_file_metadata')))
1051 ->execute()
1052 ->fetchColumn();
1053
1054 return $this->generateReferenceToolTip($referenceCount, '\'_FILE\', ' . GeneralUtility::quoteJSvalue($fileOrFolderObject->getCombinedIdentifier()));
1055 }
1056
1057 /**
1058 * Returns an instance of LanguageService
1059 *
1060 * @return \TYPO3\CMS\Lang\LanguageService
1061 */
1062 protected function getLanguageService()
1063 {
1064 return $GLOBALS['LANG'];
1065 }
1066
1067 /**
1068 * Returns the current BE user.
1069 *
1070 * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
1071 */
1072 protected function getBackendUser()
1073 {
1074 return $GLOBALS['BE_USER'];
1075 }
1076 }