FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Converters » phpBB2 to FUDforum converter
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: phpBB2 to FUDforum converter [message #166365 is a reply to message #166362] Fri, 25 November 2011 16:30 Go to previous messageGo to previous message
ShineOn is currently offline  ShineOn   United States
Messages: 53
Registered: July 2011
Karma:
Member
I tested this and it doesn't work. I still get the phpbb2 hex-format addresses.

I believe the problem may be that you're using is_numeric testing against the phpbb2 hex-valued IP address without prepending 0x to the field value. The phpbb2 ip format does not include the 0x prefix but simply the four hex-pairs.

Hex numbers don't return true to is_numeric unless they are in notation "0xff...ff" - without the 0x it evaluates as a string.

I think perhaps simply testing for length of 8 with no dots would suffice. Anything else wouldn't have to pass through the hex-to-decimal function.

I suggest this because 10.2.3.4 is a valid dotted-decimal IP address with length of 8.

You could test for length of 8 and if not 8 just pass the value, and test for a dot in the hex-to-decimal function, so you don't have to regex every record.

<edit> - I see that you are testing for strlen == 8 in the function, so I don't see the value of testing the ip_addr message field before sending it to the function... </edit>

<edit2>Frank, I commented out the test for is_numeric for message ip_addr and changed the insert routine to match the pm ip_addr line, using the decode_ip function, and it converted the IP's fine.

/*	if (is_numeric($message['ip_addr'])) {
		$message['ip_addr'] = decode_ip($message['ip_addr']);
	}
*/
	q('INSERT INTO '. $GLOBALS['DBHOST_TBL_PREFIX'] .'msg
		(id, thread_id, poster_id, post_stamp, update_stamp, updated_by, subject,
		 ip_addr, foff, length, file_id, msg_opt, apr
	) VALUES (
		'. $message['id'] .',
		'. (int)$message['thread_id'] .',
		'. (int)$message['poster_id'] .',
		'. (int)$message['post_stamp'] .',
		'. (int)$message['update_stamp'] .',
		'. (int)$message['updated_by'] .',
		'. _esc($message['subject']) .',
		'. _esc(decode_ip($message['ip_addr'])) .',
		'. $off .',
		'. $len .',
		'. $file_id .',
		'. (int)$message['msg_opt'] .',
		1)'
	);
}

</edit2>

[Updated on: Fri, 25 November 2011 19:48]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Converting phpBB2 w/mail2forum posts
Next Topic: Xenforo converter
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu May 09 20:48:07 GMT 2024

Total time taken to generate the page: 0.07802 seconds