Hola.
Escribe esto en tu archivo finish.php y sin utilizar el lib.php.
He eliminado la variable global ya que soy contrario a utilizarlas.
Utiliza los links basándote en $CFG->wwwroot
$COURSE es en mayúsculas.
Espero haberte aclarado algo.
Un saludo.
<?php
require_once("../../config.php");
global $CFG,$COURSE;
$dirblock = $CFG->wwwroot.'/mod/noticeboard';
$notice_text = optional_param('text', '', PARAM_RAW);
$courseid = optional_param('courseid', 0, PARAM_INT);
$usehtmleditor=can_use_html_editor();
echo '<form action="finish.php" method="post">';
print_textarea($usehtmleditor, 20, 50, 680, 400, 'text', $notice_text);//, 'displaycomment', $display->comment, $this->course->id);
print_single_button($dirblock."/finish.php", array('text'),'GUARDAR');
echo '<input type="hidden" name="courseid" value='.$COURSE->id.' />';
echo '</form>';
if ($usehtmleditor) {
use_html_editor('');
}
if ($notice_text != '')
print($notice_text);
if ($courseid > 0)
echo '<br />Su curso tiene la id: '.$courseid;
?>