Log in

View Full Version : URL problem after import


JayEss
09-29-2007, 11:09 PM
Here is an example of what I need to clean up after a phpbb3 import (and will do this using the cleaner.php)

[url=http://imageshack.us:1693e]http://img241.imageshack.us/img241/3988/forum005001xn5.jpg[/url:1693e]

As you can see, the closing URL tags have numbers inserted next to them. To further complicate the issue, the numbers are never the same for each URL. So here's another example:

[url=http://imageshack.us:2a6cc]http://img483.imageshack.us/img483/6328/dscn1950cj1.jpg[/url:2a6cc]

I was told to put the following in the 'posts' section of cleaner.php:

$text = preg_replace('/\[url=(.+):\w+\]/', '[url=$1]', $text);
$text = preg_replace('/\[/url:\w+\]/', '[url=$1]', $text);

The above syntax actually blanks out all my posts after I run the script. I've done this twice now with same results.

Can anyone confirm if that is supposed to be the right syntax that I am supposed to be using?

Thanks in advance.

Dismounted
09-30-2007, 06:49 AM
$find = array(
'/\/i',
'/\[/url:(.*?)]/i'
);
$replace = array(
"[url=$1]",
' ((.+?):(.*?))'
);

$text = preg_replace($find, $replace, $text);

JayEss
10-04-2007, 01:21 AM
Thank you! It didn't work but vbulletin support ended up solving it. :) Sorry for late reply.