function sed_bbcode($text) { global $L, $skin, $sys, $cfg, $sed_groups; $text = sed_bbcode_autourls($text); $text = " ".$text; $bbcodes = array( '$' => '$', '[b]' => '', '[/b]' => '', '[p]' => '

', '[/p]' => '

', '[u]' => '', '[/u]' => '', '[i]' => '', '[/i]' => '', '[hr]' => '
', '[_]' => ' ', '[__]' => '   ', '[list]' => '', '[red]' => '', '[/red]' => '', '[white]' => '', '[/white]' => '', '[green]' => '', '[/green]' => '', '[blue]' => '', '[/blue]' => '', '[orange]' => '', '[/orange]' => '', '[yellow]' => '', '[/yellow]' => '', '[purple]' => '', '[/purple]' => '', '[black]' => '', '[/black]' => '', '[grey]' => '', '[/grey]' => '', '[pink]' => '', '[/pink]' => '', '[sky]' => '', '[/sky]' => '', '[sea]' => '', '[/sea]' => '', '[quote]' => '
'.$L['bbcodes_quote'].'
', '[/quote]' => '
', '[br]' => '
', '[more]' => '' ); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = str_replace($bbcode,$bbcodehtml,$text); } $bbcodes = array( '\\[img\\]([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\[/img\\]' => '', '\\[img=([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\]([^\\[]*)\.(jpg|jpeg|gif|png)\\[/img\\]' => '', '\\[thumb=([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\]([^\\[]*)\.(jpg|jpeg|gif|png)\\[/thumb\\]' => ' ', '\\[pfs]([^\\[]*)\\[/pfs\\]' => ' \\1', '\\[t=([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\]([^\\[]*)\.(jpg|jpeg|gif|png)\\[/t\\]' => '', '\\[url=([^\\\'\;([]*)\\]([^\\[]*)\\[/url\\]' => '\\2', '\\[url\\]([^\\([]*)\\[/url\\]' => '\\1', '\\[color=([0-9A-F]{6})\\]([^\\[]*)\\[/color\\]' => '\\2', '\\[style=([1-9]{1})\\]([^\\[]*)\\[/style\\]' => '\\2', '\\[email=([._A-z0-9-]+@[A-z0-9-]+\.[.a-z]+)\\]([^\\[]*)\\[/email\\]' => '\\2', '\\[email\\]([._A-z0-9-]+@[A-z0-9-]+\.[.a-z]+)\\[/email\\]' => '\\1', '\\[user=([0-9]+)\\]([A-z0-9_\. -]+)\\[/user\\]' => '\\2', '\\[page=([0-9]+)\\]([^\\[]*)\\[/page\\]' => '\\2', '\\[page\\]([0-9]+)\\[/page\\]' => ''.$L['Page'].' #\\1', '\\[group=([0-9]+)\\]([^\\([]*)\\[/group\\]' => '\\2', '\\[topic\\]([0-9]+)\\[/topic\\]' => ''.$L['Topic'].' #\\1', '\\[post\\]([0-9]+)\\[/post\\]' => ''.$L['Post'].' #\\1', '\\[pm\\]([0-9]+)\\[/pm\\]' => '', '\\[f\\]([a-z][a-z])\\[/f\\]' => '', '\\[ac=([^\\[]*)\\]([^\\[]*)\\[/ac\\]' => '\\2', '\\[del\\]([^\\[]*)\\[/del\\]' => '\\1', '\\[quote=([^\\[]*)\\]' => '
\\1
', '\\[spoiler\\]' => '
', '\\[spoiler=([A-z0-9_\. -]+)\\]' => '
', '\\[/spoiler\\]' => '
'); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode,$bbcodehtml,$text); } if ($cfg['parser_vid']) { $bbcodes = array( '\\[youtube=([^\\[]*)\\]' => ' ', '\\[googlevideo=([^\\[]*)\\]' => ' ', '\\[metacafe=([^\\[]*)\\]' => ''); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode,$bbcodehtml,$text); } } $bbcodes = array( '\\[colleft\\]([^\\[]*)\\[/colleft\\]' => '
\\1
', '\\[colright\\]([^\\[]*)\\[/colright\\]' => '
\\1
', '\\[center\\]([^\\[]*)\\[/center\\]' => '
\\1
', '\\[right\\]([^\\[]*)\\[/right\\]' => '
\\1
', '\\[left\\]([^\\[]*)\\[/left\\]' => '
\\1
', '\\[c1\\:([^\\[]*)\\]([^\\[]*)\\[c2\\:([^\\[]*)\\]([^\\[]*)\\[c3\\]' => '
\\2\\4
' ); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode,$bbcodehtml,$text); } return(substr($text,1)); } /* ------------------ */ function sed_bbcode_autourls($text) { $text = ' '.$text; $text = preg_replace("#([\n ])([a-z0-9]+?)://([^\t \n\r]+)#i", "\\1[url]\\2://\\3[/url]", $text); $text = preg_replace("#([\n ])([a-z0-9-_.]+?@[A-z0-9-]+\.[^,\t \n\r]+)#i", "\\1[email]\\2[/email]", $text); return(substr($text,1)); } /* ------------------ */ function sed_bbcode_urls($text) { global $cfg; $bbcodes = array( '\\[img\\]([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\[/img\\]' => '\\1.\\2', '\\[thumb=([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\]([^\\[]*)\.(jpg|jpeg|gif|png)\\[/thumb\\]' => '\\1.\\2', '\\[pfs]([^\\[]*)\\[/pfs\\]' => $cfg['pfs_dir'].'\\1', ); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode,$bbcodehtml,$text); } return($text); } /* ------------------ */