News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[SMF Converter] phpBB3

Started by JayBachatero, January 23, 2008, 04:49:39 AM

Previous topic - Next topic

JayBachatero

Software: phpBB
Version: 3.0

It's finally here.  Spent the whole day working on it and managed to get a beta out.  The converter is still in beta and some things are missing.  If you have suggestions for other things to convert just post them :) .  Here is a list of what is converted.

Converts

  • Members
  • Ranks
  • Groups
  • Categories
  • Boards
  • Topics
  • Posts
  • Attachments
  • Personal Messages
  • Polls
Does Not Convert

  • Permissions (This might not be supported at all so please check permissions before making the board live.  Everything will be admin only for board access.)
  • Redirection Boards (I want to add support for the redirection boards mod.)
  • Avatars
  • Profile Fields (I want to look into this and see if I can make them SMF compatible.  You would just need to make the template changes.)
  • Basic Settings (Convert some of the basic forum settings. (site name, max post length, etc)
  • Smileys

Password Support phpBB 3.0.x  Changes not required SMF 2.0.x or higher they are already built in!
phpBB has their own custom password hash so you need to edit Sources/LogInOut.php from the SMF folder to add support for password conversion. Alternatively, you can used the attached phpBB3_Login_Fix.tgz modification (attached below) via Package Manager.

Code (find) Select

            // Snitz style - SHA-256.  Technically, this is a downgrade, but most PHP configurations don't support sha256 anyway.
            if (strlen($user_settings['passwd']) == 64 && function_exists('mhash') && defined('MHASH_SHA256'))
                $other_passwords[] = bin2hex(mhash(MHASH_SHA256, $_REQUEST['passwrd']));


Code (add after) Select

            // phpBB3 users new hashing.
            $other_passwords[] = phpBB3_password_check($_REQUEST['passwrd'], $user_settings['passwd']);


Code (find) Select

?>


Code (add before) Select

function phpBB3_password_check($passwd, $passwd_hash)
{
    // Too long or too short?
    if (strlen($passwd_hash) != 34)
        return;

    // Range of characters allowed.
    $range = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

    // Tests
    $strpos = strpos($range, $passwd_hash[3]);
    $count = 1 << $strpos;
    $count2 = $count;
$salt = substr($passwd_hash, 4, 8);

    // Things are done differently for PHP 5.
    if (@version_compare(PHP_VERSION, '5') == 1)
    {
        $hash = md5($salt . $passwd, true);
        for (; $count != 0; --$count)
            $hash = md5($hash . $passwd, true);;
    }
    else
    {
        $hash = pack('H*', md5($salt . $passwd));
        for (; $count != 0; --$count)
            $hash = pack('H*', md5($hash . $passwd));
    }

    $output = substr($passwd_hash, 0, 12);
    $i = 0;
    while ($i < 16)
    {
        $value = ord($hash[$i++]);
        $output .= $range[$value & 0x3f];

        if ($i < 16)
            $value |= ord($hash[$i]) << 8;

        $output .= $range[($value >> 6) & 0x3f];

        if ($i++ >= 16)
            break;

        if ($i < 16)
            $value |= ord($hash[$i]) << 16;

        $output .= $range[($value >> 12) & 0x3f];

        if ($i++ >= 16)
            break;

        $output .= $range[($value >> 18) & 0x3f];
    }

    // Return now.
    return $output;
}


Notes:
- Set SMF to UTF-8 mode since phpBB3 is set to UTF-8 by default.

Changelog
! Make sure that all boards get converted properly.
! Initial upload.

convert.php
Use this convert.php with the .sql file attached in this topic.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Aaron

Great job Jay! I'm sure you've just made a lot of people happy. :)

codenaught

Awesome Jay! :D I'll give it a test run a little later.
Dev Consultant
Former SMF Doc Coordinator

Augh

Thank You Jay :)

All working good now...

JayBachatero

Augh can you check and make sure that entities where converter correctly?  phpBB uses utf8_bin for text fields so hopefully everything transfers correctly.

Another thing that I just remembered.  phpBB has support for sub categories.  SMF does support this so sub categories will be set as regular categories with the boards on the main page.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

lockelymarkets

My board has heaps of subforums, to convert can I just convert as is and it will flatten it; or will I need to manually flatten the forum in phpBB3 then convert? I just don't want to convert and find I've lost heaps of posts...

Thankyou very very very very very very very very much for this converter!!!! :)

jarhaa

Something went wrong in my end, converter gave "successful" but none of the forums came up...

JayBachatero

Quote from: lockelymarkets on January 23, 2008, 03:52:47 PM
My board has heaps of subforums, to convert can I just convert as is and it will flatten it; or will I need to manually flatten the forum in phpBB3 then convert? I just don't want to convert and find I've lost heaps of posts...

Thankyou very very very very very very very very much for this converter!!!! :)
It should convert the sub forums as well.  It doesn't convert sub categories though.

Quote from: jarhaa on January 23, 2008, 03:53:56 PM
Something went wrong in my end, converter gave "successful" but none of the forums came up...
Common conversion errors.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Bdn

#8
I just tested out the converter on a clean install of SMF 1.4, everything was successful but when I log in I have no Admin access, even from my first PHPBB account, which is indeed a full admin on the PHPBB board.

Edit:

I had to go into phpMyAdmin and change my ID_GROUP to 1 (Admin) to fix my permission's because they were all defaulted to 0 and I had no access to Admin CP or any of the boards.

JayBachatero

What is your user level set to in phpBB users table?
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Toadicus

So, when you say "subcategory," do you include subforums with subforums of their own?  My forum has a lot of nested forums, and I just did a test run of the converter, and none of the nested forums were copied at all.  I got my parent categories, the main forums under the categories, but no child forums below that.

None of my "1st tier" subforums are category objects, but all of them have children of their own.

JayBachatero

Is it possible for me to get a database dump of your current phpBB3 install so that I can debug this?
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Toadicus

#12
Here ya go.

JayBachatero

Ok I got the file.  I removed it.  Wouldn't want other people to be messing with your data and get other info.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

JayBachatero

Ok use this convert.php http://www.simplemachines.org/community/index.php?action=dlattach;topic=140741.0;attach=47701 and select UTF-8 as the charset.  Also I updated the .sql file in the first post.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Toadicus

That seems to have done the trick!  I'll keep poking around and see if I notice any other issues.

Thanks!

JayBachatero

Double check attachments and see if they make it correctly.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Toadicus

Looks like the attachments made it over correctly, but the "attachment" bbcode used to display an attachment inline (e.g. [attachment=0:0c4fd]pingshot.jpg[/attachment:0c4fd] ) didn't quite translate.

JayBachatero

#18
Umm SMF doesn't support the inline images :(.  Maybe I can convert them to [img] tags.

EDIT:  Just looked into it and it seems like it would be too much work to support it :(.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Toadicus

Within some posts, some bbcodes aren't stripping their phpbb UIDs, and thus display unattractively.  Also, the converter appears to be adding close-tags for bullet codes (e.g. [/*]).

A sample of both:

[color=#228B22:9c28a]Herein lie the signups for the raid on 12/08/06.

[list:9c28a][*:9c28a]Kargin
[/*:m:9c28a][*:9c28a]Trixi
[*:9c28a]Mir
[/*:m:9c28a][*:9c28a]Sheowa
[*:9c28a]Aranthar
[/*:m:9c28a][*:9c28a]Danhunter
[*:9c28a]Gangofgreen
[/*:m:9c28a][*:9c28a]Penchance
[*:9c28a]Sinnara
[/*:m:9c28a][*:9c28a]Rinker
[*:9c28a]Acalon[/*:m:9c28a][/list:u:9c28a][/color:9c28a]

Advertisement: