<% local data, viewlibrary, page_info, session = ... %> <% htmlviewfunctions = require("htmlviewfunctions") %> <% html = require("acf.html") %> <% format = require("acf.format") %> <% -- Insert a string into another string function string_insert(value, insert, place) if place == nil then place = string.len(value)+1 end return string.sub(value, 1,place-1) .. tostring(insert) .. string.sub(value, place, string.len(value)) end --Highlight occurences of a word in a string function string_highlight(txtvalue, searchval, fcolour, bcolour) if txtvalue ~=nil and searchval ~= nil then sStart = string.find(string.lower(txtvalue),string.lower(searchval)) if sStart ~= nil then sEnd = sStart + string.len(searchval) txtvalue = string_insert(txtvalue,"", sEnd) txtvalue = string_insert(txtvalue,"", sStart) end end return txtvalue end %> <% local subdata, pagedata = htmlviewfunctions.paginate(data.value.log.value, page_info.clientdata, 200) %> <% -- Display the form, but skip log, window, and focus fields local label = data.label data.label = "Search Parameters" local log = data.value.log data.value.log = nil local window = data.value.window data.value.window = nil local focus = data.value.focus data.value.focus = nil htmlviewfunctions.displayitem(data, page_info) data.label = label data.value.log = log data.value.window = window data.value.focus = focus %> <% local clientinfo = "submit=true&badyesno=false&deniedyesno=false&bypassyesno=false&selected=false&" if data.value.clientuserid.value ~= "" then clientinfo = clientinfo .. "clientuserid="..data.value.clientuserid.value.."&" end if data.value.clientip.value ~= "" then clientinfo = clientinfo .. "clientip="..data.value.clientip.value.."&" end %> <% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %> <% htmlviewfunctions.displaypagination(pagedata, page_info) %> <% local checkhead = true for i,watch in ipairs(subdata) do if watch.selected ~= "t" then checkhead = false break end end %> <% for i,watch in ipairs(subdata) do local a,b = math.modf((i/2)) local mark = '' if watch.selected == "t" then mark=' class="selected"' end local time = {} time.year, time.month, time.day, time.hour, time.min, time.sec = string.match(watch.logdatetime, "(%d+)%-(%d+)-(%d+)%s+(%d+):(%d+):(%d+)") time = os.time(time) %> > title="<%= html.html_escape(watch.reason) %>"<% end %>> <% if (watch.shortreason and watch.shortreason ~= "") then %> <%= html.html_escape(watch.shortreason) %> <% elseif (watch.reason and watch.reason ~= "") then %> <%= html.html_escape(watch.reason) %> <% end %> <% end %>
checked<% end %>> Timestamp Source Client IP User ID Size Sus Den Byp Score Reason URL Bad Words
checked <% end %>> style="font-weight:bold;" id="focus" <% end %> ><%= html.link{value = "viewweblog?"..clientinfo.. "starttime="..os.date("%Y-%m-%d %H:%M:%S", time - 60*(tonumber(data.value.window.value))).. "&endtime="..os.date("%Y-%m-%d %H:%M:%S", time + 60*(tonumber(data.value.window.value))).. "&focus="..watch.logdatetime, label=watch.logdatetime} %> <%= html.html_escape(watch.sourcename) %> style="font-weight:bold;" <% end %> ><%= html.html_escape(watch.clientip) %> style="font-weight:bold;" <% end %> ><%= html.html_escape(watch.clientuserid) %> <%= html.html_escape(watch.bytes) %> <%= html.html_escape(watch.badyesno) %><% if watch.badyesno ~= "0" then %><% end %> <%= html.html_escape(watch.deniedyesno) %><% if watch.deniedyesno ~= "0" then %> <% end %> <%= html.html_escape(watch.bypassyesno) %><% if watch.bypassyesno ~= "0" then %> <% end %> <%= html.html_escape(watch.score) %> <% highlight_uri=html.html_escape(watch.shorturi or watch.uri) if watch.wordloc ~= nil then if string.find(watch.wordloc, "|") then badwords = format.string_to_table(watch.wordloc, "|") for key,wrd in ipairs(badwords) do highlight_uri = string_highlight(highlight_uri, wrd, "yellow", "red") end else highlight_uri = string_highlight(highlight_uri, watch.wordloc, "yellow", "red") end end %> <%= highlight_uri %> <%= watch.wordloc %>
<% htmlviewfunctions.displaypagination(pagedata, page_info) %> <% htmlviewfunctions.displaysectionend(header_level) %> <% if data.errtxt then %>

<%= html.html_escape(data.errtxt) %>

<% end %> <% if #data.value.log.value == 0 then %>

No results, try adjusting search parameters

<% end %> <% if viewlibrary.check_permission("downloadweblog") then data.label = "Download Results" data.action = "downloadweblog" data.option = "Download" data.value.log = nil data.value.window = nil data.value.focus = nil data.value.viewtype = cfe({ value="stream" }) for n,v in pairs(data.value) do v.type = "hidden" v.checked = nil end htmlviewfunctions.displayitem(data, page_info, 0) end %>