diff options
author | Henry Sudhof <kellanved@phpbb.com> | 2007-07-02 10:35:40 +0000 |
---|---|---|
committer | Henry Sudhof <kellanved@phpbb.com> | 2007-07-02 10:35:40 +0000 |
commit | 1330f4ffdad6a250e612b0bcb4e598e0a80e6bbc (patch) | |
tree | a192b54b6724530e637d9c819cc7a48dff1b30e9 /phpBB | |
parent | 45a1efb2551059af2d8fe89070b0f70411f4dccc (diff) | |
download | forums-1330f4ffdad6a250e612b0bcb4e598e0a80e6bbc.tar forums-1330f4ffdad6a250e612b0bcb4e598e0a80e6bbc.tar.gz forums-1330f4ffdad6a250e612b0bcb4e598e0a80e6bbc.tar.bz2 forums-1330f4ffdad6a250e612b0bcb4e598e0a80e6bbc.tar.xz forums-1330f4ffdad6a250e612b0bcb4e598e0a80e6bbc.zip |
There might be incorrectly converted smilies in the DB. Let's try to repair them.
git-svn-id: file:///svn/phpbb/trunk@7821 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/install/database_update.php | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7fe4d50bf2..f4ec7bb566 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -620,10 +620,39 @@ if (version_compare($current_version, '3.0.RC1', '<=')) $no_updates = false; } -//if (version_compare($current_version, '3.0.RC2', '<=')) -//{ -// $no_updates = false; -//} +if (version_compare($current_version, '3.0.RC2', '<=')) +{ + + $smileys = array(); + $sql = 'SELECT smiley_id, code + FROM ' . SMILIES_TABLE; + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $smileys[$row['smiley_id']] = $row['code']; + } + $db->sql_freeresult($result); + + foreach($smileys as $id => $code) + { + // 2.0 only entitized lt and gt; We need to do something about double quotes. + if (strchr($code, '"') === false) + { + continue; + } + $new_code = str_replace('&', '&', $code); + $new_code = str_replace('<', '<', $new_code); + $new_code = str_replace('>', '>', $new_code); + $new_code = utf8_htmlspecialchars($new_code); + $sql = 'UPDATE ' . SMILIES_TABLE . ' + SET code = \'' . $db->sql_escape($new_code) . '\' + WHERE smiley_id = ' . (int)$id; + $db->sql_query($sql); + } + $no_updates = false; +} _write_result($no_updates, $errored, $error_ary); |