diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c6595817b5..cec7907677 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -157,6 +157,10 @@ p,ul,td {font-size:10pt;}
  • Added "temporary" workaround for Apache2 + PHP module ignoring "private" cache header
  • Added workaround for modcp IP lookup and links to Anonymous user profile
  • Fixed broken bbcode parsing of quotes containing bbcode in the "username"
  • +
  • Fixed excess slashes in [quote=""] first pass encoding
  • +
  • Fixed rendering issue with quote button under Mozilla - Daz
  • +
  • Grammatical errors in remaining core lang files fixed - Cluster
  • +
  • Fixed bbcode quote breaking when username contained ] before [
  • diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 45480e49a5..b64ecce21d 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -250,8 +250,7 @@ function bbencode_first_pass($text, $uid) // [QUOTE] and [/QUOTE] for posting replies with quote, or just for quoting stuff. $text = bbencode_first_pass_pda($text, $uid, '[quote]', '[/quote]', '', false, ''); - - $text = bbencode_first_pass_pda($text, $uid, '/\[quote=(\\\\"[^"]*?\\\\")\]/is', '[/quote]', '', false, '', "[quote:$uid=\\1]"); + $text = bbencode_first_pass_pda($text, $uid, '/\[quote=(\\\".*?\\\")\]/is', '[/quote]', '', false, '', "[quote:$uid=\\1]"); // [list] and [list=x] for (un)ordered lists. $open_tag = array(); @@ -365,7 +364,6 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_ message_die(GENERAL_ERROR, "Unsupported operation for bbcode_first_pass_pda()."); } - // Start at the 2nd char of the string, looking for opening tags. $curr_pos = 1; while ($curr_pos && ($curr_pos < strlen($text))) @@ -380,29 +378,29 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_ $found_start = false; $which_start_tag = ""; $start_tag_index = -1; + for ($i = 0; $i < $open_tag_count; $i++) { // Grab everything until the first "]"... - $possible_start = substr($text, $curr_pos, strpos($text, "]", $curr_pos + 1) - $curr_pos + 1); + $possible_start = substr($text, $curr_pos, strpos($text, ']', $curr_pos + 1) - $curr_pos + 1); // // We're going to try and catch usernames with "[' characters. // - if( preg_match('/\[quote\=\\\\"/si', $possible_start) && !preg_match('/\[quote=\\\\"[^"]*\\\\"\]/si', $possible_start) ) + if( preg_match('#\[quote=\\\"#si', $possible_start, $match) && !preg_match('#\[quote=\\\"(.*?)\\\"\]#si', $possible_start) ) { - // // OK we are in a quote tag that probably contains a ] bracket. // Grab a bit more of the string to hopefully get all of it.. - // - $possible_start = substr($text, $curr_pos, strpos($text, "\"]", $curr_pos + 1) - $curr_pos + 2); + if ($close_pos = strpos($text, '"]', $curr_pos + 9)) + { + $possible_start = substr($text, $curr_pos, $close_pos - $curr_pos + 2); + } } - // - // Now compare, either using regexp or not. + // Now compare, either using regexp or not. if ($open_is_regexp) { $match_result = array(); - // PREG regexp comparison. if (preg_match($open_tag[$i], $possible_start, $match_result)) { $found_start = true; @@ -431,12 +429,12 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_ $match = array("pos" => $curr_pos, "tag" => $which_start_tag, "index" => $start_tag_index); bbcode_array_push($stack, $match); // - // Rather than just increment $curr_pos - // Set it to the ending of the tag we just found - // Keeps error in nested tag from breaking out - // of table structure.. - // - $curr_pos = $curr_pos + strlen($possible_start); + // Rather than just increment $curr_pos + // Set it to the ending of the tag we just found + // Keeps error in nested tag from breaking out + // of table structure.. + // + $curr_pos += strlen($possible_start); } else { @@ -484,7 +482,7 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_ { $code_entities_match = array('#<#', '#>#', '#"#', '#:#', '#\[#', '#\]#', '#\(#', '#\)#', '#\{#', '#\}#'); $code_entities_replace = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}'); - $between_tags = preg_replace($code_entities_match, $code_entities_replace, $between_tags); + $between_tags = htmlentities($between_tags); } $text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$curr_nesting_depth:$uid]"; $text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$curr_nesting_depth:$uid]"; @@ -519,8 +517,8 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_ { $match = bbcode_array_pop($stack); $curr_pos = $match['pos']; - bbcode_array_push($stack, $match); - ++$curr_pos; +// bbcode_array_push($stack, $match); +// ++$curr_pos; } else { diff --git a/phpBB/includes/functions_post.php b/phpBB/includes/functions_post.php index 95ba928bf2..8834d52e5a 100644 --- a/phpBB/includes/functions_post.php +++ b/phpBB/includes/functions_post.php @@ -263,7 +263,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_ } $edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : ""; - $sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)" : "UPDATE " . POSTS_TABLE . " SET post_username = $post_username, enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id"; + $sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)" : "UPDATE " . POSTS_TABLE . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id"; if (!$db->sql_query($sql, BEGIN_TRANSACTION)) { message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql); diff --git a/phpBB/templates/subSilver/viewtopic_body.tpl b/phpBB/templates/subSilver/viewtopic_body.tpl index dac8e5e2b2..9fea16eace 100644 --- a/phpBB/templates/subSilver/viewtopic_body.tpl +++ b/phpBB/templates/subSilver/viewtopic_body.tpl @@ -30,7 +30,7 @@ - +
    {postrow.L_MINI_POST_ALT}{L_POSTED}: {postrow.POST_DATE}    {L_POST_SUBJECT}: {postrow.POST_SUBJECT}{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}