New enumeration system
This commit is contained in:
11
lib/common/models/wp_timthumb/existable.rb
Normal file
11
lib/common/models/wp_timthumb/existable.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
class WpTimthumb < WpItem
|
||||
module Existable
|
||||
|
||||
def exists_from_response?(response, options = {})
|
||||
response.code == 400 && response.body =~ /no image specified/i ? true : false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
11
lib/common/models/wp_timthumb/output.rb
Normal file
11
lib/common/models/wp_timthumb/output.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
class WpTimthumb < WpItem
|
||||
module Output
|
||||
|
||||
def output
|
||||
puts ' | ' + red('[!]') + " #{url}"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
13
lib/common/models/wp_timthumb/versionable.rb
Executable file
13
lib/common/models/wp_timthumb/versionable.rb
Executable file
@@ -0,0 +1,13 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
class WpTimthumb < WpItem
|
||||
module Versionable
|
||||
|
||||
# Get the version from the body of an invalid request
|
||||
# See https://code.google.com/p/timthumb/source/browse/trunk/timthumb.php#426
|
||||
def version
|
||||
response = Browser.instance.get(url)
|
||||
response.body[%r{TimThumb version\s*: ([^<]+)} , 1]
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user