PageRenderTime 25ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/linxpinx/mercurial
PHP | 140 lines | 68 code | 10 blank | 62 comment | 12 complexity | 0e241917f6854cd8ce27eb54d8464df8 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, Unlicense, LGPL-2.1, Apache-2.0
  1. <?php
  2. /***************************************************************
  3. * Copyright notice
  4. *
  5. * (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.com)
  6. * (c) 2005-2010 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: browse_links.php 7905 2010-06-13 14:42:33Z ohader $
  36. *
  37. * @author Kasper Skaarhoj <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. require_once('class.tx_rtehtmlarea_browse_links.php');
  46. $LANG->includeLLFile('EXT:rtehtmlarea/mod3/locallang.xml');
  47. $LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xml');
  48. /**
  49. * Script class for the Element Browser window.
  50. *
  51. * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
  52. * @package TYPO3
  53. * @subpackage core
  54. */
  55. class tx_rtehtmlarea_SC_browse_links {
  56. public $mode = 'rte';
  57. public $button = 'link';
  58. protected $content = '';
  59. /**
  60. * Main function, rendering the element browser in RTE mode.
  61. *
  62. * @return void
  63. */
  64. function main() {
  65. // Setting alternative web browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
  66. $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
  67. // Clear temporary DB mounts
  68. $tmpMount = t3lib_div::_GET('setTempDBmount');
  69. if (isset($tmpMount)) {
  70. $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', intval($tmpMount));
  71. }
  72. // Set temporary DB mounts
  73. $tempDBmount = intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'));
  74. if ($tempDBmount) {
  75. $altMountPoints = $tempDBmount;
  76. }
  77. if ($altMountPoints) {
  78. $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints)));
  79. $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
  80. }
  81. // Setting alternative file browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
  82. $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
  83. if ($altMountPoints) {
  84. $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
  85. foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
  86. $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
  87. }
  88. $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
  89. }
  90. // Render type by user function
  91. $browserRendered = false;
  92. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
  93. foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
  94. $browserRenderObj = t3lib_div::getUserObj($classRef);
  95. if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
  96. if ($browserRenderObj->isValid($this->mode, $this)) {
  97. $this->content .= $browserRenderObj->render($this->mode, $this);
  98. $browserRendered = true;
  99. break;
  100. }
  101. }
  102. }
  103. }
  104. // If type was not rendered, use default rendering functions
  105. if (!$browserRendered) {
  106. $GLOBALS['SOBE']->browser = t3lib_div::makeInstance('tx_rtehtmlarea_browse_links');
  107. $GLOBALS['SOBE']->browser->init();
  108. $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php','ses');
  109. list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
  110. $GLOBALS['BE_USER']->pushModuleData('browse_links.php',$modData);
  111. $this->content = $GLOBALS['SOBE']->browser->main_rte();
  112. }
  113. }
  114. /**
  115. * Print module content
  116. *
  117. * @return void
  118. */
  119. function printContent() {
  120. echo $this->content;
  121. }
  122. }
  123. if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/browse_links.php']) {
  124. include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/browse_links.php']);
  125. }
  126. // Make instance:
  127. $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_SC_browse_links');
  128. $SOBE->main();
  129. $SOBE->printContent();
  130. ?>