diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-29 21:09:44 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-29 21:09:44 +0000 |
commit | 69603ede7a0d7567f37025eee713975282122d13 (patch) | |
tree | 1d270e63199faac57a7f2cbd939da04eb64576e6 /modules/comment/helpers | |
parent | 2bfddc4c87443640098387630967f6d141a9fce6 (diff) |
Implemented bharat's suggestions to the comment module in preparation for the spam_filter module
Diffstat (limited to 'modules/comment/helpers')
-rw-r--r-- | modules/comment/helpers/comment.php | 6 | ||||
-rw-r--r-- | modules/comment/helpers/comment_block.php | 2 | ||||
-rw-r--r-- | modules/comment/helpers/comment_installer.php | 12 |
3 files changed, 12 insertions, 8 deletions
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 92a9e54c..d6c3bd48 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -46,13 +46,15 @@ class comment_Core { $comment->text = $text; $comment->item_id = $item_id; $comment->url = $url; + $comment->ip_addr = Input::instance()->ip_address(); + $comment->user_agent = Kohana::$user_agent; $comment->created = time(); // @todo Figure out how to mock up the test of the spam_filter if (module::is_installed("spam_filter") && !TEST_MODE) { spam_filter::verify_comment($comment); } else { - $comment->visible = true; + $comment->published = true; } $comment->save(); @@ -75,6 +77,8 @@ class comment_Core { $comment->email = $email; $comment->text = $text; $comment->url = $url; + $comment->ip_addr = Input::instance()->ip_address(); + $comment->user_agent = Kohana::$user_agent; // @todo Figure out how to mock up the test of the spam_filter if (module::is_installed("spam_filter") && !TEST_MODE) { diff --git a/modules/comment/helpers/comment_block.php b/modules/comment/helpers/comment_block.php index 9231dcd6..ce748036 100644 --- a/modules/comment/helpers/comment_block.php +++ b/modules/comment/helpers/comment_block.php @@ -32,7 +32,7 @@ class comment_block_Core { $view = new View("comments.html"); $view->comments = ORM::factory("comment") ->where("item_id", $theme->item()->id) - ->where("visible", 1) + ->where("published", 1) ->orderby("created", "ASC") ->find_all(); diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php index f203d940..71b047e5 100644 --- a/modules/comment/helpers/comment_installer.php +++ b/modules/comment/helpers/comment_installer.php @@ -31,14 +31,14 @@ class comment_installer { `created` int(9) NOT NULL, `item_id` int(9) NOT NULL, `url` varchar(255) default NULL, - `visible` tinyint(1) default 1, - PRIMARY KEY (`id`)) + `published` tinyint(1) default 1, + `ip_addr` char(15) default NULL, + `user_agent` varchar(255) default NULL, + `spam_signature` varchar(255) default NULL, + `spam_type` char(15) default NULL, + PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - if (module::is_installed("spam_filter")) { - spam_filter_installer::add_fields(); - } - module::set_version("comment", 1); } } |