Simple Machines Community Forum

SMF Support => Converting to SMF => Topic started by: Misanthrope on December 09, 2004, 08:11:04 PM

Title: XMB-to-SMF converter leaves backslashes
Post by: Misanthrope on December 09, 2004, 08:11:04 PM
I just converted my old XMB 1.9 forum over to SMF, and the only problem I have is that all of the apostrophes and quotes in the posts/threads on the converted SMF install are now escaped with backslashes.

*HOW* do I get rid of those?

-Misanthrope
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 10, 2004, 01:29:10 AM
Have you had any new posts yet?

Is it both " and '?  I assume \ also would be escaped - anything else?  Are most bbc tags working properly?

I'm afraid the XMB converter hasn't had as much testing as we'd like, but I wasn't aware of this issue.  I wonder if it's only 1.9, but I expect it's probably not.

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Misanthrope on December 10, 2004, 02:30:47 AM
Yes, apostrophes and quotes were escaped.

The way XMB works, it stripslashes everything it pulls from the database before displaying it, and when I look inside the XMB database I see backslashes all over the place. So XMB aparently adds slashes somewhere in the process of putting information into the database, and I think that's what's confusing your converter's output.

So the converter should strip the slashes out of the data pulled from the XMB database before sticking it in the SMF database. I think this would fix the conversion problem. I'd do it, but my PHP mastery isn't quite up to the level I'd like it to be.

-Misanthrope
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Peter Duggan on December 10, 2004, 02:35:52 AM
Quote from: Misanthrope on December 10, 2004, 02:30:47 AM
So XMB aparently adds slashes somewhere in the process of putting information into the database

So does all properly-written software (including SMF).

<edit>At least I thought it did, but it looks like it's giving us &#039; and &quot; instead now.</edit>
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Misanthrope on December 10, 2004, 02:40:31 AM
Without checking to see if the database input is already escaped? In a lot of places I'm seeing multiple backslashes, and this is what I\\\\\'m talking about.

-Misanthrope
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Misanthrope on December 10, 2004, 02:43:32 AM
Incidentally, I'm something of a total amateur with PHP/MySQL, so bear with me if I sound like an idiot...it's just that my forum is for a commercial website, and I can't really just flush all the posts and start over. I'd really like to get rid of XMB once and for all, and SMF seems to be one of the very few decent forum packages that has a converter for XMB.

-Misanthrope

Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 10, 2004, 03:16:27 AM
I'll try to get to it this week (meaning next couple days) and attach the updated converter.  The thing is, if you put this into the database:

'don\'t'

It will store the word "don't", without the slash.  You add the slash to make sure it knows not to end the ' you started.  What XMB is apparently doing is this:

'don\\\'t'

Which is adding the extra slash in the actual data *stored*.  This is, imho, strange behavior... but whatever.

As for SMF, to avoid some complication caused by using preg_replace with the e flag (glow, shadow, etc.), slashes are avoided in the message body.

Incidentally... while I'm looking at it... were there any other problems at all you encountered?  Edit: Nevermind, it was simpler to fix than I thought it might be, after double checking an XMB install.

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Misanthrope on December 10, 2004, 06:36:25 AM
Wow, that was fast...

Yeah, I expected the conversion to go better than it did because of what you described, that "don\'t" goes into the database as "don't". That's how I thought it would work, and that's why I figured the problem was caused by XMB rather than being a general PHP/MySQL issue.

I'm gonna give the new converter a try and let you know how it worked out.

-Misanthrope
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: _complex on December 10, 2004, 07:29:04 AM
In fact, my forum did this to me too.

I just always delete them, when i go and change my permissions.

but did find this problem a little werid... :|
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 15, 2004, 07:06:03 AM
I just did a conversion using the new converter, from XMB v1.9 Nexus (alpha 7), and the only backslashes left were in the forum and post titles.

On another note all the U2U messages were lost. Not the end of the world, but it would be nice to be able to convert them as well.
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 15, 2004, 01:37:39 PM
So everything is backslashed like that.  I see.

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 17, 2004, 02:41:22 PM
 ! XMB converter was adding slashes in bad/annoying places. (xmb_to_smf.php)

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: _complex on December 17, 2004, 10:09:48 PM
So unknown have the errors been fixed?.. or?
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Kirby on December 17, 2004, 10:37:08 PM
Thats what he means I guess :P
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 17, 2004, 10:49:33 PM
Legend:
--------------------------------------------------------------------------------
! Minor change or bugfix. (don't bother to log typos except between releases.)
* Change like above, but affects templates.
& Change that affects a language file. (make two if it affects templates too.)
+ Feature addition or improvement.
- Feature or option removal.
% Development flag or note, such as branching.


-[Unknown]
Title: Re: XMB-to-SMF converter instant messages not viewable
Post by: Onsite on December 20, 2004, 04:33:14 PM
Ok, the converter does import the u2u messages into the database, but they are not viewable.
Sending new ones work fine, but none of the converted ones can be seen.
Apparently they are not being placed into the smf_im_recipients table.

Any ideas on how to add this to the converter, or running a sql query to import them into it??
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 20, 2004, 05:42:19 PM
Is the im_recipients table totally empty?  You can check with phpMyAdmin... What is phpMyAdmin? (http://www.simplemachines.org/community/index.php?topic=21919.0)

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 20, 2004, 09:23:47 PM
Quote from: [Unknown] on December 20, 2004, 05:42:19 PM
Is the im_recipients table totally empty?  You can check with phpMyAdmin... What is phpMyAdmin? (http://www.simplemachines.org/community/index.php?topic=21919.0)

Yes, except for the couple of new test IMs it is totally empty.
That's how I figured out that was the problem.
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 22, 2004, 01:59:47 AM
Any luck on finding a fix for this script yet?
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 22, 2004, 02:57:17 AM
Can you tell me if this helps at all?  Any error messages at all?

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 22, 2004, 06:33:58 AM
I received no errors on the other versions but got a couple with this one...

Converting personal messages... successful.
Converting personal messages (step 2)...Unknown column 'pm.new' in 'field list'Column count doesn't match value count at row 1 successful.
and
Converting attachments...
Error: Could not copy Midwest_Skydiving_Challenge.pdf
successful.


And still nothing is populating the smf_im_recipients table.
All of the u2u meessages appear to have been imported into the smf_instant_messages table though.
There's also a slight problem with the "Last post" column data on the start page, but that will be quickly resolved with new posts.

Thanks for working on this...
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 22, 2004, 07:22:06 AM
Try this one.

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 22, 2004, 07:28:19 AM
Sweet...
That looks like it got the job done. All u2u's are there and viewable.
The last post data is still inaccurate, but that's a non-issue for my use.
I'll go through the rest of the forums later and see if anything is missing or wrong.

Thanks for the help.
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 22, 2004, 07:29:45 AM
Quote from: Onsite on December 22, 2004, 07:28:19 AM
The last post data is still inaccurate, but that's a non-issue for my use.

Darn, I tried to fix that one too.  How innacurate is it?  Are the posts it names at least in the right board?

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 22, 2004, 07:45:37 AM
It's actually way off...
It lists users who never even posted in those forums and dates from two years ago.

For example, SlipStream isn't even allowed to post in this forum and the last post was 4 days ago.

January 31, 2003, 10:25:52 pm
in N/A
by SlipStream

Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 22, 2004, 07:51:11 AM
Can you try changing this:

// Make the last topic correct.
$result = mysql_query("
SELECT fid
FROM {$from_prefix}forums");
while ($row = mysql_fetch_assoc($result))
{
$result2 = mysql_query("
SELECT tid
FROM {$from_prefix}threads
WHERE fid = $row[fid]
ORDER BY tid DESC
LIMIT 1");
list ($newTopic) = mysql_fetch_row($result2);
mysql_free_result($result2);

mysql_query("
UPDATE {$to_prefix}boards
SET ID_LAST_MSG = $newTopic
WHERE ID_BOARD = $row[fid]
LIMIT 1");
}
mysql_free_result($result);


To:
// Make the last topic correct.
$result = mysql_query("
SELECT fid, MAX(tid) AS tid
FROM {$from_prefix}threads
GROUP BY fid");echo mysql_error();
while ($row = mysql_fetch_assoc($result))
{
mysql_query("
UPDATE {$to_prefix}boards
SET ID_LAST_MSG = $row[tid]
WHERE ID_BOARD = $row[fid]
LIMIT 1");echo mysql_error();
}
mysql_free_result($result);


Any difference?

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 22, 2004, 05:56:33 PM
Nope, no difference...
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 23, 2004, 04:18:24 AM
Grrr.... I wish I had a big enough database to test this with.

I'll stop bothering you, since it's not a huge deal.  I'll have to look at it a bit later.

Thanks again,
-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 23, 2004, 01:29:05 PM
Hey no bother...
I'll keep my XMB database after I go live with SMF, so if you want to test the converter some more I'll be happy to run it for ya.
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 26, 2004, 03:51:12 AM
Can you try the attached?

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 26, 2004, 02:01:00 PM
That worked...
The Last Post column is accurate now.

I did find another bug, if you still want to work them out.
The BB code [align=center][/align] doesn't convert to
.
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 30, 2004, 11:12:18 AM
 ! The XMB converter now properly parses the [align] bbc tag. (xmb_to_smf.php)

(hopefully...)

Anything else?

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 30, 2004, 12:47:10 PM
Just ran the new converter and got this error:
Converting polls...
Notice: Undefined offset: 1 in /usr/home/www/htdocs/forum_smf/xmb_to_smf.php on line 853

And the last post column is wrong again.
I'll run the previous converter to see if it works later.

Thanks
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on December 30, 2004, 02:55:25 PM
Okay, how about this one?

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on December 30, 2004, 04:41:59 PM
Well no errors this time, and the latest posts column is correct, but I checked on some of the old polls and none of the votes or totals converted over.
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on January 27, 2005, 09:32:21 PM
Alrighty....
Here are some more noticed glitches.

Other than the lose of u2u messages it's easy to work around the other problems.
I only have one other account to switch over, so if an updated converter pops up soon I'll wait to see how it works and report back.

Title: Re: XMB-to-SMF converter leaves backslashes
Post by: [Unknown] on January 27, 2005, 09:50:55 PM
Hmm... u2u... strange.  Is it possible these were in the outbox at all?

Please try the attached.

-[Unknown]
Title: Re: XMB-to-SMF converter leaves backslashes
Post by: Onsite on January 29, 2005, 05:08:18 PM
Quote from: [Unknown] on January 27, 2005, 09:50:55 PM
Hmm... u2u... strange.  Is it possible these were in the outbox at all?

Yeah I'm not real sure what the issue is.
I see how SMF stores the messages in mysql and that XMB tags an separate id on both incoming and outgoing, but I can't seem to figure out which ones are not converting.
I went into XMB's database and deleted all the messages that where in the outbox, which seems to have fixed the problem.