<% include("language.html") function urlencode_special(s) s = s.gsub (s, "\n", "\r\n") s = s.gsub (s, "([^%w ])", function (c) return s.format ("%%%02X", s.byte(c)) end) return s end if _SESSION["username"] ~= nil and _SESSION["currentpath"] ~= nil then local filename = _GET["filename"] or _POST["filename"] or nil local expiretime = _GET["expiretime"] or _POST["expiretime"] or "" local downloadlimit = _GET["downloadlimit"] or _POST["downloadlimit"] or "" local downloadpass = _GET["downloadpass"] or _POST["downloadpass"] or "" local sendmail = _GET["sendmail"] or _POST["sendmail"] or "" local mailaddress = _GET["mailaddress"] or _POST["mailaddress"] or "" local sender_mailaddress = _GET["sender_mailaddress"] or _POST["sender_mailaddress"] or "" local mail_message = _GET["mail_message"] or _POST["mail_message"] or "" local localaddress = _GET["localaddress"] or _POST["localaddress"] or "" local is_dir = _GET["is_dir"] or _POST["is_dir"] or nil local nowdir = _GET["nowdir"] or _POST["nowdir"] or nil if nowdir == nil then nowdir = string.gsub(_SESSION["currentpath"],":{{","%[") nowdir = string.gsub(nowdir,"}}:","%]") end if filename ~= nil then if downloadlimit == "" then downloadlimit = "-1" end local result = c_UpdateWebLink(_SESSION["username"], filename, nowdir, expiretime, downloadlimit, downloadpass, mailaddress, sender_mailaddress) if result ~= "" and result ~= "noperm" then c_AddWebLog("User '".._SESSION["username"].."' updated Web-Link for '"..filename.."'",_SESSION_ID,DOMAIN_LOG_WEB_RESPOND) if sendmail == "yes" and mailaddress ~= "" and localaddress ~= "" then local weblink = Split(c_GetWebLink(_SESSION["username"],filename,nowdir), "\r\n") local url = specialhtml_encode(localaddress).."?download&weblink="..weblink[1].."&realfilename="..urlencode_special(filename) local urltext = specialhtml_encode(localaddress).."?download&weblink="..weblink[1].."&realfilename="..urlencode_special(filename) if is_dir == "yes" then url = specialhtml_encode(localaddress).."?download&weblink="..weblink[1] urltext = specialhtml_encode(localaddress).."?download&weblink="..weblink[1] end local subject = LANG["send_file_tip"].." (Wing FTP Server)" if sender_mailaddress == "" then subject = _SESSION["username"].." "..subject else subject = specialhtml_encode(sender_mailaddress).." "..subject end local message = "" if mail_message ~= "" then local msg = specialhtml_encode(mail_message) msg = msg.gsub(msg, "\n", "
") message = ""..LANG["str_field_message"]..":"..msg.."" end local content = [[ Wing FTP Server - Weblink Download

]]..message..[[
]]..LANG["uploadstat_filename"]..[[]]..specialhtml_encode(filename)..[[
]]..LANG["geturl_title"]..[[:]]..urltext..[[
]]..LANG["password"]..[[]]..specialhtml_encode(downloadpass)..[[
  ]]..LANG["button_downpicture"]..[[  
]] local result = c_SendMessage(mailaddress, subject, content, true, sender_mailaddress) if result == false then print("Error: sending email") else print("operation successful") end end else print("Error: no permission") end else print("") end end %>