mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 12:28:52 +00:00
- found a small bug in the list parser while working on another bug
git-svn-id: file:///svn/phpbb/trunk@6898 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
de07a9e0ad
commit
a64caea9b6
1 changed files with 20 additions and 13 deletions
|
@ -513,8 +513,8 @@ class bbcode_firstpass extends bbcode
|
||||||
// if $tok is ']' the buffer holds a tag
|
// if $tok is ']' the buffer holds a tag
|
||||||
if (strtolower($buffer) == '/list' && sizeof($list_end_tags))
|
if (strtolower($buffer) == '/list' && sizeof($list_end_tags))
|
||||||
{
|
{
|
||||||
// valid [/list] tag
|
// valid [/list] tag, check nesting so that we don't hit false positives
|
||||||
if (sizeof($item_end_tags))
|
if (sizeof($item_end_tags) && sizeof($item_end_tags) >= sizeof($list_end_tags))
|
||||||
{
|
{
|
||||||
// current li tag has not been closed
|
// current li tag has not been closed
|
||||||
$out = preg_replace('/\n?\[$/', '[', $out) . array_pop($item_end_tags) . '][';
|
$out = preg_replace('/\n?\[$/', '[', $out) . array_pop($item_end_tags) . '][';
|
||||||
|
@ -567,11 +567,8 @@ class bbcode_firstpass extends bbcode
|
||||||
$item_end_tags[] = '/*:m:' . $this->bbcode_uid;
|
$item_end_tags[] = '/*:m:' . $this->bbcode_uid;
|
||||||
}
|
}
|
||||||
else if ($buffer == '/*')
|
else if ($buffer == '/*')
|
||||||
{
|
|
||||||
if (array_pop($item_end_tags) == '/*:m:' . $this->bbcode_uid)
|
|
||||||
{
|
{
|
||||||
array_pop($item_end_tags);
|
array_pop($item_end_tags);
|
||||||
}
|
|
||||||
$buffer = '/*:' . $this->bbcode_uid;
|
$buffer = '/*:' . $this->bbcode_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1182,18 +1179,28 @@ class parse_message extends bbcode_firstpass
|
||||||
{
|
{
|
||||||
if ($max_smilies)
|
if ($max_smilies)
|
||||||
{
|
{
|
||||||
$num_matches = preg_match_all('#' . str_replace('#', '', implode('|', $match)) . '#', $this->message, $matches);
|
$count = 0;
|
||||||
unset($matches);
|
foreach ($match as $key => $smilie)
|
||||||
|
{
|
||||||
if ($num_matches !== false && $num_matches > $max_smilies)
|
if ($small_count = preg_match_all($smilie, $this->message, $array))
|
||||||
|
{
|
||||||
|
$count += $small_count;
|
||||||
|
if ($count > $max_smilies)
|
||||||
{
|
{
|
||||||
$this->warn_msg[] = sprintf($user->lang['TOO_MANY_SMILIES'], $max_smilies);
|
$this->warn_msg[] = sprintf($user->lang['TOO_MANY_SMILIES'], $max_smilies);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->message = preg_replace($smilie, $replace[$key], $this->message);
|
||||||
|
}
|
||||||
|
$this->message = trim($this->message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$this->message = trim(preg_replace($match, $replace, $this->message));
|
$this->message = trim(preg_replace($match, $replace, $this->message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse Attachments
|
* Parse Attachments
|
||||||
|
|
Loading…
Add table
Reference in a new issue