<?php
if (file_exists(DIR . '/includes/drupaltin_config.php') == true)
{
require_once(DIR . '/includes/drupaltin_config.php');
$connector = new DbConnector();
/**
* Backup the original users table so we can restore it if we need to
*/
$backup = "CREATE TABLE users_backup SELECT * FROM users";
if(!$connector->query($backup))
{
echo mysql_error();
exit();
}
/**
* Delete all the old data from the users table now that it has been backed up, prepares us for the new dump :)
*/
$truncate = "TRUNCATE TABLE users";
if(!$connector->query($truncate))
{
echo mysql_error();
exit();
}
/**
* Here is where we read the database values that we need from the vB database and drump them into the Drupal database
*/
$query = $vbulletin->db->query_read("SELECT userid, username, password, email, joindate, timezoneoffset FROM user");
while ($row = mysql_fetch_object($query))
{
$row->timezoneoffset = intval($row->timezoneoffset) * 3600;
$insert = sprintf("INSERT INTO `users` (
`uid`, `name`, `pass`, `mail`, `mode`, `sort`, `threshold`, `theme`, `signature`, `created`, `access`,
`login`, `status`, `timezone`, `language`, `picture`, `init`, `data`)
VALUES (
'%s', '%s', '%s', '%s', '0', '0', '0', '', '', '%s', '0', '0', '1', '%s', '', '', '%s', 'a:0:{}')",
mysql_real_escape_string($row->userid),
mysql_real_escape_string($row->username),
mysql_real_escape_string($row->password),
mysql_real_escape_string($row->email),
mysql_real_escape_string($row->joindate),
mysql_real_escape_string($row->timezoneoffset),
mysql_real_escape_string($row->email));
if(!$connector->query($insert))
{
echo mysql_error();
exit();
}
}
} else {
echo "Missing drupaltin_config.php file. Please upload to /vbforums/includes/ and try again.";
}
?>