if ($smiley) {
$smiley = str_replace( '&', '&', $smiley );
$smiley = str_replace( '<', '<', $smiley );
$smiley = str_replace( '>', '>', $smiley );
@eval("\$string = $code;");
$string = preg_quote($string,'/');
$smiley = preg_quote($smiley,'/');
for($i = 0; $i< 2; $i++) {
$body = preg_replace("/( |\n|^|\r\])$smiley( |$|\n|\r|\[)/i","\\1<img src=\"{$config['BASE_URL']}/images/graemlins/default/$image\" alt=\"$smiley\" title=\"$string\" height=\"$height\" width=\"$width\" />\\2",$body);
}
$body = preg_replace("/(\[|:)$string(\]|:)/i","<img src=\"{$config['BASE_URL']}/images/graemlins/default/$image\" alt=\"$smiley\" title=\"$string\" height=\"$height\" width=\"$width\" />",$body);
} else {
@eval("\$string = $code;");
$string = preg_quote($string,'/');
$body = preg_replace("/(\[|:)$string(\]|:)/i","<img src=\"{$config['BASE_URL']}/images/graemlins/default/$image\" alt=\"\" title=\"$string\" height=\"$height\" width=\"$width\" />",$body);
}