Working Simpleboard (mambo) to PHPBB Converter

This is an archive of the phpBB 2.0.x convertors forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
craigf136
Registered User
Posts: 9
Joined: Mon Feb 27, 2006 2:20 am

Working Simpleboard (mambo) to PHPBB Converter

Post by craigf136 »

Well it sort of works, it is the best and only one I have found.

The problem I have, is I'm using MKPortal, once I enter username and password and click login, I get the following error.

Code: Select all

The requested URL /forum/portalhome was not found on this server.
Clicking back and entering details again works fine and logs you into the site.

It doesn't appear to transfer the users postcount from simpleboard to PHPBB. Also when selecting IP address of poster in PHPBB, lists all users as posting from that IP address previously.

For it to work, you will need to have the mos simbleboard tables in the same database that you have install PHPBB, including mos_users.

Any help in fixing this would be greatly appreciate.

Code: Select all

<?php
/* 
Simpleboard 1.0.x to phbBB2 2.0.x converter
Based on the phpbb2tosb.php script by Olle Johansson http://mambo.theyard.org/

Notes from Marcos Osorno http://www.blort.com
* Tested on: phpBB 2.0.10, Mambo 4.5 1, PHP 4.3.9, MySQL 4.0.22
* Tested by executing from within the phpBB directory, elsewhere your mileage may vary
* Will DESTROY all the data in your phpBB db and replace it with SB data! Does not append!
* User features degraded from Olle's version this script doesn't check for
  banned users and does little sanity checking on moderators.
-------------Config---------------------*/
//MySQL Database host - usually 'localhost'
$host='localhost';

//MySQL Database user
$user='database-username-goes-here';

//MySQL Database password
$pass='your-database-password-goes-here';

//MySQL Database name
$db='enter-database-name-here';

// Mambo database prefix
$mosConfig_dbprefix = "mos_";

// phpBB2 database prefix
$phpbb_dbprefix = "phpbb_";

// Temp DB prefix used for temporary tables in the script
// set this to a prefix you are NOT using on your mySQL db
$temp_dbprefix = "temp_";
/* ---------------------------------------*/
define("BBCODE_UID_LEN", 10);
$bbcode_on = 'true';

ini_set("magic_quotes_gpc", "1");
set_magic_quotes_runtime ( 0 );

echo <<<CONTENT
<?xml version=\"1.0\"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Importing data from Simpleboard</title>
<meta http-equiv="Content-Type" content="text/html; iso-8859-1" />
</head>
<body>

<h1>Importing data from Simpleboard</h1>

CONTENT;

//Connect to and select Database
echo "Connecting to Database...\n";

$lnk = mysql_connect($host, $user, $pass) or die ('Not connected: ' . mysql_error()); 
mysql_select_db($db, $lnk) or die('Error: '.mysql_error());
echo "OK\n";

// PHPBB Categories > Forums > Topics > Posts > Posts Text

// Part One - Populate Categories
echo "<br />Populating Categories...\n";

// Import the main categories
// Prune those Simpleboard categories which have a parent
// Multiply the ordering by 10 to conform to phpbb2 format
// if sb_categories.parent = 0 then category is a phpbb cateogory

//clear phpbb categories table
$query="TRUNCATE TABLE {$phpbb_dbprefix}categories";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// if sb_categories.parent = 0 then category is a category
$query="INSERT INTO {$phpbb_dbprefix}categories (cat_id, cat_title, cat_order) SELECT id, name, ordering*10 FROM {$mosConfig_dbprefix}sb_categories WHERE {$mosConfig_dbprefix}sb_categories.parent = '0' ORDER by ordering";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error()); 

// clear phpbb forums table
$query="TRUNCATE TABLE {$phpbb_dbprefix}forums";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// Part Two - Populate Forums
// phpbb2 considers category header messages as forums
// these are indicated in sb by setting sb_messages.id=sb_messages.thread
// the actual messages can be detected by seeing that sb_messages.parent != 0

// create a table for counting the number of posts
// count the topics
$query = "CREATE TABLE {$temp_dbprefix}topics SELECT catid, COUNT(*) AS topics FROM {$mosConfig_dbprefix}sb_messages WHERE id=thread GROUP BY catid;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
// count the number of posts
$query = "CREATE TABLE {$temp_dbprefix}posts SELECT catid, COUNT(*) AS posts FROM {$mosConfig_dbprefix}sb_messages GROUP BY catid;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
// find the last post numericaly
$query = "CREATE TABLE {$temp_dbprefix}last SELECT catid, MAX(id) AS last FROM {$mosConfig_dbprefix}sb_messages GROUP BY catid;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
// join table one and two
$query = "CREATE TABLE {$temp_dbprefix}join_1 SELECT a.catid, a.topics, b.posts FROM {$temp_dbprefix}topics AS a, {$temp_dbprefix}posts AS b WHERE a.catid=b.catid;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
// join the previous table and 3
$query = "CREATE TABLE {$temp_dbprefix}join_2 SELECT a.catid, a.topics, a.posts, b.last FROM {$temp_dbprefix}join_1 AS a, {$temp_dbprefix}last AS b where a.catid=b.catid;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

$query="TRUNCATE TABLE {$phpbb_dbprefix}forums";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

$query="INSERT INTO {$phpbb_dbprefix}forums"
  ."(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)"
  ." SELECT f.id, f.parent, f.name, f.description, 0,"
  ." ordering, c.posts, c.topics, c.last,'',"
  ." 0,0,1,1,1,"
  ." 1,1,3,3,1,"
  ." 1,0 FROM {$mosConfig_dbprefix}sb_categories AS f, temp_join_2 AS c WHERE f.parent != 0 AND c.catid = f.id;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// drop the temp tables
$query = "DROP TABLE {$temp_dbprefix}topics, {$temp_dbprefix}posts, {$temp_dbprefix}last, {$temp_dbprefix}join_1, {$temp_dbprefix}join_2;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// Part Three - Populate Topics
// if sb_messages.parent = 0 then messages is a topic

$query="TRUNCATE TABLE {$phpbb_dbprefix}topics";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// create a table for finding min and max number of messages and the number of replies
$query = "CREATE TABLE {$temp_dbprefix}minmaxmesg SELECT thread, MIN(id) AS min, MAX(id) as max, COUNT(id) as reply FROM {$mosConfig_dbprefix}sb_messages GROUP BY thread;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// Run a query taking simple board messages and finding which are topics by thread=id then merge with count table above
// also subtract one from the reply count because it counts itself under this algorithm
$query = "SELECT m.id, m.catid, m.userid, m.subject, m.time, m.hits, reply - 1 AS reply, locked, 0, '', c.min, c.max, 0 FROM {$mosConfig_dbprefix}sb_messages AS m, {$temp_dbprefix}minmaxmesg AS c WHERE m.thread=m.id AND m.parent=0 AND c.thread=m.thread";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

while ( $row = mysql_fetch_object( $result ) ) {
// remove extra slashes
  $subject = stripslashes( $row->subject );
// Some messages still had the single quote in them without a \
// which was causing import problems so we
// removed the single quote and replaced it with HTML for the quote
  $subject = preg_replace ('/\'/', '\'', $subject);
  $query="INSERT INTO {$phpbb_dbprefix}topics"
	." (topic_id, forum_id, topic_poster, topic_title, topic_time,"
	." topic_views, topic_replies, topic_status, topic_vote, topic_type,"
	." topic_first_post_id, topic_last_post_id, topic_moved_id)"
	." VALUES ('$row->id', '$row->catid', '$row->userid', '$subject', '$row->time',"
	." '$row->hits', '$row->reply', '$row->locked', '0', '',"
	." '$row->min', '$row->max', '0')";
  $updateresult = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
}
mysql_free_result($result);

// drop the count table
$query = "DROP TABLE {$temp_dbprefix}minmaxmesg";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

echo "OK\n";

// Part Four - Populate Messages Table
echo "<br />Populating Posts...\n";

$query="TRUNCATE TABLE {$phpbb_dbprefix}posts";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

$query="INSERT INTO {$phpbb_dbprefix}posts (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) SELECT id, thread, catid, userid, time, '', name, 1, 0, 1, 1, '', 0 FROM {$mosConfig_dbprefix}sb_messages";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

echo "OK\n";

//Populate Messages_Text Table
echo "<br />Populating Messages_Text Table...\n";
$query="TRUNCATE TABLE {$phpbb_dbprefix}posts_text";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

$query="SELECT m.id, '', m.subject, t.message FROM {$mosConfig_dbprefix}sb_messages_text AS t, {$mosConfig_dbprefix}sb_messages AS m WHERE m.id = t.mesid";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

while ( $row = mysql_fetch_object( $result ) ) {
// uses phpbb's bbcode encoder to make a uid for each message
// which is required for the bbcode to work in phpbb
  $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
  $message = prep ( $row->message);
  $subject = stripslashes( $row->subject );
  $subject = preg_replace ('/\'/', '\'', $subject);
  $query = "INSERT INTO {$phpbb_dbprefix}posts_text (post_id, bbcode_uid, post_subject, post_text) VALUES ('$row->id','$bbcode_uid', '$subject', '$message')";

$updateresult = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
}
mysql_free_result($result);

echo "OK\n";

//Populate Users Table
echo "<br />Populating Users Table...\n";

$query="TRUNCATE TABLE {$phpbb_dbprefix}users";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

$query="SELECT id, gid, username, password, lastvisitDate, registerDate, email FROM {$mosConfig_dbprefix}users ORDER by id;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

while ( $row = mysql_fetch_object( $result ) ) {
  $lastvisitDate = strtotime($row->lastvisitDate);
  $registerDate = strtotime($row->registerDate);  
// I had some users with no registration date, set them to October 1, 2004
  if ($registerDate == '0') {
    $registerDate = '1096671600';
  }
// Set moderators based on Site and Main admin from mambo
  if ($row->gid == '24' or $row->gid == '25') {
    $moderator = '1';
  } else {
    $moderator = '0';
  }
  $query="INSERT INTO {$phpbb_dbprefix}users"
   ."(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("
   ." '$row->id', 1, '$row->username', '$row->password', '$lastvisitDate',"
   ." 0, '$lastvisitDate', '$registerDate', '$moderator', 0,"
   ." -6, 1, 'english', 'D M d, Y g:i a', 0,"
   ." 0, 0, 0, 0, 1,"
   ." 1, 1, 1, 1, 1,"
   ." 1, 1, 1, 1, 0,"
   ." '', '', '$row->email', '', '',"
   ." '', '', '', '', '',"
   ." '', '', '', '', '')";
  $updateresult = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
}
mysql_free_result($result);

// take the number of posts from SB and put them into phpbb
$query="UPDATE {$phpbb_dbprefix}users, {$mosConfig_dbprefix}sb_users SET user_posts=posts WHERE user_id=userid;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// insert signatures
$query="UPDATE {$phpbb_dbprefix}users, {$mosConfig_dbprefix}sb_users SET user_sig=signature WHERE user_id=userid;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// clean up bbcode in signatures and ad bbcode_uid
$query="SELECT user_id, user_sig FROM {$phpbb_dbprefix}users ORDER BY user_id;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

while ( $row = mysql_fetch_object( $result ) ) {
// uses phpbb's bbcode encoder to make a uid for each message
// which is required for the bbcode to work in phpbb
  $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
  $signature = prep ( $row->user_sig);
  $query = "UPDATE {$phpbb_dbprefix}users SET user_sig='$signature', user_sig_bbcode_uid='$bbcode_uid' WHERE $row->user_id=user_id";
  $updateresult = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
}
mysql_free_result($result);

// create a group for each user
$query="TRUNCATE TABLE {$phpbb_dbprefix}groups";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

$query="INSERT INTO {$phpbb_dbprefix}groups (group_id, group_type, group_name, group_description, group_moderator, group_single_user) SELECT user_id, '1', '', 'Personal User', '0', '1' FROM {$phpbb_dbprefix}users ORDER BY user_id";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// have each user join their own group
$query="TRUNCATE TABLE {$phpbb_dbprefix}user_group";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

$query="INSERT INTO {$phpbb_dbprefix}user_group (group_id, user_id, user_pending) SELECT user_id, user_id, '0' FROM {$phpbb_dbprefix}users ORDER BY user_id";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

echo "OK\n";

echo "<br />Complete...\n";

echo <<<CONTENT
</body>
</html>
CONTENT;

//--- Rewrite phpBB ip ---//
function phpbb_decode_ip($int_ip)
{
	if ($int_ip == '00000000') {
		return '0.0.0.0';
	} else {
		return long2ip("0x{$int_ip}");
	}
}


//--- Function to prepare strings for MySQL storage ---/
function prep($s) {
// Insert bbcode_uid necessary for bbcode to be recognized by phpbb2
    global $bbcode_uid;

    // <strong> </strong>    
    $s = preg_replace('/\[b\]/', '[b:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[\/b\]/', '[/b:'.$bbcode_uid.']', $s);
    
    // <em> </em>
    $s = preg_replace('/\[i\]/', '[i:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[\/i\]/', '[/i:'.$bbcode_uid.']', $s);
    
    // <u> </u>    
    $s = preg_replace('/\[u\]/', '[u:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[\/u\]/', '[/u:'.$bbcode_uid.']', $s);

    // quote
    $s = preg_replace('/\[quote\]/', '[quote:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[\/quote\]/', '[/quote:'.$bbcode_uid.']', $s);

    // url with "
    $s = preg_replace('/\[url=\\\&quot\;(.*?)\\\&quot\;\](.*?)/', '[url=\\1]\\2', $s);

    // image
    $s = preg_replace('/\[img(.*?)\](.*?)\[\/img(.*?)\]/si', '[img:'.$bbcode_uid.']'.'\\2[/img:'.$bbcode_uid.']', $s);

    // color
    $s = preg_replace('/\[color=(.*?)\]/', '[color=\\1:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[\/color\]/', '[/color:'.$bbcode_uid.']', $s);

    // size
    // sb uses size 1 to 5
    // phpbb2 uses size 1 to 29
    // will use 1 = 7, 2=9, 3=12, 4=18, 5=24
    $s = preg_replace('/\[size=1\]/', '[size=7:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[size=2\]/', '[size=9:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[size=3\]/', '[size=12:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[size=4\]/', '[size=18:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[size=5\]/', '[size=24:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[\/size\]/', '[/size:'.$bbcode_uid.']', $s);

    // code
    $s = preg_replace('/\[code\]/','[code:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[\/code\]/', '[/code:'.$bbcode_uid.']', $s);

    // lists
    $s = preg_replace('/\[ul\]/', '[list'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[ol\]/', '[list=1:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[li\]/', '[*:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[\/li\]/', '', $s);
    $s = preg_replace('/\[\/ul\]/', '[list:u:'.$bbcode_uid.']', $s);
    $s = preg_replace('/\[\/ol\]/', '[list:o:'.$bbcode_uid.']', $s);
    
    return $s;
}

// function taken from phpbb2 functions file
function make_bbcode_uid()
{
        // Unique ID for this message..

        $uid = md5(mt_rand());
        $uid = substr($uid, 0, BBCODE_UID_LEN);

        return $uid;
}

?>
craigf136
Registered User
Posts: 9
Joined: Mon Feb 27, 2006 2:20 am

Post by craigf136 »

Just found a further error, when trying to change a user to administrator and to moderate a forum.

Code: Select all

Couldn't delete auth access info

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax near 'AND auth_mod = 0' at line 3

DELETE FROM phpbb_auth_access WHERE group_id = AND auth_mod = 0

Line : 180
File : admin_ug_auth.php
User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Post by D¡cky »

craigf136 wrote: The problem I have, is I'm using MKPortal, once I enter username and password and click login, I get the following error.

Code: Select all

The requested URL /forum/portalhome was not found on this server.
Clicking back and entering details again works fine and logs you into the site.

This is probably caused by your path setting in phpbb_config. If you can't access your Admin Control Panel because of it, use phpMyAdmin and in the phpbb_config table, set the script_path to /forum/
craigf136 wrote: It doesn't appear to transfer the users postcount from simpleboard to PHPBB.

Does SimpleBoard have a field for keeping track of the user's post count? You are inseerting into the user's table a post count of 0. If simple board doesn't have a field for the post count, I believe there is a MOD on here for resynching the user's post count.
craigf136 wrote: Also when selecting IP address of poster in PHPBB, lists all users as posting from that IP address previously.

What format is the IP address in SimpleBoard? If it is in dotquad format, it will have to be converted to a hex format. There is a function in includes/function.php, encode_ip().
craigf136 wrote:

Code: Select all

Couldn't delete auth access info

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax near 'AND auth_mod = 0' at line 3

DELETE FROM phpbb_auth_access WHERE group_id = AND auth_mod = 0

Line : 180
File : admin_ug_auth.php

Every user has to have a group. The easiest way is to run this script after the conversion.
Have you hugged someone today?
craigf136
Registered User
Posts: 9
Joined: Mon Feb 27, 2006 2:20 am

Post by craigf136 »

I have managed to get this script working to a certain degree and but fall short on three counts, one is an issue the other two not so much.

I encounter the following error after running the script.

Code: Select all

Importing data from Simpleboard
Connecting to Database... OK
Populating Categories... OK
Populating Posts... OK
Populating Messages_Text Table... OK
Populating Users Table...
Invalid query:
UPDATE phpbb_users, mos_sb_users SET user_posts=posts WHERE user_id=userid
You have an error in your SQL syntax near ' mos_sb_users SET user_posts=posts WHERE user_id=userid' at line 1
I'm unsure as to where the syntax error is? I assume once this is fixed, the post count for the users will be fixed in the conversion.

I used the resynch tool as suggested to fix that for now (thanks for the tip) - the IP addres isn't transferring over (simpleboard registers the IP address).

Heres the section of the script being called.

Code: Select all

// take the number of posts from SB and put them into phpbb
$query="UPDATE {$phpbb_dbprefix}users, {$mosConfig_dbprefix}sb_users SET user_posts=posts WHERE user_id=userid;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());
The 2nd part is the signatures are not tansferred, not a major issue, however, any help or suggestion's would be most welcome.

Code: Select all

// insert signatures
$query="UPDATE {$phpbb_dbprefix}users, {$mosConfig_dbprefix}sb_users SET user_sig=signature WHERE user_id=userid;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

// clean up bbcode in signatures and ad bbcode_uid
$query="SELECT user_id, user_sig FROM {$phpbb_dbprefix}users ORDER BY user_id;";
$result = mysql_query($query) or die("<br />Invalid query:<br />$query<br />" . mysql_error());

Simpleboard IP shows as 000000 & as you be aware phpbb shows as 0.0.0.0 in the script itself, I change the script to

Code: Select all

if ($int_ip == '0.0.0.0') {
from

Code: Select all

if ($int_ip == '000000') {

Code: Select all

//--- Rewrite phpBB ip ---//
function phpbb_decode_ip($int_ip)
{
	if ($int_ip == '0.0.0.0') {
		return '0.0.0.0';
	} else {
		return long2ip("0x{$int_ip}");
	}
}
It is a bit of trial and error with the script, I'm testing on a test site before transferring anything over on the live site. I'm a newbie to this type of work, so apologies if this is going over ground which has been coverd elsewhere.
User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Post by D¡cky »

For your UPDATE scripts, read this for a reference,
UPDATE Syntax.
I glanced through it only briefly, but it looks like you need table names with the fields, e.g.,
UPDATE t1, t2 set t1.field = t2.value where t1.this = t2.that;

So...your query should be something like this

Code: Select all

$query="UPDATE {$phpbb_dbprefix}users, {$mosConfig_dbprefix}sb_users SET {$phpbb_dbprefix}user_posts={$mosConfig_dbprefix}posts WHERE {$phpbb_dbprefix}user_id={$mosConfig_dbprefix}userid;";
You need to do this for both your post counts and for the signature.
Have you hugged someone today?
mwep
Registered User
Posts: 1
Joined: Wed Apr 26, 2006 3:25 pm

Working Code Yet ?

Post by mwep »

I am trying to migrate from Joomla/Simpleboard to PHPBB2. Does anyone have a working script to migrate my users and posts ?

Thanks!!!
mexkn
Registered User
Posts: 1
Joined: Sat Nov 12, 2005 5:52 pm

Post by mexkn »

This works, but there are a couple (2) fixes:
  • Both occurances of:

    Code: Select all

    $subject = preg_replace ('/\'/', '\'', $subject); 
    need to be replaced with:

    Code: Select all

    $subject = preg_replace ('/\'/', '\\\'', $subject); 
  • You need to manually add the default Anonymous account (with user_id -1) into the phpbb_users table
These were the only problems I came across while migrating.

-mexkn
odessa
Registered User
Posts: 16
Joined: Sat Feb 26, 2005 10:57 pm

Conversion searchable?

Post by odessa »

I got the conversion to work after following mexkn's two additional steps. The whole process was reasonably smooth.

I just have one issue now, and would appreciate any help: non of my imported forum posts are searchable.

Does anybody know why this would be? I have 30,000 posts and it would be a shame to have them all in my forums but not have them be searchable! Big problem, indeed...

Thanks in advance.
User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Post by D¡cky »

The search tables probably need to be rebuilt. Use this tool, Rebuild Search Index
Have you hugged someone today?
odessa
Registered User
Posts: 16
Joined: Sat Feb 26, 2005 10:57 pm

That's it!

Post by odessa »

Thanks Dicky! You're a rock star...

Such a simple answer but I don't know how I would have found it without you. You just made my day.

:D
Locked

Return to “[2.0.x] Convertors”