|
From: Jonathan H. <the...@us...> - 2002-05-17 18:22:38
|
Update of /cvsroot/phpbb/phpBB2/includes
In directory usw-pr-cvs1:/tmp/cvs-serv32493/includes
Modified Files:
Tag: phpBB-2_0_0
bbcode.php functions_post.php
Log Message:
Fix (hopefully anyway :) for nested code tag issues with bbcode
Index: bbcode.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/bbcode.php,v
retrieving revision 1.36.2.6
retrieving revision 1.36.2.7
diff -C2 -r1.36.2.6 -r1.36.2.7
*** bbcode.php 13 May 2002 01:30:59 -0000 1.36.2.6
--- bbcode.php 17 May 2002 18:22:34 -0000 1.36.2.7
***************
*** 484,487 ****
--- 484,493 ----
if ($mark_lowest_level && ($curr_nesting_depth == 1))
{
+ if ($open_tag[0] == '[code]')
+ {
+ $code_entities_match = array('#<#', '#>#', '#"#', '#:#', '#\[#', '#\]#', '#\(#', '#\)#', '#\{#', '#\}#');
+ $code_entities_replace = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}');
+ $between_tags = preg_replace($code_entities_match, $code_entities_replace, $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]";
***************
*** 489,501 ****
else
{
! if ($open_is_regexp)
{
! $text = $before_start_tag . $start_tag;
}
else
{
! $text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$uid]";
}
- $text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$uid]";
}
--- 495,515 ----
else
{
! if ($open_tag[0] == '[code]')
{
! $text = $before_start_tag . '[code]';
! $text .= $between_tags . '[/code]';
}
else
{
! if ($open_is_regexp)
! {
! $text = $before_start_tag . $start_tag;
! }
! else
! {
! $text = $before_start_tag . substr($start_tag, 0, $start_length - 1) . ":$uid]";
! }
! $text .= $between_tags . substr($close_tag_new, 0, $close_tag_new_length - 1) . ":$uid]";
}
}
Index: functions_post.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/functions_post.php,v
retrieving revision 1.9.2.5
retrieving revision 1.9.2.6
diff -C2 -r1.9.2.5 -r1.9.2.6
*** functions_post.php 17 May 2002 13:13:35 -0000 1.9.2.5
--- functions_post.php 17 May 2002 18:22:36 -0000 1.9.2.6
***************
*** 109,129 ****
if( $bbcode_on && $bbcode_uid != '' )
{
- $tmp_message = $message;
- if ( ($match_count = preg_match_all('#^(.*?)\[code\](.*?)\[\/code\](.*?)$#is', $tmp_message, $match)) )
- {
- $code_entities_match = array('#<#', '#>#', '#"#', '#:#', '#\[#', '#\]#', '#\(#', '#\)#', '#\{#', '#\}#');
- $code_entities_replace = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}');
-
- $message = '';
-
- for($i = 0; $i < $match_count; $i++)
- {
- $message .= $match[1][$i] . '[code]' . preg_replace($code_entities_match, $code_entities_replace, $match[2][$i]) . '[/code]';
- $tmp_message = $match[3][$i];
- }
-
- $message .= $tmp_message;
- }
-
$message = bbencode_first_pass($message, $bbcode_uid);
}
--- 109,112 ----
***************
*** 837,839 ****
}
! ?>
\ No newline at end of file
--- 820,822 ----
}
! ?>
|