aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/message_parser.php
diff options
context:
space:
mode:
authorLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2003-05-09 20:24:15 +0000
committerLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2003-05-09 20:24:15 +0000
commitb5d4bc5ced7f744ff5f0cb8e656f8ef37e709f9d (patch)
tree69224f05b05405402f847dc572742a21e67816f3 /phpBB/includes/message_parser.php
parent2fc8842b0f834bcc86eece396ba3850674dd72c2 (diff)
downloadforums-b5d4bc5ced7f744ff5f0cb8e656f8ef37e709f9d.tar
forums-b5d4bc5ced7f744ff5f0cb8e656f8ef37e709f9d.tar.gz
forums-b5d4bc5ced7f744ff5f0cb8e656f8ef37e709f9d.tar.bz2
forums-b5d4bc5ced7f744ff5f0cb8e656f8ef37e709f9d.tar.xz
forums-b5d4bc5ced7f744ff5f0cb8e656f8ef37e709f9d.zip
Fixed quotes having bbcodes in author name
git-svn-id: file:///svn/phpbb/trunk@3997 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r--phpBB/includes/message_parser.php34
1 files changed, 30 insertions, 4 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 2af189a69c..9e7b2bc714 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -185,7 +185,7 @@ class parse_message
// [quote] moved to the second position
$this->bbcode_array = array(
8 => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#ise' => "\$this->bbcode_code('\\1', '\\2')"),
- 0 => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#ise'=> "\$this->bbcode_quote('\\0')"),
+ 0 => array('#\[quote(?:="(.*?)")\](.+)\[/quote\]#ise'=> "\$this->bbcode_quote('\\0')"),
// TODO: validation regexp
11 => array('#\[flash\](.*?)\[/flash\]#i' => '[flash:' . $this->bbcode_uid . ']\1[/flash:' . $this->bbcode_uid . ']'),
10 => array('#\[email(=.*?)?\](.*?)\[/email\]#ise' => "\$this->validate_email('\\1', '\\2')"),
@@ -233,6 +233,8 @@ class parse_message
function bbcode_quote_username($username)
{
+echo "<pre><hr>processing <b>$username</b><hr></pre>";
+
if (!$username)
{
return '';
@@ -407,6 +409,7 @@ class parse_message
$in = substr(stripslashes($in), 1);
$close_tags = array();
+ $buffer = '';
do
{
@@ -420,7 +423,7 @@ class parse_message
}
}
- $buffer = substr($in, 0, $pos);
+ $buffer .= substr($in, 0, $pos);
$tok = $in{$pos};
$in = substr($in, $pos + 1);
@@ -428,26 +431,49 @@ class parse_message
{
if ($buffer == '/quote' && count($close_tags))
{
+ // we have found a closing tag
+
$tag = array_pop($close_tags);
$out .= $tag . ']';
$tok = '[';
+ $buffer = '';
}
- elseif (preg_match('#quote(?:="(.*?)")?#is', $buffer, $m))
+ elseif (preg_match('#^quote(?:="(.*?)")?$#is', $buffer, $m))
{
+ // the buffer holds a valid opening tag
array_push($close_tags, '/quote:' . $this->bbcode_uid);
- $out .= $buffer . ':' . $this->bbcode_uid . ']';
+
+ if (!empty($m[1]))
+ {
+ // here we can check for valid bbcode pairs or whatever
+ $username = $m[1];
+ $out .= 'quote="' . $username . '":' . $this->bbcode_uid . ']';
+ }
+ else
+ {
+ $out .= 'quote:' . $this->bbcode_uid . ']';
+ }
+
$tok = '[';
+ $buffer = '';
+ }
+ elseif (preg_match('#^quote="(.*?)#is', $buffer, $m))
+ {
+ // the buffer holds an invalid opening tag
+ $buffer .= ']';
}
else
{
$out .= $buffer . $tok;
$tok = '[]';
+ $buffer = '';
}
}
else
{
$out .= $buffer . $tok;
$tok = ($tok == '[') ? ']' : '[]';
+ $buffer = '';
}
}
while ($in);