class.tslib_content.patch

Administrator Admin, 2009-03-03 00:04

Download (2.68 KB)

View differences:

class.tslib_content.php (working copy)
6057 6057
							// Find all domain records in the rootline of the target page
6058 6058
							$targetPageRootline = $GLOBALS['TSFE']->sys_page->getRootLine($page['uid']);
6059 6059
							$foundDomains = array();
6060
							$foundForcedDomains = array();
6060
							$firstFoundForcedDomains = array();
6061 6061
							$targetPageRootlinePids = array();
6062 6062
							foreach ($targetPageRootline as $data)	{
6063 6063
								$targetPageRootlinePids[] = intval($data['uid']);
......
6072 6072
							);
6073 6073
							// TODO maybe it makes sense to hold all sys_domain records in a cache to save additional DB querys on each typolink
6074 6074
							while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
6075
								if (!isset($foundDomains[$row['pid']])) {
6076
									$foundDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
6075
								$foundDomains[] = preg_replace('/\/$/', '', $row['domainName']);
6076
								if (!isset($firstFoundDomains[$row['pid']])) {
6077
									$firstFoundDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
6077 6078
								}
6078
								if ($row['forced'] && !isset($foundForcedDomains[$row['pid']])) {
6079
									$foundForcedDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
6079
								if ($row['forced'] && !isset($firstFoundForcedDomains[$row['pid']])) {
6080
									$firstFoundForcedDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
6080 6081
								}
6081 6082
							}
6082 6083
							$GLOBALS['TYPO3_DB']->sql_free_result($res);
6083 6084

  
6084 6085
							// Set targetDomain to first found domain record if the target page cannot be reached within the current domain
6085 6086
							if (count($foundDomains) > 0
6086
							  && (!in_array($currentDomain, $foundDomains) || count($foundForcedDomains) > 0)) {
6087
							  && (!in_array($currentDomain, $foundDomains) || count($firstFoundForcedDomains) > 0)) {
6087 6088
								foreach ($targetPageRootlinePids as $pid) {
6088 6089
									// Always use the 'forced' domain if we found one
6089
									if (isset($foundForcedDomains[$pid])) {
6090
										$targetDomain = $foundForcedDomains[$pid];
6090
									if (isset($firstFoundForcedDomains[$pid])) {
6091
										$targetDomain = $firstFoundForcedDomains[$pid];
6091 6092
										break;
6092 6093
									}
6093 6094
									// Use the first found domain record
6094
									if ($targetDomain === '' && isset($foundDomains[$pid])) {
6095
										$targetDomain = $foundDomains[$pid];
6095
									if ($targetDomain === '' && isset($firstFoundDomains[$pid])) {
6096
										$targetDomain = $firstFoundDomains[$pid];
6096 6097
									}
6097 6098
								}
6098 6099
								// Do not prepend the domain if its the current hostname