%
include("language.html")
if _SESSION["logined"] ~= nil then
local domain = _POST["domain"]
local type = _POST["type"] or "ftp"
local event = _POST["event"]
local bExecute = false
if _POST["bExecute"] == "1" then
bExecute = true
end
local strExeFile = _POST["strExeFile"]
local strParam = _POST["strParam"]
local bLogfile = false
if _POST["bLogfile"] == "1" then
bLogfile = true
end
local strLogFileName = _POST["strLogFileName"]
local strLogText = _POST["strLogText"]
local bSendMail = false
if _POST["bSendMail"] == "1" then
bSendMail = true
end
local strMailTo = _POST["strMailTo"]
local strSubject = _POST["strSubject"]
local strPlainText = _POST["strPlainText"]
local strAttachFile = _POST["strAttachFile"]
local nPriority = _POST["nPriority"] or 2
local bLua = false
if _POST["bLua"] == "1" then
bLua = true
end
local strLua = _POST["strLua"]
if (_SESSION["admin_readonly"] ~= nil and _SESSION["admin_readonly"] == 1) or (_SESSION["admin_domainadmin"] ~= nil and _SESSION["admin_domainadmin"] == 1) then
print("2")
exit()
end
if event ~= nil then
type = string.lower(type)
if type == "http" then
local status,err = loadstring(strLua)
if not status then
if type(err) == "string" then
print(string.format("Lua Error: %s!",err))
end
else
c_SetHTTPEvent(domain,event,bExecute,strExeFile,strParam,bLogfile,strLogFileName,strLogText,bSendMail,strMailTo,strSubject,strPlainText,strAttachFile,nPriority,bLua,strLua)
c_AddAdminLog("administrator '".._SESSION["admin"].."' modified the http event ["..WEB_EVENT_KEY[event+1].."].",ADMIN_LOG_OK)
print("1")
end
elseif type == "ssh" then
local status,err = loadstring(strLua)
if not status then
if type(err) == "string" then
print(string.format("Lua Error: %s!",err))
end
else
c_SetSSHEvent(domain,event,bExecute,strExeFile,strParam,bLogfile,strLogFileName,strLogText,bSendMail,strMailTo,strSubject,strPlainText,strAttachFile,nPriority,bLua,strLua)
c_AddAdminLog("administrator '".._SESSION["admin"].."' modified the ssh event ["..SSH_EVENT_KEY[event+1].."].",ADMIN_LOG_OK)
print("1")
end
else
local status,err = loadstring(strLua)
if not status then
if type(err) == "string" then
print(string.format("Lua Error: %s!",err))
end
else
c_SetFTPEvent(domain,event,bExecute,strExeFile,strParam,bLogfile,strLogFileName,strLogText,bSendMail,strMailTo,strSubject,strPlainText,strAttachFile,nPriority,bLua,strLua)
c_AddAdminLog("administrator '".._SESSION["admin"].."' modified the ftp event ["..FTP_EVENT_KEY[event+1].."].",ADMIN_LOG_OK)
print("1")
end
end
end
end
%>