~ubuntu-branches/ubuntu/utopic/tdiary/utopic

« back to all changes in this revision

Viewing changes to contrib2/filter/comment_key/key.rb

  • Committer: Bazaar Package Importer
  • Author(s): Daigo Moriwaki
  • Date: 2011-04-11 21:53:16 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110411215316-ih4gt4q8p29d2wf8
Tags: 3.0.1-1
* New upstream release (Closes: #542801, #594947)
* debian/control:
 - Bumped up Standards-Version to 3.9.1.
 - Updated version dependency.
* debian/tdiary-setup.rb: Followed the upstream changes, incorporating js and
  index.fcgi

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# key.rb: Comment-key filter  Ver.0.5.0
3
 
#  included TDiary::Filter::KeyFilter class
4
 
#
5
 
# caution:
6
 
#   * This filter must use together plugin 'comment_key.rb'.
7
 
#
8
 
# see:
9
 
#   http://www20.big.or.jp/~rin_ne/soft/tdiary/commentkey.htm
10
 
#
11
 
# Copyright (c) 2005 Hahahaha <rin_ne@big.or.jp>
12
 
# Distributed under the GPL
13
 
#
14
 
 
15
 
module TDiary
16
 
        module Filter
17
 
                class KeyFilter < Filter
18
 
                        def comment_filter( diary, comment )
19
 
                                return true unless @conf['comment_key.enable']
20
 
                                return true if /^(TrackBack|Pingback)$/ =~ comment.name
21
 
 
22
 
                                require 'digest/md5'
23
 
                                keyprefix = @conf['comment_key.prefix'] || 'tdiary'
24
 
                                vkey = Digest::MD5.hexdigest(keyprefix + (@conf['comment_key.nodate'] == 'true' ? "" : @cgi.params['date'][0]))
25
 
                                vkey == @cgi.params['comment_key'][0]
26
 
                        end
27
 
                end
28
 
        end
29
 
end