diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-15 15:35:50 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-15 15:35:50 +0000 |
commit | 548cc2c10b56cc9e5c71c2f87356947939abe888 (patch) | |
tree | 82a2ceac1eb474aad83281f5d5b4fe94b0ad4d92 /phpBB/includes/message_parser.php | |
parent | 979e36077fa6ae9bbee81bacaaef029aa13c6df0 (diff) | |
download | forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar.gz forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar.bz2 forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar.xz forums-548cc2c10b56cc9e5c71c2f87356947939abe888.zip |
- fixes for the following bugs:
#5326
#5318
#5304
#5290
#5288
#5278
#5276
#5272
#5266
- also fixed the "Call-time pass-by-reference" bug #5252
- within this step changed the normalize calls to require references.
- added captcha size variables to the class scope (suggestion was posted at area51)
git-svn-id: file:///svn/phpbb/trunk@6584 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r-- | phpBB/includes/message_parser.php | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 6538bd7721..6270da8986 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -88,8 +88,11 @@ class bbcode_firstpass extends bbcode { $in = str_replace("\r\n", "\n", $this->message); - $this->message = preg_replace(array('#\[quote(=".*?")?\]([^\n])#is', '#([^\n])\[\/quote\]#is'), array("[quote\\1]\n\\2", "\\1\n[/quote]"), $this->message); - $this->message = preg_replace(array('#\[quote(=".*?")?\]([^\n])#is', '#([^\n])\[\/quote\]#is'), array("[quote\\1]\n\\2", "\\1\n[/quote]"), $this->message); + // We strip newlines and spaces after and before quotes in quotes (trimming) + $this->message = preg_replace(array('#\[quote(=".*?")?\]([\s|\n]+)#is', '#([\s|\n]+)\[\/quote\]#is'), array("[quote\\1]", "[/quote]"), $this->message); + + // Now we add exactly one newline + $this->message = preg_replace(array('#\[quote(=".*?")?\]#is', '#\[\/quote\]#is'), array("[quote\\1]\n", "\n[/quote]"), $this->message); } // Add other checks which needs to be placed before actually parsing anything (be it bbcodes, smilies, urls...) @@ -600,7 +603,7 @@ class bbcode_firstpass extends bbcode $pos = strlen($in); for ($i = 0, $tok_len = strlen($tok); $i < $tok_len; ++$i) { - $tmp_pos = strpos($in, $tok{$i}); + $tmp_pos = strpos($in, $tok[$i]); if ($tmp_pos !== false && $tmp_pos < $pos) { $pos = $tmp_pos; @@ -608,7 +611,7 @@ class bbcode_firstpass extends bbcode } $buffer .= substr($in, 0, $pos); - $tok = $in{$pos}; + $tok = $in[$pos]; $in = substr($in, $pos + 1); if ($tok == ']') @@ -616,10 +619,15 @@ class bbcode_firstpass extends bbcode if ($buffer == '/quote' && sizeof($close_tags)) { // we have found a closing tag - // Add space at the end of the closing tag to allow following urls/smilies to be parsed correctly - $out .= array_pop($close_tags) . '] '; + $out .= array_pop($close_tags) . ']'; $tok = '['; $buffer = ''; + + // Add space at the end of the closing tag if not happened before to allow following urls/smilies to be parsed correctly + if (!$in || $in[0] !== ' ') + { + $out .= ' '; + } } else if (preg_match('#^quote(?:="(.*?)")?$#is', $buffer, $m)) { @@ -1138,8 +1146,7 @@ class parse_message extends bbcode_firstpass $error = array(); $num_attachments = sizeof($this->attachment_data); - $this->filename_data['filecomment'] = request_var('filecomment', '', true); - utf8_normalize_nfc(&$this->filename_data['filecomment']); + $this->filename_data['filecomment'] = utf8_normalize_nfc(request_var('filecomment', '', true)); $upload_file = (isset($_FILES[$form_name]) && $_FILES[$form_name]['name'] != 'none' && trim($_FILES[$form_name]['name'])) ? true : false; $add_file = (isset($_POST['add_file'])) ? true : false; @@ -1256,8 +1263,7 @@ class parse_message extends bbcode_firstpass { if ($edit_comment) { - $actual_comment_list = request_var('comment_list', array(''), true); - utf8_normalize_nfc(&$actual_comment_list); + $actual_comment_list = utf8_normalize_nfc(request_var('comment_list', array(''), true)); $edit_comment = request_var('edit_comment', array(0 => '')); $edit_comment = key($edit_comment); @@ -1322,8 +1328,7 @@ class parse_message extends bbcode_firstpass { global $user, $db, $phpbb_root_path, $phpEx, $config; - $this->filename_data['filecomment'] = request_var('filecomment', '', true); - utf8_normalize_nfc(&$this->filename_data['filecomment']); + $this->filename_data['filecomment'] = utf8_normalize_nfc(request_var('filecomment', '', true)); $attachment_data = (isset($_POST['attachment_data'])) ? $_POST['attachment_data'] : array(); $this->attachment_data = array(); |