public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Search Repo:
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
add '' (empty string) as a possible valid response to 
Akismet#check_comment

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2461 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Fri Nov 10 10:31:54 -0800 2006
commit  9cb5c1e617e1b2f15161c88cf70d9574cf56f008
tree    84c199743ef2cd5634d616f84b5416bf10f2957c
parent  d4183f071e40ea47f4e0c7bf139374c196efa7ec
...
54
55
56
57
 
58
59
60
...
54
55
56
 
57
58
59
60
0
@@ -54,7 +54,7 @@
0
       akismet = Akismet.new(site.akismet_key, site.akismet_url)
0
       self.approved = !akismet.comment_check(comment_spam_options(site, request))
0
       logger.info "Checking Akismet (#{site.akismet_key}) for new comment on Article #{article_id}. #{approved? ? 'Approved' : 'Blocked'}"
0
- logger.warn "Odd Akismet Response: #{akismet.last_response.inspect}" unless %w(true false).include?(akismet.last_response)
0
+ logger.warn "Odd Akismet Response: #{akismet.last_response.inspect}" unless Akismet.normal_responses.include?(akismet.last_response)
0
     end
0
   end
0
 
...
10
11
12
 
13
14
15
 
 
16
17
18
...
60
61
62
63
 
64
65
66
...
10
11
12
13
14
15
16
17
18
19
20
21
...
63
64
65
 
66
67
68
69
0
@@ -10,9 +10,12 @@
0
 # rewritten to be more rails-like
0
 class Akismet
0
   
0
+ cattr_accessor :valid_responses, :normal_responses
0
   attr_accessor :proxy_port, :proxy_host
0
   attr_reader :last_response
0
 
0
+ @@valid_responses = Set.new(['false', ''])
0
+ @@normal_responses = @@valid_responses.dup << 'true'
0
   STANDARD_HEADERS = {
0
     'User-Agent' => 'Mephisto/' << Mephisto::Version::STRING,
0
     'Content-Type' => 'application/x-www-form-urlencoded'
0
@@ -60,7 +63,7 @@
0
   # Other server enviroment variables
0
   # In PHP there is an array of enviroment variables called $_SERVER which contains information about the web server itself as well as a key/value for every HTTP header sent with the request. This data is highly useful to Akismet as how the submited content interacts with the server can be very telling, so please include as much information as possible.
0
   def comment_check(options = {})
0
- call_akismet('comment-check', options) != "false"
0
+ !@@valid_responses.include?(call_akismet('comment-check', options))
0
   end
0
   
0
   # This call is for submitting comments that weren't marked as spam but should have been. It takes identical arguments as comment check.

Comments

    No one has commented yet.