Project

General

Profile

Bug #17636 » 6415_extended.diff

Administrator Admin, 2008-04-04 14:40

View differences:

class.tslib_fe.php (working copy)
*/
function prefixLocalAnchorsWithScript() {
$scriptPath = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));
$this->content = preg_replace('/(<(a|area).*?href=")(#[^"]*")/i','${1}' . htmlspecialchars($scriptPath) . '${3}',$this->content);
$original_content = $this->content;
$this->content = preg_replace('/(<(a|area).+href=")(#[^"]*")/i','${1}' . htmlspecialchars($scriptPath) . '${3}',$original_content);
if(preg_last_error()>0) {
//The was an error in call to preg_replace, so keep original content (Behavior prior t PHP 5.2).
t3lib_div::sysLog('preg_replace returned error-code: ' . preg_last_error().' in function prefixLocalAnchorsWithScript. Replacement not done!' , 'cms', 4);
$this->content = str_replace(' href="#',' href="'.htmlspecialchars($scriptPath).'#',$original_content);
}
}
/**
(2-2/4)