From b9da78378baf19a728987641bc17a54599d38f44 Mon Sep 17 00:00:00 2001 From: David M Date: Sat, 19 May 2007 10:45:08 +0000 Subject: [PATCH] update old posts to use new smilies git-svn-id: file:///svn/phpbb/trunk@7636 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/adjust_smilies.php | 130 +++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 phpBB/develop/adjust_smilies.php diff --git a/phpBB/develop/adjust_smilies.php b/phpBB/develop/adjust_smilies.php new file mode 100644 index 0000000000..774c8834f6 --- /dev/null +++ b/phpBB/develop/adjust_smilies.php @@ -0,0 +1,130 @@ +session_begin(); +$auth->acl($user->data); +$user->setup(); + +$echos = 0; + +$replace = array( + 'sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $new_content = str_replace($replace, $with, $row['user_sig']); + + if ($new_content != $row['user_sig']) + { + $sql = 'UPDATE ' . USERS_TABLE . " SET user_sig = '" . $db->sql_escape($new_content) . "' + WHERE user_id = " . $row['user_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '
' . "\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } +} +$db->sql_freeresult($result); + + +// Now adjust posts +$sql = 'SELECT post_id, post_text + FROM ' . POSTS_TABLE; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $new_content = str_replace($replace, $with, $row['post_text']); + + if ($row['post_text'] != $new_content) + { + $sql = 'UPDATE ' . POSTS_TABLE . " SET post_text = '" . $db->sql_escape($new_content) . "' + WHERE post_id = " . $row['post_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '
' . "\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } +} +$db->sql_freeresult($result); + +// Now to the private messages +$sql = 'SELECT msg_id, message_text + FROM ' . PRIVMSGS_TABLE; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $new_content = str_replace($replace, $with, $row['message_text']); + + if ($row['message_text'] != $new_content) + { + $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET bbcode_bitfield = '" . $db->sql_escape($new_content) . "' + WHERE msg_id = " . $row['msg_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '
' . "\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } +} +$db->sql_freeresult($result); + +// Done +$db->sql_close(); + +?> \ No newline at end of file