Need Help Recode a PHP script

function handle_bbcode_url($text, $link) 
    { 
        $rightlink = trim($link); 
        if (empty($rightlink)) 
        { 
            // no option -- use param 
            $rightlink = trim($text); 
        } 
        $rightlink = str_replace(array('`', '"', "'", '['), array('`', '"', ''', '['), $this->strip_smilies($rightlink)); 

        if (!preg_match('#^[a-z0-9]+(?<!about|javascript|vbscript):#si', $rightlink)) 
        { 
            $rightlink = "http://$rightlink"; 
        } 

        if (!trim($link) OR $text == $rightlink) 
        { 
            $tmp = unhtmlspecialchars($rightlink); 
            if (vbstrlen($tmp) > 55 AND $this->is_wysiwyg() == false) 
            { 
                $text = htmlspecialchars_uni(substr($tmp, 0, 36) . '...' . substr($tmp, -14)); 
            } 
        } 

        // remove double spaces -- fixes issues with wordwrap 
        $rightlink = str_replace('  ', '', $rightlink); 

        // standard URL hyperlink 
        return "<a href=\"http://www.hongfire.com/redirect.php?url=$rightlink\" target=\"_blank\">$text</a>"; 
    } 

that is the script, it is a redirect script for a forum that i am on.

basically this is what the script does, if there is a link in a post, the redirect script will take action and add action and add http://www.hongfire.com/redirect.php?url= to the end of it, which is good

can someone add more code to it for me, so that if an internal link that is also from www.hongfire.com, the script will detect it and NOT add the extra http://www.hongfire.com/redirect.php?url=

i know the code has to go something like this

if (strncmp("http://www.hongfire.com/", $url, 24) == 0) {
  //Compare hongfire with the first 24 characters in the url.
  //If the statement is true, then it's an internal link.
  //The url is returned untouched.
  return $url;
 }