phpBB
Statistics
| Revision:

root / trunk / phpBB / develop / change_smiley_ref.php

History | View | Annotate | Download (2.3 kB)

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