Fixed bug #7386: Remove hardcoded references to alt_main.php backend interface
authorJeff Segars <jsegars@alumni.rice.edu>
Tue, 5 Feb 2008 05:13:39 +0000 (05:13 +0000)
committerJeff Segars <jsegars@alumni.rice.edu>
Tue, 5 Feb 2008 05:13:39 +0000 (05:13 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3069 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_befunc.php
t3lib/class.t3lib_tsfebeuserauth.php
t3lib/class.t3lib_userauth.php
typo3/alt_shortcut.php
typo3/mod/user/ws/index.php

index b8c572b..708b475 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 
        * (tweak) Followup to #6472: Some small changes to the new hooks 
 
+2008-02-04 Jeff Segars <jeff@webempoweredchurch.org>
+
+       * Fixed bug #7386: Remove hardcoded references to alt_main.php backend interface
+
 2008-02-04  Martin Kutschker  <martin.t.kutschker@blackbox.net>
 
        * Fix a problem with devLog in user autehtication introduced with fix for #7350
index dc73e2a..d631c55 100755 (executable)
@@ -3969,5 +3969,32 @@ class t3lib_BEfunc       {
                }
                return array('rows'=>$theRows,'list'=>$out);
        }
+       
+       /**
+        * Returns the name of the backend script relative to the TYPO3 main directory.
+        *
+        * @param       string          Name of the backend interface  (backend, backend_old, frontend) to look up the script name for. If no interface is given, the interface for the current backend user is used.
+        * @return      string          The name of the backend script relative to the TYPO3 main directory.
+        */
+       public static function getBackendScript($interface = '') {
+               if (!$interface) {
+                       $interface = $GLOBALS['BE_USER']->uc['interfaceSetup'];
+               }
+               
+               switch ($interface) {
+                       case 'backend_old':
+                               $script = 'alt_main.php';
+                               break;
+                       case 'frontend':
+                               $script = '../.';
+                               break;
+                       case 'backend':
+                       default:
+                               $script = 'backend.php';
+                               break;
+               }
+               
+               return $script;
+       }
 }
 ?>
index f2791d8..9353b15 100755 (executable)
@@ -429,7 +429,7 @@ $query.'
                                                        parent.opener.top.goToModule("'.$pageModule.'");
                                                        parent.opener.top.focus();
                                                } else {
-                                                       vHWin=window.open(\''.TYPO3_mainDir.'alt_main.php\',\''.md5('Typo3Backend-'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
+                                                       vHWin=window.open(\''.TYPO3_mainDir.t3lib_BEfunc::getBackendInterface().'\',\''.md5('Typo3Backend-'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
                                                        vHWin.focus();
                                                }
                                                return false;
index 3ee0bd5..73fc9dc 100755 (executable)
@@ -553,9 +553,10 @@ class t3lib_userAuth {
 
                        if($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] == 3 && $this->user_table == 'be_users')        {
                                $requestStr = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT'), strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir));
-                               if($requestStr == 'alt_main.php' && t3lib_div::getIndpEnv('TYPO3_SSL')) {
+                               $backendScript = t3lib_BEfunc::getBackendScript();
+                               if($requestStr == $backendScript && t3lib_div::getIndpEnv('TYPO3_SSL')) {
                                        list(,$url) = explode('://',t3lib_div::getIndpEnv('TYPO3_SITE_URL'),2);
-                                       header('Location: http://'.$url.TYPO3_mainDir.'alt_main.php');
+                                       header('Location: http://'.$url.TYPO3_mainDir.$backendScript);
                                        exit;
                                }
                        }
index 75d7fe6..105c5ff 100755 (executable)
@@ -677,7 +677,7 @@ class SC_alt_shortcut {
                        // Changing workspace and if so, reloading entire backend:
                if (strlen($this->changeWorkspace))     {
                        $BE_USER->setWorkspace($this->changeWorkspace);
-                       return $this->doc->wrapScriptTags('top.location.href="alt_main.php";');
+                       return $this->doc->wrapScriptTags('top.location.href="'. t3lib_BEfunc::getBackendScript() . '";');
                }
                        // Changing workspace and if so, reloading entire backend:
                if (strlen($this->changeWorkspacePreview))      {
index 90d62c6..79883c2 100755 (executable)
@@ -306,7 +306,7 @@ class SC_mod_user_ws_index extends t3lib_SCbase {
                if ($changeWorkspace != '') {
                        $BE_USER->setWorkspace($changeWorkspace);
                        $this->content = $this->doc->startPage($LANG->getLL('title'));
-                       $this->content .= $this->doc->wrapScriptTags('top.location.href="' . $BACK_PATH . 'alt_main.php";');
+                       $this->content .= $this->doc->wrapScriptTags('top.location.href="' . $BACK_PATH . t3lib_BEfunc::getBackendScript() . '";');
                }
                else {
                                // Starting page: