Allow/disallow [quote] tags. If we make any other bbcode disable-able we should consider passing them in an array ;)

git-svn-id: file:///svn/phpbb/trunk@4532 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Ludovic Arnaud 2003-10-05 19:59:17 +00:00
parent efad675c35
commit 4b00d2ec21

View file

@ -55,7 +55,7 @@ class parse_message
$this->bbcode_uid = substr(md5(time()), 0, BBCODE_UID_LEN);
}
function parse($html, $bbcode, $url, $smilies, $bbcode_img = TRUE, $bbcode_flash = TRUE)
function parse($html, $bbcode, $url, $smilies, $allow_img = TRUE, $allow_flash = TRUE, $allow_quote = TRUE)
{
global $config, $db, $user;
@ -78,14 +78,18 @@ class parse_message
if ($bbcode)
{
$this->bbcode_init();
if (!$bbcode_img)
if (!$allow_img)
{
$this->bbcodes['img']['disabled'] = TRUE;
}
if (!$bbcode_flash)
if (!$allow_flash)
{
$this->bbcodes['flash']['disabled'] = TRUE;
}
if (!$allow_quote)
{
$this->bbcodes['quote']['disabled'] = TRUE;
}
$this->bbcode();
}
$this->emoticons($smilies);
@ -100,7 +104,7 @@ class parse_message
$this->message = str_replace(array('<', '>'), array('&lt;', '&gt;'), $this->message);
if ($html)
if ($html && $config['allow_html_tags'])
{
// If $html is true then "allowed_tags" are converted back from entity
// form, others remain
@ -145,7 +149,8 @@ class parse_message
}
}
// Since we add bbcode_uid to all tags, the message length will increase whenever a tag is found
// Because we add bbcode_uid to all tags, the message length
// will increase whenever a tag is found
$new_size = strlen($this->message);
if ($size != $new_size)
{
@ -159,8 +164,9 @@ class parse_message
{
static $rowset;
// This array holds all bbcode data. BBCodes will be processed in this order, so it is important to
// keep [code] in first position and [quote] in second position.
// This array holds all bbcode data. BBCodes will be processed in this
// order, so it is important to keep [code] in first position and
// [quote] in second position.
$this->bbcodes = array(
'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#ise' => "\$this->bbcode_code('\$1', '\$2')")),
'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:=&quot;(.*?)&quot;)?\](.+)\[/quote\]#ise' => "\$this->bbcode_quote('\$0')")),