webmcp
view framework/env/request/set_allowed_json_request_slots.lua @ 2:72860d232f32
Version 1.0.2
Fixed bug with explicit garbage collection (requests > 256kB caused an error)
Views prefixed with an underscore can't be called externally
ui.paginate now displays the last page, if the selected page number is too high.
Fixed bug with explicit garbage collection (requests > 256kB caused an error)
Views prefixed with an underscore can't be called externally
ui.paginate now displays the last page, if the selected page number is too high.
author | jbe/bsw |
---|---|
date | Thu Dec 10 12:00:00 2009 +0100 (2009-12-10) |
parents | 985024b16520 |
children | 944642a3e488 |
line source
1 --[[--
2 request.set_allowed_json_request_slots(
3 slot_idents -- list of names of slots which can be requested in JSON format
4 )
6 This function enables JSON requests. The given list of names of slots selects, which slots may be requestd in JSON format (without layout).
8 --]]--
10 function request.set_allowed_json_request_slots(slot_idents)
11 local hash = {}
12 for idx, slot_ident in ipairs(slot_idents) do
13 hash[slot_ident] = true
14 end
15 if cgi.params["_webmcp_json_slots[]"] then
16 for idx, slot_ident in ipairs(cgi.params["_webmcp_json_slots[]"]) do
17 if not hash[slot_ident] then
18 error('Requesting slot "' .. slot_ident .. '" is forbidden.')
19 end
20 end
21 end
22 request._json_requests_allowed = true
23 end