Fixed bug #11468: [Bug]: $altUrl parameter has no effect in t3lib_BEfunc::viewOnClick...
authorSteffen Kamper <info@sk-typo3.de>
Sun, 22 Nov 2009 17:43:49 +0000 (17:43 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Sun, 22 Nov 2009 17:43:49 +0000 (17:43 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6487 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_befunc.php

index 161b246..077121d 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
-2009-11-17  Steffen Kamper  <info@sk-typo3.de>
+2009-11-22  Steffen Kamper  <info@sk-typo3.de>
 
+       * Fixed bug #11468: [Bug]: $altUrl parameter has no effect in t3lib_BEfunc::viewOnClick() (Thanks to Fabrizio Branca)
        * Fixed bug #12548: opendocs produce invalid HTML
 
 2009-11-20  Stanislas Rolland  <typo3@sjbr.ca>
index 73759d3..ef5825f 100644 (file)
@@ -2619,51 +2619,51 @@ final class t3lib_BEfunc {
         * @return      string
         */
        public static function viewOnClick($id, $backPath = '', $rootLine = '', $anchor = '', $altUrl = '', $addGetVars = '', $switchFocus = TRUE) {
-               if ($altUrl) {
-                       $url = $altUrl;
-               } else {
 
-                       $viewScriptPreviewEnabled  = '/' . TYPO3_mainDir . 'mod/user/ws/wsol_preview.php?id=';
-                       $viewScriptPreviewDisabled = '/index.php?id=';
+               $viewScriptPreviewEnabled  = '/' . TYPO3_mainDir . 'mod/user/ws/wsol_preview.php?id=';
+               $viewScriptPreviewDisabled = '/index.php?id=';
 
-                               // check alternate Domains
-                       if ($rootLine)  {
-                               $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
-                               if (t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path']))    {
-                                       $preUrl_temp = t3lib_BEfunc::firstDomainRecord($rootLine);
-                               }
+               if ($altUrl) {
+                       $viewScriptPreviewEnabled = $viewScriptPreviewDisabled = $altUrl;
+               }
+                       // check alternate Domains
+               if ($rootLine)  {
+                       $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
+                       if (t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path']))    {
+                               $preUrl_temp = t3lib_BEfunc::firstDomainRecord($rootLine);
                        }
-                       $preUrl = $preUrl_temp ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$preUrl_temp : $backPath.'..';
+               }
+               $preUrl = $preUrl_temp ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$preUrl_temp : $backPath.'..';
 
-                               // Look if a fixed preview language should be added:
-                       $viewLanguageOrder = $GLOBALS['BE_USER']->getTSConfigVal('options.view.languageOrder');
-                       if (strlen($viewLanguageOrder)) {
-                               $suffix = '';
+                       // Look if a fixed preview language should be added:
+               $viewLanguageOrder = $GLOBALS['BE_USER']->getTSConfigVal('options.view.languageOrder');
+               if (strlen($viewLanguageOrder)) {
+                       $suffix = '';
 
-                                       // Find allowed languages (if none, all are allowed!)
-                               if (!$GLOBALS['BE_USER']->user['admin'] &&
-                                       strlen($GLOBALS['BE_USER']->groupData['allowed_languages'])) {
-                                       $allowed_languages = array_flip(explode(',', $GLOBALS['BE_USER']->groupData['allowed_languages']));
-                               }
+                               // Find allowed languages (if none, all are allowed!)
+                       if (!$GLOBALS['BE_USER']->user['admin'] &&
+                               strlen($GLOBALS['BE_USER']->groupData['allowed_languages'])) {
+                               $allowed_languages = array_flip(explode(',', $GLOBALS['BE_USER']->groupData['allowed_languages']));
+                       }
 
-                                       // Traverse the view order, match first occurence:
-                               $lOrder = t3lib_div::intExplode(',',$viewLanguageOrder);
-                               foreach($lOrder as $langUid)    {
-                                       if (is_array($allowed_languages) && count($allowed_languages)) {
-                                               if (isset($allowed_languages[$langUid])) {      // Choose if set.
-                                                       $suffix = '&L='.$langUid;
-                                                       break;
-                                               }
-                                       } else {        // All allowed since no lang. are listed.
+                               // Traverse the view order, match first occurence:
+                       $lOrder = t3lib_div::intExplode(',',$viewLanguageOrder);
+                       foreach($lOrder as $langUid)    {
+                               if (is_array($allowed_languages) && count($allowed_languages)) {
+                                       if (isset($allowed_languages[$langUid])) {      // Choose if set.
                                                $suffix = '&L='.$langUid;
                                                break;
                                        }
+                               } else {        // All allowed since no lang. are listed.
+                                       $suffix = '&L='.$langUid;
+                                       break;
                                }
-
-                                       // Add it:
-                               $addGetVars.= $suffix;
                        }
 
+                               // Add it:
+                       $addGetVars.= $suffix;
+
+
                        $urlPreviewEnabled  = $preUrl . $viewScriptPreviewEnabled . $id . $addGetVars . $anchor;
                        $urlPreviewDisabled = $preUrl . $viewScriptPreviewDisabled . $id . $addGetVars . $anchor;
                }