diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-08 02:50:23 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-08 02:50:23 +0000 |
commit | 8bf388a6f671faba94f46ad9e982139c211378ee (patch) | |
tree | 5298fd100ff25a24e07a177d6fc7835a0ae0d39d /modules/akismet | |
parent | 3d4cf6f27eb11ec3168fcc173a50de297006c7a8 (diff) |
Incremental improvement in comment moderation:
1) Akismet now detects when we change a comment's published state and submits
info back to akismet.com as appropriate
2) We now show 4 different queues (all / approved / unapproved / spam) and let you
move messages between the queues
3) We track and display "spam caught" stats.
4) You can delete comments entirely.
Diffstat (limited to 'modules/akismet')
-rw-r--r-- | modules/akismet/helpers/akismet.php | 2 | ||||
-rw-r--r-- | modules/akismet/helpers/akismet_event.php | 17 | ||||
-rw-r--r-- | modules/akismet/views/admin_akismet_stats.html.php | 15 |
3 files changed, 28 insertions, 6 deletions
diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php index 132b9206..b34ed1ac 100644 --- a/modules/akismet/helpers/akismet.php +++ b/modules/akismet/helpers/akismet.php @@ -104,7 +104,7 @@ class akismet_Core { $comment_data["permalink"] = url::site("comments/{$comment->id}"); $comment_data["blog"] = url::base(false, "http"); $comment_data["user_agent"] = $comment->user_agent; - $comment_data["referrer"] = $_SERVER["HTTP_REFERER"]; + $comment_data["referrer"] = !empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : ""; $comment_data["comment_type"] = "comment"; $comment_data["comment_author"] = $comment->author; $comment_data["comment_author_email"] = $comment->email; diff --git a/modules/akismet/helpers/akismet_event.php b/modules/akismet/helpers/akismet_event.php index 8f530faa..2a42acb3 100644 --- a/modules/akismet/helpers/akismet_event.php +++ b/modules/akismet/helpers/akismet_event.php @@ -19,9 +19,14 @@ */ class akismet_event_Core { public static function comment_created($comment) { + if (TEST_MODE) { + return; + } + switch(akismet::check_comment($comment)) { case "spam": $comment->state = "spam"; + module::incr_var("comment", "spam_caught"); break; case "ham": @@ -34,4 +39,16 @@ class akismet_event_Core { } $comment->save(); } + + public static function comment_changed($old, $new) { + if (TEST_MODE) { + return; + } + + if ($old->state != "spam" && $new->state == "spam") { + akismet::submit_spam($new); + } else if ($old->state == "spam" && $new->state != "spam") { + akismet::submit_ham($new); + } + } } diff --git a/modules/akismet/views/admin_akismet_stats.html.php b/modules/akismet/views/admin_akismet_stats.html.php index a7431a18..d82704cd 100644 --- a/modules/akismet/views/admin_akismet_stats.html.php +++ b/modules/akismet/views/admin_akismet_stats.html.php @@ -1,6 +1,11 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<iframe width="100%" - height="100%" - style="border: 0px" - src="http://<?= $api_key ?>.web.akismet.com/1.0/user-stats.php?blog=<?= urlencode($blog_url) ?>"> -</iframe> +<script type="text/javscript"> + $(document).ready(function() { + $("#gAkismetExternalStats").css("height", "600"); + }); +</script> +<div id="gAkismetStats"> + <iframe id="gAkismetExternalStats" width="100%" height="100%" frameborder="0" + src="http://<?= $api_key ?>.web.akismet.com/1.0/user-stats.php?blog=<?= urlencode($blog_url) ?>"> + </iframe> +</div> |