From 9cabdd8656d75ded8d75799455a0c30c1414155c Mon Sep 17 00:00:00 2001 From: Bart van Bragt Date: Mon, 9 Apr 2001 19:26:15 +0000 Subject: [PATCH] removed bbcode_conversion.php from main dir git-svn-id: file:///svn/phpbb/trunk@140 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/bbcode_conversion.php | 205 ------------------------------------ 1 file changed, 205 deletions(-) delete mode 100755 phpBB/bbcode_conversion.php diff --git a/phpBB/bbcode_conversion.php b/phpBB/bbcode_conversion.php deleted file mode 100755 index a4d62a0325..0000000000 --- a/phpBB/bbcode_conversion.php +++ /dev/null @@ -1,205 +0,0 @@ -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("
", "\n", $text); - - // make a uid - $uid = make_bbcode_uid(); - - // do 2.x first-pass encoding.. - $text = bbencode_first_pass($text, $uid); - - $text = addslashes($text); - - // put the uid in the database. - $sql = "UPDATE " . POSTS_TABLE . " SET bbcode_uid='" . $uid . "' WHERE (post_id = $post_id)"; - $result = $db->sql_query($sql); - if (!$result) - { - $db_error = $db->sql_error(); - die("Error doing DB update in posts table. Reason: " . $db_error["message"] . " sql: $sql"); - } - // Put the post text back in the database. - $sql = "UPDATE " . POSTS_TEXT_TABLE . " SET post_text='" . $text . "' WHERE (post_id = $post_id)"; - $result = $db->sql_query($sql); - if (!$result) - { - $db_error = $db->sql_error(); - die("Error doing DB update in post text table. Reason: " . $db_error["message"] . " sql: $sql"); - } - - if (($i % 100) == 0) - { - echo "Done post: $i
\n"; - flush(); - } - - -} - - - -echo "

Done.

\n"; - - - -// ------------------------------------------------------------------------------- -// Everything below here is 1.x BBCode functions. -// ------------------------------------------------------------------------------- - - -function bbdecode($message) { - - // Undo [code] - $code_start_html = "
Code:
";
-		$code_end_html = "

"; - $message = str_replace($code_start_html, "[code]", $message); - $message = str_replace($code_end_html, "[/code]", $message); - - // Undo [quote] - $quote_start_html = "
Quote:
"; - $quote_end_html = "

"; - $message = str_replace($quote_start_html, "[quote]", $message); - $message = str_replace($quote_end_html, "[/quote]", $message); - - // Undo [b] and [i] - $message = preg_replace("#(.*?)#s", "[b]\\1[/b]", $message); - $message = preg_replace("#(.*?)#s", "[i]\\1[/i]", $message); - - // Undo [url] (long form) - $message = preg_replace("#(.*?)#s", "[url=\\1\\2]\\3[/url]", $message); - - // Undo [url] (short form) - $message = preg_replace("#(.*?)#s", "[url]\\3[/url]", $message); - - // Undo [email] - $message = preg_replace("#(.*?)#s", "[email]\\1[/email]", $message); - - // Undo [img] - $message = preg_replace("##s", "[img]\\1[/img]", $message); - - // Undo lists (unordered/ordered) - - //
  • tags: - $message = str_replace("
  • ", "[*]", $message); - - // [list] tags: - $message = str_replace("", "[/list]", $message); - $message = str_replace("", "[/list]", $message); - - return($message); -} - - -/** - * Nathan Codding - Feb 6, 2001 - * Reverses the effects of make_clickable(), for use in editpost. - * - Does not distinguish between "www.xxxx.yyyy" and "http://aaaa.bbbb" type URLs. - * - */ - -function undo_make_clickable($text) { - - $text = preg_replace("#.*?#i", "\\1", $text); - $text = preg_replace("#.*?#i", "\\1", $text); - - return $text; - -} - - - - -?> \ No newline at end of file