okay.. I spent a little time reversing how phpBB decodes the "standard" tags... add your custom tags as needed..
Code: Select all
<?php
//ini_set('display_errors','1');
//error_reporting(E_ALL);
mysql_connect('xxx','xxx','xxx') or die(mysql_error());
mysql_select_db('xxx') or die(mysql_error());
$query = mysql_query('SELECT * FROM phpbb_posts_text p') or die(mysql_error());
header('Content-type: text/plain');
while($row = mysql_fetch_assoc($query))
{
$uid =& $row['bbcode_uid'];
$text =& $row['post_text'];
$text = html_entity_decode($text,ENT_QUOTES);
$tags = array(
'#\[/?s:'.$uid.'\]#',
'#\[/?u:'.$uid.'\]#',
'#\[/?i:'.$uid.'\]#',
'#\[/?b:'.$uid.'\]#',
'#\[/?quote:'.$uid.'\]#',
'#\[quote:'.$uid.'=".*?"\]#s',
'#\[list:'.$uid.'\]#',
'#\[\*:'.$uid.'\]#',
'#\[/list:[uo]:'.$uid.'\]#',
'#\[list=[aAiI1]:'.$uid.'\]#',
'#\[color=(\#[0-9A-F]{6}|[a-z]+):'.$uid.'\]#',
'#\[/color:'.$uid.'\]#',
'#\[size=[1-2]?[0-9]:'.$uid.'\]#',
'#\[/size:'.$uid.'\]#',
'#\[/?img:'.$uid.'\]#',
'#\[/?url[^]]*?\]#',
'#\[/?email]#',
'#\[/?code:1:'.$uid.']#',
);
$text = preg_replace($tags, '', $text);
$entities_search = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}');
$entities_replace = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}');
$text = str_replace($entities_search, $entities_replace, $text);
echo $text."\n\n\n";
}
?>