Project

General

Profile

Bug #17636 » tslib_prefixLocalAnchorsWithScript_requesturi_and_single_quotes_r4382_escaped.diff

Administrator Admin, 2008-10-29 16:36

View differences:

class.tslib_fe.php (Arbeitskopie)
* @return void Works directly on $this->content
*/
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);
$request_uri = preg_replace('~\$\d~', '\\\$0', t3lib_div::getIndpEnv('REQUEST_URI')); // escape $ when followed by digit
$this->content = preg_replace('/(<(?:a|area)\s[^>]*?\bhref\s*=\s*("|\'))(#[^\2]*\2)/is','${1}' . htmlspecialchars($request_uri) . '${3}',$this->content);
}
/**
(4-4/4)