[TASK] Make browse_links.php a wizard 81/27981/4
authorHelmut Hummel <helmut.hummel@typo3.org>
Sun, 2 Mar 2014 18:01:34 +0000 (19:01 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 5 Mar 2014 20:56:06 +0000 (21:56 +0100)
Resolves: #56470
Releases: 6.2
Change-Id: I7bf8c20ab7e084efca352840f88007a574f7e270
Reviewed-on: https://review.typo3.org/27981
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
31 files changed:
typo3/alt_file_navframe.php
typo3/browse_links.php [deleted file]
typo3/class.browse_links.php
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php
typo3/sysext/backend/Classes/RecordList/ElementBrowserRecordList.php
typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php
typo3/sysext/cms/flexform_media.xml
typo3/sysext/cms/layout/db_layout.php
typo3/sysext/core/Configuration/TCA/sys_file_reference.php
typo3/sysext/frontend/Configuration/TCA/tt_content.php
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php
typo3/sysext/recordlist/Classes/Controller/ElementBrowserFramesetController.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/conf.php [new file with mode: 0644]
typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/index.php [new file with mode: 0644]
typo3/sysext/recordlist/ext_tables.php
typo3/sysext/rtehtmlarea/Classes/BrowseLinks.php
typo3/sysext/rtehtmlarea/Classes/Controller/BrowseLinksController.php
typo3/sysext/rtehtmlarea/Classes/Extension/Typo3Link.php
typo3/sysext/rtehtmlarea/Classes/FolderTree.php
typo3/sysext/rtehtmlarea/Classes/PageTree.php
typo3/sysext/rtehtmlarea/Classes/SelectImage.php
typo3/sysext/rtehtmlarea/Classes/User.php
typo3/sysext/rtehtmlarea/ext_tables.php
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/mod3/browse_links.php [deleted file]
typo3/sysext/rtehtmlarea/mod3/index.php [new file with mode: 0644]

index d00ba79..8a60a2c 100644 (file)
@@ -34,9 +34,7 @@ require_once 'init.php';
 
 // Make instance if it is not an AJAX call
 if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
-       $fileSystemNavigationFrameController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
-               'TYPO3\\CMS\\Backend\\Controller\\FileSystemNavigationFrameController'
-       );
+       $fileSystemNavigationFrameController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\FileSystemNavigationFrameController');
        $fileSystemNavigationFrameController->initPage();
        $fileSystemNavigationFrameController->main();
        $fileSystemNavigationFrameController->printContent();
diff --git a/typo3/browse_links.php b/typo3/browse_links.php
deleted file mode 100644 (file)
index 59c8400..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the text file GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Displays the page/file tree for browsing database records or files.
- * Used from TCEFORMS an other elements
- * In other words: This is the ELEMENT BROWSER!
- *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-require __DIR__ . '/init.php';
-
-$elementBrowserController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recordlist\\Controller\\ElementBrowserController');
-$elementBrowserController->main();
-$elementBrowserController->printContent();
index 8857986..ed030a2 100644 (file)
@@ -20,7 +20,7 @@ class localPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
         * @todo Define visibility
         */
        public function __construct() {
-               $this->thisScript = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME');
+               $this->determineScriptUrl();
                $this->init();
                $this->clause = ' AND doktype!=' . \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER . $this->clause;
        }
@@ -66,7 +66,7 @@ class localPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
                        } else {
                                $arrCol = '<td></td>';
                        }
-                       $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['row']['uid'] . '\');';
+                       $aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['row']['uid']) . ');';
                        $cEbullet = $this->ext_isLinkable($v['row']['doktype'], $v['row']['uid']) ? '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/arrowbullet.gif', 'width="18" height="16"') . ' alt="" /></a>' : '';
                        $out .= '
                                <tr class="' . $bgColorClass . '">
@@ -109,12 +109,13 @@ class localPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
         * @todo Define visibility
         */
        public function PM_ATagWrap($icon, $cmd, $bMark = '') {
+               $name = '';
                if ($bMark) {
                        $anchor = '#' . $bMark;
                        $name = ' name="' . $bMark . '"';
                }
-               $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?PM=' . $cmd . '\',\'' . $anchor . '\');';
-               return '<a href="#"' . $name . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
+               $aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'PM=' . $cmd) . ',' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($anchor) . ');';
+               return '<a href="#"' . htmlspecialchars($name) . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
        }
 
        /**
@@ -168,9 +169,9 @@ class TBE_PageTree extends localPageTree {
                        $ficon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('pages', $v);
                        $onClick = 'return insertElement(\'pages\', \'' . $v['uid'] . '\', \'db\', ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($v['title']) . ', \'\', \'\', \'' . $ficon . '\',\'\',1);';
                } else {
-                       $onClick = htmlspecialchars('return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['uid'] . '\');');
+                       $onClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['uid']) . ');';
                }
-               return '<a href="#" onclick="' . $onClick . '">' . $title . '</a>';
+               return '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $title . '</a>';
        }
 
 }
@@ -195,7 +196,7 @@ class localFolderTree extends \TYPO3\CMS\Backend\Tree\View\FolderTreeView {
         * @todo Define visibility
         */
        public function __construct() {
-               $this->thisScript = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME');
+               $this->determineScriptUrl();
                parent::__construct();
        }
 
@@ -209,7 +210,7 @@ class localFolderTree extends \TYPO3\CMS\Backend\Tree\View\FolderTreeView {
         */
        public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
                if ($this->ext_isLinkable($folderObject)) {
-                       $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
+                       $aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
                        return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
                } else {
                        return '<span class="typo3-dimmed">' . $title . '</span>';
@@ -242,12 +243,13 @@ class localFolderTree extends \TYPO3\CMS\Backend\Tree\View\FolderTreeView {
         * @todo Define visibility
         */
        public function PM_ATagWrap($icon, $cmd, $bMark = '') {
+               $name = $anchor = '';
                if ($bMark) {
                        $anchor = '#' . $bMark;
                        $name = ' name="' . $bMark . '"';
                }
-               $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?PM=' . $cmd . '\',\'' . $anchor . '\');';
-               return '<a href="#"' . $name . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
+               $aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'PM=' . $cmd) . ',' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($anchor) . ');';
+               return '<a href="#"' . htmlspecialchars($name) . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
        }
 
 }
@@ -290,7 +292,7 @@ class TBE_FolderTree extends localFolderTree {
         */
        public function wrapTitle($title, $folderObject) {
                if ($this->ext_isLinkable($folderObject)) {
-                       $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
+                       $aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
                        return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
                } else {
                        return '<span class="typo3-dimmed">' . $title . '</span>';
index a583cc6..64a0374 100644 (file)
@@ -709,7 +709,7 @@ class PageLayoutController {
                // Return-url for JavaScript:
                $retUrlStr = $this->returnUrl ? '+\'&returnUrl=\'+\'' . rawurlencode($this->returnUrl) . '\'' : '';
                // Drawing the edit record selectbox
-               $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars(('jumpToUrl(\'db_layout.php?id=' . $this->id . '&edit_record=\'+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);')) . '">' . implode('', $opt) . '</select>';
+               $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars(('jumpToUrl(' . GeneralUtility::quoteJSvalue('db_layout.php?id=' . $this->id . '&edit_record=') . '+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);')) . '">' . implode('', $opt) . '</select>';
                // Creating editing form:
                if ($GLOBALS['BE_USER']->check('tables_modify', $this->eRParts[0]) && $edit_record && ($this->eRParts[0] !== 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] === 'pages' && $this->CALC_PERMS & 1)) {
                        // Splitting uid parts for special features, if new:
@@ -1107,7 +1107,7 @@ class PageLayoutController {
                                                onclick="' . htmlspecialchars(('window.location.href=\'' . $GLOBALS['BACK_PATH'] . 'show_rechis.php?element=' . rawurlencode(($this->eRParts[0] . ':' . $this->eRParts[1])) . '&revert=ALL_FIELDS&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;')) . '"
                                                title="' . htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('undoLastChange'), BackendUtility::calcAge(($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp']), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))) . '">' . IconUtility::getSpriteIcon('actions-edit-undo') . '</a>';
                                        // History button
-                                       $buttons['history_record'] = '<a href="#" onclick="' . htmlspecialchars(('jumpToUrl(\'' . $GLOBALS['BACK_PATH'] . 'show_rechis.php?element=' . rawurlencode(($this->eRParts[0] . ':' . $this->eRParts[1])) . '&returnUrl=' . rawurlencode($this->R_URI) . '#latest\');return false;')) . '" title="' . $GLOBALS['LANG']->getLL('recordHistory', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
+                                       $buttons['history_record'] = '<a href="#" onclick="' . htmlspecialchars(('jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['BACK_PATH'] . 'show_rechis.php?element=' . rawurlencode(($this->eRParts[0] . ':' . $this->eRParts[1])) . '&returnUrl=' . rawurlencode($this->R_URI) . '#latest') . ');return false;')) . '" title="' . $GLOBALS['LANG']->getLL('recordHistory', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
                                }
                        }
                }
@@ -1123,7 +1123,7 @@ class PageLayoutController {
         * Returns the number of hidden elements (including those hidden by start/end times)
         * on the current page (for the current sys_language)
         *
-        * @return void
+        * @return int
         * @todo Define visibility
         */
        public function getNumberOfHiddenElements() {
index e0d4fc8..d4bd8e7 100644 (file)
@@ -4157,6 +4157,8 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                                                                $params['flexFormPath'] = $flexFormPath;
                                                                $params['md5ID'] = $md5ID;
                                                                $params['returnUrl'] = $this->thisReturnUrl();
+
+                                                               $wScript = '';
                                                                // Resolving script filename and setting URL.
                                                                if (isset($wConf['module']['name'])) {
                                                                        $urlParameters = array();
@@ -4179,6 +4181,8 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                                                                                        break;
                                                                                }
                                                                        } else {
+                                                                               // Compatibility layer
+                                                                               // @deprecated since 6.2, will be removed 2 versions later
                                                                                $parsedWizardUrl = parse_url($wConf['script']);
                                                                                if (in_array($parsedWizardUrl['path'], array(
                                                                                                        'wizard_add.php',
@@ -4188,13 +4192,18 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                                                                                                        'wizard_list.php',
                                                                                                        'wizard_rte.php',
                                                                                                        'wizard_table.php',
+                                                                                                       'browse_links.php',
                                                                                                ))
                                                                                ) {
                                                                                        $urlParameters = array();
                                                                                        if (isset($parsedWizardUrl['query'])) {
                                                                                                 parse_str($parsedWizardUrl['query'], $urlParameters);
                                                                                        }
-                                                                                       $moduleName = str_replace('.php', '', $parsedWizardUrl['path']);
+                                                                                       $moduleName = str_replace(
+                                                                                               array('.php', 'browse_links'),
+                                                                                               array('', 'wizard_element_browser'),
+                                                                                               $parsedWizardUrl['path']
+                                                                                       );
                                                                                        $wScript = BackendUtility::getModuleUrl($moduleName, $urlParameters);
                                                                                        unset($moduleName, $urlParameters, $parsedWizardUrl);
                                                                                } else {
@@ -4202,7 +4211,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                                                                                }
                                                                        }
                                                                } elseif (in_array($wConf['type'], array('script', 'colorbox', 'popup'), TRUE)) {
-                                                                       // Illeagal configuration, fail silently
+                                                                       // Illegal configuration, fail silently
                                                                        break;
                                                                }
 
index 4a3f137..d3250fe 100644 (file)
@@ -103,9 +103,9 @@ abstract class AbstractRecordList {
        public $fixedL = 30;
 
        /**
-        * @todo Define visibility
+        * Script URL
         */
-       public $script = '';
+       public $thisScript = '';
 
        // Set to zero, if you don't want a left-margin with addElement function
        /**
@@ -171,6 +171,24 @@ abstract class AbstractRecordList {
        }
 
        /**
+        * Sets the script url depending on being a module or script request
+        */
+       protected function determineScriptUrl() {
+               if ($moduleName = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M')) {
+                       $this->thisScript = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl($moduleName);
+               } else {
+                       $this->thisScript = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME');
+               }
+       }
+
+       /**
+        * @return string
+        */
+       protected function getThisScript() {
+               return strpos($this->thisScript, '?') === FALSE ? $this->thisScript . '?' : $this->thisScript . '&';
+       }
+
+       /**
         * Returns a table-row with the content from the fields in the input data array.
         * OBS: $this->fieldArray MUST be set! (represents the list of fields to display)
         *
@@ -340,7 +358,7 @@ abstract class AbstractRecordList {
         * @todo Define visibility
         */
        public function listURL($altId = '') {
-               return $this->script . '?id=' . ($altId !== '' ? $altId : $this->id);
+               return $this->getThisScript() . 'id=' . ($altId !== '' ? $altId : $this->id);
        }
 
        /**
index 2b1f36d..fde7453 100644 (file)
@@ -39,12 +39,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 class ElementBrowserRecordList extends \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList {
-
-       /**
-        * @todo Define visibility
-        */
-       public $thisScript = 'browse_links.php';
-
        /**
         * Table name of the field pointing to this element browser
         *
@@ -67,7 +61,7 @@ class ElementBrowserRecordList extends \TYPO3\CMS\Recordlist\RecordList\Database
         */
        public function __construct() {
                parent::__construct();
-               $this->thisScript = GeneralUtility::getIndpEnv('SCRIPT_NAME');
+               $this->determineScriptUrl();
        }
 
        /**
@@ -80,7 +74,7 @@ class ElementBrowserRecordList extends \TYPO3\CMS\Recordlist\RecordList\Database
         * @todo Define visibility
         */
        public function listURL($altId = '', $table = -1, $exclList = '') {
-               return $this->thisScript . '?id=' . ($altId !== '' ? $altId : $this->id) . '&table=' . rawurlencode(($table == -1 ? $this->table : $table)) . ($this->thumbs ? '&imagemode=' . $this->thumbs : '') . ($this->searchString ? '&search_field=' . rawurlencode($this->searchString) : '') . ($this->searchLevels ? '&search_levels=' . rawurlencode($this->searchLevels) : '') . ((!$exclList || !GeneralUtility::inList($exclList, 'sortField')) && $this->sortField ? '&sortField=' . rawurlencode($this->sortField) : '') . ((!$exclList || !GeneralUtility::inList($exclList, 'sortRev')) && $this->sortRev ? '&sortRev=' . rawurlencode($this->sortRev) : '') . $this->ext_addP();
+               return $this->getThisScript() . 'id=' . ($altId !== '' ? $altId : $this->id) . '&table=' . rawurlencode(($table == -1 ? $this->table : $table)) . ($this->thumbs ? '&imagemode=' . $this->thumbs : '') . ($this->searchString ? '&search_field=' . rawurlencode($this->searchString) : '') . ($this->searchLevels ? '&search_levels=' . rawurlencode($this->searchLevels) : '') . ((!$exclList || !GeneralUtility::inList($exclList, 'sortField')) && $this->sortField ? '&sortField=' . rawurlencode($this->sortField) : '') . ((!$exclList || !GeneralUtility::inList($exclList, 'sortRev')) && $this->sortRev ? '&sortRev=' . rawurlencode($this->sortRev) : '') . $this->ext_addP();
        }
 
        /**
index c415326..96230ef 100644 (file)
@@ -308,6 +308,24 @@ abstract class AbstractTreeView {
        public $recs = array();
 
        /**
+        * Sets the script url depending on being a module or script request
+        */
+       protected function determineScriptUrl() {
+               if ($moduleName = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M')) {
+                       $this->thisScript = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl($moduleName);
+               } else {
+                       $this->thisScript = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME');
+               }
+       }
+
+       /**
+        * @return string
+        */
+       protected function getThisScript() {
+               return strpos($this->thisScript, '?') === FALSE ? $this->thisScript . '?' : $this->thisScript . '&';
+       }
+
+       /**
         * Initialize the tree class. Needs to be overwritten
         * Will set ->fieldsArray, ->backPath and ->clause
         *
@@ -526,7 +544,7 @@ abstract class AbstractTreeView {
                                $anchor = '#' . $bMark;
                                $name = ' name="' . $bMark . '"';
                        }
-                       $aUrl = $this->thisScript . '?PM=' . $cmd . $anchor;
+                       $aUrl = $this->getThisScript() . 'PM=' . $cmd . $anchor;
                        return '<a href="' . htmlspecialchars($aUrl) . '"' . $name . '>' . $icon . '</a>';
                } else {
                        return $icon;
index f7c43bd..40d8135 100644 (file)
@@ -127,7 +127,7 @@ class FolderTreeView extends \TYPO3\CMS\Backend\Tree\View\AbstractTreeView {
                        // Activates dynamic AJAX based tree
                        $scopeData = serialize($this->scope);
                        $scopeHash = GeneralUtility::hmac($scopeData);
-                       $js = htmlspecialchars('Tree.load(\'' . $cmd . '\', ' . (int)$isExpand . ', this, \'' . $scopeData . '\', \'' . $scopeHash . '\');');
+                       $js = htmlspecialchars('Tree.load(' . GeneralUtility::quoteJSvalue($cmd) . ', ' . (int)$isExpand . ', this, ' . GeneralUtility::quoteJSvalue($scopeData) . ', ' . GeneralUtility::quoteJSvalue($scopeHash) . ');');
                        return '<a class="pm" onclick="' . $js . '">' . $icon . '</a>';
                } else {
                        return $icon;
index 4fbbcb6..3e87039 100644 (file)
                                                                                <type>popup</type>
                                                                                <title>LLL:EXT:cms/locallang_ttc.xml:media.browseUrlTitle</title>
                                                                                <icon>link_popup.gif</icon>
-                                                                               <script>browse_links.php?mode=wizard&amp;act=file|url</script>
+                                                                               <module type="array">
+                                                                                       <name>wizard_element_browser</name>
+                                                                                       <urlParameters type="array">
+                                                                                               <mode>wizard</mode>
+                                                                                               <act>file|url</act>
+                                                                                       </urlParameters>
+                                                                               </module>
                                                                                <params type="array">
                                                                                        <blindLinkOptions>page,folder,mail,spec</blindLinkOptions>
                                                                                        <allowedExtensions>class,swa,dcr,wav,avi,au,mov,asf,mpg,wmv,mp3,mp4,m4v,m4a,flv,ogg,ogv,swf,webm</allowedExtensions>
                                                                                                                <type>popup</type>
                                                                                                                <title>LLL:EXT:cms/locallang_ttc.xml:media.browseUrlTitle</title>
                                                                                                                <icon>link_popup.gif</icon>
-                                                                                                               <script>browse_links.php?mode=wizard&amp;act=file|url</script>
+                                                                                                               <module type="array">
+                                                                                                                       <name>wizard_element_browser</name>
+                                                                                                                       <urlParameters type="array">
+                                                                                                                               <mode>wizard</mode>
+                                                                                                                               <act>file|url</act>
+                                                                                                                       </urlParameters>
+                                                                                                               </module>
                                                                                                                <params type="array">
                                                                                                                        <blindLinkOptions>page,folder,mail,spec</blindLinkOptions>
                                                                                                                        <allowedExtensions>mov,mpg,mp4,m4a,m4v,ogg,ogv,swf,webm</allowedExtensions>
                                                                                <type>popup</type>
                                                                                <title>LLL:EXT:cms/locallang_ttc.xml:media.browseUrlTitle</title>
                                                                                <icon>link_popup.gif</icon>
-                                                                               <script>browse_links.php?mode=wizard&amp;act=file|url</script>
+                                                                               <module type="array">
+                                                                                       <name>wizard_element_browser</name>
+                                                                                       <urlParameters type="array">
+                                                                                               <mode>wizard</mode>
+                                                                                               <act>file|url</act>
+                                                                                       </urlParameters>
+                                                                               </module>
                                                                                <params type="array">
                                                                                        <blindLinkOptions>page,folder,mail,spec</blindLinkOptions>
                                                                                        <allowedExtensions>srt</allowedExtensions>
                                                                                                                <type>popup</type>
                                                                                                                <title>LLL:EXT:cms/locallang_ttc.xml:media.browseUrlTitle</title>
                                                                                                                <icon>link_popup.gif</icon>
-                                                                                                               <script>browse_links.php?mode=wizard&amp;act=file|url</script>
+                                                                                                               <module type="array">
+                                                                                                                       <name>wizard_element_browser</name>
+                                                                                                                       <urlParameters type="array">
+                                                                                                                               <mode>wizard</mode>
+                                                                                                                               <act>file|url</act>
+                                                                                                                       </urlParameters>
+                                                                                                               </module>
                                                                                                                <params type="array">
                                                                                                                        <blindLinkOptions>page,folder,mail,spec</blindLinkOptions>
                                                                                                                        <allowedExtensions>au,asf,mp3,m4a,oga,ogg, wav,webm,wmv</allowedExtensions>
                                                                                <type>popup</type>
                                                                                <title>LLL:EXT:cms/locallang_ttc.xml:media.browseUrlTitle</title>
                                                                                <icon>link_popup.gif</icon>
-                                                                               <script>browse_links.php?mode=wizard&amp;act=file|url</script>
+                                                                               <module type="array">
+                                                                                       <name>wizard_element_browser</name>
+                                                                                       <urlParameters type="array">
+                                                                                               <mode>wizard</mode>
+                                                                                               <act>file|url</act>
+                                                                                       </urlParameters>
+                                                                               </module>
                                                                                <params type="array">
                                                                                        <blindLinkOptions>page,folder,mail,spec</blindLinkOptions>
                                                                                        <allowedExtensions>au,asf,mp3,m4a,oga,swa,wav,webm,wmv</allowedExtensions>
                                                                                                                <type>popup</type>
                                                                                                                <title>LLL:EXT:cms/locallang_ttc.xml:media.browseUrlTitle</title>
                                                                                                                <icon>link_popup.gif</icon>
-                                                                                                               <script>browse_links.php?mode=wizard&amp;act=file|url</script>
+                                                                                                               <module type="array">
+                                                                                                                       <name>wizard_element_browser</name>
+                                                                                                                       <urlParameters type="array">
+                                                                                                                               <mode>wizard</mode>
+                                                                                                                               <act>file|url</act>
+                                                                                                                       </urlParameters>
+                                                                                                               </module>
                                                                                                                <params type="array">
                                                                                                                        <blindLinkOptions>page,folder,mail,spec</blindLinkOptions>
                                                                                                                        <allowedExtensions>au,asf,mp3,m4a,oga,ogg, wav,webm,wmv</allowedExtensions>
index 4952f7d..86f5747 100644 (file)
@@ -68,7 +68,7 @@ class ext_posMap extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
         * @todo Define visibility
         */
        public function wrapRecordTitle($str, $row) {
-               $aOnClick = 'jumpToUrl(\'' . $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('tt_content:' . $row['uid']))) . '\');return false;';
+               $aOnClick = 'jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('tt_content:' . $row['uid'])))) . ');return false;';
                return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $str . '</a>';
        }
 
@@ -82,7 +82,7 @@ class ext_posMap extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
         * @todo Define visibility
         */
        public function wrapColumnHeader($str, $vv) {
-               $aOnClick = 'jumpToUrl(\'' . $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('_EDIT_COL:' . $vv))) . '\');return false;';
+               $aOnClick = 'jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('_EDIT_COL:' . $vv)))) . ');return false;';
                return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $str . '</a>';
        }
 
@@ -103,7 +103,7 @@ class ext_posMap extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
                } else {
                        $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => 'tt_content:new/' . $pid . '/' . $vv));
                }
-               return 'jumpToUrl(\'' . $location . '\');return false;';
+               return 'jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($location) . ');return false;';
        }
 
        /**
index d074bcf..ca29a2e 100644 (file)
@@ -173,7 +173,12 @@ return array(
                                                'type' => 'popup',
                                                'title' => 'LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.link',
                                                'icon' => 'link_popup.gif',
-                                               'script' => 'browse_links.php?mode=wizard',
+                                               'module' => array(
+                                                       'name' => 'wizard_element_browser',
+                                                       'urlParameters' => array(
+                                                               'mode' => 'wizard'
+                                                       )
+                                               ),
                                                'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1'
                                        )
                                )
index bb976cd..dbd9905 100644 (file)
@@ -403,7 +403,12 @@ return array(
                                                'type' => 'popup',
                                                'title' => 'LLL:EXT:cms/locallang_ttc.xlf:header_link_formlabel',
                                                'icon' => 'link_popup.gif',
-                                               'script' => 'browse_links.php?mode=wizard',
+                                               'module' => array(
+                                                       'name' => 'wizard_element_browser',
+                                                       'urlParameters' => array(
+                                                               'mode' => 'wizard'
+                                                       )
+                                               ),
                                                'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1'
                                        )
                                ),
@@ -690,7 +695,12 @@ return array(
                                                'type' => 'popup',
                                                'title' => 'LLL:EXT:cms/locallang_ttc.xlf:image_link_formlabel',
                                                'icon' => 'link_popup.gif',
-                                               'script' => 'browse_links.php?mode=wizard',
+                                               'module' => array(
+                                                       'name' => 'wizard_element_browser',
+                                                       'urlParameters' => array(
+                                                               'mode' => 'wizard'
+                                                       )
+                                               ),
                                                'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1'
                                        )
                                ),
@@ -1000,7 +1010,12 @@ return array(
                                                'type' => 'popup',
                                                'title' => 'LLL:EXT:cms/locallang_ttc.xlf:image_link_formlabel',
                                                'icon' => 'link_popup.gif',
-                                               'script' => 'browse_links.php?mode=wizard',
+                                               'module' => array(
+                                                       'name' => 'wizard_element_browser',
+                                                       'urlParameters' => array(
+                                                               'mode' => 'wizard'
+                                                       )
+                                               ),
                                                'params' => array(
                                                        'blindLinkOptions' => 'folder,file,mail,spec',
                                                        'blindLinkFields' => 'target,title,class,params'
index 618a81a..9e597a5 100644 (file)
@@ -251,6 +251,24 @@ class ElementBrowser {
        public $fileProcessor;
 
        /**
+        * Sets the script url depending on being a module or script request
+        */
+       protected function determineScriptUrl() {
+               if ($moduleName = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M')) {
+                       $this->thisScript = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl($moduleName);
+               } else {
+                       $this->thisScript = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME');
+               }
+       }
+
+       /**
+        * @return string
+        */
+       protected function getThisScript() {
+               return strpos($this->thisScript, '?') === FALSE ? $this->thisScript . '?' : $this->thisScript . '&';
+       }
+
+       /**
         * Constructor:
         * Initializes a lot of variables, setting JavaScript functions in header etc.
         *
@@ -274,6 +292,7 @@ class ElementBrowser {
                }
                // Creating backend template object:
                $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
+               $this->doc->bodyTagId = 'typo3-browse-links-php';
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                // Load the Prototype library and browse_links.js
                $this->doc->getPageRenderer()->loadPrototype();
@@ -297,8 +316,7 @@ class ElementBrowser {
                // Site URL
                // Current site url
                $this->siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
-               // The script to link to
-               $this->thisScript = GeneralUtility::getIndpEnv('SCRIPT_NAME');
+               $this->determineScriptUrl();
                // Init fileProcessor
                $this->fileProcessor = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\File\\BasicFileUtility');
                $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
@@ -799,37 +817,37 @@ class ElementBrowser {
                        $menuDef['page']['isActive'] = $this->act == 'page';
                        $menuDef['page']['label'] = $GLOBALS['LANG']->getLL('page', TRUE);
                        $menuDef['page']['url'] = '#';
-                       $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
+                       $menuDef['page']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=page') . ');return false;"';
                }
                if (in_array('file', $allowedItems)) {
                        $menuDef['file']['isActive'] = $this->act == 'file';
                        $menuDef['file']['label'] = $GLOBALS['LANG']->getLL('file', TRUE);
                        $menuDef['file']['url'] = '#';
-                       $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
+                       $menuDef['file']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=file') . ');return false;"';
                }
                if (in_array('folder', $allowedItems)) {
                        $menuDef['folder']['isActive'] = $this->act == 'folder';
                        $menuDef['folder']['label'] = $GLOBALS['LANG']->getLL('folder', TRUE);
                        $menuDef['folder']['url'] = '#';
-                       $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(\'?act=folder\');return false;"';
+                       $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=folder') . ');return false;"';
                }
                if (in_array('url', $allowedItems)) {
                        $menuDef['url']['isActive'] = $this->act == 'url';
                        $menuDef['url']['label'] = $GLOBALS['LANG']->getLL('extUrl', TRUE);
                        $menuDef['url']['url'] = '#';
-                       $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
+                       $menuDef['url']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=url') . ');return false;"';
                }
                if (in_array('mail', $allowedItems)) {
                        $menuDef['mail']['isActive'] = $this->act == 'mail';
                        $menuDef['mail']['label'] = $GLOBALS['LANG']->getLL('email', TRUE);
                        $menuDef['mail']['url'] = '#';
-                       $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
+                       $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=mail') . ');return false;"';
                }
                if (is_array($this->thisConfig['userLinks.']) && in_array('spec', $allowedItems)) {
                        $menuDef['spec']['isActive'] = $this->act == 'spec';
                        $menuDef['spec']['label'] = $GLOBALS['LANG']->getLL('special', TRUE);
                        $menuDef['spec']['url'] = '#';
-                       $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
+                       $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=spec') . ');return false;"';
                }
                // Call hook for extra options
                foreach ($this->hookObjects as $hookObject) {
@@ -931,7 +949,8 @@ class ElementBrowser {
 
                                // Render the filelist if there is a folder selected
                                if ($selectedFolder) {
-                                       $files = $this->expandFolder($selectedFolder, $this->P['params']['allowedExtensions']);
+                                       $allowedExtensions = isset($this->P['params']['allowedExtensions']) ? $this->P['params']['allowedExtensions'] : '';
+                                       $files = $this->expandFolder($selectedFolder, $allowedExtensions);
                                }
                                $this->doc->JScode .= $this->doc->wrapScriptTags('
                                Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
@@ -2362,7 +2381,7 @@ class ElementBrowser {
                                <input type="hidden" name="file[upload][' . $a . '][data]" value="' . $a . '" /><br />';
                }
                // Make footer of upload form, including the submit button:
-               $redirectValue = $this->thisScript . '?act=' . $this->act . '&mode=' . $this->mode
+               $redirectValue = $this->getThisScript() . 'act=' . $this->act . '&mode=' . $this->mode
                        . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())
                        . '&bparams=' . rawurlencode($this->bparams);
                $code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />';
@@ -2426,7 +2445,7 @@ class ElementBrowser {
                                . '<input type="hidden" name="file[newfolder][' . $a . '][target]" value="'
                                . htmlspecialchars($folderObject->getCombinedIdentifier()) . '" />';
                // Make footer of upload form, including the submit button:
-               $redirectValue = $this->thisScript . '?act=' . $this->act . '&mode=' . $this->mode
+               $redirectValue = $this->getThisScript() . 'act=' . $this->act . '&mode=' . $this->mode
                        . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())
                        . '&bparams=' . rawurlencode($this->bparams);
                $code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />'
@@ -2472,7 +2491,7 @@ class ElementBrowser {
                                . '&expandFolder=' . rawurlencode($this->selectedFolder->getCombinedIdentifier())
                                . '&bparams=' . rawurlencode($this->bparams);
                        $thumbNailCheck = BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'],
-                                       $this->thisScript, $addParams, 'id="checkDisplayThumbs"')
+                                       \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M') ? '' : $this->thisScript, $addParams, 'id="checkDisplayThumbs"')
                                . ' <label for="checkDisplayThumbs">'
                                . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', TRUE) . '</label>';
                        $out .= $this->doc->spacer(5) . $thumbNailCheck . $this->doc->spacer(15);
index 4c0388b..27f154a 100644 (file)
@@ -91,6 +91,9 @@ class ElementBrowserController {
                // this might not be needed but some classes refer to $GLOBALS['SOBE']->doc, so ...
                $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
+               // Apply the same styles as those of the base script
+               $this->doc->bodyTagId = 'typo3-browse-links-php';
+
        }
 
        /**
index 39c5aa9..3b20b29 100644 (file)
@@ -26,6 +26,8 @@ namespace TYPO3\CMS\Recordlist\Controller;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Script Class, putting the frameset together.
@@ -50,6 +52,7 @@ class ElementBrowserFramesetController {
                // Setting GPvars:
                $mode = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('mode');
                $bparams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('bparams');
+               $moduleUrl = BackendUtility::getModuleUrl('wizard_element_browser') . '&mode=';
                // Set doktype:
                $GLOBALS['TBE_TEMPLATE']->docType = 'xhtml_frames';
                $GLOBALS['TBE_TEMPLATE']->JScode = $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
@@ -57,7 +60,7 @@ class ElementBrowserFramesetController {
                                        close();
                                }
                                function setParams(mode,params) {       //
-                                       parent.content.location.href = "browse_links.php?mode="+mode+"&bparams="+params;
+                                       parent.content.location.href = ' . GeneralUtility::quoteJSvalue($moduleUrl) . '+mode+"&bparams="+params;
                                }
                                if (!window.opener) {
                                        alert("ERROR: Sorry, no link to main window... Closing");
@@ -66,7 +69,7 @@ class ElementBrowserFramesetController {
                ');
                $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:TYPO3_Element_Browser'));
                // URL for the inner main frame:
-               $url = $GLOBALS['BACK_PATH'] . 'browse_links.php?mode=' . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams);
+               $url = $GLOBALS['BACK_PATH'] . $moduleUrl . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams);
                // Create the frameset for the window:
                // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload"
                $this->content .= '
index 8d6506c..2c2147b 100644 (file)
@@ -1082,14 +1082,14 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
                                        if (isset($this->currentTable['prev'][$row['uid']])) {
                                                // Up
                                                $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prev'][$row['uid']];
-                                               $cells['moveUp'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL('moveUp', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-up') . '</a>';
+                                               $cells['moveUp'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->doc->issueCommand($params, -1)) . ');')) . '" title="' . $GLOBALS['LANG']->getLL('moveUp', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-up') . '</a>';
                                        } else {
                                                $cells['moveUp'] = $this->spaceIcon;
                                        }
                                        if ($this->currentTable['next'][$row['uid']]) {
                                                // Down
                                                $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']];
-                                               $cells['moveDown'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL('moveDown', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-down') . '</a>';
+                                               $cells['moveDown'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->doc->issueCommand($params, -1)) . ');')) . '" title="' . $GLOBALS['LANG']->getLL('moveDown', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-down') . '</a>';
                                        } else {
                                                $cells['moveDown'] = $this->spaceIcon;
                                        }
@@ -1102,10 +1102,10 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
                                if ($permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField))) {
                                        if ($row[$hiddenField]) {
                                                $params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0';
-                                               $cells['hide'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL(('unHide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>';
+                                               $cells['hide'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->doc->issueCommand($params, -1)) . ');')) . '" title="' . $GLOBALS['LANG']->getLL(('unHide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>';
                                        } else {
                                                $params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
-                                               $cells['hide'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL(('hide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-hide') . '</a>';
+                                               $cells['hide'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->doc->issueCommand($params, -1)) . ');')) . '" title="' . $GLOBALS['LANG']->getLL(('hide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-hide') . '</a>';
                                        }
                                } elseif (!$this->table) {
                                        $cells['hide'] = $this->spaceIcon;
@@ -1135,8 +1135,7 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
 
                                        $params = '&cmd[' . $table . '][' . $row['uid'] . '][delete]=1';
                                        $onClick = htmlspecialchars(
-                                               ('if (confirm(' . $warningText . ')) {jumpToUrl(\''
-                                                       . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');} return false;')
+                                               ('if (confirm(' . $warningText . ')) {jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->doc->issueCommand($params, -1)) . ');} return false;')
                                        );
 
                                        $icon = IconUtility::getSpriteIcon('actions-edit-' . $actionName);
@@ -1150,14 +1149,14 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
                                        // Up (Paste as the page right after the current parent page)
                                        if ($this->calcPerms & 8) {
                                                $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id;
-                                               $cells['moveLeft'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL('prevLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-left') . '</a>';
+                                               $cells['moveLeft'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->doc->issueCommand($params, -1)) . ');')) . '" title="' . $GLOBALS['LANG']->getLL('prevLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-left') . '</a>';
                                        }
                                        // Down (Paste as subpage to the page right above)
                                        if ($this->currentTable['prevUid'][$row['uid']]) {
                                                $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']]));
                                                if ($localCalcPerms & 8) {
                                                        $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']];
-                                                       $cells['moveRight'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL('nextLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-right') . '</a>';
+                                                       $cells['moveRight'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(' . GeneralUtility::quoteJSvalue($GLOBALS['SOBE']->doc->issueCommand($params, -1)) . ');')) . '" title="' . $GLOBALS['LANG']->getLL('nextLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-right') . '</a>';
                                                } else {
                                                        $cells['moveRight'] = $this->spaceIcon;
                                                }
diff --git a/typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/conf.php b/typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/conf.php
new file mode 100644 (file)
index 0000000..14907f0
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+//required for mod.php
+$MCONF['name'] = 'wizard_browse_links';
+$MCONF['script'] = '_DISPATCH';
+$MCONF['access'] = '';
diff --git a/typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/index.php b/typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/index.php
new file mode 100644 (file)
index 0000000..867713b
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Helmut Hummel <helmut.hummel@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the text file GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Displays the page/file tree for browsing database records or files.
+ * Used from TCEFORMS an other elements
+ * In other words: This is the ELEMENT BROWSER!
+ */
+$elementBrowserController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recordlist\\Controller\\ElementBrowserController');
+$elementBrowserController->main();
+$elementBrowserController->printContent();
index 4892cd9..718ca21 100644 (file)
@@ -13,4 +13,10 @@ if (TYPO3_MODE === 'BE') {
                '',
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'mod1/'
        );
-}
+
+       // Register element browser wizard
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'wizard_element_browser',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/ElementBrowserWizard/'
+       );
+}
\ No newline at end of file
index 886a4f3..a42d145 100644 (file)
@@ -136,8 +136,7 @@ class BrowseLinks extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                }
                // Current site url
                $this->siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
-               // the script to link to
-               $this->thisScript = GeneralUtility::getIndpEnv('SCRIPT_NAME');
+               $this->determineScriptUrl();
        }
 
        /**
@@ -468,37 +467,37 @@ class BrowseLinks extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                        $menuDef['page']['isActive'] = $this->act == 'page';
                        $menuDef['page']['label'] = $GLOBALS['LANG']->getLL('page', TRUE);
                        $menuDef['page']['url'] = '#';
-                       $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'' . htmlspecialchars(('?act=page&mode=' . $this->mode . '&bparams=' . $this->bparams)) . '\');return false;"';
+                       $menuDef['page']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue(($this->getThisScript() . 'act=page&mode=' . $this->mode . '&bparams=' . $this->bparams)) . ');return false;"';
                }
                if (in_array('file', $this->allowedItems)) {
                        $menuDef['file']['isActive'] = $this->act == 'file';
                        $menuDef['file']['label'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:file', TRUE);
                        $menuDef['file']['url'] = '#';
-                       $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'' . htmlspecialchars(('?act=file&mode=' . $this->mode . '&bparams=' . $this->bparams)) . '\');return false;"';
+                       $menuDef['file']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue(($this->getThisScript() . 'act=file&mode=' . $this->mode . '&bparams=' . $this->bparams)) . ');return false;"';
                }
                if (in_array('folder', $this->allowedItems)) {
                        $menuDef['folder']['isActive'] = $this->act == 'folder';
                        $menuDef['folder']['label'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:folder', TRUE);
                        $menuDef['folder']['url'] = '#';
-                       $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(\'' . htmlspecialchars(('?act=folder&mode=' . $this->mode . '&bparams=' . $this->bparams)) . '\');return false;"';
+                       $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue(($this->getThisScript() . 'act=folder&mode=' . $this->mode . '&bparams=' . $this->bparams)) . ');return false;"';
                }
                if (in_array('url', $this->allowedItems)) {
                        $menuDef['url']['isActive'] = $this->act == 'url';
                        $menuDef['url']['label'] = $GLOBALS['LANG']->getLL('extUrl', TRUE);
                        $menuDef['url']['url'] = '#';
-                       $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'' . htmlspecialchars(('?act=url&mode=' . $this->mode . '&bparams=' . $this->bparams)) . '\');return false;"';
+                       $menuDef['url']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue(($this->getThisScript() . 'act=url&mode=' . $this->mode . '&bparams=' . $this->bparams)) . ');return false;"';
                }
                if (in_array('mail', $this->allowedItems)) {
                        $menuDef['mail']['isActive'] = $this->act == 'mail';
                        $menuDef['mail']['label'] = $GLOBALS['LANG']->getLL('email', TRUE);
                        $menuDef['mail']['url'] = '#';
-                       $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'' . htmlspecialchars(('?act=mail&mode=' . $this->mode . '&bparams=' . $this->bparams)) . '\');return false;"';
+                       $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue(($this->getThisScript() . 'act=mail&mode=' . $this->mode . '&bparams=' . $this->bparams)) . ');return false;"';
                }
                if (is_array($this->thisConfig['userLinks.']) && in_array('spec', $this->allowedItems)) {
                        $menuDef['spec']['isActive'] = $this->act == 'spec';
                        $menuDef['spec']['label'] = $GLOBALS['LANG']->getLL('special', TRUE);
                        $menuDef['spec']['url'] = '#';
-                       $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'' . htmlspecialchars(('?act=spec&mode=' . $this->mode . '&bparams=' . $this->bparams)) . '\');return false;"';
+                       $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(' . GeneralUtility::quoteJSvalue(($this->getThisScript() . 'act=spec&mode=' . $this->mode . '&bparams=' . $this->bparams)) . ');return false;"';
                }
                // call hook for extra options
                foreach ($this->hookObjects as $hookObject) {
index 5529f5a..b221873 100644 (file)
@@ -42,6 +42,13 @@ class BrowseLinksController {
        protected $content = '';
 
        /**
+        * Initialize language files
+        */
+       public function __construct() {
+               $GLOBALS['LANG']->includeLLFile('EXT:rtehtmlarea/mod3/locallang.xlf');
+               $GLOBALS['LANG']->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xlf');
+       }
+       /**
         * Main function, rendering the element browser in RTE mode.
         *
         * @return      void
index 3758bfc..1d91648 100644 (file)
@@ -23,6 +23,9 @@ namespace TYPO3\CMS\Rtehtmlarea\Extension;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * TYPO3Link plugin for htmlArea RTE
  *
@@ -82,7 +85,7 @@ class Typo3Link extends \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi {
                        RTEarea[' . $RTEcounter . '].buttons.' . $button . ' = new Object();';
                        }
                        $registerRTEinJavascriptString .= '
-                       RTEarea[' . $RTEcounter . '].buttons.' . $button . '.pathLinkModule = "' . $this->htmlAreaRTE->extHttpPath . 'mod3/browse_links.php";';
+                       RTEarea[' . $RTEcounter . '].buttons.' . $button . '.pathLinkModule = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_element_browser'));
                        if ($this->htmlAreaRTE->is_FE()) {
                                $RTEProperties = $this->htmlAreaRTE->RTEsetup;
                        } else {
index d86ed10..e13d6fe 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace TYPO3\CMS\Rtehtmlarea;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Base extension class which generates the folder tree.
@@ -13,7 +14,7 @@ class FolderTree extends \localFolderTree {
         * Constructor function of the class
         */
        public function __construct() {
-               // The backpath is set her to fix problems with relatives path when used in ajax scope
+               // The backpath is set here to fix problems with relatives path when used in ajax scope
                $GLOBALS['BACK_PATH'] = isset($GLOBALS['ajaxID']) ? '../../../' : $GLOBALS['BACK_PATH'];
                parent::__construct();
        }
@@ -21,14 +22,14 @@ class FolderTree extends \localFolderTree {
        /**
         * Wrapping the title in a link, if applicable.
         *
-        * @param       string                  Title, ready for output.
-        * @param       \TYPO3\CMS\Core\Resource\Folder The "record
-        * @return      string                  Wrapping title string.
+        * @param string $title Title, ready for output.
+        * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The "record"
+        * @return string Wrapping title string.
         * @todo Define visibility
         */
        public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
                if ($this->ext_isLinkable($folderObject)) {
-                       $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&contentTypo3Charset=' . $GLOBALS['SOBE']->browser->contentTypo3Charset . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
+                       $aOnClick = 'return jumpToUrl(\'' . $this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&contentTypo3Charset=' . $GLOBALS['SOBE']->browser->contentTypo3Charset . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
                        return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
                } else {
                        return '<span class="typo3-dimmed">' . $title . '</span>';
@@ -62,8 +63,8 @@ class FolderTree extends \localFolderTree {
                if ($this->thisScript) {
                        // Activates dynamic AJAX based tree
                        $scopeData = serialize($this->scope);
-                       $scopeHash = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac($scopeData);
-                       $js = htmlspecialchars('Tree.thisScript=\'' . $this->backPath . 'ajax.php\',Tree.load(\'' . $cmd . '\', ' . (int)$isExpand . ', this, ' . json_encode($scopeData) . ', \'' . $scopeHash . '\');');
+                       $scopeHash = GeneralUtility::hmac($scopeData);
+                       $js = htmlspecialchars('Tree.load(' . GeneralUtility::quoteJSvalue($cmd) . ', ' . (int)$isExpand . ', this, ' . GeneralUtility::quoteJSvalue($scopeData) . ', ' . GeneralUtility::quoteJSvalue($scopeHash) . ');');
                        return '<a class="pm" onclick="' . $js . '">' . $icon . '</a>';
                } else {
                        return $icon;
index fa648a8..20d8b35 100644 (file)
@@ -37,6 +37,8 @@ namespace TYPO3\CMS\Rtehtmlarea;
  * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @author     Stanislas Rolland <typo3(arobas)sjbr.ca>
  */
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Class which generates the page tree
  *
@@ -67,7 +69,7 @@ class PageTree extends \localPageTree {
                        } else {
                                $arrCol = '<td></td>';
                        }
-                       $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['row']['uid'] . '\');';
+                       $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['row']['uid']) . ');';
                        $cEbullet = $this->ext_isLinkable($v['row']['doktype'], $v['row']['uid']) ? '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/arrowbullet.gif', 'width="18" height="16"') . ' alt="" /></a>' : '';
                        $out .= '
                                <tr class="' . $bgColorClass . '">
index d4734cf..fe61014 100644 (file)
@@ -164,9 +164,7 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                }
                // Site URL
                $this->siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
-               // Current site url
-               // the script to link to
-               $this->thisScript = GeneralUtility::getIndpEnv('SCRIPT_NAME');
+               $this->determineScriptUrl();
        }
 
        /**
@@ -370,10 +368,10 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                        var HTMLArea = window.parent.HTMLArea;
 
                        HTMLArea.TYPO3Image.insertElement = function (table, uid, type, filename, filePath, fileExt, fileIcon) {
-                               return jumpToUrl(\'?editorNo=\' + \'' . $editorNo . '\' + \'&insertImage=\' + filePath + \'&table=\' + table + \'&uid=\' + uid + \'&type=\' + type + \'bparams=\' + \'' . $this->bparams . '\');
+                               return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'editorNo=') . ' + \'' . $editorNo . '\' + \'&insertImage=\' + filePath + \'&table=\' + table + \'&uid=\' + uid + \'&type=\' + type + \'bparams=\' + \'' . $this->bparams . '\');
                        }
                        function insertElement(table, uid, type, fileName, filePath, fileExt, fileIcon, action, close) {
-                               return jumpToUrl(\'?editorNo=\' + \'' . $editorNo . '\' + \'&insertImage=\' + filePath + \'&table=\' + table + \'&uid=\' + uid + \'&type=\' + type + \'bparams=\' + \'' . $this->bparams . '\');
+                               return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'editorNo=') . ' + \'' . $editorNo . '\' + \'&insertImage=\' + filePath + \'&table=\' + table + \'&uid=\' + uid + \'&type=\' + type + \'bparams=\' + \'' . $this->bparams . '\');
                        }
                        function initEventListeners() {
                                if (Ext.isWebKit) {
@@ -694,25 +692,25 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                        $menuDef['image']['isActive'] = FALSE;
                        $menuDef['image']['label'] = $GLOBALS['LANG']->getLL('currentImage', TRUE);
                        $menuDef['image']['url'] = '#';
-                       $menuDef['image']['addParams'] = 'onClick="jumpToUrl(\'?act=image&bparams=' . $this->bparams . '\');return false;"';
+                       $menuDef['image']['addParams'] = 'onClick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=image&bparams=' . $this->bparams) . ');return false;"';
                }
                if (in_array('magic', $this->allowedItems)) {
                        $menuDef['magic']['isActive'] = FALSE;
                        $menuDef['magic']['label'] = $GLOBALS['LANG']->getLL('magicImage', TRUE);
                        $menuDef['magic']['url'] = '#';
-                       $menuDef['magic']['addParams'] = 'onClick="jumpToUrl(\'?act=magic&bparams=' . $this->bparams . '\');return false;"';
+                       $menuDef['magic']['addParams'] = 'onClick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=magic&bparams=' . $this->bparams) . ');return false;"';
                }
                if (in_array('plain', $this->allowedItems)) {
                        $menuDef['plain']['isActive'] = FALSE;
                        $menuDef['plain']['label'] = $GLOBALS['LANG']->getLL('plainImage', TRUE);
                        $menuDef['plain']['url'] = '#';
-                       $menuDef['plain']['addParams'] = 'onClick="jumpToUrl(\'?act=plain&bparams=' . $this->bparams . '\');return false;"';
+                       $menuDef['plain']['addParams'] = 'onClick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=plain&bparams=' . $this->bparams) . ');return false;"';
                }
                if (in_array('dragdrop', $this->allowedItems)) {
                        $menuDef['dragdrop']['isActive'] = FALSE;
                        $menuDef['dragdrop']['label'] = $GLOBALS['LANG']->getLL('dragDropImage', TRUE);
                        $menuDef['dragdrop']['url'] = '#';
-                       $menuDef['dragdrop']['addParams'] = 'onClick="jumpToUrl(\'?act=dragdrop&bparams=' . $this->bparams . '\');return false;"';
+                       $menuDef['dragdrop']['addParams'] = 'onClick="jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=dragdrop&bparams=' . $this->bparams) . ');return false;"';
                }
                // Call hook for extra options
                foreach ($this->hookObjects as $hookObject) {
index 6975edd..2e64558 100644 (file)
@@ -281,7 +281,7 @@ class User {
                                } else {
                                        $title = $GLOBALS['LANG']->sL($title, TRUE);
                                }
-                               $lines[] = '<tr><td colspan="3" class="bgColor5"><a href="#" title="' . $GLOBALS['LANG']->getLL('expand', TRUE) . '" onClick="jumpToUrl(\'?OC_key=' . ($openKeys[$openK] ? 'C|' : 'O|') . $openK . '\');return false;"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], ('gfx/ol/' . ($openKeys[$openK] ? 'minus' : 'plus') . 'bullet.gif'), 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('expand', TRUE) . '" /><strong>' . $title . '</strong></a></td></tr>';
+                               $lines[] = '<tr><td colspan="3" class="bgColor5"><a href="#" title="' . $GLOBALS['LANG']->getLL('expand', TRUE) . '" onClick="jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('?OC_key=' . ($openKeys[$openK] ? 'C|' : 'O|') . $openK) . ');return false;"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], ('gfx/ol/' . ($openKeys[$openK] ? 'minus' : 'plus') . 'bullet.gif'), 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('expand', TRUE) . '" /><strong>' . $title . '</strong></a></td></tr>';
                                $lines[] = $v;
                        }
                        $content .= '<table border="0" cellpadding="1" cellspacing="1">' . implode('', $lines) . '</table>';
index a5c9977..1786964 100644 (file)
@@ -60,3 +60,10 @@ if (TYPO3_MODE === 'BE' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::i
        ));
        $GLOBALS['TYPO3_USER_SETTINGS']['showitem'] .= ',--div--;LLL:EXT:rtehtmlarea/locallang.xlf:rteSettings,rteWidth,rteHeight,rteResize,rteMaxHeight,rteCleanPasteBehaviour';
 }
+if (TYPO3_MODE === 'BE') {
+       // Register RTE element browser wizard
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'rtehtmlarea_wizard_element_browser',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'mod3/'
+       );
+}
\ No newline at end of file
index 15a4c78..6e65d11 100644 (file)
@@ -6580,7 +6580,7 @@ HTMLArea.Plugin = Ext.extend(HTMLArea.Plugin, {
         * @return      string          the url
         */
        makeUrlFromModulePath: function(modulePath, parameters) {
-               return modulePath + '?' + this.editorConfiguration.RTEtsConfigParams + '&editorNo=' + this.editor.editorId + '&sys_language_content=' + this.editorConfiguration.sys_language_content + '&contentTypo3Language=' + this.editorConfiguration.typo3ContentLanguage + (parameters?parameters:'');
+               return modulePath + (modulePath.indexOf("?") === -1 ? "?" : "&") + this.editorConfiguration.RTEtsConfigParams + '&editorNo=' + this.editor.editorId + '&sys_language_content=' + this.editorConfiguration.sys_language_content + '&contentTypo3Language=' + this.editorConfiguration.typo3ContentLanguage + (parameters?parameters:'');
        },
        /**
         * Append an entry at the end of the troubleshooting log
diff --git a/typo3/sysext/rtehtmlarea/mod3/browse_links.php b/typo3/sysext/rtehtmlarea/mod3/browse_links.php
deleted file mode 100644 (file)
index 34e8236..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
- *  (c) 2005-2013 Stanislas Rolland <typo3(arobas)sjbr.ca>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the text file GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Displays the page/file tree for browsing database records or files.
- * Used from TCEFORMS an other elements
- * In other words: This is the ELEMENT BROWSER!
- *
- * Adapted for htmlArea RTE by Stanislas Rolland
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @author     Stanislas Rolland <typo3(arobas)sjbr.ca>
- */
-error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED));
-unset($MCONF);
-require __DIR__ . '/conf.php';
-require $BACK_PATH . 'init.php';
-$LANG->includeLLFile('EXT:rtehtmlarea/mod3/locallang.xlf');
-$LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xlf');
-/*
- * @deprecated since 6.0, the classname tx_rtehtmlarea_SC_browse_links and this file is obsolete
- * and will be removed with 6.2. The class was renamed and is now located at:
- * typo3/sysext/rtehtmlarea/Classes/Controller/BrowseLinksController.php
- */
-require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('rtehtmlarea') . 'Classes/Controller/BrowseLinksController.php';
-// Make instance:
-$SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Rtehtmlarea\\Controller\\BrowseLinksController');
-$SOBE->main();
-$SOBE->printContent();
diff --git a/typo3/sysext/rtehtmlarea/mod3/index.php b/typo3/sysext/rtehtmlarea/mod3/index.php
new file mode 100644 (file)
index 0000000..8e91b45
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
+ *  (c) 2005-2013 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the text file GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Displays the page/file tree for browsing database records or files.
+ * Used from TCEFORMS an other elements
+ * In other words: This is the ELEMENT BROWSER!
+ *
+ * Adapted for htmlArea RTE by Stanislas Rolland
+ *
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @author     Stanislas Rolland <typo3(arobas)sjbr.ca>
+ */
+
+// Make instance:
+$SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Rtehtmlarea\\Controller\\BrowseLinksController');
+$SOBE->main();
+$SOBE->printContent();