sub ubb_code
{

# Guestwho UBB code filter. Modified version adapted from original UBB by Infopop.

# Get the data to replace UBB code in:
my ($post) = shift;

# If UBB code is enabled, we replace the UBB code tags with real HTML content.
# This can be customised to suit your personal preferences if you wish.

if ($ubbenable){
 $post =~ s! \[URL\]   \s*? (http://\S+?) \s*? 		  \[/URL\] ! <A HREF="$1" TARGET=_blank>$1</A>         !isgx;
 $post =~ s! \[URL\]   \s*? 	(\S+?) 	  \s*?        \[/URL\] ! <A HREF="http://$1" TARGET=_blank>$1</A>  !isgx;
 $post =~ s! \[EMAIL\] \s*?	 (\S+\@\S+?)  \s*? 		\[/EMAIL\] ! <A HREF="mailto:$1">$1</A>                !isgx;
 $post =~ s! \[IMG\]   \s*? 	(\S+?) 	  \s*?        \[/IMG\] ! <IMG SRC="$1">                            !isgx;
 $post =~ s! \[QUOTE\]			(.+?)     	    	\[/QUOTE\] ! <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>$1<HR></BLOCKQUOTE>!isgx;
 $post =~ s! \[i\]				(.+?)           		\[/i\] ! <i>$1</i>                                 !isgx;
 $post =~ s! \[b\]    			(.+?)          			\[/b\] ! <b>$1</b>                                 !isgx;
 $post =~ s! \[u\]    			(.+?)          			\[/u\] ! <u>$1</u>                                 !isgx;
}

# Now we return the data with the UBB code replaced:
return $post;
}
1;