picombo 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/classes/input.rb +10 -17
- data/lib/classes/router.rb +3 -2
- metadata +3 -3
data/lib/classes/input.rb
CHANGED
@@ -7,13 +7,6 @@ module Picombo
|
|
7
7
|
#
|
8
8
|
# * To return the entire input hash, omit the key
|
9
9
|
# * If the key is not found, the default parameter is returned, by default nil
|
10
|
-
#
|
11
|
-
# === XSS Filtering
|
12
|
-
#
|
13
|
-
# in the main config file, there is an xss_clean option. If you set this to true,
|
14
|
-
# all GET and POST variables will be scanned and cleaned of script data. You can manually
|
15
|
-
# filter strings by using:
|
16
|
-
# Picombo::Input.instance.xss_clean(str)
|
17
10
|
class Input
|
18
11
|
include Singleton
|
19
12
|
|
@@ -21,16 +14,6 @@ module Picombo
|
|
21
14
|
def set_request(req)
|
22
15
|
@req = req
|
23
16
|
|
24
|
-
if Picombo::Config.get('config.xss_clean')
|
25
|
-
@req.GET().each do |key, value|
|
26
|
-
Picombo::Log.write(:debug, 'Cleaning GET key: '+key)
|
27
|
-
@req.GET()[key] = Picombo::Security.xss_clean(value, Picombo::Config.get('config.xss_clean'))
|
28
|
-
end
|
29
|
-
@req.POST().each do |key, value|
|
30
|
-
Picombo::Log.write(:debug, 'Cleaning POST key: '+key)
|
31
|
-
@req.POST()[key] = Picombo::Security.xss_clean(value, Picombo::Config.get('config.xss_clean'))
|
32
|
-
end
|
33
|
-
end
|
34
17
|
Picombo::Log.write(:debug, 'Input Library initialized')
|
35
18
|
end
|
36
19
|
|
@@ -45,6 +28,16 @@ module Picombo
|
|
45
28
|
default
|
46
29
|
end
|
47
30
|
|
31
|
+
def query_string(hash)
|
32
|
+
temp = []
|
33
|
+
|
34
|
+
hash.each do |key, value|
|
35
|
+
temp << key+'='+value
|
36
|
+
end
|
37
|
+
|
38
|
+
temp.join('&')
|
39
|
+
end
|
40
|
+
|
48
41
|
# Retrieves a POST item by key. If the key doesn't exist, return default
|
49
42
|
# Optionaly returns the entire POST hash if key is nil
|
50
43
|
def post(key = nil, default = nil)
|
data/lib/classes/router.rb
CHANGED
@@ -152,6 +152,7 @@ module Picombo
|
|
152
152
|
|
153
153
|
router_parts = path == '/' ? ('/'+@@routes['_default'][:val]).split('/') : path.split('/')
|
154
154
|
@@current_uri = path.split('?').at(0)
|
155
|
+
@@current_uri.slice!(0)
|
155
156
|
@@segments = @@current_uri.split('/')[1..-1]
|
156
157
|
@@rsegments = router_parts[1..-1]
|
157
158
|
routed_uri = @@current_uri
|
@@ -168,8 +169,8 @@ module Picombo
|
|
168
169
|
elsif route.is_a?(Regexp)
|
169
170
|
match = route.match(@@current_uri)
|
170
171
|
if ! match.nil? and match.length > 1
|
171
|
-
routed_uri.gsub!(
|
172
|
-
@@rsegments = routed_uri.split('/')
|
172
|
+
routed_uri.gsub!(route, destination[:val])
|
173
|
+
@@rsegments = routed_uri.split('/')
|
173
174
|
end
|
174
175
|
end
|
175
176
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeremy Bush
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-17 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|