<?php

	function ubb($text){
        $text = htmlspecialchars($text);
        $text = nl2br($text);

	$text = str_replace(":grin:","<img src=images/smiles/icon_biggrin.gif>", $text);
	$text = str_replace(":S","<img src=images/smiles/icon_confused.gif>", $text);
	$text = str_replace("8)","<img src=images/smiles/icon_cool.gif>", $text);
	$text = str_replace(":.(","<img src=images/smiles/icon_cry.gif>", $text);
	$text = str_replace(":eek:","<img src=images/smiles/icon_eek.gif>", $text);
	$text = str_replace(":evil:","<img src=images/smiles/icon_evil.gif>", $text);
	$text = str_replace(":lol:","<img src=images/smiles/icon_lol.gif>", $text);
	$text = str_replace(":@","<img src=images/smiles/icon_mad.gif>", $text);
	$text = str_replace(":D","<img src=images/smiles/icon_mrgreen.gif>", $text);
	$text = str_replace(":|","<img src=images/smiles/icon_neutral.gif>", $text);
	$text = str_replace(":P","<img src=images/smiles/icon_razz.gif>", $text);
	$text = str_replace(":$","<img src=images/smiles/icon_redface.gif>", $text);
	$text = str_replace(":roll:","<img src=images/smiles/icon_rolleyes.gif>", $text);
	$text = str_replace(":(","<img src=images/smiles/icon_sad.gif>", $text);
	$text = str_replace(":)","<img src=images/smiles/icon_smile.gif>", $text);
	$text = str_replace(":o","<img src=images/smiles/icon_surprised.gif>", $text);
	$text = str_replace(":twisted:","<img src=images/smiles/icon_twisted.gif>", $text);
	$text = str_replace(";)","<img src=images/smiles/icon_wink.gif>", $text);
	$text = str_replace(":{","<img src=images/smiles/icon_dracula.gif>", $text);
	$text = str_replace(":sick:","<img src=images/smiles/icon_sick.gif>", $text);
	$text = str_replace(":uhm:","<img src=images/smiles/icon_uhm.gif>", $text);
	$text = str_replace(":clap:","<img src=images/smiles/icon_clap.gif>", $text);
	$text = str_replace(":dance:","<img src=images/smiles/icon_dance.gif>", $text);
	$text = str_replace(":stop:","<img src=images/smiles/icon_stop.gif>", $text);
	$text = str_replace(":doh:","<img src=images/smiles/icon_doh.gif>", $text);
	$text = str_replace(":nono:","<img src=images/smiles/icon_nono.gif>", $text);
	$text = str_replace(":think:","<img src=images/smiles/icon_think.gif>", $text);
	$text = str_replace(":ssht:","<img src=images/smiles/icon_ssht.gif>", $text);
	$text = str_replace(":nope:","<img src=images/smiles/icon_nope.gif>", $text);
	$text = str_replace(":salut:","<img src=images/smiles/icon_salut.gif>", $text);
	$text = str_replace(":wall:","<img src=images/smiles/icon_wall.gif>", $text);

	$text = str_replace("cw","**", $text);
	$text = str_replace("CW","**", $text);
	$text = str_replace("ultimatecrime","************", $text);
	$text = str_replace("ultimatecrime","************", $text);
	$text = str_replace("ultimatecrime","************", $text);
	$text = str_replace("http://www.ultimatecrime.nl","**************************", $text);
	$text = str_replace("http://www.ultimatecrime.nl/","***************************", $text);
	$text = str_replace("www.ultimatecrime.nl","*******************", $text);
	$text = str_replace("ultimatecrime.nl","***************", $text);
	$text = str_replace("KANKER","*****", $text);
	$text = str_replace("kanker","*****", $text);
	$text = str_replace("Kanker","*****", $text);
	$text = str_replace("gay","***", $text);

        $text = preg_replace("#\[center\](.*?)\[/center\]#si","<center>\\1</center>", $text);
        $text = preg_replace("#\[right\](.*?)\[/right\]#si","<p align=right>\\1</p>", $text);
        $text = preg_replace("#\[b\](.*?)\[/b\]#si","<b>\\1</b>", $text);
        $text = preg_replace("#\[u\](.*?)\[/u\]#si","<u>\\1</u>", $text);
        $text = preg_replace("#\[i\](.*?)\[/i\]#si","<i>\\1</i>", $text);
        $text = preg_replace("#\[left\](.*?)\[/left\]#si","<left>\\1</left>", $text);
        $text = preg_replace("#\[center\](.*?)\[/center\]#si","<center>\\1</center>", $text);
        $text = preg_replace("#\[right\](.*?)\[/right\]#si","<p align=right>\\1</p>", $text);
        $text = preg_replace("#\[url\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\1</a>", $text);
        $text = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si","<a href=\\1 target=_blank>\\2</a>", $text);
        $text = preg_replace("#\[img\](.*?)\[/img\]#si","<img src=\\1>", $text);
        $text = preg_replace("#\[color=(.*?)\](.*?)\[/color\]#si","<font color=\\1>\\2</font>", $text);
        $text = preg_replace("#\[move\](.*?)\[/move\]#si","<marquee>\\1</marquee>", $text);
        $text = preg_replace("#\[edit\](.*?)\[/edit\]#si","<font color=orange><b>Edit</b></font>:<i> \\1</i><br>", $text);

	return $text;
	}

?>
