Improve BBCode javascript stripping regex
This commit is contained in:
parent
c2eb2f460b
commit
003e6a7371
1 changed files with 4 additions and 2 deletions
|
@ -1161,8 +1161,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
||||||
$Text = preg_replace('/\"\;/','"',$Text);
|
$Text = preg_replace('/\"\;/','"',$Text);
|
||||||
|
|
||||||
// fix any escaped ampersands that may have been converted into links
|
// fix any escaped ampersands that may have been converted into links
|
||||||
$Text = preg_replace("/\<([^>]*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
|
$Text = preg_replace('/\<([^>]*?)(src|href)=(.*?)\&\;(.*?)\>/ism', '<$1$2=$3&$4>', $Text);
|
||||||
$Text = preg_replace("/\<([^>]*?)(src|href)=\"(?!http|ftp|mailto|gopher|cid)(.*?)\>/ism",'<$1$2="">',$Text);
|
|
||||||
|
// removes potentially harmful javascript in src/href
|
||||||
|
$Text = preg_replace('/\<([^>]*?)(src|href)="javascript(.*?)\>/ism', '', $Text);
|
||||||
|
|
||||||
if($saved_image)
|
if($saved_image)
|
||||||
$Text = bb_replace_images($Text, $saved_image);
|
$Text = bb_replace_images($Text, $saved_image);
|
||||||
|
|
Loading…
Reference in a new issue