diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-29 19:37:19 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-29 19:37:19 +0000 |
commit | 95f1440ef22dcfec43f19909292b2c357ceab5aa (patch) | |
tree | 2f702c293bdf0c5622992cc6dd263db39853f342 /modules/comment/controllers/comments.php | |
parent | 3c0be5156bd1f429e45f3eba4d97ea02217e55ee (diff) |
Changes to the comment module to support spam filtering. Basically added two columns to the comment table. The url of the author's web site(default null) and a flag to indicate that the comment is visible (default true).
The comment block has changed to only display comments that are visible.
And there is code added to call the spam_filter helper if the spam_filter module is installed.
Diffstat (limited to 'modules/comment/controllers/comments.php')
-rw-r--r-- | modules/comment/controllers/comments.php | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php index e6ade267..293c456d 100644 --- a/modules/comment/controllers/comments.php +++ b/modules/comment/controllers/comments.php @@ -61,18 +61,15 @@ class Comments_Controller extends REST_Controller { $form = comment::get_add_form($item); if ($form->validate()) { - $comment->author = $this->input->post("author"); - $comment->email = $this->input->post("email"); - $comment->text = $this->input->post("text"); - $comment->created = time(); - $comment->item_id = $this->input->post("item_id"); - $comment->save(); - - module::event("comment_created", $comment); + $comment = comment::create($this->input->post("author"), + $this->input->post("email"), + $this->input->post("text"), + $this->input->post("item_id"), + $this->input->post("url")); print json_encode( array("result" => "success", - "resource" => url::site("comments/{$comment->id}"), + "resource" => $comment->visible ? url::site("comments/{$comment->id}") : NULL, "form" => comment::get_add_form($item)->__toString())); } else { print json_encode( @@ -107,12 +104,11 @@ class Comments_Controller extends REST_Controller { $form = comment::get_edit_form($comment); if ($form->validate()) { - $comment->author = $this->input->post("author"); - $comment->email = $this->input->post("email"); - $comment->text = $this->input->post("text"); - $comment->save(); - - module::event("comment_updated", $comment); + $comment = comment::update($comment, + $this->input->post("author"), + $this->input->post("email"), + $this->input->post("text"), + $this->input->post("url")); print json_encode( array("result" => "success", |