diff -r 17721bad21df -r 6d32d80b2192 index.php --- a/index.php Sat May 30 14:46:57 2009 -0400 +++ b/index.php Sun May 31 23:26:05 2009 -0400 @@ -82,7 +82,7 @@ $page_timestamp = $page->revision_time; break; case 'comments': - $template->header(); + $output->header(); require_once(ENANO_ROOT.'/includes/pageutils.php'); $sub = ( isset ($_GET['sub']) ) ? $_GET['sub'] : false; switch($sub) @@ -100,7 +100,29 @@ ) { echo 'Invalid request'; break; } $cid = ( isset($_POST['captcha_id']) ) ? $_POST['captcha_id'] : false; $cin = ( isset($_POST['captcha_input']) ) ? $_POST['captcha_input'] : false; - PageUtils::addcomment($paths->page_id, $paths->namespace, $_POST['name'], $_POST['subj'], $_POST['text'], $cin, $cid); // All filtering, etc. is handled inside this method + + require_once('includes/comment.php'); + $comments = new Comments($paths->page_id, $paths->namespace); + + $submission = array( + 'mode' => 'submit', + 'captcha_id' => $cid, + 'captcha_code' => $cin, + 'name' => $_POST['name'], + 'subj' => $_POST['subj'], + 'text' => $_POST['text'], + ); + + $result = $comments->process_json($submission); + if ( $result['mode'] == 'error' ) + { + echo '