Bug #20801 » 11608_v2.patch

Administrator Admin, 2009-11-15 23:55

View differences:

class.t3lib_befunc.php (working copy)
2615 2615
			$viewScriptPreviewEnabled  = '/' . TYPO3_mainDir . 'mod/user/ws/wsol_preview.php?id=';
2616 2616
			$viewScriptPreviewDisabled = '/index.php?id=';
2617 2617

  
2618
				// check alternate Domains
2619
			if ($rootLine)  {
2620
				$parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
2621
				if (t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path']))    {
2622
					$preUrl_temp = t3lib_BEfunc::firstDomainRecord($rootLine);
2623
				}
2624
			}
2625
			$preUrl = $preUrl_temp ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$preUrl_temp : $backPath.'..';
2626

  
2627 2618
				// Look if a fixed preview language should be added:
2628 2619
			$viewLanguageOrder = $GLOBALS['BE_USER']->getTSConfigVal('options.view.languageOrder');
2629 2620
			if (strlen($viewLanguageOrder))	{
......
2653 2644
				$addGetVars.= $suffix;
2654 2645
			}
2655 2646

  
2656
			$urlPreviewEnabled  = $preUrl . $viewScriptPreviewEnabled . $id . $addGetVars . $anchor;
2657
			$urlPreviewDisabled = $preUrl . $viewScriptPreviewDisabled . $id . $addGetVars . $anchor;
2647
			$viewDomain = t3lib_BEfunc::getViewDomain($id, $rootLine);
2648
			$urlPreviewEnabled  = $viewDomain . $viewScriptPreviewEnabled . $id . $addGetVars . $anchor;
2649
			$urlPreviewDisabled = $viewDomain . $viewScriptPreviewDisabled . $id . $addGetVars . $anchor;
2658 2650
		}
2659 2651

  
2660 2652
		return "previewWin=window.open(top.WorkspaceFrontendPreviewEnabled?'" .
......
2662 2654
			"','newTYPO3frontendWindow');" . ( $switchFocus ? 'previewWin.focus();' : '');
2663 2655
	}
2664 2656

  
2657
 	/**
2658
	 * Builds the frontend view domain for a given page ID with a given root
2659
	 * line.
2660
	 *
2661
	 * @param integer $pageId the page ID to use, must be > 0
2662
	 * @param array $rootLine the root line structure to use
2663
	 *
2664
	 * @return string the full domain including the protocol http:// or https://
2665
	 *
2666
	 * @author Michael Klapper <michael.klapper@aoemedia.de>
2667
	 */
2668
	public static function getViewDomain($pageId, $rootLine = null) {
2669
		$domain = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
2670

  
2671
		if (!is_array($rootLine)) {
2672
			$rootLine = t3lib_BEfunc::BEgetRootLine($pageId);
2673
		}
2674

  
2675
		// checks alternate Domains
2676
		if (count($rootLine) > 0) {
2677
			$urlParts = parse_url($domain);
2678
			if (t3lib_BEfunc::getDomainStartPage($urlParts['host'], $urlParts['path'])) {
2679
				$protocol = t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
2680
				$domain = $protocol . t3lib_BEfunc::firstDomainRecord($rootLine);
2681
			}
2682
		}
2683

  
2684
		return $domain;
2685
	}	
2686
	
2665 2687
	/**
2666 2688
	 * Returns the merged User/Page TSconfig for page id, $id.
2667 2689
	 * Please read details about module programming elsewhere!
(2-2/2)