diff --git a/phpBB/bbcode_conversion.php b/phpBB/bbcode_conversion.php new file mode 100755 index 0000000000..a4d62a0325 --- /dev/null +++ b/phpBB/bbcode_conversion.php @@ -0,0 +1,205 @@ +Creating backup table..
\n"; +flush(); + +$result = $db->sql_query($sql); +if (!$result) +{ + $db_error = $db->sql_error(); + die("Error doing DB backup table creation. Reason: " . $db_error["message"]); +} + +$sql = "insert into $backup_name select * from $table_name"; + +echo "Populating backup table..
\n"; +flush(); + +$result = $db->sql_query($sql); +if (!$result) +{ + $db_error = $db->sql_error(); + die("Error doing DB backup table data moving. Reason: " . $db_error["message"]); +} + + +$sql = "SELECT p.post_id, t.post_text FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " t WHERE (p.post_id = t.post_id)"; +if(!$result = $db->sql_query($sql)) +{ + die("error getting posts to work on"); +} +if(!$total_rows = $db->sql_numrows($result)) +{ + die("error getting rowcount"); +} + +echo "Found $total_rows total rows to work on.
\n"; +flush(); + +$row = $db->sql_fetchrowset($result); + +for($i = 0; $i < $total_rows; $i++) +{ + $post_id = $row[$i]['post_id']; + $text = $row[$i]['post_text']; + + // undo 1.2.x encoding.. + $text = bbdecode($text); + $text = undo_make_clickable($text); + $text = str_replace("Done.
\n"; + + + +// ------------------------------------------------------------------------------- +// Everything below here is 1.x BBCode functions. +// ------------------------------------------------------------------------------- + + +function bbdecode($message) { + + // Undo [code] + $code_start_html = "Code: |
"; + $code_end_html = " |
Quote: |
"; + $quote_end_html = " |
Code: |
'; diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 97a47d82b4..a56c0288bf 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -22,6 +22,7 @@ ***************************************************************************/ include('extension.inc'); include('common.'.$phpEx); +include('functions/bbcode.'.$phpEx); if(!isset($HTTP_GET_VARS['topic'])) // For backward compatibility { @@ -84,7 +85,7 @@ if(!isset($start)) $start = 0; } -$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, r.rank_title, r.rank_image, p.post_time, p.post_id, pt.post_text +$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, r.rank_title, r.rank_image, p.post_time, p.post_id, p.bbcode_uid, pt.post_text FROM ".POSTS_TABLE." p LEFT JOIN ".USERS_TABLE." u ON p.poster_id = u.user_id LEFT JOIN ".RANKS_TABLE." r ON (u.user_rank = r.rank_id) @@ -146,6 +147,7 @@ for($x = 0; $x < $total_posts; $x++) } $message = stripslashes($postrow[$x]["post_text"]); + $bbcode_uid = $postrow[$x]['bbcode_uid']; if(!$allow_html) { @@ -154,8 +156,11 @@ for($x = 0; $x < $total_posts; $x++) if($allow_bbcode) { // do bbcode stuff here + $message = bbencode_second_pass($message, $bbcode_uid); } + $message = str_replace("\n", " |