| 1 |
<?php</span> |
|---|
| 2 |
<span class="code-lang">set_config('site_keywords', '��������, �������, ��-�� tbdevsz'); |
|---|
| 3 |
set_config('autoclean_interval_delete_old_sessions', '10'); |
|---|
| 4 |
set_config('autoclean_last_run_delete_old_sessions', '0', true);</span> |
|---|
| 5 |
<span class="code-lang"> |
|---|
| 6 |
set_config('autowarn_settings', str_replace(',', ';', $config['autowarn_settings'])); |
|---|
| 7 |
set_config('email_function_name', 'mail'); |
|---|
| 8 |
|
|---|
| 9 |
$db->sql_query("ALTER TABLE " . PEERS_TABLE . " DROP INDEX `peer_id`"); |
|---|
| 10 |
$db->sql_query("ALTER TABLE " . PEERS_TABLE . " CHANGE `peer_id` `peer_id` BLOB NOT NULL"); |
|---|
| 11 |
$db->sql_query("CREATE INDEX peer_id ON " . PEERS_TABLE . " (peer_id(20))"); |
|---|
| 12 |
|
|---|
| 13 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'board_disable\''); |
|---|
| 14 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'config_id\''); |
|---|
| 15 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'coppa_fax\''); |
|---|
| 16 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'coppa_mail\''); |
|---|
| 17 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'lastcleantime\''); |
|---|
| 18 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'lastcleantime_additional\''); |
|---|
| 19 |
|
|---|
| 20 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'allow_theme_create\''); |
|---|
| 21 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'board_startdate\''); |
|---|
| 22 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'peerlimit\''); |
|---|
| 23 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'require_activation\''); |
|---|
| 24 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'board_email\''); |
|---|
| 25 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'allow_namechange\''); |
|---|
| 26 |
|
|---|
| 27 |
$db->sql_query('ALTER TABLE ' . CATEGORIES_TABLE . ' ADD cat_parent_id INT( 10 ) NOT NULL AFTER image'); |
|---|
| 28 |
|
|---|
| 29 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' CHANGE `id` `comment_id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT'); |
|---|
| 30 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' CHANGE `user` `comment_user` INT( 10 ) UNSIGNED NOT NULL DEFAULT \'0\''); |
|---|
| 31 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' ADD `comment_type` TINYINT( 1 ) NOT NULL DEFAULT \'0\''); |
|---|
| 32 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' ADD `comment_for_id` INT( 10 ) NOT NULL DEFAULT \'0\''); |
|---|
| 33 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' CHANGE `added` `comment_added` INT( 11 ) NOT NULL DEFAULT \'0\''); |
|---|
| 34 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' CHANGE `text` `comment_text` TEXT CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL'); |
|---|
| 35 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' CHANGE `ori_text` `comment_ori_text` TEXT CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL'); |
|---|
| 36 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' CHANGE `editedby` `comment_editedby` INT( 10 ) UNSIGNED NOT NULL DEFAULT \'0\''); |
|---|
| 37 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' CHANGE `editedat` `comment_editedat` INT( 11 ) NOT NULL DEFAULT \'0\''); |
|---|
| 38 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' ADD INDEX ( `comment_for_id` ) '); |
|---|
| 39 |
|
|---|
| 40 |
$sql = 'SELECT comment_id, torrent, request, offer FROM ' . COMMENTS_TABLE; |
|---|
| 41 |
$result = $db->sql_query($sql); |
|---|
| 42 |
$updates = array(); |
|---|
| 43 |
while ( $row = $db->sql_fetchrow($result) ) { |
|---|
| 44 |
if ( $row['torrent'] ) { |
|---|
| 45 |
$sql = 'UPDATE ' . COMMENTS_TABLE . ' SET comment_for_id = ' . $row['torrent'] . ', comment_type = ' . TYPE_TORRENT . ' WHERE comment_id = ' . $row['comment_id']; |
|---|
| 46 |
$db->sql_query($sql); |
|---|
| 47 |
} |
|---|
| 48 |
elseif ( $row['request'] ) { |
|---|
| 49 |
$sql = 'UPDATE ' . COMMENTS_TABLE . ' SET comment_for_id = ' . $row['request'] . ', comment_type = ' . TYPE_REQUEST . ' WHERE comment_id = ' . $row['comment_id']; |
|---|
| 50 |
$db->sql_query($sql); |
|---|
| 51 |
} |
|---|
| 52 |
elseif ( $row['offer'] ) { |
|---|
| 53 |
$sql = 'UPDATE ' . COMMENTS_TABLE . ' SET comment_for_id = ' . $row['offer'] . ', comment_type = ' . TYPE_OFFER . ' WHERE comment_id = ' . $row['comment_id']; |
|---|
| 54 |
$db->sql_query($sql); |
|---|
| 55 |
} |
|---|
| 56 |
else { |
|---|
| 57 |
$message .= 'Unknown comment type at ID ' . $row['comment_id'] . '<br />'; |
|---|
| 58 |
} |
|---|
| 59 |
} |
|---|
| 60 |
$db->sql_freeresult($result); |
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' DROP `request`'); |
|---|
| 64 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' DROP `offer`'); |
|---|
| 65 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' DROP `torrent`'); |
|---|
| 66 |
|
|---|
| 67 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' CHANGE `id` `checkcomm_id` INT( 11 ) NOT NULL AUTO_INCREMENT'); |
|---|
| 68 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' CHANGE `userid` `checkcomm_userid` INT( 10 ) NOT NULL DEFAULT \'0\''); |
|---|
| 69 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' CHANGE `notify_status` `checkcomm_notify_status` TINYINT( 1 ) NOT NULL DEFAULT \'0\''); |
|---|
| 70 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' ADD `checkcomm_for_id` INT( 10 ) NOT NULL DEFAULT \'0\''); |
|---|
| 71 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' ADD `checkcomm_type` TINYINT( 1 ) NOT NULL DEFAULT \'0\''); |
|---|
| 72 |
|
|---|
| 73 |
$sql = 'SELECT torrent, request, offer, checkcomm_id FROM ' . COMMENTS_NOTIFY_TABLE; |
|---|
| 74 |
$result = $db->sql_query($sql); |
|---|
| 75 |
while ( $row = $db->sql_fetchrow($result) ) { |
|---|
| 76 |
if ( $row['torrent'] ) { |
|---|
| 77 |
$sql = 'UPDATE ' . COMMENTS_NOTIFY_TABLE . ' SET checkcomm_for_id = ' . $row['torrent'] . ', checkcomm_type = ' . TYPE_TORRENT . ' WHERE checkcomm_id = ' . $row['checkcomm_id']; |
|---|
| 78 |
$db->sql_query($sql); |
|---|
| 79 |
} |
|---|
| 80 |
elseif ( $row['request'] ) { |
|---|
| 81 |
$sql = 'UPDATE ' . COMMENTS_NOTIFY_TABLE . ' SET checkcomm_for_id = ' . $row['request'] . ', checkcomm_type = ' . TYPE_REQUEST . ' WHERE checkcomm_id = ' . $row['checkcomm_id']; |
|---|
| 82 |
$db->sql_query($sql); |
|---|
| 83 |
} |
|---|
| 84 |
elseif ( $row['offer'] ) { |
|---|
| 85 |
$sql = 'UPDATE ' . COMMENTS_NOTIFY_TABLE . ' SET checkcomm_for_id = ' . $row['offer'] . ', checkcomm_type = ' . TYPE_OFFER . ' WHERE checkcomm_id = ' . $row['checkcomm_id']; |
|---|
| 86 |
$db->sql_query($sql); |
|---|
| 87 |
} |
|---|
| 88 |
else { |
|---|
| 89 |
$message .= 'Unknown comment type at ID ' . $row['checkcomm_id'] . '<br />'; |
|---|
| 90 |
} |
|---|
| 91 |
} |
|---|
| 92 |
$db->sql_freeresult($result); |
|---|
| 93 |
|
|---|
| 94 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' DROP `checkcomm_id`'); |
|---|
| 95 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' DROP `request`'); |
|---|
| 96 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' DROP `offer`'); |
|---|
| 97 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' DROP `torrent`'); |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
$db->sql_query('ALTER TABLE ' . CATEGORIES_TABLE . ' CHANGE `name` `name` VARCHAR( 255 ) NOT NULL'); |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' ADD `checkcomm_last_comment_id` INT( 10 ) NOT NULL DEFAULT \'0\''); |
|---|
| 104 |
|
|---|
| 105 |
$cn_ary = array( TYPE_TORRENT, TYPE_REQUEST, TYPE_OFFER ); |
|---|
| 106 |
|
|---|
| 107 |
foreach ( $cn_ary AS $_null => $type ) { |
|---|
| 108 |
$sql = 'SELECT MAX(comment_id) AS max_id, comment_for_id FROM ' . COMMENTS_TABLE . ' WHERE comment_type = ' . $type . ' GROUP BY comment_for_id'; |
|---|
| 109 |
$result = $db->sql_query($sql); |
|---|
| 110 |
while ( $row = $db->sql_fetchrow($result) ) { |
|---|
| 111 |
$sql = 'UPDATE ' . COMMENTS_NOTIFY_TABLE . ' SET checkcomm_last_comment_id = ' . $row['max_id'] . ' WHERE checkcomm_for_id = ' . $row['comment_for_id'] . ' AND checkcomm_type = ' . $type; |
|---|
| 112 |
$db->sql_query($sql); |
|---|
| 113 |
} |
|---|
| 114 |
} |
|---|
| 115 |
$db->sql_query('ALTER TABLE ' . COMMENTS_NOTIFY_TABLE . ' ADD INDEX ( `checkcomm_last_comment_id` )'); |
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'board_email_form\''); |
|---|
| 120 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'max_dead_torrent_time\''); |
|---|
| 121 |
|
|---|
| 122 |
$db->sql_query('UPDATE ' . CONFIG_TABLE . ' SET name = \'captcha_foreground_lattice_width\' WHERE name = \'captcha_foreground_lattice_x\''); |
|---|
| 123 |
$db->sql_query('UPDATE ' . CONFIG_TABLE . ' SET name = \'captcha_foreground_lattice_height\' WHERE name = \'captcha_foreground_lattice_y\''); |
|---|
| 124 |
|
|---|
| 125 |
$db->sql_query('ALTER TABLE ' . CATEGORIES_TABLE . ' ADD `allow_upload` TINYINT( 1 ) NOT NULL DEFAULT \'0\''); |
|---|
| 126 |
$db->sql_query('UPDATE ' . CATEGORIES_TABLE . ' SET allow_upload = 1'); |
|---|
| 127 |
|
|---|
| 128 |
$db->sql_query('ALTER TABLE ' . USERS_TABLE . ' CHANGE `notifs` `notifs` MEDIUMTEXT NOT NULL '); |
|---|
| 129 |
|
|---|
| 130 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' ADD `comment_reputation` INT( 10 ) NOT NULL DEFAULT \'0\''); |
|---|
| 131 |
$db->sql_query('ALTER TABLE ' . USERS_TABLE . ' CHANGE `points` `user_reputation` INT( 11 ) NOT NULL DEFAULT \'0\''); |
|---|
| 132 |
$db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ADD `post_reputation` INT( 10 ) NOT NULL DEFAULT \'0\''); |
|---|
| 133 |
|
|---|
| 134 |
$db->sql_query('CREATE TABLE IF NOT EXISTS `ranks` (`rank_id` int(10) NOT NULL auto_increment, `rank_name` varchar(255) NOT NULL, `rank_points` int(10) NOT NULL,`rank_image` varchar(255) NOT NULL,PRIMARY KEY (`rank_id`))'); |
|---|
| 135 |
|
|---|
| 136 |
$db->sql_query('ALTER TABLE ' . CONFIG_TABLE . ' CHANGE `value` `value` TEXT NOT NULL'); |
|---|
| 137 |
$db->sql_query('ALTER TABLE ' . TOPICS_TABLE . ' CHANGE `topic_title` `topic_title` VARCHAR( 255 ) NOT NULL'); |
|---|
| 138 |
|
|---|
| 139 |
$db->sql_query('ALTER TABLE `' . CHEATERS_TABLE . '` CHANGE `che_peer_id` `che_peer_id` BLOB NOT NULL'); |
|---|
| 140 |
$db->sql_query('ALTER TABLE `' . THEMES_TABLE . '` CHANGE `bbcode_bitfield` `bbcode_bitfield` BLOB NOT NULL'); |
|---|
| 141 |
$db->sql_query('ALTER TABLE `' . USERS_TABLE . '` CHANGE `secret` `secret` BLOB NOT NULL'); |
|---|
| 142 |
$db->sql_query('ALTER TABLE `' . USERS_TABLE . '` CHANGE `editsecret` `editsecret` BLOB NOT NULL'); |
|---|
| 143 |
|
|---|
| 144 |
$db->sql_query('ALTER TABLE `' . SIMPATY_TABLE . '` ADD INDEX ( `simpid` )'); |
|---|
| 145 |
$db->sql_query('RENAME TABLE indexrelases TO indexreleases'); |
|---|
| 146 |
|
|---|
| 147 |
$db->sql_return_on_error(true); |
|---|
| 148 |
|
|---|
| 149 |
$db->sql_query('ALTER DATABASE `' . $db_name . '` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci'); |
|---|
| 150 |
$db->sql_query('ALTER TABLE `' . POSTS_TEXT_TABLE . '` CHANGE `post_text` `post_text` mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci'); |
|---|
| 151 |
|
|---|
| 152 |
$tables = get_defined_constants(true); |
|---|
| 153 |
if ( sizeof($tables['user']) ) { |
|---|
| 154 |
foreach ( $tables['user'] AS $table_define => $table_name ) { |
|---|
| 155 |
if ( strpos($table_define, '_TABLE') === false ) { |
|---|
| 156 |
continue; |
|---|
| 157 |
} |
|---|
| 158 |
|
|---|
| 159 |
$db->sql_query('ALTER TABLE `' . $table_name . '` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci'); |
|---|
| 160 |
|
|---|
| 161 |
$sql2 = 'SHOW CREATE TABLE ' . $table_name; |
|---|
| 162 |
$result2 = $db->sql_query($sql2); |
|---|
| 163 |
$row2 = $db->sql_fetchrow($result2); |
|---|
| 164 |
$ary = array_values($row2); |
|---|
| 165 |
$create_table = $ary[1]; |
|---|
| 166 |
$table_ary = explode("\n", $create_table); |
|---|
| 167 |
|
|---|
| 168 |
foreach ( $table_ary AS $_null => $string ) { |
|---|
| 169 |
if ( strpos($string, 'character set cp1251') !== false ) { |
|---|
| 170 |
preg_match('/`(.*?)` (.*?) character set cp1251/i', $string, $matches); |
|---|
| 171 |
|
|---|
| 172 |
$sql = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $matches[1] . '` `' . $matches[1] . '` ' . $matches[2] . ' CHARACTER SET utf8 COLLATE utf8_general_ci'; |
|---|
| 173 |
|
|---|
| 174 |
if ( !$db->sql_query($sql) ) { |
|---|
| 175 |
$error = $db->sql_error(); |
|---|
| 176 |
|
|---|
| 177 |
if ( $error['code'] != 1062 ) { |
|---|
| 178 |
trigger_error('Error in sql ' . $sql . ' ' . $error['message']); |
|---|
| 179 |
} |
|---|
| 180 |
} |
|---|
| 181 |
} |
|---|
| 182 |
} |
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
} |
|---|
| 186 |
while ( $row = $db->sql_fetchrow($result) ); |
|---|
| 187 |
} |
|---|
| 188 |
|
|---|
| 189 |
$db->sql_return_on_error(false); |
|---|
| 190 |
|
|---|
| 191 |
$sql = 'CREATE TABLE ' . SEARCH_WORD_TABLE . '1 AS SELECT * FROM ' . SEARCH_WORD_TABLE . ' WHERE 1 GROUP BY word_text'; |
|---|
| 192 |
$db->sql_query($sql); |
|---|
| 193 |
|
|---|
| 194 |
$sql = 'DROP TABLE ' . SEARCH_WORD_TABLE; |
|---|
| 195 |
$db->sql_query($sql); |
|---|
| 196 |
|
|---|
| 197 |
$sql = 'RENAME TABLE ' . SEARCH_WORD_TABLE . '1 TO ' . SEARCH_WORD_TABLE; |
|---|
| 198 |
$db->sql_query($sql); |
|---|
| 199 |
|
|---|
| 200 |
set_config('offline_text', ''); |
|---|
| 201 |
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE name = \'default_language_charset\''); |
|---|
| 202 |
|
|---|
| 203 |
$base_dir = $root_path . 'templates/upload_templates/'; |
|---|
| 204 |
|
|---|
| 205 |
$try_decode = function_exists('mb_detect_encoding') && function_exists('iconv'); |
|---|
| 206 |
|
|---|
| 207 |
if ( $dir = opendir($base_dir) ) { |
|---|
| 208 |
while ( $file = readdir($dir) ) { |
|---|
| 209 |
if( $file != '..' && $file != '.' && $file != 'index.htm' && !is_dir($base_dir . $file) ) { |
|---|
| 210 |
if ( ($content = @file_get_contents($base_dir . $file)) === false || !$try_decode ) { |
|---|
| 211 |
echo('<span style="color:red">Cant open file ' . $file . '. Please, update this file to new encoding utf-8 manually.</span>'); |
|---|
| 212 |
continue; |
|---|
| 213 |
} |
|---|
| 214 |
|
|---|
| 215 |
$from_charset = mb_detect_encoding($content, 'auto', true); |
|---|
| 216 |
|
|---|
| 217 |
if ( $from_charset == 'UTF-8' ) { |
|---|
| 218 |
continue; |
|---|
| 219 |
} |
|---|
| 220 |
|
|---|
| 221 |
$content = iconv($from_charset, 'UTF-8', $content); |
|---|
| 222 |
|
|---|
| 223 |
if ( @file_put_contents($base_dir . $file, $content) === false ) { |
|---|
| 224 |
@unlink($base_dir . $file); |
|---|
| 225 |
file_put_contents($base_dir . $file, $content); |
|---|
| 226 |
@chmod($base_dir . $file, $content, 0777); |
|---|
| 227 |
} |
|---|
| 228 |
} |
|---|
| 229 |
} |
|---|
| 230 |
} |
|---|
| 231 |
else { |
|---|
| 232 |
echo('<span style="color:red">Cant open dir ' . $base_dir . '. Please, update upload templates files to new encoding utf-8 manually.</span>'); |
|---|
| 233 |
} |
|---|
| 234 |
|
|---|
| 235 |
set_config('points_settings', ''); |
|---|
| 236 |
|
|---|
| 237 |
$db->sql_query('ALTER TABLE ' . USERS_TABLE . ' ADD user_reputation_level INT( 10 ) NOT NULL DEFAULT \'0\' AFTER user_reputation'); |
|---|
| 238 |
$db->sql_query('ALTER TABLE ' . USERS_TABLE . ' ADD `user_rank_id` INT( 10 ) NOT NULL DEFAULT \'0\''); |
|---|
| 239 |
$db->sql_query('ALTER TABLE ' . RANKS_TABLE . ' ADD `rank_level` INT( 10 ) NOT NULL DEFAULT \'0\''); |
|---|
| 240 |
|
|---|
| 241 |
$db->sql_query('ALTER TABLE ' . NEWS_TABLE . ' ADD news_comments INT( 10 ) NOT NULL DEFAULT \'0\''); |
|---|
| 242 |
$db->sql_query('ALTER TABLE ' . COMMENTS_TABLE . ' DROP comment_ori_text'); |
|---|
| 243 |
|
|---|
| 244 |
$sql = 'SELECT COUNT(*) AS num_help FROM ' . HELPDESK_TABLE . ' WHERE solved = 0'; |
|---|
| 245 |
$result = $db->sql_query($sql); |
|---|
| 246 |
$help_num = ( $row = $db->sql_fetchrow($result) ) ? intval($row['num_help']) : 0; |
|---|
| 247 |
|
|---|
| 248 |
set_config('count_helpdesk_not_solved', $help_num, true); |
|---|
| 249 |
|
|---|
| 250 |
$sql = 'SELECT COUNT(*) AS numreports FROM ' . REPORTS_TABLE . ' WHERE dealtwith = 0'; |
|---|
| 251 |
$result = $db->sql_query($sql); |
|---|
| 252 |
$numreports = ( $row = $db->sql_fetchrow($result) ) ? intval($row['numreports']) : 0; |
|---|
| 253 |
|
|---|
| 254 |
set_config('count_reports_not_solved', $numreports, true); |
|---|
| 255 |
|
|---|
| 256 |
$sql = 'SELECT COUNT(*) AS count FROM ' . UPLOADAPP_TABLE . ' WHERE active = 1'; |
|---|
| 257 |
$result = $db->sql_query($sql); |
|---|
| 258 |
$num_candidates = ( $row = $db->sql_fetchrow($result) ) ? intval($row['count']) : 0; |
|---|
| 259 |
|
|---|
| 260 |
set_config('count_candidates_waiting', $num_candidates, true); |
|---|
| 261 |
|
|---|
| 262 |
$db->sql_query('ALTER TABLE ' . NEWS_TABLE . ' ADD `news_disable_comments` TINYINT( 1 ) NOT NULL DEFAULT \'0\''); |
|---|
| 263 |
$db->sql_query('ALTER TABLE ' . NEWS_TABLE . ' DROP INDEX `added`'); |
|---|
| 264 |
|
|---|
| 265 |
$db->sql_query('ALTER TABLE ' . RANKS_TABLE . ' ADD `rank_simpaty_limit` INT( 3 ) NOT NULL DEFAULT \'0\''); |
|---|
| 266 |
|
|---|
| 267 |
$db->sql_query('DROP TABLE `themes_name`'); |
|---|
| 268 |
|
|---|
| 269 |
set_config('mod_rewrite_enabled', 0); |
|---|
| 270 |
|
|---|
| 271 |
$db->sql_query('ALTER TABLE ' . USERS_TABLE . ' DROP `client`'); |
|---|
| 272 |
$db->sql_query('ALTER TABLE ' . USERS_TABLE . ' DROP `simpaty`'); |
|---|
| 273 |
|
|---|
| 274 |
$db->sql_query('ALTER TABLE ' . THEMES_TABLE . ' DROP `bbcode_bitfield`'); |
|---|
| 275 |
|
|---|
| 276 |
$db->sql_query('UPDATE ' . POSTS_TEXT_TABLE . ' SET post_text = REPLACE( post_text, CONCAT( \':\', bbcode_uid ) , \'\' )'); |
|---|
| 277 |
$db->sql_query('ALTER TABLE ' . POSTS_TEXT_TABLE . ' DROP bbcode_uid'); |
|---|
| 278 |
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_sig = REPLACE( user_sig, CONCAT( \':\', user_sig_bbcode_uid ) , \'\' )'); |
|---|
| 279 |
$db->sql_query('ALTER TABLE ' . USERS_TABLE . ' DROP user_sig_bbcode_uid'); |
|---|
| 280 |
|
|---|
| 281 |
$db->sql_query('UPDATE ' . POSTS_TEXT_TABLE . ' SET post_text = REPLACE( post_text, \'[color=green][size=9]\' , \'[color=green][size=1]\' )'); |
|---|
| 282 |
$db->sql_query('UPDATE ' . COMMENTS_TABLE . ' SET comment_text = REPLACE( comment_text, \'[color=green][size=9]\' , \'[color=green][size=1]\' )'); |
|---|
| 283 |
|
|---|
| 284 |
$sql = 'SELECT post_text, post_id FROM ' . POSTS_TEXT_TABLE . ' WHERE post_text LIKE \'%[img:%\''; |
|---|
| 285 |
$result = $db->sql_query($sql); |
|---|
| 286 |
while ( $row = $db->sql_fetchrow($result) ) { |
|---|
| 287 |
$post_text = preg_replace('/\[img:([0-9]+):([0-9]+)\]/si', '[img]', $row['post_text']); |
|---|
| 288 |
$db->sql_query('UPDATE ' . POSTS_TEXT_TABLE . ' SET post_text = \'' . $db->sql_escape($post_text) . '\' WHERE post_id = ' . $row['post_id']); |
|---|
| 289 |
} |
|---|
| 290 |
|
|---|
| 291 |
set_config('tags_max_allow', 10); |
|---|
| 292 |
set_config('tags_max_length', 50); |
|---|
| 293 |
set_config('tags_min_length', 3); |
|---|
| 294 |
|
|---|
| 295 |
$db->sql_query('CREATE TABLE IF NOT EXISTS tags ( |
|---|
| 296 |
tag_name varchar(255) NOT NULL, |
|---|
| 297 |
tag_type tinyint(1) NOT NULL, |
|---|
| 298 |
tag_for_id int(10) NOT NULL, |
|---|
| 299 |
tag_count int(10) NOT NULL DEFAULT \'0\', |
|---|
| 300 |
KEY tag_type (tag_type), |
|---|
| 301 |
KEY tag_for_id (tag_for_id) |
|---|
| 302 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); |
|---|
| 303 |
|
|---|
| 304 |
$db->sql_query('CREATE TABLE IF NOT EXISTS tags_users ( |
|---|
| 305 |
tag_users_uid int(10) NOT NULL, |
|---|
| 306 |
tag_users_for_id int(10) NOT NULL, |
|---|
| 307 |
tag_users_type tinyint(1) NOT NULL, |
|---|
| 308 |
tag_users_name varchar(255) NOT NULL, |
|---|
| 309 |
KEY tag_users_type (tag_users_type), |
|---|
| 310 |
KEY tag_users_for_id (tag_users_for_id), |
|---|
| 311 |
KEY tag_users_uid (tag_users_uid) |
|---|
| 312 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); |
|---|
| 313 |
|
|---|
| 314 |
$db->sql_query('ALTER TABLE ' . FILES_TABLE . ' CHANGE `filename` `filename` TEXT NULL DEFAULT \'\''); |
|---|
| 315 |
$db->sql_query('ALTER TABLE ' . FILES_TABLE . ' DROP id'); |
|---|
| 316 |
|
|---|
| 317 |
$db->sql_query('ALTER TABLE ' . TORRENTS_TABLE . ' CHANGE flags flags TINYINT( 1 ) NOT NULL DEFAULT \'0\''); |
|---|
| 318 |
$db->sql_query('ALTER TABLE ' . TORRENTS_TABLE . ' ADD INDEX (flags)'); |
|---|
| 319 |
$db->sql_query('ALTER TABLE ' . TORRENTS_TABLE . ' DROP INDEX added'); |
|---|
| 320 |
$db->sql_query('ALTER TABLE ' . SNATCHED_TABLE . ' DROP connectable'); |
|---|
| 321 |
$db->sql_query('ALTER TABLE ' . PEERS_TABLE . ' DROP connectable'); |
|---|
| 322 |
$db->sql_query('ALTER TABLE ' . TOPICS_TABLE . ' CHANGE `topic_title` `topic_title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT \'\''); |
|---|
| 323 |
$db->sql_query('ALTER TABLE ' . POSTS_TEXT_TABLE . ' CHANGE `post_subject` `post_subject` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL'); |
|---|
| 324 |
|
|---|
| 325 |
$db->sql_query('ALTER TABLE ' . TORRENTS_TABLE . ' DROP save_as'); |
|---|
| 326 |
|
|---|
| 327 |
set_config('load_db_lastread', '0'); |
|---|
| 328 |
set_config('load_anon_lastread', '1'); |
|---|
| 329 |
set_config('load_db_track', '0'); |
|---|
| 330 |
|
|---|
| 331 |
$upd_version = '0.3.4'; |
|---|
| 332 |
?> |
|---|