root / trunk / phpBB / develop / change_smiley_ref.php
History | View | Annotate | Download (2.3 kB)
| 1 | <?php
|
|---|---|
| 2 | /***************************************************************************
|
| 3 | * merge_clean_posts.php |
| 4 | * ------------------- |
| 5 | * begin : Tuesday, February 25, 2003 |
| 6 | * copyright : (C) 2003 The phpBB Group |
| 7 | * email : support@phpbb.com |
| 8 | * |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | /***************************************************************************
|
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation; either version 2 of the License, or |
| 16 | * (at your option) any later version. |
| 17 | * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | //
|
| 21 | // Security message:
|
| 22 | //
|
| 23 | // This script is potentially dangerous.
|
| 24 | // Remove or comment the next line (die(".... ) to enable this script.
|
| 25 | // Do NOT FORGET to either remove this script or disable it after you have used it.
|
| 26 | //
|
| 27 | die("Please read the first lines of this script for instructions on how to enable it"); |
| 28 | |
| 29 | @set_time_limit(2400); |
| 30 | |
| 31 | // This script adds missing permissions
|
| 32 | $db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = ''; |
| 33 | |
| 34 | define('IN_PHPBB', 1); |
| 35 | define('ANONYMOUS', 1); |
| 36 | $phpEx = substr(strrchr(__FILE__, '.'), 1); |
| 37 | $phpbb_root_path='./../'; |
| 38 | include($phpbb_root_path . 'config.'.$phpEx); |
| 39 | require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx); |
| 40 | require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx); |
| 41 | include($phpbb_root_path . 'includes/functions.'.$phpEx); |
| 42 | |
| 43 | $cache = new acm(); |
| 44 | $db = new $sql_db(); |
| 45 | |
| 46 | // Connect to DB
|
| 47 | $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); |
| 48 | |
| 49 | $sql = "SELECT post_id, post_text FROM {$table_prefix}posts WHERE post_text LIKE '%{SMILE_PATH}%'"; |
| 50 | $result = $db->sql_query($sql); |
| 51 | |
| 52 | while ($row = $db->sql_fetchrow($result)) |
| 53 | {
|
| 54 | $db->sql_query("UPDATE {$table_prefix}posts SET post_text = '" . $db->sql_escape(str_replace('{SMILE_PATH}', '{SMILIES_PATH}', $row['post_text'])) . "' WHERE post_id = " . $row['post_id']); |
| 55 | } |
| 56 | $db->sql_freeresult($result); |
| 57 | |
| 58 | echo "<p><b>Done</b></p>\n"; |

