Bug #20801 » 0011608.patch

Administrator Admin, 2009-07-31 11:42

View differences:

t3lib/class.t3lib_befunc.php (working copy)
2553 2553
			$viewScriptPreviewEnabled  = '/' . TYPO3_mainDir . 'mod/user/ws/wsol_preview.php?id=';
2554 2554
			$viewScriptPreviewDisabled = '/index.php?id=';
2555 2555

  
2556
				// check alternate Domains
2557
			if ($rootLine)  {
2558
				$parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
2559
				if (t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path']))    {
2560
					$preUrl_temp = t3lib_BEfunc::firstDomainRecord($rootLine);
2561
				}
2562
			}
2563
			$preUrl = $preUrl_temp ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$preUrl_temp : $backPath.'..';
2564

  
2565 2556
				// Look if a fixed preview language should be added:
2566 2557
			$viewLanguageOrder = $GLOBALS['BE_USER']->getTSConfigVal('options.view.languageOrder');
2567 2558
			if (strlen($viewLanguageOrder))	{
......
2591 2582
				$addGetVars.= $suffix;
2592 2583
			}
2593 2584

  
2594
			$urlPreviewEnabled  = $preUrl . $viewScriptPreviewEnabled . $id . $addGetVars . $anchor;
2595
			$urlPreviewDisabled = $preUrl . $viewScriptPreviewDisabled . $id . $addGetVars . $anchor;
2585
			$viewDomain = t3lib_BEfunc::getViewDomain($id, $rootLine);
2586
			
2587
			$urlPreviewEnabled  = $viewDomain . $viewScriptPreviewEnabled . $id . $addGetVars . $anchor;
2588
			$urlPreviewDisabled = $viewDomain . $viewScriptPreviewDisabled . $id . $addGetVars . $anchor;
2596 2589
		}
2597 2590

  
2598 2591
		return "previewWin=window.open(top.WorkspaceFrontendPreviewEnabled?'" .
......
2601 2594
	}
2602 2595

  
2603 2596
	/**
2597
	 * Build the frontend view domain.
2598
	 *
2599
	 * @param integer $currentPageId 
2600
	 * @param array $rootLineStruct DEFAULT null
2601
	 * @return string
2602
	 * @author Michael Klapper <michael.klapper@aoemedia.de>
2603
	 */
2604
	public static function getViewDomain($currentPageId, $rootLineStruct = null) {
2605
		$domain = '';
2606

  
2607
		if (! is_array($rootLineStruct) ){
2608
			$rootLineStruct = t3lib_BEfunc::BEgetRootLine($currentPageId);
2609
		}
2610

  
2611
			// check alternate Domains
2612
		if ( count($rootLineStruct) > 0) {
2613
			$urlParts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
2614
			if ( t3lib_BEfunc::getDomainStartPage($urlParts['host'], $urlParts['path']) ) {
2615
				$domain = t3lib_BEfunc::firstDomainRecord($rootLineStruct);
2616
			}
2617
		}
2618

  
2619
		return $domain ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://') . $domain : t3lib_div::getIndpEnv('TYPO3_SITE_URL');
2620
	}
2621
	
2622
	/**
2604 2623
	 * Returns the merged User/Page TSconfig for page id, $id.
2605 2624
	 * Please read details about module programming elsewhere!
2606 2625
	 * Usage: 15
(1-1/2)