xoops forums

elbertvan

Just popping in
Posted on: 2009/4/25 10:13
elbertvan
elbertvan (Show more)
Just popping in
Posts: 16
Since: 2004/10/4
#1

SMF CBB 3.08 converter

I don't know if this is the right place to post it.
But in my quest to convert a joomla/smf bridged site to XOOPS i ran into the issue that there isn't a single convertor for Simple Machines Forum to Xoops.

So i decided to create one, im not a coder or DB admin so the code won't be that clean and its very simple.

The converter is located here smfconverter.

Please read the readme.txt file as it contains information you must read as it contains some XOOPS core hacks for the password conversion from SMF to Xoops.

I have tested it on a SMF 1.07 installation to a XOOPS 2.3.3 installation with CBB 3.08 installed.
The signatures are getting migrated but its best to leave them out as the images with the img width and heigth aren't understood by Xoops.

Hope you find this a bit usefull.
These scripts come without garantee and support. Allways make sure you make a backup before migrating.

Regards.

Mamba

Moderator
Posted on: 2009/4/25 21:17
Mamba
Mamba (Show more)
Moderator
Posts: 10935
Since: 2004/4/23
#2

Re: SMF CBB 3.08 converter

Thank you for doing it, and sharing with us!!
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

bumpeboy

Friend of XOOPS
Posted on: 2009/10/16 23:33
bumpeboy
bumpeboy (Show more)
Friend of XOOPS
Posts: 170
Since: 2008/10/4
#3

Re: SMF CBB 3.08 converter



I have tried this but the READ ME aint clear at all.

Step 1- Somehow clear.

Step 2- Very clear

Step 3- Very clear


Step 4- Not clear at all, what do you mean by,

Run:
-members.php
-categories.php
-forums.php
-topics.php
-posts.php

I have them on the PC folder, so to where do i run them, do you mean to Upload them on the server or what? and if thats the case, then to where, is it to my newly installed XOOPS or to my old SMF, either way to which folders?

Step 5- Clear
Step 6- Clear

Step 7- Left hanging, you say thats all, so what do i do with the files thats i have changed above.




I need help here from someone please.

Thanks


BELOW IS THE READ ME FILE:::::::::::::::::::::::::::::::::


Quote:
SMF v1.0.x -> XOOPS 2.3.X/CBB 3.08
-----------------------------


Requirements:
- SMF 1.0.X (tested with SMF 1.07)
- XOOPS 2.3.X and CBB 3.08
- MySQL 4.X or higher
- 15 free minutes

The scripts do tranfer the user signatures as well, but the images in there aren't allways shown right. Inform your users to alter them or hack the scripts so you won't transfere them.
Avatars are not transfered due to Xoops's odd way of handling them, get your users to upload them again.

How to import
-------------
Step -10000:

ALLWAYS MAKE A BACKUP OF YOUR XOOPS INSTALLATION AND DATABASE.

Step 1:

First you have to do a clean installation of XOOPS 2.3.x and the
CBB 3.08 module. Make sure you don't create aditional users, else delete them in the XOOPS database with "delete from prefix_users where uid > 1" because it won't transfer the first user from SMF as that is the first user and normaly the admin user, the scripts do however transfer the topics and posts created by this user.

Step 2:

Empty these tables:
-prefix_bb_categories
-prefix_bb_forums
-prefix_bb_posts
-prefix_bb_posts_text
-prefix_bb_topics
-prefix_bb_reads_forum
-prefix_bb_reads_topic

Don't delete them, only empty :).

Step 3:

Now you have to make proper changes in config.php file (database name,
username, password, table's names).

Step 4:

Run:
-members.php
-categories.php
-forums.php
-topics.php
-posts.php

Step 5:

SMF uses a different password encryption level based on SHA1, XOOPS uses MD5 encryption.
To have XOOPS use the SMF SHA1 hash some core files have to be hacked.
Becarefull you can ruin a lot in these files so only do whats in this file.

edit /xoopsdir/kernel/member.php
Find the function &loginUserMd5

Add this function above or below it.

/**
* Logs in a user with a SHA1 SMF password
*/

function &loginUserSha1($uname, $pwd)
{
$smf_hash = sha1(strtolower($uname) . $pwd);
$criteria = new CriteriaCompo(new Criteria('uname', $uname)); $criteria->add(new Criteria('pass', $smf_hash));
$user = $this->_uHandler->getObjects($criteria, false); if (!$user || count($user) != 1) {
$user = false;
return $user;
}
return $user[0];
}

Save the file and close it.

Next edit /xoopsdir/class/auth/auth_xoops.php

Replace:

function authenticate($uname, $pwd = null) {
$member_handler =& xoops_gethandler('member');
$user =& $member_handler->loginUser($uname, $pwd);
if ($user == false) {
$this->setErrors(1, _US_INCORRECTLOGIN);
}
return ($user);
}

With:

function authenticate($uname, $pwd = null) {
$member_handler =& xoops_gethandler('member');
$usermd5 =& $member_handler->loginUser($uname, $pwd);
$usersha1 =& $member_handler->loginUserSha1($uname, $pwd);

if ($usermd5 == false OR $usersha1 == false) {
$this->setErrors(1, _US_INCORRECTLOGIN);
}


if ($usermd5 == true) {
$user = $usermd5;
}

if ($usersha1 == true) {
$user = $usersha1;
}


return ($user);
}


Safe the file and exit.

Step 6:

Empty the caches in the folders:

xoops_data/caches/smarty_cache
xoops_data/caches/smarty_compile
xoops_data/caches/xoops_cache

Don't delete the .htaccess files in there and the index.html files.

Step 7:

Actually, that's all!
.

ghia

Community Support Member
Posted on: 2009/10/17 7:25
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#4

Re: SMF CBB 3.08 converter

I think it is best to do this local on a PC with eg XAMPP.
Install XOOPS 2.3.3 and import a backup of your forum database.
I think it doesn't matter much where the scripts are placed, because they will only operate on a database. So, the root may be fine.
Check the files, if there are includes of known XOOPS files as eg mainfile.php, this will give an idea of the assumed path against the XOOPS root directory.

drzflow15

Just popping in
Posted on: 2010/2/8 13:18
drzflow15
drzflow15 (Show more)
Just popping in
Posts: 19
Since: 2010/2/5 1
#5

Re: SMF CBB 3.08 converter

When i try to run

TOPICS.PHP i get this error
RULES
MySQL error on query BR> INSERT INTO xoopys_bb_topics VALUES ( 2, 'RULES', 2, '1247741220', 816, 0, 2, 4, 1, 0, 1, 0, 0, 1, '', 0, 0, 0, 0, '');
mysql_errno = 1136
mysql_error = Column count doesn't match value count at row 1

when i run POST.PHP i get this one
2 MySQL error on query BR> INSERT INTO xoopys_bb_posts VALUES ( 2, 0, 2, 4, 1247741220, 2, '', 1203085671, 'RULES', '', 1, 1, 0, NULL, 0);
mysql_errno = 1136
mysql_error = Column count doesn't match value count at row 1

Forums.php i get this one
Rules
debug1: Rules
debug2: Read before posting
MySQL error on query BR> INSERT INTO xoopys_bb_forums VALUES ( 4, 'Rules', 'Read before posting', 0, '', 1, 1, 2, 1, 25, 0, 1000, 'zip|jpg|gif', 0);
mysql_errno = 1136
mysql_error = Column count doesn't match value count at row 1

When i run categories.php
i get this error?

INTRO
MySQL error on query BR> INSERT INTO xoopys_bb_categories VALUES ( 1, '', 'INTRO', '', 0, '');
mysql_errno = 1062
mysql_error = Duplicate entry '1' for key 1



does it have to do soemthing with my Forum thread named RULES?

ghia

Community Support Member
Posted on: 2010/2/8 14:40
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#6

Re: SMF CBB 3.08 converter

Quote:
TOPICS.PHP i get this error
RULES
MySQL error on query BR> INSERT INTO xoopys_bb_topics VALUES ( 2, 'RULES', 2, '1247741220', 816, 0, 2, 4, 1, 0, 1, 0, 0, 1, '', 0, 0, 0, 0, '');
mysql_errno = 1136
mysql_error = Column count doesn't match value count at row 1
Weird! The column count should be 19. It seems the last '' empty field is too much. Delete it from the insert statement in the code.
0000'');
=>
0000);
I suppose similar modifications may be needed for the other scripts. Check the structure in phpMyAdmin and the field names and types with the script variables. It is easy to see the resemblence.

For the duplicate key error see to it, that your bb tables are empty at the start.

drzflow15

Just popping in
Posted on: 2010/2/8 17:09
drzflow15
drzflow15 (Show more)
Just popping in
Posts: 19
Since: 2010/2/5 1
#7

Re: SMF CBB 3.08 converter

Does It matter that I'm using the latest XOOPS version and this tut says 2.3.x

drzflow15

Just popping in
Posted on: 2010/2/8 20:42
drzflow15
drzflow15 (Show more)
Just popping in
Posts: 19
Since: 2010/2/5 1
#8

Re: SMF CBB 3.08 converter

i got topics.php,categories.php,members.php to work. I cant get Forums.php and posts.php to work , cant find which code to edit/remove

ghia

Community Support Member
Posted on: 2010/2/8 23:10
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#9

Re: SMF CBB 3.08 converter

Try with
$q1 "INSERT INTO $xoops_posts VALUES (
                
$row[ID_MSG],
                0,
                
$row[ID_TOPIC],
                
$row[ID_BOARD],
                
$row[posterTime],
                
$row[ID_MEMBER],
                '',
                
$ip,
                '
$subject',
                0,
                1,
                1,
                1,
                1,
                '',
                0,
                1,
                0,
                NULL,
                0);"
;

and
$q2 "INSERT INTO $xoops_posts_text VALUES (
                
$row[ID_MSG],
                '
$message',
                NULL);"
;

drzflow15

Just popping in
Posted on: 2010/2/9 3:53
drzflow15
drzflow15 (Show more)
Just popping in
Posts: 19
Since: 2010/2/5 1
#10

Re: SMF CBB 3.08 converter

WOW man thanks so much..

i got forums.php to work,. just followed the structure the same way you did. i appreciate your help man.

+1