Project

General

Profile

Bug #22683 » 14436-4.2.diff

Administrator Admin, 2010-05-19 19:29

View differences:

t3lib/class.t3lib_parsehtml_proc.php (working copy)
// Split content by the TYPO3 pseudo tag "<link>":
$blockSplit = $this->splitIntoBlock('link',$value,1);
$siteUrl = $this->siteUrl();
foreach($blockSplit as $k => $v) {
$error = '';
if ($k%2) { // block:
$tagCode = t3lib_div::unQuoteFilenames(trim(substr($this->getFirstTag($v),0,-1)),true);
$link_param = $tagCode[1];
$href = '';
$siteUrl = $this->siteUrl();
// Parsing the typolink data. This parsing is roughly done like in tslib_content->typolink()
if(strstr($link_param,'@')) { // mailadr
if ($this->isExternalURL($link_param, $siteUrl)) {
$href = $link_param;
}
elseif (strstr($link_param,'@')) { // mailadr
$href = 'mailto:'.eregi_replace('^mailto:','',$link_param);
} elseif (substr($link_param,0,1)=='#') { // check if anchor
$href = $siteUrl.$link_param;
......
}
/**
* Checks if URL does not reference any domain in this TYPO3 installation
*
* @param string $testString Test string
* @param string $siteUrl Site URL
* @return boolean
*/
protected function isExternalURL($testString, $siteUrl) {
if (t3lib_div::isValidUrl($testString)) {
$host = parse_url($testString, PHP_URL_HOST);
list($row) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('COUNT(*) AS counter',
'sys_domain',
'domainName=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($host, 'sys_domain') .
t3lib_BEfunc::BEenableFields('sys_domain') . t3lib_BEfunc::BEenableFields('sys_domain'));
if ($row['counter'] > 0) {
return false;
}
return substr($testString, 0, strlen($siteUrl)) !== $siteUrl;
}
return false;
}
/**
* Preserve special tags
*
* @param string Content input
(1-1/4)