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