[CLEANUP] Cleanup jumpToUrl() and unused JS in Backend
[Packages/TYPO3.CMS.git] / typo3 / sysext / func / Classes / Controller / PageFunctionsController.php
index 3e7ceda..4bc82da 100644 (file)
@@ -15,7 +15,7 @@ namespace TYPO3\CMS\Func\Controller;
  *
  *  The GNU General Public License can be found at
  *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  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.
  *
  *
@@ -27,6 +27,8 @@ namespace TYPO3\CMS\Func\Controller;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+
 /**
  * Script Class for the Web > Functions module
  * This class creates the framework to which other extensions can connect their sub-modules
@@ -70,7 +72,7 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
        public function main() {
                // Access check...
                // The page will show only if there is a valid page and if this page may be viewed by the user
-               $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
+               $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
                $access = is_array($this->pageinfo);
                // Template markers
                $markers = array(
@@ -84,19 +86,10 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                // Main
                if ($this->id && $access) {
                        // JavaScript
-                       $this->doc->JScode = $this->doc->wrapScriptTags('
-                               script_ended = 0;
-                               function jumpToUrl(URL) {
-                                       window.location.href = URL;
-                               }
-                       ');
-                       $this->doc->postCode = $this->doc->wrapScriptTags('
-                               script_ended = 1;
-                               if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
-                       ');
+                       $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';');
                        // Setting up the context sensitive menu:
                        $this->doc->getContextMenuCode();
-                       $this->doc->form = '<form action="index.php" method="post"><input type="hidden" name="id" value="' . $this->id . '" />';
+                       $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />';
                        $vContent = $this->doc->getVersionSelector($this->id, TRUE);
                        if ($vContent) {
                                $this->content .= $this->doc->section('', $vContent);
@@ -105,7 +98,7 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                        // Setting up the buttons and markers for docheader
                        $docHeaderButtons = $this->getButtons();
                        $markers['CSH'] = $docHeaderButtons['csh'];
-                       $markers['FUNC_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
+                       $markers['FUNC_MENU'] = BackendUtility::getFuncMenu(
                                $this->id,
                                'SET[function]',
                                $this->MOD_SETTINGS['function'],
@@ -153,13 +146,13 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                        'shortcut' => ''
                );
                // CSH
-               $buttons['csh'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH'], '', TRUE);
+               $buttons['csh'] = BackendUtility::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH'], '', TRUE);
                if ($this->id && is_array($this->pageinfo)) {
                        // View page
-                       $buttons['view'] = '<a href="#"
-                                       onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '"
-                                       title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '
-                               ">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>';
+                       $buttons['view'] = '<a href="#" '
+                               . 'onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" '
+                               . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">'
+                               . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>';
                        // Shortcut
                        if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
                                $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
@@ -169,5 +162,3 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
        }
 
 }
-
-?>
\ No newline at end of file