Bug #19396 » typo3core_bugfix_9455_trunk.patch
t3lib/class.t3lib_parsehtml_proc.php (copie de travail) | ||
---|---|---|
// Internal, static:
|
||
var $recPid = 0; // Set this to the pid of the record manipulated by the class.
|
||
var $elRef = ''; // Element reference [table]:[field], eg. "tt_content:bodytext"
|
||
var $siteUrlForPid; // Site Url coresponding to the domain to which the pid belongs
|
||
var $relPath=''; // Relative path
|
||
var $relBackPath=''; // Relative back-path
|
||
public $tsConfig = array(); // Current Page TSConfig
|
||
... | ... | |
/**
|
||
* Initialize, setting element reference and record PID
|
||
* Initialize, setting element reference, record PID and corresponding site url
|
||
*
|
||
* @param string Element reference, eg "tt_content:bodytext"
|
||
* @param integer PID of the record (page id)
|
||
... | ... | |
function init($elRef='',$recPid=0) {
|
||
$this->recPid = $recPid;
|
||
$this->elRef = $elRef;
|
||
$this->setSiteUrlForPid();
|
||
}
|
||
/**
|
||
... | ... | |
}
|
||
/**
|
||
* Returns SiteURL based on the record pid
|
||
*
|
||
* @return string site url
|
||
*/
|
||
function setSiteUrlForPid() {
|
||
// Initialize the page-select functions to check rootline:
|
||
$sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
|
||
$sys_page->init(TRUE);
|
||
$rootline = $sys_page->getRootLine($this->recPid);
|
||
$domain = '';
|
||
foreach ($rootline as $data) {
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('domainName', 'sys_domain', 'pid='.intval($data['uid']).' AND redirectTo=\'\'' .t3lib_BEfunc::deleteClause('sys_domain'), '', 'sorting');
|
||
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
|
||
$GLOBALS['TYPO3_DB']->sql_free_result($res);
|
||
if ($row) {
|
||
$domain = preg_replace('/\/$/','',$row['domainName']);
|
||
break;
|
||
}
|
||
if ($data['is_siteroot']) {
|
||
// Possibly subdomain inside main domain. In any case we must stop now because site root is reached.
|
||
break;
|
||
}
|
||
}
|
||
if ($domain) {
|
||
$this->siteUrlForPid = str_replace(t3lib_div::getIndpEnv('TYPO3_HOST_ONLY'), $domain, t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
|
||
} else {
|
||
$this->siteUrlForPid = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
|
||
}
|
||
}
|
||
/**
|
||
* Returns SiteURL based on thisScript.
|
||
*
|
||
* @return string Value of t3lib_div::getIndpEnv('TYPO3_SITE_URL');
|
||
... | ... | |
$siteUrl_parts = parse_url($url);
|
||
$curUrl_parts = parse_url($curURL);
|
||
$siteUrlForPid_parts = parse_url($this->siteUrlForPid);
|
||
if ($siteUrl_parts['host']==$curUrl_parts['host'] // Hosts should match
|
||
&& (!$info['relScriptPath'] || (defined('TYPO3_mainDir') && substr($info['relScriptPath'],0,strlen(TYPO3_mainDir))==TYPO3_mainDir))) { // If the script path seems to match or is empty (FE-EDIT)
|
||
... | ... | |
$uP=parse_url($info['relUrl']);
|
||
if (!strcmp('#'.$siteUrl_parts['fragment'],$info['relUrl'])) {
|
||
$info['url']=$info['relUrl'];
|
||
$info['type']='anchor';
|
||
// If the page of the current record belongs to the same subdomain as the link host
|
||
if ($curUrl_parts['host'] == $siteUrlForPid_parts['host']) {
|
||
$info['url']=$info['relUrl'];
|
||
$info['type']='anchor';
|
||
}
|
||
} elseif (!trim($uP['path']) || !strcmp($uP['path'],'index.php')) {
|
||
$pp = explode('id=',$uP['query']);
|
||
$parameters = explode('&', $pp[1]);
|
||
... | ... | |
$info['query'] = $parameters[0]?'&'.implode('&', $parameters):'';
|
||
}
|
||
} else {
|
||
$info['url']=$info['relUrl'];
|
||
$info['type']='file';
|
||
// If the page of the current record belongs to the same subdomain as the link host
|
||
if ($curUrl_parts['host'] == $siteUrlForPid_parts['host']) {
|
||
$info['url']=$info['relUrl'];
|
||
$info['type']='file';
|
||
}
|
||
}
|
||
} else {
|
||
unset($info['relScriptPath']);
|