[TASK] Make Backend Ajax URLs absolute 21/38321/4
authorBenjamin Mack <benni@typo3.org>
Sat, 28 Mar 2015 11:10:34 +0000 (12:10 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 29 Mar 2015 17:09:42 +0000 (19:09 +0200)
All ajaxURLs are now referenced with the absolute path,
a back path is not necessary anymore.

Resolves: #66109
Releases: master
Change-Id: Ie49b8bc8af0eb450096473f1fb6c393c8b7bbe74
Reviewed-on: http://review.typo3.org/38321
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/rtehtmlarea/Classes/Extension/Spellchecker.php
typo3/sysext/t3editor/Classes/T3editor.php
typo3/sysext/t3editor/res/jslib/t3editor.js
typo3/sysext/t3editor/res/jslib/ts_codecompletion/tscodecompletion.js
typo3/sysext/t3editor/res/jslib/ts_codecompletion/tsref.js

index 9acd236..dc38867 100644 (file)
@@ -3162,17 +3162,12 @@ class BackendUtility {
         *
         * @param string $ajaxIdentifier Identifier of the AJAX callback
         * @param array $urlParameters URL parameters that should be added as key value pairs
-        * @param bool $backPathOverride Backpath that should be used instead of the global $BACK_PATH
+        * @param bool $backPathOverride (unused)
         * @param bool $returnAbsoluteUrl If set to TRUE, the URL returned will be absolute, $backPathOverride will be ignored in this case
         * @return string Calculated URL
         * @internal
         */
        static public function getAjaxUrl($ajaxIdentifier, array $urlParameters = array(), $backPathOverride = FALSE, $returnAbsoluteUrl = FALSE) {
-               if ($backPathOverride) {
-                       $backPath = $backPathOverride;
-               } else {
-                       $backPath = isset($GLOBALS['BACK_PATH']) ? $GLOBALS['BACK_PATH'] : '';
-               }
                $additionalUrlParameters = array(
                        'ajaxID' => $ajaxIdentifier
                );
@@ -3183,7 +3178,7 @@ class BackendUtility {
                if ($returnAbsoluteUrl) {
                        return GeneralUtility::getIndpEnv('TYPO3_REQUEST_DIR') . $url;
                } else {
-                       return $backPath . $url;
+                       return PathUtility::getAbsoluteWebPath(PATH_typo3 . $url);
                }
        }
 
index ccf8e91..c687ab5 100644 (file)
@@ -110,7 +110,7 @@ class Spellchecker extends \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi {
                        RTEarea[' . $RTEcounter . '].buttons.' . $button . '.spellCheckerMode = "' . $spellCheckerMode . '";
                        RTEarea[' . $RTEcounter . '].buttons.' . $button . '.enablePersonalDicts = ' . ($enablePersonalDicts ? 'true' : 'false') . ';';
                        $registerRTEinJavascriptString .= '
-                       RTEarea[' . $RTEcounter . '].buttons.' . $button . '.path = "' . ($this->htmlAreaRTE->is_FE() || $this->htmlAreaRTE->isFrontendEditActive() ? ($GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . 'index.php?eID=rtehtmlarea_spellchecker' : $this->htmlAreaRTE->backPath . BackendUtility::getAjaxUrl('rtehtmlarea::spellchecker')) . '";';
+                       RTEarea[' . $RTEcounter . '].buttons.' . $button . '.path = "' . ($this->htmlAreaRTE->is_FE() || $this->htmlAreaRTE->isFrontendEditActive() ? ($GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . 'index.php?eID=rtehtmlarea_spellchecker' : BackendUtility::getAjaxUrl('rtehtmlarea::spellchecker')) . '";';
                }
                return $registerRTEinJavascriptString;
        }
index 1ebec1a..df0d677 100644 (file)
@@ -183,7 +183,6 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface {
                                'T3editor.lang = ' . json_encode($GLOBALS['LANG']->getLabelsWithPrefix('js.', 'label_')) . ';' . LF .
                                'T3editor.PATH_t3e = "' . $GLOBALS['BACK_PATH'] . $path_t3e . '"; ' . LF .
                                'T3editor.PATH_codemirror = "' . $GLOBALS['BACK_PATH'] . $path_codemirror . '"; ' . LF .
-                               'T3editor.URL_typo3 = "' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir) . '"; ' . LF .
                                'T3editor.template = ' . $this->getPreparedTemplate() . ';' . LF .
                                'T3editor.ajaxSavetype = "' . $this->ajaxSaveType . '";' . LF
                        );
index 373e785..cd795f5 100644 (file)
@@ -320,7 +320,7 @@ if (!Prototype.Browser.MobileSafari) {
                                                }, event.memo.parameters);
 
                                                new Ajax.Request(
-                                                       T3editor.URL_typo3 + TYPO3.settings.ajaxUrls['T3Editor::saveCode'], {
+                                                       TYPO3.settings.ajaxUrls['T3Editor::saveCode'], {
                                                                parameters: params,
                                                                onComplete: function(ajaxrequest) {
                                                                        var wasSuccessful = ajaxrequest.status == 200
index d0751b7..f122cbf 100644 (file)
@@ -99,7 +99,7 @@ var TsCodeCompletion = function(codeMirror, outerdiv) {
         */
        function loadPluginArray() {
                new Ajax.Request(
-                       T3editor.URL_typo3 + TYPO3.settings.ajaxUrls['T3Editor::getPlugins'],
+                       TYPO3.settings.ajaxUrls['T3Editor::getPlugins'],
                                {
                                method: 'get',
                                onSuccess: function(transport) {
@@ -147,7 +147,7 @@ var TsCodeCompletion = function(codeMirror, outerdiv) {
        function loadExtTemplatesAsync() {
                var urlParameters = '&pageId=' + getGetVar('id');
                new Ajax.Request(
-                       T3editor.URL_typo3 + TYPO3.settings.ajaxUrls['CodeCompletion::loadTemplates'],
+                       TYPO3.settings.ajaxUrls['CodeCompletion::loadTemplates'],
                        {
                                method: 'get',
                                parameters: urlParameters,
index fed478d..af15daf 100644 (file)
@@ -31,7 +31,7 @@ var TsRefProperty = function(parentType,name,value) {
                        var urlParameters = '&typeId=' + this.parentType + '&parameterName=' + this.name;
 
                        new Ajax.Request(
-                               T3editor.URL_typo3 + TYPO3.settings.ajaxUrls['T3Editor_TSrefLoader::getDescription'],
+                               TYPO3.settings.ajaxUrls['T3Editor_TSrefLoader::getDescription'],
                                {
                                        method: 'get',
                                        parameters: urlParameters,
@@ -76,7 +76,7 @@ var TsRef = function() {
 
        this.loadTsrefAsync = function() {
                new Ajax.Request(
-                       T3editor.URL_typo3 + TYPO3.settings.ajaxUrls['T3Editor_TSrefLoader::getTypes'],
+                       TYPO3.settings.ajaxUrls['T3Editor_TSrefLoader::getTypes'],
                        {
                                method: 'get',
                                onSuccess: function(transport) {