diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-07 19:50:27 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-07 19:50:27 +0000 |
commit | f8802d438a7d3db3809f9b29e7cc41986ae2617d (patch) | |
tree | e905d59661419ef1b16a70b40ea8a67da76809b4 /modules/akismet/helpers/akismet_event.php | |
parent | 01dcbbcda5a4630cec6a1bbee052ef108e291a5d (diff) |
Properly handle the case where the akismet backend doesn't return a true/false
value. Add phpdoc.
Diffstat (limited to 'modules/akismet/helpers/akismet_event.php')
-rw-r--r-- | modules/akismet/helpers/akismet_event.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/akismet/helpers/akismet_event.php b/modules/akismet/helpers/akismet_event.php index bc4e895a..8f530faa 100644 --- a/modules/akismet/helpers/akismet_event.php +++ b/modules/akismet/helpers/akismet_event.php @@ -19,9 +19,19 @@ */ class akismet_event_Core { public static function comment_created($comment) { - if (akismet::check_comment($comment)) { + switch(akismet::check_comment($comment)) { + case "spam": $comment->state = "spam"; - $comment->save(); + break; + + case "ham": + $comment->state = "published"; + break; + + case "unknown": + $comment->state = "unpublished"; + break; } + $comment->save(); } } |