Migração do XMB para phpBB

Suporte à dúvidas gerais relacionadas ao phpBB.
DiFalco
Novato
Novato
Mensagens: 4
Registrado em: 22 Mar 2013, 22:56

Migração do XMB para phpBB

Mensagem por DiFalco »

Qual a URL do seu fórum: http://www.aovascotudo.com/forum/
Tipo de Hospedagem: Pago
Qual a versão do phpBB: XMB 1.9.11
É um novo ou uma conversão: -
Usuário de teste: -
Estilos instalados: -
Artodia: -
Modificações instaladas: -
Qual seu nivel de experiência: Iniciante
Quando começou o problema: -
Descreva seu problema: Existe alguma forma de migração do fórum XMB para o sistema phpBB???
Avatar do usuário
robra
Membro Sênior
Membro Sênior
Mensagens: 6065
Registrado em: 02 Dez 2010, 22:29

Re: Migração do XMB para phpBB

Mensagem por robra »

[DICA] Antes de abrir um Novo Tópico, procure saber se a sua dúvida já foi respondida. Pesquise no Google por palavras(em inglês também) relacionadas à ela, somado à palavra "phpbb".
DiFalco
Novato
Novato
Mensagens: 4
Registrado em: 22 Mar 2013, 22:56

Re: Migração do XMB para phpBB

Mensagem por DiFalco »

Vlw cara, vou dar uma lida no material!
Avatar do usuário
robra
Membro Sênior
Membro Sênior
Mensagens: 6065
Registrado em: 02 Dez 2010, 22:29

Re: Migração do XMB para phpBB

Mensagem por robra »

DiFalco escreveu:Vlw cara, vou dar uma lida no material!
Ok.
Lembrando que você instala o phpBB2 no diretório /phpbb2 e o phpBB3 no diretório /phpbb3.
Aí faz a conversão do XMB para o phpBB2, e depois do phpBB2 para o phpBB3.
Depois de tudo certo no phpBB3, aí poderá renomear o diretório /forum para /forum_xmb e o diretório /phpbb3 para /forum, alterando depois nas "configurações do servidor" a opção "Pasta do sistema:" para /forum.

Abraço. Imagem
[DICA] Antes de abrir um Novo Tópico, procure saber se a sua dúvida já foi respondida. Pesquise no Google por palavras(em inglês também) relacionadas à ela, somado à palavra "phpbb".
DiFalco
Novato
Novato
Mensagens: 4
Registrado em: 22 Mar 2013, 22:56

Re: Migração do XMB para phpBB

Mensagem por DiFalco »

Fui efetuar a migração e quando executo o _xmbtophpbb.php dá erro, alguém pode me ajudar?

Código: Selecionar todos

db_connect_id) { $result = @mysql_insert_id($this->db_connect_id); return $result; } else { return false; } } */ function result($query, $row) { $query = mysql_result($query, $row); return $query; } // XMB Table Layout define('XMB_RANKS_TABLE', $xmb_prefix . 'ranks'); define('XMB_USERS_TABLE', $xmb_prefix . 'members'); define('XMB_FORUMS_TABLE', $xmb_prefix . 'forums'); define('XMB_TOPICS_TABLE', $xmb_prefix . 'threads'); define('XMB_POSTS_TABLE', $xmb_prefix . 'posts'); define('XMB_WATCH_TABLE', $xmb_prefix . 'favorites'); define('XMB_CONFIG_TABLE', $xmb_prefix . 'settings'); define('XMB_PRIVMSGS_TABLE', $xmb_prefix . 'u2u'); define('XMB_ATTACH_TABLE', $xmb_prefix . 'attachments'); define('XMB_SMILIES_TABLE', $xmb_prefix . 'smilies'); define('XMB_BANNED_TABLE', $xmb_prefix . 'banned'); define('XMB_WORDS_TABLE', $xmb_prefix . 'words'); // phpBB Table Layout define('RANKS_TABLE', $phpbb_prefix . 'ranks'); define('USERS_TABLE', $phpbb_prefix . 'users'); define('CATEGORIES_TABLE', $phpbb_prefix.'categories'); define('FORUMS_TABLE', $phpbb_prefix.'forums'); define('AUTH_ACCESS_TABLE', $phpbb_prefix.'auth_access'); define('USER_GROUP_TABLE', $phpbb_prefix.'user_group'); define('GROUPS_TABLE', $phpbb_prefix.'groups'); define('TOPICS_TABLE', $phpbb_prefix.'topics'); define('POSTS_TABLE', $phpbb_prefix.'posts'); define('POSTS_TEXT_TABLE', $phpbb_prefix.'posts_text'); define('TOPICS_WATCH_TABLE', $phpbb_prefix.'topics_watch'); define('CONFIG_TABLE', $phpbb_prefix.'config'); define('VOTE_DESC_TABLE', $phpbb_prefix.'vote_desc'); define('VOTE_RESULTS_TABLE', $phpbb_prefix.'vote_results'); define('VOTE_VOTERS_TABLE', $phpbb_prefix.'vote_voters'); define('PRIVMSGS_TABLE', $phpbb_prefix.'privmsgs'); define('PRIVMSGS_TEXT_TABLE', $phpbb_prefix.'privmsgs_text'); define('ATTACH_CONFIG_TABLE', $phpbb_prefix.'attach_config'); define('ATTACH_TYPES_TABLE', $phpbb_prefix.'attach_types'); define('ATTACH_TYPECONFIG_TABLE', $phpbb_prefix.'attach_typeconfig'); define('ATTACH_EXTENSIONS_TABLE', $phpbb_prefix.'attach_extensions'); define('ATTACH_DESC_TABLE', $phpbb_prefix.'attach_desc'); define('ATTACH_TABLE', $phpbb_prefix.'attach'); define('SEARCH_WORD_TABLE', $phpbb_prefix.'search_wordlist'); define('SEARCH_MATCH_TABLE', $phpbb_prefix.'search_wordmatch'); define('SMILIES_TABLE', $phpbb_prefix.'smilies'); define('BANLIST_TABLE', $phpbb_prefix.'banlist'); define('WORDS_TABLE', $phpbb_prefix.'words'); define('THEMES_TABLE', $phpbb_prefix.'themes'); define('THEMES_NAME' , $phpbb_prefix.'themes_name'); // // ok, now we descide what to do // if ( isset($HTTP_GET_VARS['cmd']) || isset($HTTP_POST_VARS['cmd']) ) { $cmd = ( isset($HTTP_GET_VARS['cmd']) ) ? $HTTP_GET_VARS['cmd'] : $HTTP_POST_VARS['cmd']; $cmd = htmlspecialchars($cmd); } if ($xmb_prefix == $phpbb_prefix) { echo "Please check the _config.php, it says that the prefix for both, XMB and phpBB are the same. This will not work.
"; exit; } if (!$cmd) { echo "Command = " . $cmd . "
"; echo "Welcome to the script that will convert everthing possbile from XMB 1.5 Gold, Silver (final) to phpBB 2.0.0 

Please click below to start the first step in the conversion:"; //	 $cmd = convert; echo "

Check settings
"; //	 echo "

Check settings
"; echo "Command = " . $cmd . "
"; } else if ($cmd == 'convert') { ?>
Make sure you have uploaded the following files to the directoy where you have the files for phpBB 2.0.0:
_config.php
_xmbtophpbb.php
Original fiile structure for the phpBB 2.0.0 (see _readme.txt before doing actual conversion)
Click here to see what it will be converter.
"; if ($cnv_all == 1) { echo "
Since the variable cnv_all (convert all) is set to 1, that means everything will be converted if possible, except attachments. Enable them by hand.

"; } else { echo "
"; if ($cnv_ranks == 1) { echo "
Ranks
"; } if ($cnv_users == 1) { echo "
Usernames
"; } if ($cnv_forums == 1) { echo "
Forums
"; } if ($cnv_topics == 1) { echo "
Topics
"; } if ($cnv_posts == 1) { echo "
Posts
"; } if ($cnv_settings == 1) { echo "
Settings
"; } if ($cnv_polls == 1) { echo "
Polls
"; } if ($cnv_u2u == 1) { echo "
U2U
"; } if ($cnv_attach == 1) { echo "
Attachments
"; } if ($cnv_smilies == 1) { echo "
Smilies :o)
"; } if ($cnv_search == 1) { echo "
Search Index
"; } if ($cnv_banip == 1) { echo "
Banned IP numbers
"; } if ($cnv_word == 1) { echo "
Word replacement
"; } if (($cnv_ranks == 0) && ($cnv_users == 0) && ($cnv_forums == 0) && ($cnv_topics == 0) && ($cnv_posts == 0) && ($cnv_settings == 0) && ($cnv_polls == 0) && ($cnv_u2u == 0) && ($cnv_attach == 0) && ($cnv_search == 0) && ($cnv_smilies == 0) && ($cnv_banip == 0) && ($cnv_word == 0)) { echo "
Absolutely nothing! Check the _config.php file!!!
"; } } echo "
"; echo "Click here to finally start the conversion process."; } else if ($cmd == 'do_convert') { echo "The database data is being converted! Please be patient :)
"; // // Convert Ranks // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_ranks == 1) ) ) { echo "
Converting ranks..."; // Delete All User Ranks query("DELETE FROM " . RANKS_TABLE, "Couldn't delete from Ranks Table"); // Get XMB Rank Data $sql = "SELECT * FROM " . XMB_RANKS_TABLE; $result = query($sql, "Couldn't find " . XMB_RANKS_TABLE); $rank_count = $db->sql_numrows($result); $rank_data = $db->sql_fetchrowset($result); query($sql, "Couldn't delete ranks."); echo "."; for ($i = 0; $i < $rank_count; $i++) { if ($rank_data[$i]['posts'] == 0) { $rank_special = 1; } else { $rank_special = 0; } $sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_min, rank_special, rank_image) VALUES ('" . $rank_data[$i]['title'] . "', '" . $rank_data[$i]['posts'] . "', " . $rank_special . ",'" . $rank_data[$i]['avatarrank'] . "')"; query($sql, "Couldn't insert ranks");	 } echo "DONE"; }	 // // Start Users Conversion // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_users == 1) ) ) {	 echo "
Converting users...";	 echo ""; // Delete Users Data query("DELETE FROM " . USERS_TABLE, "Couldn't delete from Banlist Table"); query("DELETE FROM " . BANLIST_TABLE, "Couldn't delete from Banlist Table"); query("DELETE FROM " . USER_GROUP_TABLE, "Delete users from table ".USER_GROUP_TABLE." failed"); query("DELETE FROM " . GROUPS_TABLE, "Unable to delete old groups"); // Insert anonymous user here. $sql = "INSERT INTO " . USERS_TABLE . " (user_id, user_active, username, user_password, user_session_time, user_session_page, user_lastvisit, user_regdate, user_level, user_posts, user_timezone, user_style, user_lang, user_dateformat, user_new_privmsg, user_unread_privmsg, user_last_privmsg, user_emailtime, user_viewemail, user_attachsig, user_allowhtml, user_allowbbcode, user_allowsmile, user_allowavatar, user_allow_pm, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_rank, user_avatar, user_avatar_type, user_email, user_icq, user_website, user_from, user_sig, user_sig_bbcode_uid, user_aim, user_yim, user_msnm, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (-1, 0, 'Anonymous', '', 0, 0, 0, 1017373177, 0, 14, '0', NULL, '', '', 0, 0, 1018197250, NULL, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, NULL, '', 0, '', '', '', '', '', NULL, '', '', '', '', '', '', '')"; query($sql, "Unable to insert anonymous user into user table"); // Get Users Data // Just another way to get how many records are there inside the XMB database $number = query("SELECT COUNT(*) FROM ". XMB_USERS_TABLE,"Couldn't get the number of posts inside the users table"); $usersnum = result($number, 0); echo "
Total number of users to be converted: $usersnum..."; Flush(); $loopnum=intval($usersnum / 500); // how many loop he needs to create $users_left=($usersnum % 500);	 // how many users are left from divizion if ($users_left <> 0 ){ $loopnum++;	 // one extra loop for the users_left } $user_loc=0; $user_default=500; for ($y = 1; $y <= $loopnum; $y++)	 // does a loop as long as it has to { echo "
Converting 500 users from user number $user_loc"; Flush(); if ($y <> $loopnum) { $sql = "SELECT * FROM " . XMB_USERS_TABLE . " LIMIT $user_loc,$user_default "; // 500 users } else { $sql = "SELECT * FROM " . XMB_USERS_TABLE . " LIMIT $user_loc,$users_left "; // on the last pass only what is left } $result = query($sql, "Couldn't get data from 'members'"); $users_count = $db->sql_numrows($result); $users_data = $db->sql_fetchrowset($result); for ($i = 0; $i < $users_count; $i++) { $user_viewemail = (trim($users_data[$i]['showemail']) == 'yes') ? 1 : 0; $avatar_type = ($users_data[$i]['avatar'] != '') ? 2 : 0; // 2 = custom page avatar $status_id = ($users_data[$i]['status'] == 'Administrator') ? 1 : 0; $uid_bb = make_bbcode_uid(); $signature = stripslashes($users_data[$i]['sig']); // Fixing the [email]tag since phpBB doesn't support it $signature = preg_replace('/\[email=(.*?)\](.*?)\[\/email\]/si', '[email]\\1[/email]', $signature); $signature = bbencode_first_pass($signature, $uid_bb); $signature = addslashes($signature); $location = stripslashes($users_data[$i]['location']); $location = addslashes($location); if ($users_data[$i]['status'] == 'Banned') { $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid) VALUES (" . $users_data[$i]['uid'] . ")"; query($sql, "Couldn't insert banned users");	 } if ($users_data[$i]['status'] != 'Member') { $sql = "SELECT * FROM " . RANKS_TABLE . " WHERE rank_title = '" . $users_data[$i]['status'] . "'"; $result = query($sql, "Couldn't Select Rank"); $row = $db->sql_fetchrow($result); $rank_id = $row['rank_id'];	 } if ($users_data[$i]['customstatus'] != '')	 { $custom_status=stripslashes($users_data[$i]['customstatus']); $custom_status=addslashes($custom_status); $sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_min, rank_special) VALUES ('" . $custom_status . "', 0 , 1)"; query($sql, "Couldn't insert special ranks");	 /* What ID did it assign*/ $sql = "SELECT rank_id FROM " . RANKS_TABLE . " WHERE rank_title = '" . $users_data[$i]['customstatus'] . "'"; $result = query($sql, "Couldn't Select Special Rank"); $row = $db->sql_fetchrow($result); $rank_id = $row['rank_id'];	 } // // This is meant to assign ranks from the phpBB ranks table, but it doesn't work // It needs to check the post numbers against rank titles in the phpBB table, // because the XMB member status doesn't actually give a rank, but I don't know how to do that.	 // if ($users_data[$i]['status'] == 'Member')	 { $sql = "SELECT * FROM " . RANKS_TABLE . " WHERE rank_title = '" . $users_data[$i]['title'] . "'"; $result = query($sql, "Couldn't Select Rank"); $row = $db->sql_fetchrow($result); $rank_id = $row['rank_id'];	 } $lastvisit = ($users_data[$i]['lastvisit'] == '') ? 0 : $users_data[$i]['lastvisit']; //	 $user_yahoo = strlen($users_data[$i]['yahoo']) < 3 ? '' : addslashes($users_data[$i]['yahoo']); //	 $user_aim = strlen($users_data[$i]['aim']) < 3 ? '' : addslashes($users_data[$i]['aim']); $user_yahoo = (eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $users_data[$i]['yahoo'])) ? $users_data[$i]['yahoo'] : ''; $user_aim = (eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $users_data[$i]['aim'])) ? $users_data[$i]['aim'] : ''; $user_msn = (eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $users_data[$i]['msn'])) ? $users_data[$i]['msn'] : ''; $user_icq= (preg_match("/^[0-9]+$/", $users_data[$i]['icq'])) ? $users_data[$i]['icq'] : ''; $site = trim($users_data[$i]['site']); if ( substr(strtolower($site), 0, 7) != "http://" ) { $site = "http://" . $site; } if( strtolower($site) == 'http://' ) { $site = ''; } $site = addslashes($site); $email=addslashes($users_data[$i]['email']); $sql = "INSERT IGNORE INTO " . USERS_TABLE . " (user_id, user_active, username, user_password, user_session_time, user_session_page, user_lastvisit, user_regdate, user_level, user_posts, user_timezone, user_style, user_lang, user_dateformat, user_new_privmsg, user_unread_privmsg, user_last_privmsg, user_emailtime, user_viewemail, user_attachsig, user_allowhtml, user_allowbbcode, user_allowsmile, user_allowavatar, user_allow_pm, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_rank, user_avatar, user_avatar_type, user_email, user_icq, user_website, user_from, user_sig, user_sig_bbcode_uid, user_aim, user_yim, user_msnm, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (" . $users_data[$i]['uid'] . ", 1, '" . $users_data[$i]['username'] . "', '" . $users_data[$i]['password'] . "', 0, 0, " . $lastvisit . ", " . $users_data[$i]['regdate'] . ", " . $status_id . ", " . $users_data[$i]['postnum'] . ", " . $users_data[$i]['timeoffset'] . ", 1, 'english', 'd M Y h:i a', 0, 0, 0, NULL, " . $user_viewemail . ", 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, '" . $rank_id . "', '" . $users_data[$i]['avatar'] . "', " . $avatar_type . ", '" . $email . "', '" . $user_icq . "', '" . $site . "', '" . $location . "', '" . $signature . "', '" . $uid_bb . "', '" . $user_aim . "', '" . $user_yahoo . "', '" . $user_msn . "', '', '', '', '')"; query($sql, "Couldn't insert user data"); // Group creation /* This in here is new!!! */ $sql = "SELECT MAX(group_id) AS new_group_id FROM " . GROUPS_TABLE; $result = query($sql, "Unable to read data"); $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; $sql = "INSERT INTO " . GROUPS_TABLE . " (group_id , group_name, group_description, group_single_user) VALUES ($new_group_id, '" . addslashes($users_data[$i]['username']) . "', 'Personal User', 1)"; /* Here ends what's new!!! */ /*	 $sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user) VALUES ('" . addslashes($users_data[$i]['username']) . "', 'Personal User', 1)";*/ query($sql, "Unable to insert user into groups table"); //	 $group_id_no = $db->sql_nextid(); // User -> Group creation /* This in here is new!!! */ $sql = "SELECT MAX(group_id) AS new_group_id FROM " . USER_GROUP_TABLE; $result = query($sql, "Unable to read data"); $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; /* Here ends what's new!!! */ $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) VALUES ($new_group_id, " . $users_data[$i]['uid'] . ", 0)"; query($sql, "Unable to insert user into user groups table ");	 } $user_loc=$user_loc+500; } // Creating administrators group $sql = "SELECT * FROM " . XMB_USERS_TABLE . " WHERE status='Administrator'"; $admin_result = query($sql, "Couldn't get data from 'members'"); $admin_count = $db->sql_numrows($admin_result); $admin_data = $db->sql_fetchrowset($admin_result); if ($admin_count > 0) { // MAX $sql = "SELECT MAX(group_id) AS new_group_id FROM " . GROUPS_TABLE; $result = query($sql, "Unable to read data"); $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; // MAX $sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user) VALUES ($new_group_id, '2', 'Administrators', 'Converted administrators', " . $admin_data[0]['uid'] . ", 0)"; query($sql, "Couldn't create group for Administrators"); // $admins_group_id = $db->sql_nextid(); /* This in here is new!!! */ $sql = "SELECT MAX(group_id) AS new_group_id FROM " . USER_GROUP_TABLE; $result = query($sql, "Unable to read data"); $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; /* Here ends what's new!!! */ for($i = 0; $i < $admin_count; $i++) { $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) VALUES ($new_group_id, " . $admin_data[$i]['uid'] . ", 0)"; query($sql, "Unable to add administartors to their groups"); $new_group_id = $new_group_id + 1; } } // Creating super moderators group $sql = "SELECT * FROM " . XMB_USERS_TABLE . " WHERE status='Super Moderator'"; $smod_result = query($sql, "Couldn't get data from 'members'"); $smod_count = $db->sql_numrows($smod_result); $smod_data = $db->sql_fetchrowset($smod_result); if ($smod_count > 0) { // MAX $sql = "SELECT MAX(group_id) AS new_group_id FROM " . GROUPS_TABLE; $result = query($sql, "Unable to read data"); $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; // MAX $sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user) VALUES ($new_group_id, '2', 'Super Moderators', 'Converted Super Moderators', " . $smod_data[0]['uid'] . ", 0)"; query($sql, "Couldn't create group for Super Moderators"); //	 $smod_group_id = $db->sql_nextid(); /* This in here is new!!! */ $sql = "SELECT MAX(group_id) AS new_group_id FROM " . USER_GROUP_TABLE; $result = query($sql, "Unable to read data"); $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; /* Here ends what's new!!! */ for($i = 0; $i < $smod_count; $i++) { $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) VALUES ($new_group_id, " . $smod_data[$i]['uid'] . ", 0)"; query($sql, "Unable to add super moderators to their groups"); $new_group_id = $new_group_id + 1; } } // Creating moderators group $sql = "SELECT * FROM " . XMB_USERS_TABLE . " WHERE status='Moderator'"; $nmod_result = query($sql, "Couldn't get data from 'members'"); $nmod_count = $db->sql_numrows($nmod_result); $nmod_data = $db->sql_fetchrowset($nmod_result); if ($nmod_count > 0) { // MAX $sql = "SELECT MAX(group_id) AS new_group_id FROM " . GROUPS_TABLE; $result = query($sql, "Unable to read data");	 $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; // MAX $sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user) VALUES ($new_group_id, '2', 'Moderators', 'Converted Moderators', " . $nmod_data[0]['uid'] . ", 0)"; query($sql, "Couldn't create group for moderators"); /* This in here is new!!! */ $sql = "SELECT MAX(group_id) AS new_group_id FROM " . USER_GROUP_TABLE; $result = query($sql, "Unable to read data"); $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; /* Here ends what's new!!! */ //	 $nmod_group_id = $db->sql_nextid(); for($i = 0; $i < $nmod_count; $i++) { $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) VALUES ($new_group_id, " . $nmod_data[$i]['uid'] . ", 0)"; query($sql, "Unable to add moderators to their groups"); $new_group_id = $new_group_id + 1; } }	 echo "...DONE"; }	 // // Convert Forums // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_forums == 1) ) ) { echo "
Converting forums..."; query("DELETE FROM " . CATEGORIES_TABLE, "Couldn't delete categories"); query("DELETE FROM " . FORUMS_TABLE, "Couldn't delete forums"); // Checking for Categories. If none are found "Default Category" is inserted. $sql = "SELECT * FROM " . XMB_FORUMS_TABLE . " WHERE type = 'group'"; $result = query($sql, "Couldn't get forums data"); $group_count = $db->sql_numrows($result); $group_data = $db->sql_fetchrowset($result); if ($group_data == 0) // if there is no category add the default one { $sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_id, cat_title, cat_order) VALUES (1, 'Default Category', 10)"; query($sql, "Couldn't insert default category"); } $sql = "SELECT * FROM " . XMB_FORUMS_TABLE; $result = query($sql, "Couldn't get forums data"); $forums_count = $db->sql_numrows($result); $forums_data = $db->sql_fetchrowset($result); query("DELETE FROM " . AUTH_ACCESS_TABLE, "Couldn't delete authority access table."); echo "."; for ($i = 0; $i < $forums_count; $i++) { $type = $forums_data[$i]['type']; $fid = $forums_data[$i]['fid']; $name = stripslashes($forums_data[$i]['name']); $status = ( $forums_data[$i]['status'] == 'on' ) ? 0 : 1; $lastpost = ( $forums_data[$i]['lastpost'] != '') ? 1 : 0; $moderator = $forums_data[$i]['moderator']; $displayorder = $forums_data[$i]['displayorder']; $private = $forums_data[$i]['private']; $description = stripslashes($forums_data[$i]['description']); $allowhtml = $forums_data[$i]['allowhtml']; $allowsmilies = $forums_data[$i]['allowsmilies']; $allowbbcode = $forums_data[$i]['allowbbcode']; $userlist = $forums_data[$i]['userlist']; $theme = $forums_data[$i]['theme']; $posts = $forums_data[$i]['posts']; $threads = $forums_data[$i]['threads']; $fup = $forums_data[$i]['fup']; $postperm = $forums_data[$i]['postperm']; $allowimgcode = $forums_data[$i]['allowimgcode']; $attachstatus = $forums_data[$i]['attachstatus']; $pollstatus = $forums_data[$i]['pollstatus']; $password = $forums_data[$i]['password']; $guestposting = $forums_data[$i]['guestposting']; $description = stripslashes($description); $description = addslashes($description); $name = addslashes($name); $group = $forums_data[$i]['group']; if (trim($type) == "group") { $sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_id, cat_title, cat_order) VALUES (" . $fid . ", '" . $name . "', " . $displayorder . ")"; query($sql, "Couldn't insert data into categories"); } if (trim($type) == "sub") { $sql = "SELECT * FROM " . XMB_FORUMS_TABLE ." WHERE fid = $fup"; $result = query($sql, "Couldn't find post id"); $row = $db->sql_fetchrow($result); $sub_fup = $row['fup']; if ($sub_fup != 0) { $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments) VALUES (" . $fid . ", '" . $sub_fup . "', '" . $name . "', '" . $description . "', " . $status . ", " . $displayorder . ", " . $posts . ", " . $threads . ", " . $lastpost . ", NULL, 0, 0, 0, 1, 1, 1, 1, 3, 3, 1, 1, 3)"; query($sql, "Couldn't insert data into forums"); } if ($sub_fup == 0) { $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments) VALUES (" . $fid . ", 1 , '" . $name . "', '" . $description . "', " . $status . ", " . $displayorder . ", " . $posts . ", " . $threads . ", " . $lastpost . ", NULL, 0, 0, 0, 1, 1, 1, 1, 3, 3, 1, 1, 3)"; query($sql, "Couldn't insert data into forums"); } } if (trim($type) == "forum" && $private == 3) { $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments) VALUES (" . $fid . ", " . $fup . ", '" . $name . "', '" . $description . "', " . $status . ", " . $displayorder . ", " . $posts . ", " . $threads . ", " . $lastpost . ", NULL, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)"; query($sql, "Couldn't insert data into forums"); } else if (trim($type) == "forum" && $userlist != '') { $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments) VALUES (" . $fid . ", " . $fup . ", '" . $name . "', '" . $description . "', " . $status . ", " . $displayorder . ", " . $posts . ", " . $threads . ", " . $lastpost . ", NULL, 0, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2)"; query($sql, "Couldn't insert data into forums"); } // This assigns forums with no category to the default category. else if (trim($type) == "forum" && $fup == 0) { $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments) VALUES (" . $fid . ", " . 1 . ", '" . $name . "', '" . $description . "', " . $status . ", " . $displayorder . ", " . $posts . ", " . $threads . ", " . $lastpost . ", NULL, 0, 0, 0, 1, 1, 1, 1, 3, 3, 1, 1, 3)"; query($sql, "Couldn't insert data into forums"); } // Converts rest of the forums else if (trim($type) == "forum") { $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments) VALUES (" . $fid . ", " . $fup . ", '" . $name . "', '" . $description . "', " . $status . ", " . $displayorder . ", " . $posts . ", " . $threads . ", " . $lastpost . ", NULL, 0, 0, 0, 1, 1, 1, 1, 3, 3, 1, 1, 3)"; query($sql, "Couldn't insert data into forums"); } if ($moderator != '') { // Moderators convert $user_mods = array(); $what_users = explode(", ",$moderator); $number_of = count($what_users); for($j=0; $j < $number_of; $j++) { $sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username='" . $what_users[$j] . "'"; $id_result = query($sql, "Couldn't get user_id"); $row = $db->sql_fetchrow($id_result); $userid = $row['user_id']; $user_mods[] = $userid; $group_query = query("SELECT group_id FROM " . USER_GROUP_TABLE . " WHERE user_id=".$userid, "Unable to get group_id for user"); $row = $db->sql_fetchrow($group_query); $groupid = $row['group_id']; query("INSERT INTO " . AUTH_ACCESS_TABLE . " (group_id, forum_id, auth_mod) VALUES ($groupid, $fid, 1)", "Unable to insert moderators"); } // Update user_level for users that are moderator if (count($user_mods)) { $sql = "UPDATE " . USERS_TABLE . " SET user_level = 2 WHERE user_id IN (" . implode(", ", $user_mods) . ") AND user_level <> 1 "; query($sql,"Couldn't update user levels to moderator"); } } // If a forum has userlist access. if ($userlist !== '') { // MAX $sql = "SELECT MAX(group_id) AS new_group_id FROM " . GROUPS_TABLE; $result = query($sql, "Can't read groups table data!"); $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; // MAX $sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_type, group_name, group_description, group_moderator, group_single_user) VALUES ($new_group_id, 2, '$name users', 'users allowed to access $name', 2, 0)"; query($sql, "Couldn't insert data."); //	 $group_id_no = $db->sql_nextid(); $sql = "INSERT INTO " . AUTH_ACCESS_TABLE . " (group_id, forum_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments, auth_mod) VALUES ($new_group_id, $fid, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)"; query($sql, "Couldn't insert data."); $what_users = explode(", ", $userlist); $number_of = count($what_users); echo "."; for ($j = 0; $j < $number_of; $j++) { $sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username='" . $what_users[$j] . "'"; $result_x = query($sql, "Couldn't obtain user_id"); $rows = $db->sql_fetchrow($result_x); $u_id = $rows['user_id']; // MAX $sql = "SELECT MAX(group_id) AS new_group_id FROM " . USER_GROUP_TABLE; $result = query($sql, "Unable to read data");	 $row = $db->sql_fetchrow($result); $new_group_id = $row['new_group_id'] + 1; // MAX $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) VALUES (" . $new_group_id . ", '" . $u_id . "', 0)"; query($sql, "Couldn't insert data."); } } $sql = "SELECT * FROM " . GROUPS_TABLE . " WHERE (group_name = 'Administrators' OR group_name = 'Super Moderators')"; $auth_result = query($sql, "Couldn't get admin auth data"); $auth_count = $db->sql_numrows($auth_result); $auth_data = $db->sql_fetchrowset($auth_result); for ($k = 0; $k < $auth_count; $k++) { $sql = "INSERT INTO " . AUTH_ACCESS_TABLE . " (group_id, forum_id, auth_mod) VALUES (" . $auth_data[$k]['group_id'] . ", " . $fid . ", 1)"; query($sql, "Couldn't insert admin auth data."); } }	 echo "DONE"; } // // Convert Topics // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_topics == 1) ) ) { echo "
Converting topics..."; echo ""; // emptying the database query("DELETE FROM " . TOPICS_TABLE, "Couldn't delete Topics."); $number = query("SELECT COUNT(*) FROM ". XMB_TOPICS_TABLE,"Couldn't get the number of topics inside the topics table"); $topicsnum = result($number, 0); $loopnum=intval($topicsnum / 500);	 // how many loop he needs to create $topics_left=($topicsnum % 500);	 // how many users are left from divizion echo "
Total number of topics to be converted: $topicsnum..."; Flush(); if ($topics_left <> 0 ){ $loopnum++;	 // one extra loop for the topics_left } $topics_loc=0; $topics_default=500; for ($y = 1; $y <= $loopnum; $y++)	 // does a loop as long as it has to { echo "
Converting 500 topics from topic number $topics_loc"; Flush(); if ($y <> $loopnum) { $sql = "SELECT * FROM " . XMB_TOPICS_TABLE . " LIMIT $topics_loc,$topics_default "; // 500 topics } else { $sql = "SELECT * FROM " . XMB_TOPICS_TABLE . " LIMIT $topics_loc,$topics_left "; // on the last pass only what is left } // $sql = "SELECT * FROM " . XMB_TOPICS_TABLE; $result = query($sql, "Couldn't get Data from Topics Table."); $topics_count = $db->sql_numrows($result); $topics_data = $db->sql_fetchrowset($result); echo ".";	 for ($i = 0; $i < $topics_count; $i++) { $tid = $topics_data[$i]['tid']; $fid = $topics_data[$i]['fid']; $subject = stripslashes($topics_data[$i]['subject']); $icon = $topics_data[$i]['icon']; $lastpost = $topics_data[$i]['lastpost']; $lastposttime = explode("|", $lastpost); $lastposttime = $lastposttime[0]; $views = $topics_data[$i]['views']; $replies = $topics_data[$i]['replies']; $author = $topics_data[$i]['author']; $sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username='" . $author . "'"; $result = query($sql, "Couldn't get user_id."); $row = $db->sql_fetchrow($result); $authorid = $row['user_id']; $is_closed = ( $topics_data[$i]['closed'] == 'yes' ) ? 1 : 0; // if topic is closed $topped = $topics_data[$i]['topped']; $topic_type = ( $topped == 1 ) ? 1 : 0; // Sticky. I like how this word sounds ;) $pollopts = ( $topics_data[$i]['pollopts'] != '' ) ? 1 : 0; $subject = addslashes($subject); /* Conversion of topics there were moved but have a shadow topic where they were moved from */ if ( ($topics_data[$i]['closed'] != '') && ($topics_data[$i]['closed'] != 'yes') ) { $moved_data=explode("|", $topics_data[$i]['closed']); $sql = "INSERT INTO " . TOPICS_TABLE . " (topic_id, forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_status, topic_vote, topic_type, topic_last_post_id, topic_moved_id) VALUES (" . $tid . ", " . $fid . ", '" . $subject . "', '" . $authorid . "', '" . $lastposttime . "', " . $views . ", " . $replies . ", 2 , " . $pollopts . ", '" . $topic_type . "', 1, '" . $moved_data[1] . "')"; query($sql, "Couldn't insert moved topic."); } else // if not do as usual { $sql = "INSERT INTO " . TOPICS_TABLE . " (topic_id, forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_status, topic_vote, topic_type, topic_last_post_id, topic_moved_id) VALUES (" . $tid . ", " . $fid . ", '" . $subject . "', '" . $authorid . "', '" . $lastposttime . "', " . $views . ", " . $replies . ", " . $is_closed . ", " . $pollopts . ", '" . $topic_type . "', 1, 0)"; query($sql, "Couldn't insert topic."); } } $topics_loc=$topics_loc+500; } echo "...DONE!"; } // // Convert posts, favourites and fixes for last post // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_posts == 1) ) ) { echo "
Converting posts..."; echo ""; // emptying the database query("DELETE FROM " . POSTS_TABLE, "Couldn't delete posts."); query("DELETE FROM " . POSTS_TEXT_TABLE, "Couldn't delete posts text."); query("DELETE FROM " . TOPICS_WATCH_TABLE, "Couldn't delete topics watch."); $number = query("SELECT COUNT(*) FROM ". XMB_POSTS_TABLE,"Couldn't get the number of posts inside the posts table"); $postsnum = result($number, 0); $loopnum=intval($postsnum / 500);	 // how many loop he needs to create $posts_left=($postsnum % 500);	 // how many posts are left from divizion echo "
Total number of posts to be converted: $postsnum..."; Flush(); if ($posts_left <> 0 ){	 $loopnum++;	 // one extra loop for the posts_left } $posts_loc=0; $posts_default=500; for ($y = 1; $y <= $loopnum; $y++)	 // does a loop as long as it has to { echo "
Converting 500 posts from post number $posts_loc"; Flush(); if ($y <> $loopnum) { $sql = "SELECT * FROM " . XMB_POSTS_TABLE . " LIMIT $posts_loc,$posts_default "; // 500 topics } else { $sql = "SELECT * FROM " . XMB_POSTS_TABLE . " LIMIT $posts_loc,$posts_left "; // on the last pass only what is left } $result = query($sql, "Couldn't obtain post data."); $posts_count = $db->sql_numrows($result); $posts_data = $db->sql_fetchrowset($result); echo "."; flush(); for ($i = 0; $i < $posts_count; $i++) { $fid = $posts_data[$i]['fid']; $tid = $posts_data[$i]['tid']; $pid = $posts_data[$i]['pid']; $author = $posts_data[$i]['author']; $message = stripslashes($posts_data[$i]['message']); $subject = stripslashes($posts_data[$i]['subject']); $dateline = $posts_data[$i]['dateline']; $icon = $posts_data[$i]['icon']; $usesig = ( $posts_data[$i]['usesig'] == 'yes' ) ? 1 : 0; $useip = $posts_data[$i]['useip']; $useip = encode_ip($useip); $bbcodeoff = ( $posts_data[$i]['bbcodeoff'] == 'yes' ) ? 1 : 0; $smileyoff = ( $posts_data[$i]['smileyoff'] == 'yes' ) ? 0 : 1; // Fixing the [email]tag since phpBB doesn't support it $message = preg_replace('/\[email=(.*?)\](.*?)\[\/email\]/si', '[email]\\1[/email]', $message); $uid = make_bbcode_uid(); $message = bbencode_first_pass($message, $uid); $subject = addslashes($subject); $message = addslashes($message); $sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username='" . $author . "'"; $result = query($sql, "Couldn't get user_id."); $row = $db->sql_fetchrow($result); $authorid = $row['user_id']; $authorid = ( $authorid == '' ) ? -1 : $authorid; // If the user could not be found, post it as anonymous $sql = "INSERT INTO " . POSTS_TABLE . " (post_id, topic_id, forum_id, poster_id, post_time, poster_ip, post_username, enable_bbcode, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count) VALUES (" . $pid . ", " . $tid . ", " . $fid . ", " . $authorid . ", '" . $dateline . "', '" . $useip . "', '', " . $bbcodeoff . ", 0, " . $smileyoff . ", " . $usesig . ", NULL, 0)"; query($sql, "Couldn't insert data into posts"); $sql = "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, bbcode_uid, post_subject, post_text) VALUES (" . $pid . ", '" . $uid . "', '" . $subject . "', '" . $message . "')"; query($sql, "Couldn't insert post text"); } $posts_loc=$posts_loc+500; } echo "DONE
"; // Favorites -> Watch Topics echo "Converting favorites (Topic Watch)..."; $sql = "SELECT * FROM " . XMB_WATCH_TABLE; $result = query($sql, "Couldn't obtain Favorites"); $watch_count = $db->sql_numrows($result); $watch_data = $db->sql_fetchrowset($result); echo "."; for ($i = 0; $i < $watch_count; $i++) { $tid = $watch_data[$i]['tid']; $username = $watch_data[$i]['username']; $type = $watch_data[$i]['type']; $sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username='" . $username . "'"; $result = query($sql, "Couldn't get user_id."); $row = $db->sql_fetchrow($result); $authorid = $row['user_id']; $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (topic_id, user_id, notify_status) VALUES (" . $tid . ", " . $authorid . ", 0)"; query($sql, "Couldn't insert data into watchs table"); } echo "DONE"; // Fix last post in forums echo ", fixing last post in forums..."; $sql = "SELECT forum_id FROM " . FORUMS_TABLE; $result = query($sql, "Couldn't obtain forum id"); $forums_count = $db->sql_numrows($result); $forums_data = $db->sql_fetchrowset($result); echo "."; for ($i = 0; $i < $forums_count; $i++) { $forum_id = $forums_data[$i]['forum_id']; $sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE forum_id=" . $forum_id . " ORDER BY post_time DESC LIMIT 0, 1"; $result = query($sql, "Couldn't obtain post_id"); $row = $db->sql_fetchrow($result); $post_id = $row['post_id']; $post_id = ( $post_id == '' ) ? 0 : $post_id; // If the post_id can't be find (category), set it to 0 $sql = "UPDATE " . FORUMS_TABLE . " SET forum_last_post_id=" . $post_id . " WHERE forum_id=" . $forum_id; query($sql, "Couldn't update Forums table"); } echo "DONE"; // Fix last post in topics echo ", fixing last post in topics..."; $sql = "SELECT topic_id, topic_moved_id FROM " . TOPICS_TABLE; $result = query($sql, "Couldn't obtain topic id"); $topics_count = $db->sql_numrows($result); $topics_data = $db->sql_fetchrowset($result); echo "."; for ($i = 0; $i < $topics_count; $i++) { $original_topic_id = $topics_data[$i]['topic_id']; $topic_id = ($topics_data[$i]['topic_moved_id'] != 0 ) ? $topics_data[$i]['topic_moved_id'] : $topics_data[$i]['topic_id'];	 // If it'a a moved topic $sql = "SELECT MIN(post_id) AS firstpostid, MAX(post_id) AS lastpostid FROM " . POSTS_TABLE . " WHERE topic_id=" . $topic_id . " GROUP BY topic_id"; $result = query($sql, "Couldn't obtain post_id (minimal and maximal)"); $row = $db->sql_fetchrow($result); $firstpostid = $row['firstpostid']; $firstpostid = ( $firstpostid == '' ) ? 0 : $firstpostid; // If the post_id can't be find (?deleted?), set it to 0 $lastpostid = $row['lastpostid']; $lastpostid = ( $lastpostid == '' ) ? 0 : $lastpostid; // If the post_id can't be find (?deleted?), set it to 0 $sql = "UPDATE " . TOPICS_TABLE . " SET topic_last_post_id=" . $lastpostid . " WHERE topic_id=" . $original_topic_id; query($sql, "Couldn't update Topics table"); $sql = "UPDATE " . TOPICS_TABLE . " SET topic_first_post_id=" . $firstpostid . " WHERE topic_id=" . $original_topic_id; query($sql, "Couldn't update Topics table"); } echo "DONE"; }	 // // Convert Settings // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_settings == 1) ) ) { echo "
Converting forum settings..."; $sql = "SELECT * FROM " . XMB_CONFIG_TABLE; $result = query($sql, "Couldn't obtain settings"); $config_count = $db->sql_numrows($result); $config_data = $db->sql_fetchrowset($result); query("DELETE FROM " . CONFIG_TABLE, "Couldn't delete config table"); for ($i = 0; $i < $config_count; $i++) { $langfile = $config_data[$i]['langfile']; $bbname = $config_data[$i]['bbname']; $postperpage = $config_data[$i]['postperpage']; $topicperpage = $config_data[$i]['topicperpage']; $hottopic = $config_data[$i]['hottopic']; $theme = $config_data[$i]['theme']; $bbstatus = $config_data[$i]['bbstatus']; $whosonlinestatus = $config_data[$i]['whosonlinestatus']; $regstatus = $config_data[$i]['regstatus']; $bboffreason = $config_data[$i]['bboffreason']; $regviewonly = $config_data[$i]['regviewonly']; $floodctrl = $config_data[$i]['floodctrl']; $catsonly = $config_data[$i]['catsonly']; $hideprivate = $config_data[$i]['hideprivate']; $emailcheck = $config_data[$i]['emailcheck']; $bbrules = $config_data[$i]['bbrules']; $bbrulestxt = $config_data[$i]['bbrulestxt']; $bbrulestxt = $config_data[$i]['bbrulestxt']; $searchstatus = $config_data[$i]['searchstatus']; $faqstatus = $config_data[$i]['faqstatus']; $memliststatus = $config_data[$i]['memliststatus']; $sitename = $config_data[$i]['sitename']; $siteurl = $config_data[$i]['siteurl']; $avastatus = $config_data[$i]['avastatus']; $u2uquota = $config_data[$i]['u2uquota']; $gzipcompress = $config_data[$i]['gzipcompress']; $boardurl = $config_data[$i]['boardurl']; $coppa = $config_data[$i]['coppa']; $timeformat = $config_data[$i]['timeformat']; $adminemail = $config_data[$i]['adminemail']; $dateformat = $config_data[$i]['dateformat']; $sigbbcode = $config_data[$i]['sigbbcode']; $sightml = $config_data[$i]['sightml']; $reportpost = $config_data[$i]['reportpost']; $bbinsert = $config_data[$i]['bbinsert']; $smileyinsert = $config_data[$i]['smileyinsert']; $doublee = $config_data[$i]['doublee']; $smtotal = $config_data[$i]['smtotal']; $smcols = $config_data[$i]['smcols']; $editedby = $config_data[$i]['editedby']; $dotfolders = $config_data[$i]['dotfolders']; $attachimgpost = $config_data[$i]['attachimgpost']; query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('config_id', '1')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('board_disable', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('sitename', '" . $bbname . "')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('site_desc', '" . $sitename . "')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('cookie_name', 'phpbb2mysql')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('cookie_path', '/')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('cookie_domain', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('cookie_secure', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('session_length', '900')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_html', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_html_tags', 'b,i,u,pre')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_bbcode', '1')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_smilies', '1')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_sig', '1')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_namechange', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_theme_create', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_avatar_local', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_avatar_remote', '1')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_avatar_upload', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('override_user_style', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('posts_per_page', '" . $postperpage . "')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('topics_per_page', '" . $topicperpage . "')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('hot_threshold', '" . $hottopic . "')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('max_poll_options', '10')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('max_sig_chars', '255')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('max_inbox_privmsgs', '50')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('max_sentbox_privmsgs', '25')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('max_savebox_privmsgs', '50')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('board_email_sig', 'Thanks, The Management')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('board_email', '" . $adminemail . "')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('smtp_delivery', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('smtp_host', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('require_activation', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('flood_interval', '15')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('board_email_from', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('avatar_filesize', '6144')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('avatar_max_width', '80')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('avatar_max_height', '80')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('avatar_path', 'images/avatars')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('avatar_gallery_path', 'images/avatars/gallery')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('smilies_path', 'images/smiles')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('default_style', '1')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('default_dateformat', 'D M d, Y g:i a')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('board_timezone', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('prune_enable', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('privmsg_disable', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('gzip_compress', '0')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('coppa_fax', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('coppa_email', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('board_startdate', '1014044920')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('default_lang', 'english')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('smtp_username', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('smtp_password', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('board_email_form', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('coppa_mail', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('record_online_users', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('record_online_date', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('server_name', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('server_port', '80')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('script_path', '')", "Couldn't insert config data"); query("INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('version', '.0.0')", "Couldn't insert config data"); } echo "DONE"; } // This is here just in case someone (like myself) is converting to a phpBB table that was completely emptied - SadBastard if ($cnv_all == 1) { echo "
Inserting default themes..."; query("DELETE FROM " . THEMES_TABLE, "Couldn't themes"); query("DELETE FROM " . THEMES_NAME, "Couldn't themes"); query("INSERT INTO " . THEMES_TABLE . " (themes_id, template_name, style_name, head_stylesheet, body_background, body_bgcolor, body_text, body_link, body_vlink, body_alink, body_hlink, tr_color1, tr_color2, tr_color3, tr_class1, tr_class2, tr_class3, th_color1, th_color2, th_color3, th_class1, th_class2, th_class3, td_color1, td_color2, td_color3, td_class1, td_class2, td_class3, fontface1, fontface2, fontface3, fontsize1, fontsize2, fontsize3, fontcolor1, fontcolor2, fontcolor3, span_class1, span_class2, span_class3, img_size_poll, img_size_privmsg) VALUES (1, 'subSilver', 'subSilver', 'subSilver.css', '', 'E5E5E5', '000000', '006699', '5493B4', '', 'DD6900', 'EFEFEF', 'DEE3E7', 'D1D7DC', '', '', '', '98AAB1', '006699', 'FFFFFF', 'cellpic1.gif', 'cellpic3.gif', 'cellpic2.jpg', 'FAFAFA', 'FFFFFF', '', 'row1', 'row2', '', 'Verdana, Arial, Helvetica, sans-serif', 'Trebuchet MS', 'Courier, \'Courier New\', sans-serif', 10, 11, 12, '444444', '006600', 'FFA34F', '', '', '', NULL, NULL)", "Couldn't insert config data"); query("INSERT INTO " . THEMES_NAME . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name) VALUES (1, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')", "Couldn't insert config data"); echo "DONE"; }	 // // Convert Polls // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_polls == 1) ) ) { echo "
Converting polls..."; $result = query("SELECT * FROM " . XMB_TOPICS_TABLE . " WHERE pollopts != ''", "Couldn't get poll data"); $poll_count = $db->sql_numrows($result); $poll_data = $db->sql_fetchrowset($result); query("DELETE FROM " . VOTE_DESC_TABLE, "Couldn't delete polls"); query("DELETE FROM " . VOTE_RESULTS_TABLE, "Couldn't delete polls"); query("DELETE FROM " . VOTE_VOTERS_TABLE, "Couldn't delete polls"); $id=0; for ($i = 0; $i < $poll_count; $i++) { $tid = $poll_data[$i]['tid']; $fid = $poll_data[$i]['fid'];	 $sql = "SELECT post_time FROM " . POSTS_TABLE . " WHERE forum_id=" . $fid . " AND topic_id=" . $tid . " ORDER BY post_time ASC LIMIT 0, 1"; $result = query($sql, "Couldn't obtain post time."); $row = $db->sql_fetchrow($result); $post_time = $row['post_time']; $subject = stripslashes($poll_data[$i]['subject']); $pollopts = $poll_data[$i]['pollopts']; $authors = $poll_data[$i]['author']; $id++; $subject = addslashes($subject); $sql = "INSERT INTO " . VOTE_DESC_TABLE . " (vote_id, topic_id, vote_text, vote_start, vote_length) VALUES (" . $id . ", " . $tid . ", '" . $subject . "', '" . $post_time . "', 0)"; query($sql, "Couldn't insert poll."); $pollopts = explode("#|#", $pollopts); $total_results = count($pollopts); $users = $pollopts[$total_results-1]; for ($j = 0; $j < $total_results-1; $j++) {	 $text = explode("||~|~||", $pollopts[$j]); $option_text = addslashes($text[0]); $sql = "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES (" . $id . ", " . $j++ . ",'" . $option_text . "', '" . $text[1] . "')"; query($sql, "Couldn't insert vote results."); $j--; } $voted_users = explode(" ",$users); // WRONG BECAUSE OF THE USERS WITH SPACE BETWEEN HIS USERNAME $number_users = count($voted_users); $new_users= array();	 // Define an empty array	 $j_test = 0;	 // to get rid of empty records in array, because of skipping one users for($j = 1; $j < $number_users; $j++) { $sql = "SELECT user_id from " . USERS_TABLE . " WHERE username='" . $voted_users[$j] . "'"; // if the user exists $result = query($sql, "Couldn't obtain user id."); $row = $db->sql_fetchrow($result); $authorid = $row['user_id']; if ( $authorid == '' ) // The user that voted was not found! { $spaced_user="$voted_users[$j] ". $voted_users[$j+1]; // Probably has space so lets add another name from the list $sql = "SELECT user_id from " . USERS_TABLE . " WHERE username='" . $spaced_user . "'"; // if the user exists $result = query($sql, "Couldn't obtain user id."); $row = $db->sql_fetchrow($result); $new_authorid = $row['user_id']; $new_users[$j-$j_test] = ( $new_authorid != '' ) ? $new_authorid : -1; $j_test++; $j++; } else { $new_users[$j-$j_test]=$authorid; } }	 $number_users = count($new_users); for($j = 1; $j <= $number_users; $j++) { $sql = "SELECT poster_ip FROM " . POSTS_TABLE . " WHERE poster_id=" . $new_users[$j] . " ORDER BY post_time DESC LIMIT 0, 1"; $result = query($sql, "Couldn't obtain posters ip with the number $new_users[$j]."); $row = $db->sql_fetchrow($result); $poster_ip = ( $row['poster_ip'] == '' ) ? "00000000" : $row['poster_ip']; query("INSERT INTO " . VOTE_VOTERS_TABLE . " (vote_id, vote_user_id, vote_user_ip) VALUES (" . $id . ", " . $new_users[$j] . ", '" . $poster_ip . "')", "Couldn't insert poll."); }	 } echo "DONE"; }	 // // Start convertion of Private Messages // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_u2u == 1) ) ) { echo "
Converting private messages..."; query("DELETE FROM " . PRIVMSGS_TABLE, "Couldn't delete private messages"); query("DELETE FROM " . PRIVMSGS_TEXT_TABLE, "Couldn't delete private messages"); $id = 0; $number = query("SELECT COUNT(*) FROM ". XMB_PRIVMSGS_TABLE,"Couldn't get the number of private messages inside the U2U table"); $privatenum = result($number, 0); $loopnum=intval($privatenum / 500);	 // how many loop he needs to create $private_left=($privatenum % 500);	 // how many users are left from divizion echo "
Total number of private messages to be converted: $privatenum..."; Flush(); if ($private_left <> 0 ){ $loopnum++;	 // one extra loop for the topics_left } $private_loc=0; $private_default=500; for ($y = 1; $y <= $loopnum; $y++)	 // does a loop as long as it has to { echo "
Converting 500 private messages from private message number $private_loc"; Flush(); if ($y <> $loopnum) { $sql = "SELECT * FROM " . XMB_PRIVMSGS_TABLE . " LIMIT $private_loc,$private_default "; // 500 private messages } else { $sql = "SELECT * FROM " . XMB_PRIVMSGS_TABLE . " LIMIT $private_loc,$private_left "; // on the last pass only what is left } $result = query($sql, "Couldn't get Data from Topics Table."); $u2u_count = $db->sql_numrows($result); $u2u_data = $db->sql_fetchrowset($result); for ($i = 0; $i < $u2u_count; $i++) { $u2utid = $u2u_data[$i]['u2uid']; $msgto = $u2u_data[$i]['msgto']; $msgfrom = $u2u_data[$i]['msgfrom']; $dateline = $u2u_data[$i]['dateline']; $subject = stripslashes($u2u_data[$i]['subject']); $message = stripslashes($u2u_data[$i]['message']); $folder = $u2u_data[$i]['folder']; $new = $u2u_data[$i]['new']; if (($folder == 'inbox') && ($new == 'yes')) { $type=1; } elseif ((($folder == 'inbox') && ($new == 'no')) || (($folder == 'inbox') && ($new == ''))) { $type=0; } elseif ($folder == 'outbox') { $type=2; } $uid = make_bbcode_uid(); $message = bbencode_first_pass($message, $uid); $subject = make_clickable($subject); $message = make_clickable($message); $subject = addslashes($subject); $message = addslashes($message); $sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username='" . $msgfrom . "'"; $result = query($sql, "Couldn't obtain user id."); $row = $db->sql_fetchrow($result); $msg_from = $row['user_id']; $msg_from = ( $msg_from == '' ) ? -1 : $msg_from; // If the ID of the sender can't be find (?deleted?), set ID to -1 $sql = "SELECT user_id FROM " . USERS_TABLE . " WHERE username='" . $msgto . "'"; $result = query($sql, "Couldn't obtain user id."); $row = $db->sql_fetchrow($result); $msg_to = $row['user_id']; $msg_to = ( $msg_to == '' ) ? -1 : $msg_to; // If the ID of the receiver can't be find (?deleted?), set ID to -1 $sql = "SELECT poster_ip FROM " . POSTS_TABLE . " WHERE poster_id=" . $msg_from . " ORDER BY post_time DESC LIMIT 0, 1"; $result = query($sql, "Couldn't obtain poster ip."); $row = $db->sql_fetchrow($result); $poster_ip = $row['poster_ip']; $id++; if ($msg_from <> -1 && $msg_to <> -1) // if one of the users are found (were deleted in XMB) ignore this U2U { $sql = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_id, privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_bbcode, privmsgs_enable_html, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES (" . $id . ", " . $type . ", '" . $subject . "', " . $msg_from . ", " . $msg_to . ", '" . $dateline . "', '" . $poster_ip . "', 1, 0, 1, 0)"; query($sql, "Couldn't insert private message."); $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) VALUES (" . $id . ", '" . $uid . "', '" . $message . "')"; query($sql, "Couldn't insert private message."); } } $private_loc=$private_loc+500; } echo "...DONE!"; }	 // // Start convertion of Smilies (only the one that are not allready in) // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_smilies == 1) ) ) { echo "
Converting smilies..."; $result = query("SELECT * FROM " . XMB_SMILIES_TABLE . " WHERE type = 'smiley'", "Couldn't get smilies data"); $smilie_count = $db->sql_numrows($result); $smilie_data = $db->sql_fetchrowset($result); echo "."; for ($i = 0; $i < $smilie_count; $i++) { $code = $smilie_data[$i]['code']; $url = $smilie_data[$i]['url']; $url_trunced=substr($url,-strpos(strrev($url),'/')); // Last slash, only filename $smilie_xmb_path = $xmb_path . "/images/" . $url; $sql = "SELECT code FROM " . SMILIES_TABLE . " WHERE code='" . $code . "'"; $result = query($sql, "Couldn't obtain smilies code."); $code_number = $db->sql_numrows($result); if ($code_number == 0)	 // if it's not found allready { if (!($fp = fopen($phpbb_smilie . "/" . $url_trunced, "w")) ) { echo "
ERROR:Can't write file " . $phpbb_smilie . "/" . $url; } else { $copy_from = $xmb_path . '/images/' . $url; $copy_to = $phpbb_smilie . '/' . $url_trunced; if (!@copy($copy_from,$copy_to)) { echo "
Warning: error copying smilie from $copy_from to $copy_to, copy it by hand.
"; } fclose($fp); } $sql = "INSERT INTO " . SMILIES_TABLE . " (code, smile_url) VALUES ('" . $code . "','" . $url_trunced . "')"; query($sql, "Couldn't insert smilies data."); } } echo "DONE"; }	 // // Start convertion of banned IP numbers // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_banip == 1) ) ) { echo "
Converting banned IP numbers..."; $result = query("SELECT * FROM " . XMB_BANNED_TABLE, "Couldn't get banned IP data"); $banned_count = $db->sql_numrows($result); $banned_data = $db->sql_fetchrowset($result); echo "."; for ($i = 0; $i < $banned_count; $i++) { $ip1 = $banned_data[$i]['ip1']; $ip1 = ($banned_data[$i]['ip1'] == -1) ? 255 : $banned_data[$i]['ip1']; $ip2 = $banned_data[$i]['ip2']; $ip2 = ($banned_data[$i]['ip2'] == -1) ? 255 : $banned_data[$i]['ip2']; $ip3 = $banned_data[$i]['ip3']; $ip3 = ($banned_data[$i]['ip3'] == -1) ? 255 : $banned_data[$i]['ip3']; $ip4 = $banned_data[$i]['ip4']; $ip4 = ($banned_data[$i]['ip4'] == -1) ? 255 : $banned_data[$i]['ip4']; $ip_total=$ip1 . "." . $ip2 . "." . $ip3 . "." . $ip4; $banned_ip = encode_ip($ip_total); $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip) VALUES ('" . $banned_ip . "')"; query($sql, "Couldn't insert banned IP numbers");	 } echo "DONE"; }	 // // Start convertion of word replacements // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_word == 1) ) ) { echo "
Converting replaced words..."; query("DELETE FROM " . WORDS_TABLE, "Couldn't delete censored word data"); $result = query("SELECT * FROM " . XMB_WORDS_TABLE, "Couldn't get replaced word data"); $words_count = $db->sql_numrows($result); $words_data = $db->sql_fetchrowset($result); echo "."; for ($i = 0; $i < $words_count; $i++) { $sql = "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ( '". $words_data[$i]['find'] . "','" . $words_data[$i]['replace1'] . "' )"; query($sql, "Couldn't insert censored words");	 } echo "DONE"; }	 // // Convert Attachments (2.0.0 W/ ATTACHMENT MOD version 2.2.1 only! Doesn't work with older versions!) // if ( $cnv_attach == 1 ) { echo "
Trying to convert attachments..."; query("DELETE FROM " . ATTACH_DESC_TABLE, "Couldn't delete attachment descriptions"); query("DELETE FROM " . ATTACH_TABLE, "Couldn't delete attachment table"); $result = query("SELECT config_value FROM " . ATTACH_CONFIG_TABLE . " WHERE config_name='upload_dir'", "Couldn't obtain Attachment Informations."); $row = $db->sql_fetchrow($result); $directory = $row['config_value']; if (!is_dir($directory)) { echo "
Please create a directory 'files' under your phpBB2-Installation with world-writable rights."; echo "
Under Linux please chmod the directory to 777.
EXIT."; exit; } // Test write if (!($fp = fopen($directory . "/test.txt", "w"))) { echo "
You have to chmod the directory files to 777 to migrate Attachments.
EXIT."; exit; } else { @unlink($directory . "/test.txt"); } $sql = "SELECT * FROM " . XMB_ATTACH_TABLE; $result = query($sql, "Couldn't get Attachment Data."); $attach_count = $db->sql_numrows($result); $attach_data = $db->sql_fetchrowset($result); echo "."; for ($i = 0; $i < $attach_count; $i++) { $aid = $attach_data[$i]['aid']; $tid = $attach_data[$i]['tid']; $pid = $attach_data[$i]['pid']; $filename = $attach_data[$i]['filename']; $filetype = $attach_data[$i]['filetype']; $filesize = $attach_data[$i]['filesize']; $attachment = $attach_data[$i]['attachment']; $downloads = $attach_data[$i]['downloads']; // Getting the post's poster id and timestamp $sql = "SELECT * FROM " . POSTS_TABLE . " WHERE post_id = $pid"; $result = query($sql, "Couldn't find post id"); $row = $db->sql_fetchrow($result); $post_time = $row['post_time']; $poster_id = $row['poster_id']; // Creating new filename $sufix = substr($filename, -4); substr($filename,-strpos(strrev($filename),'.')); $new_filename = $poster_id . "_" . $post_time . $sufix; if (!($fp = fopen($directory . "/" . $new_filename, "w")) ) { echo "
ERROR:Can't write file " . $directory . "/" . $new_filename; } else { fwrite($fp, $attachment); fclose($fp); } $sql = "INSERT INTO " . ATTACH_DESC_TABLE . " (attach_id, attach_filename, download_count, filename, comment, mimetype, filesize, filetime) VALUES (" . $aid . ", '" . $new_filename . "', " . $downloads . ", '" . $filename . "', '', '" . $filetype . "', " . $filesize .", '')"; query($sql, "Couldn't insert Attachment description."); $sql = "INSERT INTO " . ATTACH_TABLE . " (attach_id, post_id, privmsgs_id) VALUES (" . $aid . ", " . $pid . ", 0)"; query($sql, "Couldn't insert Attachment data."); } echo "DONE";	 }	 // // Search Fill Begins Here // if ( ($cnv_all == 1) || ( ($cnv_all == 0) && ($cnv_search == 1) ) ) { echo "
Filling Search..."; query("DELETE FROM " . SEARCH_WORD_TABLE, "Couldn't delete from Search Word Table"); query("DELETE FROM " . SEARCH_MATCH_TABLE, "Couldn't delete from Search Match Table"); $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); $board_config = Array(); $userdata = Array(); $theme = Array(); $images = Array(); $lang = Array(); $gen_simple_header = FALSE; @include($phpbb_root_path . 'config.'.$phpEx); include($phpbb_root_path . 'includes/functions_search.'.$phpEx); include($phpbb_root_path . 'includes/constants.'.$phpEx); include($phpbb_root_path . 'includes/template.'.$phpEx); include($phpbb_root_path . 'includes/sessions.'.$phpEx); include($phpbb_root_path . 'includes/auth.'.$phpEx); include($phpbb_root_path . 'includes/db.'.$phpEx); $common_percent = 0.4; // Percentage of posts in which a word has to appear to be marked as common echo ""; // // Try and load stopword and synonym files // // This needs fixing! Shouldn't be hardcoded to English files! $stopword_array = file($phpbb_root_path . "language/lang_english/search_stopwords.txt"); $synonym_array = file($phpbb_root_path . "language/lang_english/search_synonyms.txt"); // // Fetch a batch of posts_text entries // $sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id FROM ". POSTS_TEXT_TABLE; if ( !($result = $db->mysql_query($sql)) ) { $error = $db->sql_error(); die("Couldn't get maximum post ID :: " . $sql . " :: " . $error['message']); } $max_post_id = $db->sql_fetchrow($result); $totalposts = $max_post_id['total']; $max_post_id = $max_post_id['max_post_id']; $postcounter = (!isset($HTTP_GET_VARS['batchstart'])) ? 0 : $HTTP_GET_VARS['batchstart']; $batchsize = 200; // Process this many posts per loop $batchcount = 0; for(;$postcounter <= $max_post_id; $postcounter += $batchsize) { $batchstart = $postcounter + 1; $batchend = $postcounter + $batchsize; $batchcount++; $sql = "SELECT * FROM " . POSTS_TEXT_TABLE . " WHERE post_id BETWEEN $batchstart AND $batchend"; if( !($result = $db->mysql_query($sql)) ) { $error = $db->sql_error(); die("Couldn't get post_text :: " . $sql . " :: " . $error['message']); } $rowset = $db->sql_fetchrowset($result); $db->sql_freeresult($result); $post_rows = count($rowset); if( $post_rows ) { //	$sql = "LOCK TABLES ".POST_TEXT_TABLE." WRITE"; //	$result = $db->mysql_query($sql); echo "
Restart from posting $batchstart
"; // For every post in the batch: for($post_nr = 0; $post_nr < $post_rows; $post_nr++ ) { echo "."; flush(); $post_id = $rowset[$post_nr]['post_id']; $matches = array(); $matches['text'] = split_words(clean_words("post", $rowset[$post_nr]['post_text'], $stopword_array, $synonym_array)); $matches['title'] = split_words(clean_words("post", $rowset[$post_nr]['post_subject'], $stopword_array, $synonym_array)); while( list($match_type, $match_ary) = @each($matches) ) { $title_match = ( $match_type == 'title' ) ? 1 : 0; $num_matches = count($match_ary); if ( $num_matches < 1 ) { // Skip this post if no words where found continue; } // For all words in the posting $sql_in = ""; $sql_insert = ''; $sql_select = ''; $word = array(); $word_count = array(); for($j = 0; $j < $num_matches; $j++) { $this_word = strtolower(trim($match_ary[$j])); if ( $this_word != '' ) { $word_count[$this_word] = ( isset($word_count[$this_word]) ) ? $word_count[$this_word] + 1 : 0; $comma = ($sql_insert != '')? ', ': ''; $sql_insert .= "$comma('" . $this_word . "')"; $sql_select .= "$comma'" . $this_word . "'"; } } if ( $sql_insert == '' ) { die("no words found"); } $sql = 'INSERT IGNORE INTO ' . SEARCH_WORD_TABLE . " (word_text) VALUES $sql_insert"; if ( !$result = $db->mysql_query($sql) ) { $error = $db->sql_error(); die("Couldn't INSERT words :: " . $sql . " :: " . $error['message']); } // Get the word_id's out of the DB (to see if they are already there) $sql = "SELECT word_id, word_text FROM " . SEARCH_WORD_TABLE . " WHERE word_text IN ($sql_select) GROUP BY word_text"; $result = $db->mysql_query($sql); if ( !$result ) { $error = $db->sql_error(); die("Couldn't select words :: " . $sql . " :: " . $error['message']); } $sql_insert = array(); while( $row = $db->sql_fetchrow($result) ) { $sql_insert[] = "($post_id, " . $row['word_id'] . ", $title_match)"; } $db->sql_freeresult($result); $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) VALUES " . implode(", ", $sql_insert); $result = $db->mysql_query($sql); if ( !$result ) { $error = $db->sql_error(); die("Couldn't insert new word match :: " . $sql . " :: " . $error['message']); } } // All posts } //	$sql = "UNLOCK TABLES"; //	$result = $db->mysql_query($sql); } // Remove common words after the first 2 batches and after every 4th batch after that. if( $batchcount % 4 == 3 ) { echo "
Removing common words (words that appear in more than $common_percent of the posts)
"; flush(); echo "Removed ". remove_common("global", $common_percent) ." words that where too common.
"; } } echo "DONE";	 } } ?>
Editado pela última vez por robra em 05 Dez 2013, 09:24, em um total de 1 vez.
Razão: Códigos são postados no BBcode [Code] e não no [Quote].
Avatar do usuário
robra
Membro Sênior
Membro Sênior
Mensagens: 6065
Registrado em: 02 Dez 2010, 22:29

Re: Migração do XMB para phpBB

Mensagem por robra »

Em um dos links de suporte que citei, há uma mensagem de um usuário dizendo que converteu o XMB->SMF e depois SMF->phpBB.
:arrow: Você tentou isso também :?:

Abraço. Imagem
[DICA] Antes de abrir um Novo Tópico, procure saber se a sua dúvida já foi respondida. Pesquise no Google por palavras(em inglês também) relacionadas à ela, somado à palavra "phpbb".
DiFalco
Novato
Novato
Mensagens: 4
Registrado em: 22 Mar 2013, 22:56

Re: Migração do XMB para phpBB

Mensagem por DiFalco »

Acredita q eu não tinha visto?? hahahahaha

Vlw, li aqui e baixei tudo o necessário.. mais tarde farei a atualização!

;)
Trancado