PageRenderTime 37ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/typo3/sysext/rtehtmlarea/mod3/browse_links.php

https://github.com/andreaswolf/typo3-tceforms
PHP | 139 lines | 67 code | 10 blank | 62 comment | 12 complexity | 98c986a0f455cf76f17f48753c45a397 MD5 | raw file
Possible License(s): Apache-2.0, BSD-2-Clause, LGPL-3.0
  1. <?php
  2. /***************************************************************
  3. * Copyright notice
  4. *
  5. * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
  6. * (c) 2005-2011 Stanislas Rolland <typo3(arobas)sjbr.ca>
  7. * All rights reserved
  8. *
  9. * This script is part of the TYPO3 project. The TYPO3 project is
  10. * free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * The GNU General Public License can be found at
  16. * http://www.gnu.org/copyleft/gpl.html.
  17. * A copy is found in the textfile GPL.txt and important notices to the license
  18. * from the author is found in LICENSE.txt distributed with these scripts.
  19. *
  20. *
  21. * This script is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * This copyright notice MUST APPEAR in all copies of the script!
  27. ***************************************************************/
  28. /**
  29. * Displays the page/file tree for browsing database records or files.
  30. * Used from TCEFORMS an other elements
  31. * In other words: This is the ELEMENT BROWSER!
  32. *
  33. * Adapted for htmlArea RTE by Stanislas Rolland
  34. *
  35. * $Id$
  36. *
  37. * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  38. * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
  39. */
  40. error_reporting (E_ALL ^ E_NOTICE);
  41. unset($MCONF);
  42. require('conf.php');
  43. require($BACK_PATH.'init.php');
  44. require($BACK_PATH.'template.php');
  45. $LANG->includeLLFile('EXT:rtehtmlarea/mod3/locallang.xml');
  46. $LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xml');
  47. /**
  48. * Script class for the Element Browser window.
  49. *
  50. * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  51. * @package TYPO3
  52. * @subpackage core
  53. */
  54. class tx_rtehtmlarea_SC_browse_links {
  55. public $mode = 'rte';
  56. public $button = 'link';
  57. protected $content = '';
  58. /**
  59. * Main function, rendering the element browser in RTE mode.
  60. *
  61. * @return void
  62. */
  63. function main() {
  64. // Setting alternative web browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
  65. $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
  66. // Clear temporary DB mounts
  67. $tmpMount = t3lib_div::_GET('setTempDBmount');
  68. if (isset($tmpMount)) {
  69. $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', intval($tmpMount));
  70. }
  71. // Set temporary DB mounts
  72. $tempDBmount = intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'));
  73. if ($tempDBmount) {
  74. $altMountPoints = $tempDBmount;
  75. }
  76. if ($altMountPoints) {
  77. $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints)));
  78. $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
  79. }
  80. // Setting alternative file browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
  81. $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
  82. if ($altMountPoints) {
  83. $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
  84. foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
  85. $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
  86. }
  87. $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
  88. }
  89. // Render type by user function
  90. $browserRendered = false;
  91. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
  92. foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
  93. $browserRenderObj = t3lib_div::getUserObj($classRef);
  94. if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
  95. if ($browserRenderObj->isValid($this->mode, $this)) {
  96. $this->content .= $browserRenderObj->render($this->mode, $this);
  97. $browserRendered = true;
  98. break;
  99. }
  100. }
  101. }
  102. }
  103. // If type was not rendered, use default rendering functions
  104. if (!$browserRendered) {
  105. $GLOBALS['SOBE']->browser = t3lib_div::makeInstance('tx_rtehtmlarea_browse_links');
  106. $GLOBALS['SOBE']->browser->init();
  107. $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php','ses');
  108. list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
  109. $GLOBALS['BE_USER']->pushModuleData('browse_links.php',$modData);
  110. $this->content = $GLOBALS['SOBE']->browser->main_rte();
  111. }
  112. }
  113. /**
  114. * Print module content
  115. *
  116. * @return void
  117. */
  118. function printContent() {
  119. echo $this->content;
  120. }
  121. }
  122. if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/browse_links.php'])) {
  123. include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/browse_links.php']);
  124. }
  125. // Make instance:
  126. $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_SC_browse_links');
  127. $SOBE->main();
  128. $SOBE->printContent();
  129. ?>