lib/knj/web.rb in knjrbfw-0.0.51 vs lib/knj/web.rb in knjrbfw-0.0.52

- old
+ new

@@ -61,47 +61,27 @@ end return cookiestr end + #Parses a query and returns the various _GET-variables. def self.parse_urlquery(querystr, args = {}) get = {} querystr.to_s.split("&").each do |value| pos = value.index("=") if pos != nil name = value[0..pos-1] name = name.to_sym if args[:syms] valuestr = value.slice(pos+1..-1) - Knj::Web.parse_name(get, self.urldec(name), valuestr, args) + Knj::Web.parse_name(get, Knj::Web.urldec(name), valuestr, args) end end return get end - def self.parse_secname(seton, secname, args) - secname_empty = false - if secname.length <= 0 - secname_empty = true - try = 0 - - loop do - if !seton.key?(try.to_s) - break - else - try += 1 - end - end - - secname = try.to_s - end - - secname = secname.to_sym if args[:syms] and secname.is_a?(String) and !Knj::Php.is_numeric(secname) - return [secname, secname_empty] - end - def self.parse_name(seton, varname, value, args = {}) if value.respond_to?(:filename) and value.filename realvalue = value else realvalue = value.to_s @@ -127,9 +107,30 @@ seton[name][secname] = realvalue end else seton[varname] = realvalue end + end + + def self.parse_secname(seton, secname, args) + secname_empty = false + if secname.length <= 0 + secname_empty = true + try = 0 + + loop do + if !seton.key?(try.to_s) + break + else + try += 1 + end + end + + secname = try.to_s + end + + secname = secname.to_sym if args[:syms] and secname.is_a?(String) and !Knj::Php.is_numeric(secname) + return [secname, secname_empty] end def self.parse_name_second(seton, varname, value, args = {}) if value.respond_to?(:filename) and value.filename realvalue = value \ No newline at end of file