1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-29 21:10:31 +02:00

some tiny bugfixes

git-svn-id: file:///svn/phpbb/trunk@8155 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2007-10-08 14:38:44 +00:00
parent b3475ac803
commit e8b2c4128e
8 changed files with 26 additions and 14 deletions

View File

@@ -672,6 +672,11 @@ class bbcode_firstpass extends bbcode
{
global $config, $user;
/**
* If you change this code, make sure the cases described within the following reports are still working:
* #3572, #14667
*/
$in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in)));
if (!$in)
@@ -801,12 +806,19 @@ class bbcode_firstpass extends bbcode
{
// Search the text for the next tok... if an ending quote comes first, then change tok to []
$pos1 = strpos($in, '[/quote');
// If the token ] comes first, we change it to ]
$pos2 = strpos($in, ']');
// If the token [ comes first, we change it to [
$pos3 = strpos($in, '[');
if ($pos1 !== false && ($pos2 === false || $pos1 < $pos2))
if ($pos1 !== false && ($pos2 === false || $pos1 < $pos2) && ($pos3 === false || $pos1 < $pos3))
{
$tok = '[]';
}
else if ($pos3 !== false && ($pos2 === false || $pos3 < $pos2))
{
$tok = '[';
}
else
{
$tok = ']';
@@ -1049,7 +1061,7 @@ class parse_message extends bbcode_firstpass
$this->message = preg_replace($match, $replace, trim($this->message));
// Message length check. -1 disables this check completely.
if ($config['max_' . $mode . '_chars'] != -1)
if ($config['max_' . $mode . '_chars'])
{
$msg_len = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message));