Sha256: 7e9dab5d8c6773a6c854dd85d2c16aaa14ff67ae98a6cee6386d460b2eb094cd

Contents?: true

Size: 855 Bytes

Versions: 38

Compression:

Stored size: 855 Bytes

Contents

#
# 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

38 entries across 28 versions & 1 rubygems

Version Path
tdiary-5.0.13 lib/tdiary/filter.rb
tdiary-5.0.12.1 lib/tdiary/filter.rb
tdiary-5.0.11 lib/tdiary/filter.rb
tdiary-5.0.10 lib/tdiary/filter.rb
tdiary-5.0.9 lib/tdiary/filter.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/lib/tdiary/filter.rb
tdiary-5.0.8 lib/tdiary/filter.rb
tdiary-5.0.7 lib/tdiary/filter.rb
tdiary-5.0.6 lib/tdiary/filter.rb
tdiary-5.0.5 lib/tdiary/filter.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/tdiary-5.0.3/lib/tdiary/filter.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/lib/tdiary/filter.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.3/lib/tdiary/filter.rb
tdiary-5.0.4 lib/tdiary/filter.rb
tdiary-5.0.4 vendor/bundle/gems/tdiary-5.0.3/lib/tdiary/filter.rb
tdiary-5.0.3 lib/tdiary/filter.rb
tdiary-5.0.2 lib/tdiary/filter.rb
tdiary-5.0.1 lib/tdiary/filter.rb