Index: t3lib/class.t3lib_parsehtml_proc.php
===================================================================
--- t3lib/class.t3lib_parsehtml_proc.php (revision 7641)
+++ t3lib/class.t3lib_parsehtml_proc.php (working copy)
@@ -690,15 +690,18 @@
// Split content by the TYPO3 pseudo tag "":
$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:'.preg_replace('/^mailto:/i','',$link_param);
} elseif (substr($link_param,0,1)=='#') { // check if anchor
$href = $siteUrl.$link_param;
@@ -763,6 +766,28 @@
}
/**
+ * 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