Jop, das ist klar. Hab mittlerweile entdeckt, dass ich die Pfade manuell in der convert.php eingeben muss

.
Hier ein paar Beispiele und meine Lösungsvorschlläge

:
$DB_site->database = $dbname;
$DB_site->server = $servername;
$DB_site->user = $dbusername;
$DB_site->password = $dbpassword;
=>
$DB_site->database = $datenbankname; z.B. Testdatenbank
$DB_site->server = $servername; z.B. Testserver
$DB_site->user = $datenbankusername; z.B. Testuser
$DB_site->password = $datenbankpasswort; z.B. Testpasswort
^natürlich werden hier die echten Daten eingetragen, jedoch hab ich keine Lust diese hier preiszugeben

).
include(PHPBB_PATH . 'includes/functions_admin.' . $phpEx);
=>
include(PHPBB_PATH . '
www.meinedomain.de/phpBB2/includes/functions_admin.' . $phpEx);
require(VBULLETIN_PATH . 'admin/db_mysql.php');
=>
require(VBULLETIN_PATH . '
www.meinedomain.de/vb/includes/db_mysql.php');
Stimmt das so ?
Und wo in der convert.php muss ich alles etwas ändern? Diese sieht standardmäßig so aus:
[quote]<?php
/***************************************************************************
* convert.php
* -------------------
* begin : Saturday, Feb 23, 2002
* copyright : (C) 2002 Matthijs van de Water
* Portions of code (C) 2001 the phpBB Group
* email : converter@matthijs.net
* support@phpbb.com
*
* $Id: convert.php,v 1.33 2003/01/18 17:27:13 mvdwater Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
/***************************************************************************
*
* If you are unsure if this piece of software reached you unmodified,
* please download the latest version from http://matthijs.beryllium.net/
*
***************************************************************************/
/***************************************************************************
*
* VBULLETIN 2.0/2.2 TO PHPBB 2.0 CONVERSION TOOL
*
***************************************************************************
*
* FILE DESCRIPTION
*
* This script will convert from an existing vBulletin 2.0 / 2.2 installation
* to a new phpBB 2.0 installation.
*
*
* INSTALLATION GUIDELINES
*
* Backup your files and database before attempting to run this conversion!
* No change is made to your original vBulletin database, but one can never
* be too carefull. The author and/or the phpBB Group are not responsible
* for any data-loss as a result of using this software.
*
* Do a clean install of the latest version of phpBB 2.0.
*
* Make sure smilie and avatar dirs are writable and executable
* for the webserver, as it needs to create directories and images.
*
* Please verify the configuration defines below and update them to
* your situation.
*
* Place the convert.php file in the vBulletin root dir.
*
* Open the script in your browser and follow the onscreen instructions.
* Be sure to take your time for the conversion, as the process may take
* up to an hour, depending on the size of your board and the speed of
* your server.
*
***************************************************************************/
//
// Conversion Tool Configuration Settings
//
// Global path defines, change this if your installation is different.
// On Windows systems, use either \\ or / as directory delimiters.
// Be sure to keep the tailing slash on all paths!
define('VBULLETIN_PATH', 'http://miroerr.mi.funpic.de/forum/');
define('PHPBB_PATH', 'http://miroerr.mi.funpic.de/phpBB2/');
define('PHPBB_URI', 'http://miroerr.mi.funpic.de/phpBB2/');
// Do this many items in one go.
// Should be good for most servers, no need to change this unless your
// server can't handle the load.
define('BATCH_SIZE', 1000);
// If safe mode is on, process this many batches before breaking
// and reloading to stop script timeouts in lengthy steps.
// Only change this if you have timout problems. Can't be lower than 1
// and must be integer.
define('SAFE_MODE_BATCHES', 2);
// Enable this if you have timeout problems
define('FORCE_SAFE_MODE', 0);
//
// End Configuration Settings
//
//
// THERE IS NO NEED TO CHANGE ANYTHING BELOW THIS LINE
//
// This must be defined to be able to use the phpBB includes
// And to access the page if the board is disabled
define('IN_PHPBB', true);
define('IN_ADMIN', true);
// Define script version and filename
define('SCRIPT_VERSION', '1.33');
define('SCRIPT_FILENAME', $PHP_SELF);
// Some defines for vBulletin
// These guys may not like using defines, but I do
define('VB_THREAD_CLOSED', 0);
define('VB_THREAD_OPEN', 1);
define('VB_THREAD_MOVED', 10);
define('VB_INBOX', 0);
define('VB_SENTBOX', -1);
define('VB_UG_UNREGISTERED', 1);
define('VB_UG_REGISTERED', 2);
define('VB_UG_AWAITING_EMAIL_CONF', 3);
define('VB_UG_AWAITING_COPPA_CONF', 4);
define('VB_UG_SUPER_MODS', 5);
define('VB_UG_ADMIN', 6);
define('VB_UG_MODERATORS', 7);
// Record starttime
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$script_starttime = $mtime;
// Check if paths defined above are correct
if ( !@file_exists(VBULLETIN_PATH . 'http://miroerr.mi.funpic.de/forum/includes/config.php') )
{
die("ERROR: Unable to find vBulletin configuration file.<br />Check the path defines.<br />");
}
if ( !@file_exists(PHPBB_PATH . 'http://miroerr.mi.funpic.de/phpBB2/extension.inc') )
{
die("ERROR: Unable to find phpBB includes.<br />Check the path defines.<br />");
}
// Unlimited execution time, but not in safe mode
$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
if ( @$ini_val('safe_mode') || FORCE_SAFE_MODE )
{
define('SAFE_MODE', 1);
}
else
{
@set_time_limit(0);
define('SAFE_MODE', 0);
}
//
// This will load all vBulletin needed data
// No vBulletin functions are used, accept for the database class
//
// Load config file
require(VBULLETIN_PATH . 'http://miroerr.mi.funpic.de/forum/includes/config.php');
// Force persistent connections
$usepconnect = 1;
// Init DB class, force MySQL
require(VBULLETIN_PATH . 'http://miroerr.mi.funpic.de/forum/includes/db_mysql.php');
$DB_site = new DB_Sql_vb();
$DB_site->database = $dbname;
$DB_site->server = $servername;
$DB_site->user = $dbusername;
$DB_site->password = $dbpassword;
// Use our own error reporting
$DB_site->reporterror = 0;
$DB_site->connect();
// Load vBulletin options
$sql = "SELECT template AS options FROM template WHERE title='options'";
$options_query = $DB_site->query($sql);
if ( !$options_query )
{
die("Unable to fetch vBulletin options");
}
$row = $DB_site->fetch_array($options_query);
eval($row['options']);
$DB_site->free_result($options_query);
unset($row);
if ( !$templateversion )
{
$templateversion = '2.0.0';
}
define('VBULLETIN_VERSION', $templateversion);
//
// End vBulletin global settings
//
//
// Include phpBB config and global files and needed functions
//
$phpbb_root_path = PHPBB_PATH;
include(PHPBB_PATH . 'http://miroerr.mi.funpic.de/phpBB2/extension.inc');
include(PHPBB_PATH . 'http://miroerr.mi.funpic.de/phpBB2/common.' . $phpEx);
include(PHPBB_PATH . 'http://miroerr.mi.funpic.de/phpBB2/incl ... tions_post.' . $phpEx);
include(PHPBB_PATH . 'http://miroerr.mi.funpic.de/phpBB2/includes/bbcode.' . $phpEx);
include(PHPBB_PATH . 'http://miroerr.mi.funpic.de/phpBB2/incl ... ons_search.' . $phpEx);
include(PHPBB_PATH . 'http://miroerr.mi.funpic.de/phpBB2/incl ... ions_admin.' . $phpEx);
// Output no caching headers to keep browsers from caching steps
header ("Cache-Control: no-store, no-cache, must-revalidate");
header ("Cache-Control: pre-check=0, post-check=0, max-age=0", false);
header ("Pragma: no-cache");
header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// Step descriptions and sequence
$steps = array("start" => "Welcome Screen",
"settings" => "Settings",
"forums" => "Forums, Catogories and Permissions",
"users" => "Users",
"mods" => "Moderators, Admins and Usergroups",
"topics" => "Topics",
"posts" => "Posts",
"pm" => "Private Messages",
"polls" => "Polls",
"wordlist" => "Search Wordlist",
"end" => "Finalisation and Thank You Screen");
//
// Start of functions block
//
//
// Dies with a nicely formatted error message
//
function die_nice($message, $line = '', $sql = '')
{
global $db, $DB_site;
$phpbb_error = $db->sql_error();
if ( !empty($phpbb_error['message']) )
{
$error = $phpbb_error['code'] . " :: " . $phpbb_error['message'];
}
else
{
$error = $DB_site->errno . " :: " . $DB_site->errdesc;
}
print "<br /><br /><span class="error">ERROR</span>: $message<br /><br />\n";
print "After you have located and fixed the error, reload this page to continue the conversion process.<br />\n";
print "<pre>Debug information:<br />\n";
if ( !empty($line) )
{
print "Line: " . $line . "<br />\n";
}
if ( !empty($sql) )
{
print "SQL: " . $sql . "<br />\n";
}
print "MySQL Error: " . $error . "<br />\n";
print "</pre>\n";
common_footer();
exit;
}
//
// Converts vB only bbcode tags to corresponding phpBB bbcode
//
function convert_vb_code ($bbcode, $quote_template = -1)
{
// Remove [font] tags
$search = array("|\[font=[^\]]*\]|si", "|\[/font\]|si");
$replace = array("", "");
$bbcode = preg_replace($search, $replace, $bbcode);
// Convert [php] tag to [code]
// If you have the [php] MOD installed, you should comment this out
$search = array("[php]", "[/php]", "[PHP]", "[/PHP]");
$replace = array("[code]", "[/code]", "[code]", "[/code]");
$bbcode = str_replace($search, $replace, $bbcode);
// Convert [size] tags
// This needs PHP > 4 since it uses the eval option
$search = "/\[size=([0-9]+)\]/ie";
$replace = "'[size='.( (\\1 == 1) ? 9 : 6*\\1 ).']'";
$bbcode = preg_replace($search, $replace, $bbcode);
// Convert "" syntax
$search = "/\{1}([^"']*)['"]{1}\](.*)\[\/url\]/siU";
$replace = "[url=\\1]\\2";
$bbcode = preg_replace($search, $replace, $bbcode);
// Convert [quote] structure (use specified template)
if ($quote_template != -1)
{
if ( preg_match("/(\[quote\].*\[\/quote\])/si", $bbcode, $match) )
{
$quote_text = $match[1];
$search = $quote_template;
$replace = array("[quote="\\1"]\n", "[/quote][/quote][/quote]");
$quote_text = preg_replace($search, $replace, $quote_text);
$bbcode = preg_replace("/(\[quote\].*\[\/quote\])/si", $quote_text, $bbcode);
}
}
return $bbcode;
}
//
// Locks tables - modified from upgrade.php
//
function lock_tables($state, $tables= '')
{
global $DB_site;
if ( $state == 1 )
{
if ( is_array($tables) )
{
$tables = join(' WRITE, ', $tables);
}
$sql = "LOCK TABLES $tables WRITE";
$result = $DB_site->query($sql);
if ( !$result )
{
die_nice("Unable to do LOCK TABLES $tables WRITE", __LINE__, $sql);
}
}
else
{
$sql = "UNLOCK TABLES";
$result = $DB_site->query($sql);
if ( !$result )
{
die_nice("Unable to unlock tables", __LINE__, $sql);
}
}
}
//
// Print common page header - modified from upgrade.php
//
function common_header()
{
global $step, $steps;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>vBulletin 2.0/2.2 Conversion Tool for phpBB 2.0</title>
<meta name="description" content="vBulletin 2.0/2.2 to phpBB 2.0 Conversion Tool">
<meta name="keywords" content="phpbb2 phpbb 2.0 vbulletin vb phpbb2vb convert_vb2 2.2.2 2.2.1 2.2.0 2.2.x 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.x 2.x conversion tool import convert merge">
<meta name="author" content="Matthijs van de Water">
<meta name="version" content="<?php print SCRIPT_VERSION; ?>">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
/* Specifiy background images for selected styles
This can't be done within the external style sheet as NS4 sees image paths relative to
the page which called the style sheet (i.e. this page in the root phpBB directory)
whereas all other browsers see image paths relative to the style sheet. Stupid NS again!
*/
TH { background-image: url(<?php print PHPBB_URI; ?>templates/subSilver/images/cellpic3.gif) }
TD.cat { background-image: url(<?php print PHPBB_URI; ?>templates/subSilver/images/cellpic1.gif) }
TD.rowpic { background-image: url(<?php print PHPBB_URI; ?>templates/subSilver/images/cellpic2.jpg); background-repeat: repeat-y }
td.icqback { background-image: url(<?php print PHPBB_URI; ?>templates/subSilver/images/icon_icq_add.gif); background-repeat: no-repeat }
TD.catHead,TD.catSides,TD.catLeft,TD.catRight,TD.catBottom { background-image: url(<?php print PHPBB_URI; ?>templates/subSilver/images/cellpic1.gif) }
font,th,td,p,body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11pt }
a:link,a:active,a:visited { font-family: Verdana, Arial, Helvetica, sans-serif; color : #006699; font-size:11pt }
a:hover { font-family: Verdana, Arial, Helvetica, sans-serif; text-decoration: underline; color : #DD6900; font-size:11pt }
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
.maintitle,h1,h2 { font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}
.copyright { font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #444444; letter-spacing: -1px;}
a.copyright { font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #444444; text-decoration: none;}
a.copyright:hover { font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; text-decoration: underline;}
a.copyright:visited { font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #444444; }
.ok { color:green; }
.error { color:red; font-weight: bold; }
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("<?php print PHPBB_URI; ?>templates/subSilver/formIE.css");
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="<?php print PHPBB_URI; ?>templates/subSilver/images/logo_phpBB.gif" border="0" alt="phpBB 2.0" vspace="1" /></td>
<td align="center" width="100%" valign="middle"><span class="maintitle">Converting to phpBB 2.0</span><br />vBulletin 2.0/2.2 Conversion Tool by Matthijs van de Water</span></td>
</tr>
</table></td>
</tr>
</table>
<br clear="all" />
<?php
if ( $step != "all" && $step != "start" && $step != "end" )
{
print "<b>Converting " . $steps[$step] . "</b><br />\n";
}
return;
}
// Print common page footer - modified from upgrade.php
function common_footer()
{
global $db, $query_count, $script_starttime;
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
?>
<br clear="all" />
<br />
<div align="center"><span class="copyright">
Conversion Tool © 2002 <a href="http://www.matthijs.net/phpbb/" target="_mvdw" class="copyright">Matthijs van de Water</a><br />
phpBB 2.0 and portions of code © 2001 <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a><br />
vBulletin © 2000-2003 <a href="http://www.jelsoft.com/" target="_vb" class="copyright">Jelsoft Enterprises Limited</a><br />
</span></div>
<br />
<div align="center"><span class="copyright">Step execution time <?php printf("%.3f", $endtime - $script_starttime); ?> seconds :: <?php print $db->num_queries; ?> queries in phpBB database :: <?php print $query_count; ?> queries in vBulletin database :: Debug Mode</span></div>
</body>
</html>
<?php
return;
}
//
// Print next step HTML
//
function next_step($step, $continue)
{
global $steps;
if ( $continue )
{
print "<hr /><a href="$PHP_SELF?step=$step&startat=$continue">Resume step: <b>$step</b></a><br /><br />\n";
print "<script language="javascript">document.location = '$PHP_SELF?step=$step&startat=$continue';</script>\n";
}
else if ( $step != 'all' && $step != 'start' && $step != 'end' )
{
// Get next step from steps array
@reset($steps);
$next = false;
while ( list($key, $value) = each($steps) )
{
if ( $key == $step )
{
$next = key($steps);
break;
}
}
if ( $next )
{
print "<hr /><a href="$PHP_SELF?step=$next">Next step: <b>$next</b></a><br /><br />\n";
}
}
return;
}
//
// End functions
//
// Display welcome screen if the user hasn't specified a specific starting point.
$step = ( isset($HTTP_GET_VARS['step']) ) ? $HTTP_GET_VARS['step'] : 'start';
// Get resume point if one was given
$start_id = ( isset($HTTP_GET_VARS['startat']) ) ? $HTTP_GET_VARS['startat'] : 0;
// Next resume point initialisation
$resume_id = false;
// Output common header
common_header();
//
// The big switch, determine step to be taken
//
switch ( $step )
{
//
// STEP START - SHOW STARTUP SCREEN
//
case 'start':
print "<b>Welcome to the vBulletin 2.0 / 2.2 to phpBB 2.0 Conversion Tool.</b><br /><br />\n";
print "This script will guide you through the conversion process. Depending on the size of your board and the speed of your server the process can last over an hour, so be patient.<br />\n";
print "Don't interrupt the loading of pages, follow the instructions on screen.<br />\n";
print "<br /><b>Be sure to backup your database(s) before continuing!</b><br />\n";
if ( $board_config['version'] < '.0.4' )
{
print "<span class="error">Warning</span> :: Your phpBB version is incompatible with this version of the converter. You should install <a target="_phpbb" href="http://www.phpbb.com/downloads.php">the latest version of phpBB</a> available.<br />";
}
if ( substr($dbms, 0, 5) != 'mysql' )
{
print "<span class="error">Warning</span> :: You have selected a DBMS that is not MySQL. The script may not work as expected and might give errors. You should select either MySQL 3.x or 4.x as your DBMS during the phpBB installation.<br />";
}
if ( SAFE_MODE == 1 )
{
print "<span class="error">Warning</span> :: PHP Safe Mode is on. This can cause the script to timeout. You should disable safe mode if you can.<br />";
}
if ( !@is_writable(PHPBB_PATH . $board_config['smilies_path'] . '/') )
{
print "<span class="error">Warning</span> :: Smilies dir is not writable. You should change the permissions if you can.</span><br />";
}
if ( !@is_writable(PHPBB_PATH . $board_config['avatar_gallery_path'] . '/') )
{
print "<span class="error">Warning</span> :: Avatar Gallery dir is not writable. You should change the permissions if you can.</span><br />";
}
if ( !@is_writable(PHPBB_PATH . $board_config['avatar_path'] . '/') )
{
print "<span class="error">Warning</span> :: Avatar dir is not writable. You should change the permissions if you can.</span><br />";
}
print "<br /><br /><br /><br />\n";
print "<hr /><a href="$PHP_SELF?step=settings">Start Conversion</a><br /><br />\n";
if ($step != 'all')
{
break;
}
//
// STEP ALL - DO ALL STEPS IN ONE GO IF NOT IN SAFE MODE
//
case 'all':
if ( SAFE_MODE )
{
print "<span class="error">Error</span> :: Cannot do all steps in one go when in safe mode.<br />\n";
break;
}
//
// STEP SETTINGS - CONVERT BOARD SETTINGS
//
case 'settings':
print "* Converting configuration settings :: ";
flush();
//
// General Config Table
//
// Private message quota
$pm_sentbox = intval($pmquota);
$pm_savebox = intval($pmquota / 2);
$pm_inbox = intval($pmquota / 2);
// Patch floodcheck time
$floodchecktime = ( $enablefloodcheck ) ? intval($floodchecktime) : 0;
// Patch dateformat
$dateformat .= " $timeformat";
// Patch timezone offset if needed
if ( substr($timeoffset, 0, 1) == '+' )
{
$timeoffset = substr($timeoffset, 1);
}
// Get max online users and date/time
$sql = "SELECT template AS maxloggedin
FROM template
WHERE title = 'maxloggedin'
AND templatesetid = -1";
$template_query = $DB_site->query($sql);
if ( !$template_query )
{
die_nice("Unable to query maxloggedin information", __LINE__, $sql);
}
$row = $DB_site->fetch_array($template_query);
$max_logged_in = $row['maxloggedin'];
$max = explode(" ", $max_logged_in);
$max_users = intval($max[0]);
$max_users_timestamp = intval($max[1]);
// Activation type
$activation = ($verifyemail) ? USER_ACTIVATION_SELF : USER_ACTIVATION_NONE;
$activation = ($moderatenewmembers) ? USER_ACTIVATION_ADMIN : $activation;
// Inversed config options
$priv_msg_disable = ( $enablepms ) ? 0 : 1;
$board_disable = ( $bbactive ) ? 0 : 1;
$queries = array();
// Generate update configuration table queries
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $board_disable . "' WHERE config_name = 'board_disable'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . addslashes($bbtitle) . "' WHERE config_name = 'sitename'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = 'vBulletin 2.x Converted Board' WHERE config_name = 'site_desc'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . addslashes($cookiepath) . "' WHERE config_name = 'cookie_path'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . addslashes($cookiedomain) . "' WHERE config_name = 'cookie_domain'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($cookietimeout) . "' WHERE config_name = 'session_length'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($allowhtml) . "' WHERE config_name = 'allow_html'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($allowbbcode) . "' WHERE config_name = 'allow_bbcode'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($allowsmilies) . "' WHERE config_name = 'allow_smilies'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($allowsignatures) . "' WHERE config_name = 'allow_sig'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($avatarallowupload) . "' WHERE config_name = 'allow_avatar_local'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($avatarallowwebsite) . "' WHERE config_name = 'allow_avatar_remote'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($avatarallowupload) . "' WHERE config_name = 'allow_avatar_upload'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($maxposts) . "' WHERE config_name = 'posts_per_page'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($maxthreads) . "' WHERE config_name = 'topics_per_page'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($hotnumberposts) . "' WHERE config_name = 'hot_threshold'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($maxpolloptions) . "' WHERE config_name = 'max_poll_options'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $pm_inbox . "' WHERE config_name = 'max_inbox_privmsgs'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $pm_sentbox . "' WHERE config_name = 'max_sentbox_privmsgs'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $pm_savebox . "' WHERE config_name = 'max_savebox_privmsgs'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . addslashes($webmasteremail) . "' WHERE config_name = 'board_email'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $activation . "' WHERE config_name = 'require_activation'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($floodchecktime) . "' WHERE config_name = 'flood_interval'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($secureemail) . "' WHERE config_name = 'board_email_form'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($avatarmaxsize) . "' WHERE config_name = 'avatar_filesize'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($avatarmaxdimension) . "' WHERE config_name = 'avatar_max_width'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($avatarmaxdimension) . "' WHERE config_name = 'avatar_max_height'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $dateformat . "' WHERE config_name = 'default_dateformat'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $timeoffset . "' WHERE config_name = 'board_timezone'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $priv_msg_disable . "' WHERE config_name = 'privmsg_disable'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . intval($gzipoutput) . "' WHERE config_name = 'gzip_compress'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $faxnumber . "' WHERE config_name = 'coppa_fax'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $address . "' WHERE config_name = 'coppa_mail'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $max_users . "' WHERE config_name = 'record_online_users'";
$queries[] = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $max_users_timestamp . "' WHERE config_name = 'record_online_date'";
@reset($queries);
while ( list($i, $sql) = each($queries) )
{
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to update config table ($i)", __LINE__, $sql);
}
}
unset($queries);
print " <span class="ok"><b>OK</b></span><br />\n";
// Update board_config (this is only usefull when using the step=all option)
$board_config['allow_html'] = $allowhtml;
$board_config['allow_bbcode'] = $allowbbcode;
$board_config['allow_smilies'] = $allowsmilies;
$board_config['allow_sig'] = $allowsignatures;
$board_config['allow_avatar_local'] = $avatarallowupload;
$board_config['allow_avatar_remote'] = $avatarallowwebsite;
$board_config['allow_avatar_upload'] = $avatarallowupload;
//
// Ranks
//
print "* Converting ranks :: ";
$sql = "DELETE FROM " . RANKS_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Delete ranks from table failed", __LINE__, $sql);
}
$sql = "SELECT * FROM usertitle";
$ranks_query = $DB_site->query($sql);
if ( !$result )
{
die_nice("Unable to query ranks", __LINE__, $sql);
}
while ( $rank = $DB_site->fetch_array($ranks_query) )
{
$title = addslashes($rank['title']);
$min = intval($rank['minposts']);
$sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_min) VALUES ('$title', '$min')";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert rank '$title'", __LINE__, $sql);
}
}
print " <span class="ok"><b>OK</b></span><br />\n";
//
// Censor Words
//
print "* Converting censored words :: ";
flush();
$sql = "DELETE FROM " . WORDS_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to delete existing entries from words table", __LINE__, $sql);
}
$words = explode(" ",$censorwords);
$sql = "INSERT IGNORE INTO " . WORDS_TABLE . " (word, replacement) VALUES ";
$count = 0;
$censor_char = ( $censorchar ) ? $censorchar : '*';
while ( list($i, $word) = each($words) )
{
$word = strtolower(trim($word));
if ( ereg("^\{.*\}$", $word) )
{
$word = substr($word, 1, -1);
$replacement = str_repeat($censor_char, strlen($word));
}
else
{
$replacement = str_repeat($censor_char, strlen($word));
$word = "*$word*";
}
if ( strlen($replacement) > 1 )
{
$sql .= "('" . str_replace("\'", "''", $word) . "', '" . $replacement . "'),";
$count++;
}
}
if ( $count )
{
// Remove tailing ','
$sql = substr($sql, 0, -1);
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert censored words", __LINE__, $sql);
}
}
print " <span class="ok"><b>OK</b></span><br />\n";
//
// Illegal Usernames
//
print "* Converting disallowed usernames :: ";
flush();
$sql = "DELETE FROM ". DISALLOW_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to empty disallowed usernames", __LINE__, $sql);
}
$usernames = explode(" ", $illegalusernames);
$sql = "INSERT IGNORE INTO " . DISALLOW_TABLE . " (disallow_username) VALUES ";
$count = 0;
while ( list($i, $username) = each($usernames) )
{
$username = strtolower(trim($username));
if ( strlen($username) > 1 )
{
$sql .= "('" . addslashes($username) . "'),";
$count++;
}
}
if ( $count )
{
$sql = substr($sql, 0, -1);
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert disallowed usernames", __LINE__, $sql);
}
}
print " <span class="ok"><b>OK</b></span><br />\n";
// Ban-list cleanup
$sql = "DELETE FROM " . BANLIST_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to empty banlist table", __LINE__, $sql);
}
//
// IP addresses
//
print "* Converting banned IPs :: ";
flush();
$ip_list_temp = explode(" ", $banip);
$sql = "INSERT IGNORE INTO " . BANLIST_TABLE . " (ban_ip) VALUES ";
for($i = 0; $i < count($ip_list_temp); $i++)
{
$dots = substr_count($ip_list_temp[$i], ".");
while ($dots < 3)
{
$ip_list_temp[$i] .= ".255";
$dots++;
}
$ip = encode_ip($ip_list_temp[$i]);
$sql .= "('$ip'),";
}
if ( count($ip_list_temp) )
{
$sql = substr($sql, 0, -1);
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert banned IPs", __LINE__, $sql);
}
}
print " <span class="ok"><b>OK</b></span><br />\n";
//
// Email addresses
//
print "* Converting banned email addresses :: ";
flush();
$ban_mail_temp = explode(" ", $banemail);
$sql = "INSERT IGNORE INTO " . BANLIST_TABLE . " (ban_email) VALUES ";
while ( list($i,$email) = each($ban_mail_temp) )
{
$email = strtolower(trim($email));
if ( substr($email, 0, 1) == "@" )
{
$email = '*' . $email;
}
$sql .= "('$email'),";
}
if ( count($ban_mail_temp) )
{
$sql = substr($sql, 0, -1);
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert banned email addresses", __LINE__, $sql);
}
}
print " <span class="ok"><b>OK</b></span><br />\n";
//
// Convert smilies and generate smilie packs
//
// Check if smilie dir is writable
if ( is_writable(PHPBB_PATH . $board_config['smilies_path'] . '/') )
{
print "* Generating smilie pack from vBulletin smilies :: ";
$delimeter = '=+:';
//
// Export our current smiley config as a smiley pak...
//
$sql = "SELECT * FROM " . SMILIES_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Couldn't query current smilies", __LINE__, $sql);
}
$resultset = $db->sql_fetchrowset($result);
$smile_pak = "";
for($i = 0; $i < count($resultset); $i++ )
{
$smile_pak .= $resultset[$i]['smile_url'] . $delimeter;
$smile_pak .= $resultset[$i]['emoticon'] . $delimeter;
$smile_pak .= $resultset[$i]['code'] . "\n";
}
$fp = fopen (PHPBB_PATH . $board_config['smilies_path'] . '/phpbb2_original_smilies.pak', 'wb');
$written = fwrite($fp, $smile_pak);
fclose($fp);
if ( $written != strlen($smile_pak) )
{
@unlink(PHPBB_PATH . $board_config['smilies_path'] . '/phpbb2_original_smilies.pak');
print "<br /> <b>Warning</b>: error writing smilie pack, skipping smilie conversion.<br />";
}
else
{
// Old smilie pack written
// Build smilie pack from vB smilies and save it, copy smilies to new location
// Store only non-existing smilies in the database
$vb_smile_pak = "";
$no_copy = false;
$sql = "SELECT * FROM smilie";
$smilie_query = $DB_site->query($sql);
if ( !$smilie_query )
{
die_nice("Unable to query smilie info", __LINE__, $sql);
}
while ( $smilie = $DB_site->fetch_array($smilie_query) )
{
$filename = basename($smilie['smiliepath']);
$new_file = "vb_" . $filename;
$copy_from = VBULLETIN_PATH . $smilie['smiliepath'];
$copy_to = PHPBB_PATH . $board_config['smilies_path'] . '/' . $new_file;
if ( !$no_copy )
{
if ( !@copy($copy_from, $copy_to) )
{
print "<br /> <b>Warning</b>: error copying smilies, copy them by hand.<br />";
$no_copy = true;
}
}
$vb_smile_pak .= $new_file . $delimeter;
$vb_smile_pak .= $smilie['title'] . $delimeter;
$vb_smile_pak .= $smilie['smilietext'] . "\n";
// Check if smilie exists
$sql = "SELECT smilies_id FROM " . SMILIES_TABLE . " WHERE code = '" . addslashes($smilie['smilietext']) . "'";
$exists = $db->sql_query($sql);
if ( !$exists )
{
die_nice("Unable to query existing smilie", __LINE__, $sql);
}
if ( !$db->sql_numrows($exists) )
{
// Smilie does not yet exist, insert
$smilie_code = addslashes($smilie['smilietext']);
$emoticon = addslashes($smilie['title']);
$sql = "INSERT INTO " . SMILIES_TABLE . " (code, smile_url, emoticon)
VALUES ('$smilie_code', '$new_file', '$emoticon')";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert smilie (" . $smilie['smilietext'] . ")", __LINE__, $sql);
}
}
}
$fp = fopen(PHPBB_PATH . $board_config['smilies_path'] . '/vb_converted_smilies.pak', 'wb');
$written = fwrite($fp, $vb_smile_pak);
fclose($fp);
if ( $written != strlen($vb_smile_pak) )
{
@unlink(PHPBB_PATH . $board_config['smilies_path'] . '/vb_converted_smilies.pak');
print "<br /> <b>Warning</b>: error writing vB smilie pack.<br />";
}
}
print " <span class="ok"><b>OK</b></span><br />\n";
}
else
{
// Some day I may put some code here to download the smilie pack
// for now, we just forget about the smilies
// User should make sure dir has correct permissions
print "* <span class="error">Skipping smilies, smilie dir not writable</span><br />";
}
//
// Convert Avatar Gallery
//
$failed = false;
if ( is_writable(PHPBB_PATH . $board_config['avatar_gallery_path'] . '/') )
{
print "* Generating Avatar Gallery from vBulletin Avatars :: ";
flush();
$sql = "SELECT avatarpath FROM avatar";
$avatar_query = $DB_site->query($sql);
if ( !$avatar_query )
{
die_nice("Unable to query avatar data", __LINE__, $sql);
}
while ( $avatar = $DB_site->fetch_array($avatar_query) )
{
// Strip beginning 'images/avatars/'.
// Ignore avatars outside images/avatars dir for the moment,
// people with normal installations shouldn't have any problems.
if ( substr($avatar['avatarpath'], 0, 15) == 'images/avatars/' )
{
$path = substr($avatar['avatarpath'], 15);
$dirname = dirname($path);
if ($dirname == ".")
{
$dirname = "default";
}
$filename = basename($path);
if ( !@file_exists(PHPBB_PATH . $board_config['avatar_gallery_path'] . '/' . $dirname . '/') )
{
// Create dir
if ( !@mkdir(PHPBB_PATH . $board_config['avatar_gallery_path'] . '/' . $dirname, 0777) )
{
// Dir creation failed... skip gallery conversion
$failed = true;
break;
}
}
@copy(VBULLETIN_PATH . $avatar['avatarpath'], PHPBB_PATH . $board_config['avatar_gallery_path'] . '/' . $dirname . '/' . $filename);
}
}
if ( $failed == true )
{
print "<span class="error">FAILED</span><br />\nYou should copy the avatars by hand. Note that the avatars in the vBulletin root dir should be copied to a dir called 'default'.";
}
else
{
print " <span class="ok"><b>OK</b></span><br />\n";
}
}
else
{
// Avatar Gallery not writable
print "* <span class="error">Skipping Gallery Avatars, avatar dir not writable</span><br />";
}
//
// Topic watch list
//
print "* Converting topic watch list :: ";
flush();
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to delete existing entries from topic watchlist", __LINE__, $sql);
}
$sql = "SELECT * FROM subscribethread";
$subscribe_query = $DB_site->query($sql);
if ( !$subscribe_query )
{
die_nice("Unable to query watch list info", __LINE__, $sql);
}
while ( $subscribe = $DB_site->fetch_array($subscribe_query) )
{
$topic_id = intval($subscribe['topic_id']);
$user_id = intval($subscribe['user_id']);
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (topic_id, user_id)
VALUES ('$topic_id', '$user_id')";
}
print " <span class="ok"><b>OK</b></span><br />\n";
if ($step != 'all')
{
break;
}
//
// STEP FORUMS - CONVERT FORUMS
//
case 'forums':
print "* Deleting existing forums and categories :: ";
flush();
$sql = "DELETE FROM " . FORUMS_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to delete old forums", __LINE__, $sql);
}
$sql = "DELETE FROM " . CATEGORIES_TABLE;
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to delete old categories", __LINE__, $sql);
}
$sql = "DELETE FROM " . GROUPS_TABLE . " WHERE group_id <> 1";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to delete old groups", __LINE__, $sql);
}
$sql = "DELETE FROM " . AUTH_ACCESS_TABLE . " WHERE group_id <> 1";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to delete access rights", __LINE__, $sql);
}
print " <span class="ok"><b>OK</b></span><br />\n";
print "* Converting categories :: ";
flush();
$sql = "SELECT forumid, title, displayorder, parentid, parentlist
FROM forum
WHERE cancontainthreads = 0
ORDER BY parentid,displayorder";
$category_query = $DB_site->query($sql);
if ( !$category_query )
{
die_nice("Unable to query category information", __LINE__, $sql);
}
$categories = array();
$display_order = 0;
while ( $category = $DB_site->fetch_array($category_query) )
{
$categories[ $category['forumid'] ] = $category;
$display_order++;
$title = addslashes($category['title']);
$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order)
VALUES ('$title', '$display_order')";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert category (" . $category['title'] . ")", __LINE__, $sql);
}
$categories[ $category['forumid'] ]['cat_id'] = $db->sql_nextid();
}
print " <span class="ok"><b>OK</b></span><br />\n";
print "* Converting forums and permissions :: ";
flush();
//
// Get standard usergroup permissions
//
$sql = "SELECT * FROM usergroup WHERE usergroupid IN (1,2) ORDER BY usergroupid";
$permission_query = $DB_site->query($sql);
if ( !$permission_query )
{
die_nice("Unable to query default usergroup permissions", __LINE__, $sql);
}
$auth_standard = array();
while ( $perm = $DB_site->fetch_array($permission_query) )
{
if ( $perm['usergroupid'] == 1 )
{
$auth_standard['view'] = ( $perm['canview'] ) ? AUTH_ALL : AUTH_REG;
$auth_standard['read'] = $auth_standard['view'];
$auth_standard['post'] = ( $perm['canpostnew'] ) ? AUTH_ALL : AUTH_REG;
$auth_standard['reply'] = ( $perm['canreplyothers'] ) ? AUTH_ALL : AUTH_REG;
$auth_standard['edit'] = ( $perm['caneditpost'] ) ? AUTH_ALL : AUTH_REG;
$auth_standard['delete'] = ( $perm['candeletepost'] ) ? AUTH_ALL : AUTH_REG;
$auth_standard['vote'] = ( $perm['canvote'] ) ? AUTH_ALL : AUTH_REG;
$auth_standard['pollcreate'] = ( $perm['canpostpoll'] ) ? AUTH_ALL : AUTH_REG;
$auth_standard['attachments'] = ( $perm['canpostattachment'] ) ? AUTH_ALL : AUTH_REG;
}
else
{
$auth_standard['view'] = ( $perm['canview'] ) ? $auth_standard['view'] : AUTH_MOD;
$auth_standard['read'] = $auth_standard['view'];
$auth_standard['post'] = ( $perm['canpostnew'] ) ? $auth_standard['post'] : AUTH_MOD;
$auth_standard['reply'] = ( $perm['canreplyothers'] ) ? $auth_standard['reply'] : AUTH_MOD;
$auth_standard['edit'] = ( $perm['caneditpost'] ) ? $auth_standard['edit'] : AUTH_MOD;
$auth_standard['delete'] = ( $perm['candeletepost'] ) ? $auth_standard['delete'] : AUTH_MOD;
$auth_standard['vote'] = ( $perm['canvote'] ) ? $auth_standard['vote'] : AUTH_MOD;
$auth_standard['pollcreate'] = ( $perm['canpostpoll'] ) ? $auth_standard['pollcreate'] : AUTH_MOD;
$auth_standard['attachments'] = ( $perm['canpostattachment'] ) ? $auth_standard['attachments'] : AUTH_MOD;
}
}
// Sticky and announce only for MODs
$auth_standard['sticky'] = AUTH_MOD;
$auth_standard['announce'] = AUTH_MOD;
$sql = "SELECT * FROM forum WHERE cancontainthreads<>0 ORDER BY parentid,displayorder";
$forums_query = $DB_site->query($sql);
if ( !$forums_query )
{
die_nice("Unable to query forum information", __LINE__, $sql);
}
while ( $forum = $DB_site->fetch_array($forums_query) )
{
$forum_status = ( $forum['allowposting'] ) ? FORUM_UNLOCKED : FORUM_LOCKED;
// This should always give the correct category
$cat_id = $categories[ $forum['parentid'] ]['cat_id'];
if (!$cat_id)
{
$parents = explode(',', $forum['parentlist']);
for ($i = 0; $i < count($parents); $i++)
{
if ( $categories[ $parents[$i] ]['cat_id'] )
{
$cat_id = $categories[ $parents[$i] ]['cat_id'];
break;
}
}
if ( !$cat_id )
{
// This should never happen...
$cat_id = 1;
}
}
//
// Get custom forum permissions
// Yeah.. it's pretty messy
//
$forum_id = intval($forum['forumid']);
$sql = "SELECT *
FROM forumpermission
WHERE forumid = '$forum_id'
AND usergroupid IN (1,2)
ORDER BY usergroupid";
$permission_query = $DB_site->query($sql);
if ( !$permission_query )
{
die_nice("Unable to query forum permissions for forum " . $forum['forumid'], __LINE__, $sql);
}
$auth = array();
while ( $perm = $DB_site->fetch_array($permission_query) )
{
if ( $perm['usergroupid'] == 1 )
{
$auth['view'] = ( $perm['canview'] ) ? AUTH_ALL : AUTH_REG;
$auth['read'] = $auth['view'];
$auth['post'] = ( $perm['canpostnew'] ) ? AUTH_ALL : AUTH_REG;
$auth['reply'] = ( $perm['canreplyothers'] ) ? AUTH_ALL : AUTH_REG;
$auth['edit'] = ( $perm['caneditpost'] ) ? AUTH_ALL : AUTH_REG;
$auth['delete'] = ( $perm['candeletepost'] ) ? AUTH_ALL : AUTH_REG;
$auth['vote'] = ( $perm['canvote'] ) ? AUTH_ALL : AUTH_REG;
$auth['pollcreate'] = ( $perm['canpostpoll'] ) ? AUTH_ALL : AUTH_REG;
$auth['attachments'] = ( $perm['canpostattachment'] ) ? AUTH_ALL : AUTH_REG;
}
else if ( isset($auth['view']) )
{
$auth['view'] = ( $perm['canview'] ) ? $auth['view'] : AUTH_MOD;
$auth['read'] = $auth['view'];
$auth['post'] = ( $perm['canpostnew'] ) ? $auth['post'] : AUTH_MOD;
$auth['reply'] = ( $perm['canreplyothers'] ) ? $auth['reply'] : AUTH_MOD;
$auth['edit'] = ( $perm['caneditpost'] ) ? $auth['edit'] : AUTH_MOD;
$auth['delete'] = ( $perm['candeletepost'] ) ? $auth['delete'] : AUTH_MOD;
$auth['vote'] = ( $perm['canvote'] ) ? $auth['vote'] : AUTH_MOD;
$auth['pollcreate'] = ( $perm['canpostpoll'] ) ? $auth['pollcreate'] : AUTH_MOD;
$auth['attachments'] = ( $perm['canpostattachment'] ) ? $auth['attachments'] : AUTH_MOD;
}
else
{
$auth['view'] = ( $perm['canview'] ) ? $auth_standard['view'] : AUTH_MOD;
$auth['read'] = $auth['view'];
$auth['post'] = ( $perm['canpostnew'] ) ? $auth_standard['post'] : AUTH_MOD;
$auth['reply'] = ( $perm['canreplyothers'] ) ? $auth_standard['reply'] : AUTH_MOD;
$auth['edit'] = ( $perm['caneditpost'] ) ? $auth_standard['edit'] : AUTH_MOD;
$auth['delete'] = ( $perm['candeletepost'] ) ? $auth_standard['delete'] : AUTH_MOD;
$auth['vote'] = ( $perm['canvote'] ) ? $auth_standard['vote'] : AUTH_MOD;
$auth['pollcreate'] = ( $perm['canpostpoll'] ) ? $auth_standard['pollcreate'] : AUTH_MOD;
$auth['attachments'] = ( $perm['canpostattachment'] ) ? $auth_standard['attachments'] : AUTH_MOD;
}
}
if ( !isset($auth['view']) )
{
// Use standard permissions
$auth['view'] = $auth_standard['view'];
$auth['read'] = $auth_standard['read'];
$auth['post'] = $auth_standard['post'];
$auth['reply'] = $auth_standard['reply'];
$auth['edit'] = $auth_standard['edit'];
$auth['delete']= $auth_standard['delete'];
$auth['vote'] = $auth_standard['vote'];
$auth['pollcreate'] = $auth_standard['pollcreate'];
$auth['attachments'] = $auth_standard['attachments'];
}
// Sticky and announce only for MODs
$auth['sticky'] = AUTH_MOD;
$auth['announce'] = AUTH_MOD;
// Will let forum sync at the end handle this
$last_post_id = 0;
$forum_title = addslashes($forum['title']);
$forum_description = addslashes($forum['description']);
$forum_order = intval($forum['displayorder']);
$forum_posts = intval($forum['replycount']);
$forum_topics = intval($forum['threadcount']);
$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 ('$forum_id', '$cat_id', '$forum_title', '$forum_description', '$forum_status', '$forum_order', '$forum_posts', '$forum_topics', '$last_post_id', '0', '0', '" . $auth['view'] . "', '" . $auth['read'] . "', '" . $auth['post'] . "', '" . $auth['reply'] . "', '" . $auth['edit'] . "', '" . $auth['delete'] . "', '" . $auth['sticky'] . "', '" . $auth['announce'] . "', '" . $auth['vote'] . "', '" . $auth['pollcreate'] . "', '" . $auth['attachments'] . "')";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert forum (". $forum['title'] . ")", __LINE__, $sql);
}
}
print " <span class="ok"><b>OK</b></span><br />\n";
if ( $step != 'all' )
{
break;
}
//
// STEP USERS - CONVERT USERS
//
case 'users':
if ( !$start_id )
{
print "* Deleting existing users :: ";
flush();
$sql = "DELETE FROM " . USERS_TABLE . " WHERE user_id <> -1";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Delete users from users table failed", __LINE__, $sql);
}
$sql = "DELETE FROM " . USER_GROUP_TABLE . " WHERE user_id <> -1";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Delete users from usergroup table failed", __LINE__, $sql);
}
print " <span class="ok"><b>OK</b></span><br />\n";
}
$sql = "SELECT MAX(userid) AS max_id FROM user";
$max_query = $DB_site->query($sql);
if ( !$max_query )
{
die_nice("Unable to get maximum userid", __LINE__, $sql);
}
$row = $DB_site->fetch_array($max_query);
$max_id = $row['max_id'];
$sql = "SELECT MAX(group_id) AS total
FROM " . GROUPS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
die_nice('Could not obtain next group_id information', __LINE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
die_nice('Could not obtain next group_id information', __LINE__, $sql);
}
$group_id = $row['total'] + 1;
// Default settings for users
$style = $board_config['default_style'];
$lang = $board_config['default_lang'];
$date_format = $board_config['default_dateformat'];
$allow_html = $board_config['allow_html'];
$allow_bbcode = $board_config['allow_bbcode'];
$allow_smile = $board_config['allow_smilies'];
$allow_sig = $board_config['allow_sig'];
// Global config will overwrite this setting, so it is safe to set it to 1
// Changed this in version 1.31 because of avatar-problems people seemed to have
$allow_avatar = 1;
$allow_pm = ( $board_config['privmsg_disable'] ) ? 0 : 1;
//
// Check for custom userfields Location, Interests and Occupation
//
$sql = "SELECT profilefieldid, title FROM profilefield WHERE title IN ('location', 'interests', 'occupation')";
$pf_query = $DB_site->query($sql);
if ( !$pf_query )
{
die_nice("Unable to fetch custom profile fields", __LINE__, $sql);
}
$profilefield_sql = "%s AS location, %s AS interests, %s AS occupation ";
$location = "''";
$interests = "''";
$occupation = "''";
while ( $row = $DB_site->fetch_array($pf_query) )
{
switch ( $row['title'] )
{
case 'location':
$location = 'uf.field' . $row['profilefieldid'];
break;
case 'interests':
$interests = 'uf.field' . $row['profilefieldid'];
break;
case 'occupation':
$occupation = 'uf.field' . $row['profilefieldid'];
break;
}
}
// Build custom profilefield sql
$profilefield_sql = sprintf($profilefield_sql, $location, $interests, $occupation);
$banned_users = array();
$batchsize = intval(BATCH_SIZE); // Process this many posts per loop
$batchcount = 0;
if ( SAFE_MODE )
{
$resume_batches = intval(SAFE_MODE_BATCHES);
}
else
{
$resume_batches = 0;
}
//
// Loop through the users in batches
//
for($counter = $start_id; $counter <= $max_id; $counter += $batchsize)
{
$batchstart = $counter + 1;
$batchend = $counter + $batchsize;
$batchcount++;
print " * Converting Users ( $batchstart to $batchend ) :: ";
flush();
$sql = "SELECT u.*, $profilefield_sql
FROM user u LEFT JOIN userfield uf ON u.userid=uf.userid
WHERE u.userid
BETWEEN $batchstart
AND $batchend
ORDER BY u.userid ASC";
$users_query = $DB_site->query($sql);
if ( !$users_query )
{
die_nice("Unable to query batch ( $batchstart - $batchend )", __LINE__, $sql);
}
$per_pct = ceil( $DB_site->num_rows($users_query) / 40 );
$inc = 0;
while ( $user = $DB_site->fetch_array($users_query) )
{
// Rank
$user_rank = $user['usertitle'];
// Convert user level
switch ( $user['usergroupid'] )
{
case VB_UG_UNREGISTERED:
$user_level = ANONYMOUS;
$active = 0;
// This treats all users in this category as banned
// Not the best solution, but vB doesn't allow us a better one
$banned_users[] = $user['userid'];
break;
case VB_UG_REGISTERED:
$user_level = USER;
$active = 1;
break;
case VB_UG_AWAITING_EMAIL_CONF:
$user_level = USER;
$active = 0;
break;
case VB_UG_AWAITING_COPPA_CONF:
$user_level = USER;
$active = 0;
break;
case VB_UG_SUPER_MODS:
$user_level = MOD;
$active = 1;
$groups['super_mods'][] = $user['userid'];
break;
case VB_UG_ADMIN:
$user_level = ADMIN;
$active = 1;
$groups['admins'][] = $user['userid'];
break;
case VB_UG_MODERATORS:
$user_level = MOD;
$active = 1;
break;
default:
// Unknown custom usergroup
$user_level = USER;
$active = 1;
$groups[ $user['usergroupid'] ][] = $user['userid'];
break;
}
//
// Do custom rank
//
$sql = "SELECT rank_id, rank_special
FROM " . RANKS_TABLE . "
WHERE rank_title = '" . addslashes($user_rank) . "'";
$rank_query = $db->sql_query($sql);
if ( !$rank_query )
{
die_nice("Unable to query rankid for rank $user_rank", __LINE__, $sql);
}
$rank_data = $db->sql_fetchrow($rank_query);
if ( !$rank_data )
{
// Non-existing rank
$sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_special)
VALUES ('" . addslashes($user_rank) . "', 1)";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert new rank ($user_rank)", __LINE__, $sql);
}
$rank_id = $db->sql_nextid();
}
else if ( $rank_data['rank_special'] == 0 )
{
$rank_id = 'NULL';
}
else
{
$rank_id = $rank_data['rank_id'];
}
//
// Do avatar (check if gallery avatar or normal avatar)
//
$avatar_id = intval($user['avatarid']);
if ( $avatar_id == 0 )
{
//
// Normal avatar
//
$user_id = intval($user['userid']);
$sql = "SELECT avatardata FROM customavatar WHERE userid = '$user_id'";
$avatar_query = $DB_site->query($sql);
if ( !$avatar_query )
{
die_nice("Unable to query avatar data for user $user_id", __LINE__, $sql);
}
$row = $DB_site->fetch_array($avatar_query);
$avatar_data = $row['avatardata'];
if ( strlen($avatar_data) > 0 )
{
// Portion of code taken from profile.php
// Build avatar image from vB database string
$avatar_filename = $user_id . ".gif";
if( file_exists( PHPBB_PATH . $board_config['avatar_path'] . "/$avatar_filename" ) )
{
@unlink(PHPBB_PATH . $board_config['avatar_path'] . "/$avatar_filename");
}
$fptr = @fopen(PHPBB_PATH . $board_config['avatar_path'] . "/$avatar_filename", "wb");
$bytes_written = @fwrite($fptr, $avatar_data, strlen($avatar_data));
@fclose($fptr);
$avatar = $avatar_filename;
$avatar_type = USER_AVATAR_UPLOAD;
}
else
{
//
// No avatar
//
$avatar = '';
$avatar_type = USER_AVATAR_NONE;
}
}
else
{
//
// Gallery avatar
//
$sql = "SELECT avatarpath FROM avatar WHERE avatarid = $avatar_id";
$avatar_query = $DB_site->query($sql);
if ( !$avatar_query )
{
die_nice("Unable to query gallery avatar data (" . $user['avatarid'] . ")", __LINE__, $sql);
}
$row = $DB_site->fetch_array($avatar_query);
// Only support avatars in the appropriate avatars dir
// This should be ok for standard installs
// People with different setups should change this
if ( substr($row['avatar_path'], 0, 15) == 'images/avatars/' )
{
$path = substr($row['avatar_path'], 15);
$dirname = dirname($path);
if ($dirname == ".")
{
// Name of gallery category for vB root avatars
$dirname = "default";
}
$filename = basename($path);
$avatar = $dirname . "/" . $filename;
$avatar_type = USER_AVATAR_GALLERY;
}
else
{
$avatar = '';
$avatar_type = USER_AVATAR_NONE;
}
}
//
// Do signature
//
$sig_uid = ( $allow_bbcode ) ? make_bbcode_uid() : "";
$signature = addslashes(convert_vb_code($user['signature']));
$signature = prepare_message($signature, $allow_html, $allow_bbcode, $allow_smilies, $sig_uid);
//
// Do some checks on the data
//
$user['yahoo'] = ( strlen($user['yahoo']) < 3 ) ? '' : $user['yahoo'];
$user['aim'] = ( strlen($user['aim']) < 3 ) ? '' : $user['aim'];
$website = trim($user['homepage']);
if ( substr(strtolower($website), 0, 7) != "http://" )
{
$website = "http://" . $website;
}
if ( strtolower($website) == 'http://' )
{
$website = '';
}
$website = addslashes($website);
$icq = ( ereg("^[0-9]+$", $user['icq']) ) ? $user['icq'] : '';
$show_online = ( $user['invisible'] ) ? 0 : 1;
// Check if passwords needs to be encrypted.
// vBulletin < 2.2.0 doesn't encrypt passwords.
if ( VBULLETIN_VERSION < '2.2.0' )
{
$user['password'] = md5($user['password']);
}
$password = addslashes($user['password']);
$user_id = intval($user['userid']);
$username = addslashes($user['username']);
$last_visit = intval($user['lastvisit']);
$join_date = intval($user['joindate']);
$posts = intval($user['posts']);
$timezone_offset = addslashes($user['timezoneoffset']);
$date_format = addslashes($date_format);
$view_email = intval($user['showemail']);
$notify = intval($user['emailnotification']);
$notify_pm = intval($user['emailonpm']);
$pm_popup = intval($user['pmpopup']);
$avatar = addslashes($avatar);
$email = addslashes($user['email']);
$location = addslashes($user['location']);
$aim = addslashes($user['aim']);
$yim = addslashes($user['yahoo']);
$occupation = addslashes($user['occupation']);
$interests = addslashes($user['interests']);
// Change this if a MSN-messenger hack is installed on your vB
$msnm = '';
//
// User insert
//
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, user_active, username, user_password, user_lastvisit, user_regdate, user_level, user_posts, user_timezone, user_style, user_lang, user_dateformat, 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)
VALUES ('$user_id', '$active', '$username', '$password', '$last_visit', '$join_date', '$user_level', '$posts', '$timezone_offset', '$style', '$lang', '$date_format', '$view_email', '$allow_sig', '$allow_html', '$allow_bbcode', '$allow_smile', '$allow_avatar', '$allow_pm', '$show_online', '$notify', '$notify_pm', '$pm_popup', '$rank_id', '$avatar', '$avatar_type', '$email', '$icq', '$website', '$location', '$signature', '$sig_uid', '$aim', '$yim', '$msnm', '$occupation', '$interests')";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to insert user $user_id", __LINE__, $sql);
}
//
// Group creation
//
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_id, group_name, group_description, group_single_user)
VALUES ('$group_id', '$username', 'Personal User', '1')";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to create group for user $user_id", __LINE__, $sql);
}
//
// User -> Group creation
//
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES ('$group_id', '$user_id', '0')";
$result = $db->sql_query($sql);
if ( !$result )
{
die_nice("Unable to create user-group link for user $user_id", __LINE__, $sql);
}
$group_id++;
$inc++;
if ( $inc == $per_pct )
{
print ".";
flush();
$inc = 0;
}
}
$DB_site->free_result($users_query);
print " <span class="ok"><b>OK</b></span><br />\n";
// Output resume HTML if batchcount equals resume_batches
if ( $batchcount == $resume_batches )
{
$resume_id = $batchend;
break;
}
}
if ( $step != 'all' )
{
break;
}
//
// STEP MODS - CONVERT MODERATORS, ADMINS AND USERGROUPS
//
case 'mods':
$banned_users = array();
$groups = array();
$groups['admins'] = array();
$groups['super_mods'] = array();
// Fetch info to populate usergroups
$sql = "SELECT userid, usergroupid FROM user
WHERE usergroupid NOT IN ('" . VB_UG_REGISTERED . "', '" . VB_UG_AWAITING_EMAIL_CONF . "', '" . VB_UG_AWAITING_COPPA_CONF . "', '" . VB_UG_MODERATORS . "')";
$user_query = $DB_site->query($sql);
if ( !$user_query )
{
die_nice("Unable to query usergroup information", __LINE__, $sql);
}
while ( $user = $DB_site->fetch_array($user_query) )
{
$usergroup_id = intval($user['usergroupid']);
$user_id = intval($user['userid']);
switch ( $usergroup_id )
{
case 0:
// Invalid entry
break;
case VB_UG_UNREGISTERED:
// This treats all users in this category as banned
// Not the best solution, but vB doesn't allow us a better one
$banned_users[] = $user_id;
break;
case VB_UG_SUPER_MODS:
$groups['super_mods'][] = $user_id;
break;
case VB_UG_ADMIN:
$groups['admins'][] = $user_id;
break;
default:
// Unknown custom usergroup
$groups[$usergroup_id][] = $user_id;
break;
}
}
$DB_site->free_result($user_query);
$sql = "SELECT MAX(group_id) AS total
FROM " . GROUPS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
die_nice('Could not obtain next group_id information', __LINE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
die_nice('Could not obtain next group_id information', __LINE__, $sql);
}
$group_id = $row['total'] + 1;
//
// Handle super-mods and admins, create groups for them
//
if( count($groups['super_mods']) && count($groups['admins']) )
{
print " * Creating new group for admins and super moderators :: ";
flush();
$primary_admin = intval($groups['admins'][0]);
$group_type = GRO