* Fixed issue 7052: Permission problem of RTE images
[Packages/TYPO3.CMS.git] / typo3 / alt_doc_ajax.php
index 17cfae4..e432031 100755 (executable)
@@ -70,10 +70,18 @@ class SC_alt_doc_ajax {
        var $R_URL_parts;                       // Contains the parts of the REQUEST_URI (current url). By parts we mean the result of resolving REQUEST_URI (current url) by the parse_url() function. The result is an array where eg. "path" is the script path and "query" is the parameters...
        var $R_URL_getvars;                     // Contains the current GET vars array; More specifically this array is the foundation for creating the R_URI internal var (which becomes the "url of this script" to which we submit the forms etc.)
        var $R_URI;                                     // Set to the URL of this script including variables which is needed to re-display the form. See main()
-       var $tceforms;                          // Contains the instance of TCEforms class.
+
+       /**
+        * instance of TCEforms class
+        *
+        * @var t3lib_TCEforms
+        */
+       var $tceforms;
        var $localizationMode;          // GP var, localization mode for TCEforms (eg. "text")
        var $ajax = array();            // the AJAX paramerts from get/post
 
+       var $doc;                                       // Document template object
+
        function init() {
                global $BE_USER;
 
@@ -95,6 +103,12 @@ class SC_alt_doc_ajax {
                        // CLEANSE SETTINGS
                $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
 
+                       // Create an instance of the document template object
+               $this->doc = t3lib_div::makeInstance('template');
+               $this->doc->backPath = $GLOBALS['BACK_PATH'];
+               $this->doc->docType = 'xhtml_trans';
+
+                       // Initialize TCEforms (rendering the forms)
                $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
                $this->tceforms->initDefaultBEMode();
                $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
@@ -122,6 +136,7 @@ class SC_alt_doc_ajax {
                header('Last-Modified: '.gmdate("D, d M Y H:i:s").' GMT');
                header('Cache-Control: no-cache, must-revalidate');
                header('Pragma: no-cache');
+               header('Content-type: text/javascript; charset=utf-8');
 
                $this->content = '';
 
@@ -130,8 +145,12 @@ class SC_alt_doc_ajax {
                        $method = array_shift($this->ajax);
 
                                // Security check
-                       if(!in_array($method, array('createNewRecord', 'setExpandedCollapsedState'))) return false;
+                       if (!in_array($method, array('createNewRecord', 'setExpandedCollapsedState'))) {
+                               return false;
+                       }
 
+                               // Perform the requested action:
+                       $this->tceforms->inline->initForAJAX($method, $this->ajax);
                        $this->content = call_user_func_array(
                                array(&$this->tceforms->inline, $method),
                                $this->ajax