Changeset 6008
- Timestamp:
- 02/02/08 01:25:02 (5 years ago)
- Location:
- platform/tdiary
- Files:
-
- 2 modified
-
filter/antirefspam.rb (modified) (6 diffs)
-
plugin/antirefspam.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
platform/tdiary/filter/antirefspam.rb
r5585 r6008 1 1 # 2 # antirefspam filter.rb2 # antirefspam.rb 3 3 # 4 4 # Copyright (c) 2004-2005 T.Shimomura <redbug@netlife.gr.jp> … … 36 36 # str にトップページURLが含まれているかどうか 37 37 unless @conf.index_page.empty? 38 if /\Ahttps?:\/\// =~ @conf.index_page38 if @conf.index_page.index(URI.regexp(%w[http https])) == 0 39 39 if str.include? @conf.index_page 40 40 return true … … 48 48 return true 49 49 end 50 51 url = myurl.gsub("/", "\\/").gsub(":", "\\:") 52 exp = Regexp.new(url) 50 51 #url = myurl.gsub("/", "\\/").gsub(":", "\\:") 52 #exp = Regexp.new(url) 53 exp = Regexp.union(myurl) 53 54 if exp =~ str 54 55 return true … … 76 77 # "信頼できるURL" を1つずつ取り出してrefererと合致するかチェックする 77 78 conf_trustedurl.each_line do |trusted| 78 trusted.sub!(/\r?\n /,'')79 trusted.sub!(/\r?\n|\r/,'') 79 80 next if trusted =~ /\A(\#|\s*)\z/ # #または空白で始まる行は読み飛ばす 80 81 81 82 # まずは "信頼できる URL" が referer に含まれるかどうか 82 83 if referer.include? trusted … … 84 85 return true 85 86 end 86 87 87 88 # 含まれなかった場合は "信頼できる URL" を正規表現とみなして再チェック 88 89 begin 89 if referer =~ Regexp.new( trusted.gsub("/", "\\/").gsub(":", "\\:") ) 90 #if referer =~ Regexp.new( trusted.gsub("/", "\\/").gsub(":", "\\:") ) 91 if referer =~ Regexp.union( trusted ) 90 92 debug_out("trusted", trusted+" (=~) "+referer) 91 93 return true … … 237 239 ngwords = @conf['antirefspam.comment_ngwords'] 238 240 ngwords.to_s.each_line do |ngword| 239 ngword.sub!(/\r?\n /,'')241 ngword.sub!(/\r?\n|\r/,'') 240 242 if comment.body.downcase.include? ngword.downcase 241 243 log_spamcomment( comment ) -
platform/tdiary/plugin/antirefspam.rb
r5381 r6008 1 1 # 2 # antirefspam.rb 2 # antirefspam.rb 3 3 # 4 4 # Copyright (c) 2004-2005 T.Shimomura <redbug@netlife.gr.jp>
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)