public function act_add_comment()
{
Utils::check_request_method(array('POST'));
// We need to get the post anyway to redirect back to the post page.
$post = Post::get(array('id' => $this->handler_vars['id']));
if (!$post) {
// trying to comment on a non-existent post? Weirdo.
header('HTTP/1.1 403 Forbidden', true, 403);
die;
}
// Allow theme action hooks to work
Themes::create();
$form = $post->comment_form();
$form->get();
// Disallow non-FormUI comments
if (!$form->submitted) {
// Trying to submit a non-FormUI comment
header('HTTP/1.1 403 Forbidden', true, 403);
die;
} else {
// To be eventually incorporated more fully into FormUI.
Plugins::act('comment_form_submit', $form);
if ($form->success) {
$this->add_comment($post->id, $form->cf_commenter->value, $form->cf_email->value, $form->cf_url->value, $form->cf_content->value, $form->get_values());
} else {
Session::error(_t('There was a problem submitting your comment.'));
$form->bounce();
//Utils::redirect( $post->permalink . '#respond' );
}
}
}