<?php
// Maak de UBBC codes aan
// Enters
$bericht = str_replace ("[br]","\n",$bericht);
$bericht = str_replace ("\n","<br>",$bericht);

// Code
$bericht = str_replace ("[code]","<b>Code:</b><br /><table bgcolor=\"#000000\" cellspacing=\"1\" width=\"90%\"><tr><td><table cellpadding=2 cellspacing=\"0\" bgcolor=\"#FFFFFF\" width=\"100%\"><tr><td><font face=Courier size=\"1\" color=\"#000000\">", $bericht);
$bericht = str_replace ("[/code]", "</font></td></tr></table></td></tr></table>", $bericht);

// Vet, schuin, etc
$bericht = preg_replace("/\[b\](.+?)\[\/b\]/is",'<strong>\1</strong>', $bericht);
$bericht = preg_replace("/\[i\](.+?)\[\/i\]/is",'<em>\1</em>', $bericht);
$bericht = preg_replace("/\[u\](.+?)\[\/u\]/is",'<u>\1</u>', $bericht);
$bericht = preg_replace("/\[s\](.+?)\[\/s\]/is",'<s>\1</s>', $bericht);

// Marquee
$bericht = str_replace ("[move]", "<div align=\"center\"><marquee width=\"90%\">", $bericht);
$bericht = str_replace ("[/move]", "</marquee></div>", $bericht);

// Flash
$bericht = eregi_replace("\\[flash=([^\\[]*)\\,([^\\[]*)\\]([^\\[]*)\\[/flash\\]","<object classid=\"clsid: D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\\1 height=\\2><param name=movie value=\\3><param name=play value=true><param name=loop value=true><param name=quality value=high><embed src=\\3 width=\\1 height=\\2 play=true loop=true quality=high></embed></object>",$bericht);

// Glow & Shadow
$bericht = preg_replace ("/\[glow](.*)\[\/glow\]/","<table border='0' style='FILTER: glow(color=#00FF00, strength=2)'><tr><td>\\1</td></tr></table>",$bericht);
$bericht = preg_replace ("/\[shadow](.*)\[\/shadow\]/", "<table style='FILTER: shadow(color=#808080, direction=5, strength=4)' border='0'><tr><td>\\1</td></tr></table>",$bericht);
$bericht = preg_replace ("/\[glow=(.*)\\](.*)\[\/glow\]/","<table border='0' style='FILTER: glow(color=\\1, strength=2)'><tr><td>\\2</td></tr></table>",$bericht);
$bericht = preg_replace ("/\[shadow=(.*)\\](.*)\[\/shadow\]/", "<table style='FILTER: shadow(color=\\1, direction=5, stregth=2)' border='0'><tr><td>\\2</td></tr></table>",$bericht);

// Color, font & size
$bericht = preg_replace ("#\[color=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]#si", "<font color=\"\\1\">\\2</font>", $bericht);
$bericht = preg_replace ("/\[font=(.*)\](.*)\[\/font\]/", "<font face=\"$1\">$2</font>", $bericht);
$bericht = preg_replace ("/\[size=(.*)\](.*)\[\/size\]/", "<font size=\"$1\">$2</font>", $bericht);

// Plaatje toevoegen
$bericht = preg_replace("/\[img\](.*?)\[\/img\]/si", "<img src=\"\\1\" border=\"0\">",$bericht);

// Diversen
$bericht = str_replace ("[tt]", "<tt>", $bericht);
$bericht = str_replace ("[/tt]", "</tt>", $bericht);
$bericht = str_replace ("[left]", "<div align=left>", $bericht);
$bericht = str_replace ("[/left]", "</div>", $bericht);
$bericht = str_replace ("[center]", "<div align=\"center\">", $bericht);
$bericht = str_replace ("[/center]", "</div>", $bericht);
$bericht = str_replace ("[right]", "<div align=\"right\">", $bericht);
$bericht = str_replace ("[/right]", "</div>", $bericht);
$bericht = str_replace ("[sub]", "<sub>", $bericht);
$bericht = str_replace ("[/sub]", "</sub>", $bericht);
$bericht = str_replace ("[sup]", "<sup>", $bericht);
$bericht = str_replace ("[/sup]", "</sup>", $bericht);
$bericht = str_replace ("[fixed]", "<font face=\"Courier New\">", $bericht);
$bericht = str_replace ("[/fixed]", "</font>", $bericht);
$bericht = str_replace ("[[","{{",$bericht);
$bericht = str_replace ("]]","}}",$bericht);
$bericht = str_replace ("|","&#124;",$bericht);
$bericht = str_replace ("[pre]","<pre>",$bericht);
$bericht = str_replace ("[/pre]","</pre>",$bericht);
$bericht = str_replace ("{{","[",$bericht);
$bericht = str_replace ("}}","]",$bericht);

// Horizontale lijn
$bericht = str_replace ("[hr]","<hr>",$bericht);

// URL's
$bericht = preg_replace ("#\[url\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#", "<a href=\"\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[url\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/url\]#", "<a href=\"http://\\1\" target=\"_blank\">\\1</a>", $bericht);
$bericht = preg_replace ("#\[url=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#", "<a href=\"\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[url=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/url\]#", "<a href=\"http://\\1\" target=\"_blank\">\\2</a>", $bericht);

// UseNet & FTP
$bericht = preg_replace ("#\[news\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/news\]#", "<a href=\"news:\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[news\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/news\]#", "<a href=\"news:\\1\" target=\"_blank\">\\1</a>", $bericht);
$bericht = preg_replace ("#\[news=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/news\]#", "<a href=\"news:\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[news=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/news\]#", "<a href=\"news:\\1\" target=\"_blank\">\\2</a>", $bericht);

$bericht = preg_replace ("#\[ftp\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/ftp\]#", "<a href=\"ftp://\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[ftp\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/ftp\]#", "<a href=\"ftp://\\1\" target=\"_blank\">\\1</a>", $bericht);
$bericht = preg_replace ("#\[ftp=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/ftp\]#", "<a href=\"ftp://\\1\\2\" target=\"_blank\">\\2</a>", $bericht);
$bericht = preg_replace ("#\[ftp=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/ftp\]#", "<a href=\"ftp://\\1\" target=\"_blank\">\\2</a>", $bericht);

// E-mails
$bericht = preg_replace ("#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#", "<a href=\"mailto:\\1\">\\1</a>", $bericht);
$bericht = preg_replace ("#\[email=([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\](.*?)\[/email\]#", "<a href=\"mailto:\\1\">\\3</a>", $bericht);

// Quotes
$bericht = preg_replace ("/\[quote\](.*)\[\/quote\]/","<p><i>Quote:</i><table bgcolor=#000000 cellspacing=\"1\" width=\"75%\" align=\"left\"><tr><td width=\"100%\"><table cellpadding=\"2\" cellspacing=\"0\" width=\"100%\" bgcolor=\"#FFFFFF\"><tr><td width=\"100%\"><font face=\"Verdana\" size=\"1\" color=\"#000000\">$1</font></td></tr></table></td></tr></table></p>",$bericht);

// Lijst
$bericht = str_replace ("[list]","<ul>",$bericht);
$bericht = str_replace ("[*]","<li>",$bericht);
$bericht = str_replace ("[/list]","</li></ul>",$bericht);

// Tabel
$bericht = str_replace ("[table]","<table class=\"main\">",$bericht);
$bericht = str_replace ("[/table]","</table>",$bericht);
$bericht = str_replace ("[tr]","<tr>",$bericht);
$bericht = str_replace ("[/tr]","</tr>",$bericht);
$bericht = str_replace ("[td]","<td>",$bericht);
$bericht = str_replace ("[/td]","</td>",$bericht);

// Smiley's
// Roll Eyes
$bericht = str_replace ("::)","<img src=\"img/ubbc/rolleyes.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[rolleyes]","<img src=\"img/ubbc/rolleyes.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("::-)","<img src=\"img/ubbc/rolleyes.gif\" border=\"0\">",$bericht);
// Smile
$bericht = str_replace (":)","<img src=\"img/ubbc/smiley.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[smile]","<img src=\"img/ubbc/smiley.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":-)","<img src=\"img/ubbc/smiley.gif\" border=\"0\">",$bericht);
// Wink
$bericht = str_replace (";)","<img src=\"img/ubbc/wink.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[wink]","<img src=\"img/ubbc/wink.gif\" border=\"0\">",$bericht);
$bericht = str_replace (";-)","<img src=\"img/ubbc/wink.gif\" border=\"0\">",$bericht);
// Cheesy
$bericht = str_replace (":D","<img src=\"img/ubbc/cheesy.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[cheesy]","<img src=\"img/ubbc/cheesy.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":-D","<img src=\"img/ubbc/cheesy.gif\" border=\"0\">",$bericht);
// Grin
$bericht = str_replace (";D","<img src=\"img/ubbc/grin.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[grin]","<img src=\"img/ubbc/grin.gif\" border=\"0\">",$bericht);
$bericht = str_replace (";-D","<img src=\"img/ubbc/grin.gif\" border=\"0\">",$bericht);
// Angry
$bericht = str_replace ("a:(","<img src=\"img/ubbc/angry.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[angry]","<img src=\"img/ubbc/angry.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("a:-(","<img src=\"img/ubbc/angry.gif\" border=\"0\">",$bericht);
// Sad
$bericht = str_replace (":(","<img src=\"img/ubbc/sad.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[sad]","<img src=\"img/ubbc/sad.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":-(","<img src=\"img/ubbc/sad.gif\" border=\"0\">",$bericht);
// Shocked
$bericht = str_replace (":o","<img src=\"img/ubbc/shocked.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[shocked]","<img src=\"img/ubbc/shocked.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":-o","<img src=\"img/ubbc/shocked.gif\" border=\"0\">",$bericht);
// Cool
$bericht = str_replace ("8)","<img src=\"img/ubbc/cool.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[cool]","<img src=\"images/images//cool.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("8-)","<img src=\"img/ubbc/cool.gif\" border=\"0\">",$bericht);
// Huh???
$bericht = str_replace ("???","<img src=\"img/ubbc/huh.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[huh]","<img src=\"img/ubbc/huh.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":?","<img src=\"img/ubbc/huh.gif\" border=\"0\">",$bericht);
// Tongue
$bericht = str_replace (":P","<img src=\"img/ubbc/tongue.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[tongue]","<img src=\"img/ubbc/tongue.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":-P","<img src=\"img/ubbc/tongue.gif\" border=\"0\">",$bericht);
// Embarresed
$bericht = str_replace (":[","<img src=\"img/ubbc/embarassed.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[embarassed]","<img src=\"img/ubbc/embarassed.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":-[","<img src=\"img/ubbc/embarassed.gif\" border=\"0\">",$bericht);
// Lipsrsealed
$bericht = str_replace (":-X","<img src=\"img/ubbc/lipsrsealed.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[lipsrsealed]","<img src=\"img/ubbc/lipsrsealed.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":X","<img src=\"img/ubbc/lipsrsealed.gif\" border=\"0\">",$bericht);
// Undecided
$bericht = str_replace (":-/","<img src=\"img/ubbc/undecided.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[undecided]","<img src=\"img/ubbc/undecided.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":-s","<img src=\"img/ubbc/undecided.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":s","<img src=\"img/ubbc/undecided.gif\" border=\"0\">",$bericht);
// Kiss
$bericht = str_replace (":*","<img src=\"img/ubbc/kiss.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[kiss]","<img src=\"img/ubbc/kiss.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":-*","<img src=\"img/ubbc/kiss.gif\" border=\"0\">",$bericht);
// Cry
$bericht = str_replace (":\'(","<img src=\"img/ubbc/cry.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[cry]","<img src=\"img/ubbc/cry.gif\" border=\"0\">",$bericht);
$bericht = str_replace (":\'-(","<img src=\"img/ubbc/cry.gif\" border=\"0\">",$bericht);
// Love
$bericht = str_replace ("(L)","<img src=\"img/ubbc/love.gif\" border=\"0\">",$bericht);
$bericht = str_replace ("[love]","<img src=\"img/ubbc/love.gif\" border=\"0\">",$bericht);
?>
