diff options
author | Nils Adermann <naderman@naderman.de> | 2007-04-28 21:16:32 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2007-04-28 21:16:32 +0000 |
commit | 87956e71a435f39a29ff391bc22da0c318f327f5 (patch) | |
tree | eaac2a6de8aca7fe10239fa9f596a724fba409f4 /phpBB/develop/adjust_magic_urls.php | |
parent | aaa93a8fc725b15adc94c85a52513261b0d93923 (diff) | |
download | forums-87956e71a435f39a29ff391bc22da0c318f327f5.tar forums-87956e71a435f39a29ff391bc22da0c318f327f5.tar.gz forums-87956e71a435f39a29ff391bc22da0c318f327f5.tar.bz2 forums-87956e71a435f39a29ff391bc22da0c318f327f5.tar.xz forums-87956e71a435f39a29ff391bc22da0c318f327f5.zip |
- magic urls should have class="postlink", added class="postlink-local" for relative magic urls [Bug #9867]
run develop/adjust_magic_urls.php to modify your post/sig/pm contents to use class="postlink"
- corrected a few bugs in fulltext_mysql stats [Bug #10165]
git-svn-id: file:///svn/phpbb/trunk@7424 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/develop/adjust_magic_urls.php')
-rw-r--r-- | phpBB/develop/adjust_magic_urls.php | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/phpBB/develop/adjust_magic_urls.php b/phpBB/develop/adjust_magic_urls.php new file mode 100644 index 0000000000..1430a47a12 --- /dev/null +++ b/phpBB/develop/adjust_magic_urls.php @@ -0,0 +1,126 @@ +<?php +/** +* Adds class="postlink" to magic urls +* +* You should make a backup from your users, posts and privmsgs table in case something goes wrong +* Forum descriptions and rules need to be re-submitted manually. +*/ +die("Please read the first lines of this script for instructions on how to enable it"); + +set_time_limit(0); + +define('IN_PHPBB', true); +$phpbb_root_path = './../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.'.$phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup(); + +$echos = 0; + +$replace = array( + '<!-- l --><a href="', + '<!-- m --><a href="', + '<!-- w --><a href="', +); +$with = array( + '<!-- l --><a class="postlink-local" href="', + '<!-- m --><a class="postlink" href="', + '<!-- w --><a class="postlink" href="', +); + +// Adjust user signatures +$sql = 'SELECT user_id, user_sig + FROM ' . USERS_TABLE; +$result = $db->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 '<br />' . "\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 '<br />' . "\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 '<br />' . "\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); + } +} +$db->sql_freeresult($result); + +// Done +$db->sql_close(); + +?>
\ No newline at end of file |