try changing all the places the otuput is parsed to this;
Code:
# parse the output for wiki markup
global $wgTitle;
global $wgUser;
$parser = new Parser();
$parser->startExternalParse($wgTitle, ParserOptions::newFromUser( $wgUser ), OT_HTML);
$output = $parser->parse( $output, $wgTitle, ParserOptions::newFromUser( $wgUser ), true );
return $output->getText();
Not tested on 1.5.x, but works on 1.4.12
-Ross