Sha256: 3f87bec7343cb92b498b80d8ae85a5700f725a2912806481b162a4b618155099

Contents?: true

Size: 880 Bytes

Versions: 31

Compression:

Stored size: 880 Bytes

Contents

# -*- coding: utf-8; -*-
#
# module/class Filter
#
module TDiary
	module Filter
		class Filter
			include ViewHelper

			DEBUG_NONE = 0
			DEBUG_SPAM = 1
			DEBUG_FULL = 2

			def initialize( cgi, conf )
				@cgi, @conf = cgi, conf

				if @conf.options.include?('filter.debug_mode')
					@debug_mode = @conf.options['filter.debug_mode']
				else
					@debug_mode = DEBUG_NONE
				end
			end

			def comment_filter( diary, comment )
				true
			end

			def referer_filter( referer )
				true
			end

			def debug( msg, level = DEBUG_SPAM )
				return if @debug_mode == DEBUG_NONE
				return if @debug_mode == DEBUG_SPAM and level == DEBUG_FULL

				TDiary.logger.info("#{@cgi.remote_addr}->#{(@cgi.params['date'][0] || 'no date').dump}: #{msg}")
			end
		end
	end
end

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vim: ts=3

Version data entries

31 entries across 30 versions & 1 rubygems

Version Path
tdiary-5.0.0 lib/tdiary/filter.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/tdiary-4.2.0/lib/tdiary/filter.rb
tdiary-4.2.1 lib/tdiary/filter.rb
tdiary-4.2.0 lib/tdiary/filter.rb
tdiary-4.1.3 lib/tdiary/filter.rb
tdiary-4.1.2 lib/tdiary/filter.rb
tdiary-4.1.1 lib/tdiary/filter.rb
tdiary-4.1.0 lib/tdiary/filter.rb
tdiary-4.1.0.20141126 lib/tdiary/filter.rb
tdiary-4.0.5.1 tdiary/filter.rb
tdiary-4.0.5 tdiary/filter.rb
tdiary-4.0.4 tdiary/filter.rb
tdiary-4.0.3 tdiary/filter.rb
tdiary-4.0.2.20140201 tdiary/filter.rb
tdiary-4.0.2 tdiary/filter.rb
tdiary-4.0.1.20131102 tdiary/filter.rb
tdiary-4.0.1.20130929 tdiary/filter.rb
tdiary-4.0.1.20130903 tdiary/filter.rb
tdiary-4.0.1 tdiary/filter.rb
tdiary-4.0.0.20130826 tdiary/filter.rb