diff -ru TYPO3core_orig_cvs/typo3/sysext/cms/tslib/class.tslib_content.php TYPO3core_patch1590/typo3/sysext/cms/tslib/class.tslib_content.php --- TYPO3core_orig_cvs/typo3/sysext/cms/tslib/class.tslib_content.php 2005-10-21 10:06:59.000000000 +0200 +++ TYPO3core_patch1590/typo3/sysext/cms/tslib/class.tslib_content.php 2005-10-25 16:53:10.000000000 +0200 @@ -4972,6 +4972,7 @@ } $this->lastTypoLinkTarget = $target; $finalTagParts['url']=$this->lastTypoLinkUrl; + $this->typoLink_registerExternal($this->lastTypoLinkUrl,$linktxt); $finalTagParts['targetParams'] = $target ? ' target="'.$target.'"' : ''; $finalTagParts['TYPE']='url'; } elseif ($containsSlash || $isLocalFile) { // file (internal) @@ -4991,6 +4992,7 @@ $finalTagParts['TYPE'] = 'file'; } else { $GLOBALS['TT']->setTSlogMessage("typolink(): File '".$splitLinkParam[0]."' did not exist, so '".$linktxt."' was not linked.",1); + $this->typoLink_error($splitLinkParam[0], 'file', $linktxt); return $linktxt; } } else { // integer or alias (alias is without slashes or periods or commas, that is 'nospace,alphanum_x,lower,unique' according to definition in $TCA!) @@ -5051,6 +5053,7 @@ $page = $GLOBALS['TSFE']->sys_page->getPage($mount_info['mount_pid'],$disableGroupAccessCheck); if (!count($page)) { $GLOBALS['TT']->setTSlogMessage("typolink(): Mount point '".$mount_info['mount_pid']."' was not available, so '".$linktxt."' was not linked.",1); + $this->typoLink_error($mount_info['mount_pid'], 'mount', $linktxt); return $linktxt; } $MPvarAcc['re-map'] = $mount_info['MPvar']; @@ -5121,6 +5124,7 @@ $finalTagParts['TYPE']='page'; } else { $GLOBALS['TT']->setTSlogMessage("typolink(): Page id '".$link_param."' was not found, so '".$linktxt."' was not linked.",1); + $this->typoLink_error($link_param, 'page', $linktxt); return $linktxt; } } @@ -5166,6 +5170,37 @@ } /** + * here, a hook function can be called which handles all the things which should happen when a link is not found or a link *might* be not found + * + * @param string Target of the link, can be an integer for pages, or a file reference + * @param string either 'file', 'page', or 'mount', or 'external' + * @param string linked text + * @param boolean has to be set to zero if the link still needs to be checked (in the backend) - needed for external links + * @private + */ + function typoLink_error($linkurl,$type,$linktext,$is_error = 1) { + global $TYPO3_CONF_VARS; + if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['typoLink_error'])) { + $params = array('target' => $linkurl, 'type' => $type, 'linktext' => $linktext, 'is_error' => $is_error); + $fakeThis = FALSE; + foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['typoLink_error'] as $hookMethod) { + t3lib_div::callUserFunction($hookMethod,$params,$fakeThis); + } + } + } + + /** + * wrapper for typoLink_error for external links. This function is called for all external links because they need to be checked seperately in the backend. + * + * @param string Target of the link, can be an integer for pages, or a file reference + * @param string linked text + * @private + */ + function typoLink_registerExternal($linkurl,$linktext) { + $this->typoLink_error($linkurl,'external',$linktext,0); + } + + /** * Based on the input "TypoLink" TypoScript configuration this will return the generated URL * * ' @see typoLink()