[TASK] Remove dummy files from ext:rtehtmlarea
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / Classes / Controller / BrowseLinksController.php
1 <?php
2 namespace TYPO3\CMS\Rtehtmlarea\Controller;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * (c) 2005-2013 Stanislas Rolland <typo3(arobas)sjbr.ca>
9 * All rights reserved
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 * A copy is found in the textfile GPL.txt and important notices to the license
20 * from the author is found in LICENSE.txt distributed with these scripts.
21 *
22 *
23 * This script is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * This copyright notice MUST APPEAR in all copies of the script!
29 ***************************************************************/
30
31 /**
32 * Script class for the Element Browser window.
33 *
34 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
35 */
36 class BrowseLinksController {
37
38 public $mode = 'rte';
39
40 public $button = 'link';
41
42 protected $content = '';
43
44 /**
45 * Main function, rendering the element browser in RTE mode.
46 *
47 * @return void
48 * @todo Define visibility
49 */
50 public function main() {
51 // Setting alternative web browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
52 $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
53 // Clear temporary DB mounts
54 $tmpMount = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('setTempDBmount');
55 if (isset($tmpMount)) {
56 $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', intval($tmpMount));
57 }
58 // Set temporary DB mounts
59 $tempDBmount = intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'));
60 if ($tempDBmount) {
61 $altMountPoints = $tempDBmount;
62 }
63 if ($altMountPoints) {
64 $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $altMountPoints)));
65 $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
66 }
67 // Setting alternative file browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
68 $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
69 if ($altMountPoints) {
70 $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
71 foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
72 $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
73 }
74 $GLOBALS['BE_USER']->getFileStorages();
75 $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->groupData['filemounts'];
76 }
77 // Render type by user function
78 $browserRendered = FALSE;
79 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
80 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
81 $browserRenderObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
82 if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
83 if ($browserRenderObj->isValid($this->mode, $this)) {
84 $this->content .= $browserRenderObj->render($this->mode, $this);
85 $browserRendered = TRUE;
86 break;
87 }
88 }
89 }
90 }
91 // If type was not rendered, use default rendering functions
92 if (!$browserRendered) {
93 $GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Rtehtmlarea\\BrowseLinks');
94 $GLOBALS['SOBE']->browser->init();
95 $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php', 'ses');
96 list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
97 $GLOBALS['BE_USER']->pushModuleData('browse_links.php', $modData);
98 $this->content = $GLOBALS['SOBE']->browser->main_rte();
99 }
100 }
101
102 /**
103 * Print module content
104 *
105 * @return void
106 * @todo Define visibility
107 */
108 public function printContent() {
109 echo $this->content;
110 }
111
112 }
113
114
115 ?>