Recursively erase javascript URI scheme in noJSLink to avoid XSS
This commit is contained in:
parent
d5be0c0cdb
commit
e2226c01e7
1 changed files with 6 additions and 2 deletions
|
@ -30,10 +30,14 @@ class Sanitize {
|
|||
return htmlspecialchars_decode($text, $flags);
|
||||
}
|
||||
|
||||
// Remove javacript from links
|
||||
// Remove javascript from links
|
||||
public static function noJSLink($text)
|
||||
{
|
||||
return preg_replace("/javascript\s*:\s*/", "", $text);
|
||||
$text = trim($text);
|
||||
while(strpos($text, 'javascript')===0){
|
||||
$text = preg_replace("/javascript\s*:\s*/", "", $text);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
public static function pathFile($path, $file=false)
|
||||
|
|
Loading…
Add table
Reference in a new issue