Advertisement:

Author Topic: [SMF Converter] phpBB3  (Read 422632 times)

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,561
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
[SMF Converter] phpBB3
« on: January 23, 2008, 04:49:39 AM »
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 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.
« Last Edit: October 21, 2009, 04:13:55 PM by Norv »
Follow me on Twitter

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

Offline Aaron

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 6,711
  • Gender: Male
    • Aaronweb.net
Re: [SMF Converter] phpBB3
« Reply #1 on: January 23, 2008, 05:31:44 AM »
Great job Jay! I'm sure you've just made a lot of people happy. :)

Offline codenaught

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 14,655
  • Gender: Male
  • Formerly Known As akabugeyes
Re: [SMF Converter] phpBB3
« Reply #2 on: January 23, 2008, 12:00:15 PM »
Awesome Jay! :D I'll give it a test run a little later.
Dev Consultant
Former SMF Doc Coordinator

Offline Augh

  • Semi-Newbie
  • *
  • Posts: 17
Re: [SMF Converter] phpBB3
« Reply #3 on: January 23, 2008, 12:33:49 PM »
Thank You Jay :)

All working good now...

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,561
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: [SMF Converter] phpBB3
« Reply #4 on: January 23, 2008, 12:53:48 PM »
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

Offline lockelymarkets

  • Semi-Newbie
  • *
  • Posts: 27
    • auonline
Re: [SMF Converter] phpBB3
« Reply #5 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!!!! :)

Offline jarhaa

  • Semi-Newbie
  • *
  • Posts: 14
  • Gender: Male
    • Project Normandy 2010
Re: [SMF Converter] phpBB3
« Reply #6 on: January 23, 2008, 03:53:56 PM »
Something went wrong in my end, converter gave "successful" but none of the forums came up...

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,561
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: [SMF Converter] phpBB3
« Reply #7 on: January 23, 2008, 04:07:03 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.

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

Offline Bdn

  • Newbie
  • *
  • Posts: 1
Re: [SMF Converter] phpBB3
« Reply #8 on: January 23, 2008, 09:33:46 PM »
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.
« Last Edit: January 23, 2008, 10:14:26 PM by Bdn »

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,561
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: [SMF Converter] phpBB3
« Reply #9 on: January 23, 2008, 10:26:38 PM »
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

Offline Toadicus

  • Semi-Newbie
  • *
  • Posts: 14
Re: [SMF Converter] phpBB3
« Reply #10 on: January 24, 2008, 12:45:17 PM »
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.

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,561
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: [SMF Converter] phpBB3
« Reply #11 on: January 24, 2008, 01:06:32 PM »
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

Offline Toadicus

  • Semi-Newbie
  • *
  • Posts: 14
Re: [SMF Converter] phpBB3
« Reply #12 on: January 24, 2008, 01:51:44 PM »
Here ya go.
« Last Edit: January 24, 2008, 02:13:36 PM by JayBachatero »

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,561
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: [SMF Converter] phpBB3
« Reply #13 on: January 24, 2008, 02:14:14 PM »
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

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,561
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: [SMF Converter] phpBB3
« Reply #14 on: January 24, 2008, 04:52:36 PM »
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

Offline Toadicus

  • Semi-Newbie
  • *
  • Posts: 14
Re: [SMF Converter] phpBB3
« Reply #15 on: January 24, 2008, 05:04:00 PM »
That seems to have done the trick!  I'll keep poking around and see if I notice any other issues.

Thanks!

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,561
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: [SMF Converter] phpBB3
« Reply #16 on: January 24, 2008, 05:07:29 PM »
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

Offline Toadicus

  • Semi-Newbie
  • *
  • Posts: 14
Re: [SMF Converter] phpBB3
« Reply #17 on: January 24, 2008, 05:13:33 PM »
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.

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,561
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: [SMF Converter] phpBB3
« Reply #18 on: January 24, 2008, 05:36:07 PM »
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 :(.
« Last Edit: January 24, 2008, 05:39:07 PM by JayBachatero »
Follow me on Twitter

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

Offline Toadicus

  • Semi-Newbie
  • *
  • Posts: 14
Re: [SMF Converter] phpBB3
« Reply #19 on: January 24, 2008, 05:54:55 PM »
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:

Code: [Select]
[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]