<%
include("language.html")

local downloadurl = _GET["url"] or ""
downloadurl = specialhtml_encode(downloadurl)

local file_list = strContent
local files = Split(file_list, "\r\n")
local outputHTML = ""
local nCount = 0
local strColor = "#FFF"
for _,filename in pairs(files) do
	if filename ~= "" then
		if nCount % 2 == 1 then
			strColor = "#EEE"
		else
			strColor = "#FFF"
		end
		outputHTML = outputHTML.."<tr><td style='padding:12px; word-break:break-all; background:"..strColor..";'>"..specialhtml_encode(filename).."</td><td style='padding:12px; background:"..strColor..";'><a href='"..downloadurl.."&realfilename="..urlencode(filename).."' style='border-radius:5px; background-color:#007BFF; color:#FFF; padding:8 20px; text-decoration:none;'>"..LANG["button_downpicture"].."</a></td></tr>"
		nCount = nCount+1
	end
end

if string.find(downloadurl,"?download&weblink=") then
%>
<html>
<head>
<title>Wing FTP Server - Weblink Download</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Pragma" content="no-cache" /> 
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="Shortcut Icon" href="images/logo.ico" type="image/x-icon">
<style type="text/css">
<!--
body{
background:#60605E;
font-family: Tahoma, sans-serif;
text-align: center;
font-size:11px;
font-weight:bold;
color:#000000;
overflow: auto;
}
a:link,a:visited,a:active,a:hover{color: #FFF;text-decoration:none;}
.font{
font-size:12px;
font-weight:bold;
color:#000000;
}

.listhead
{
		border-top: 1px solid white; border-right: 1px solid #ACA899; border-left: 1px solid white; border-bottom: 3px solid #CBC7B8;
		font: 12px/22px arial; cursor: pointer; padding-left: 10px; background-color: #EBEADB; overflow:hidden;
}
-->
</style>

</head>

<body>
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
  <tr> 
	<td align='center' valign='top' style='padding-top:30px;'> 
	<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' style='max-width: 980px; _width: 980px;'>
		<tr>
			<td style='background:#FFF;' height='88'>
				<a href='https://www.wftpserver.com/' target='_blank'><img src='images/logo_s.png' border='0'></a>
				<hr />
			</td>
		</tr>
		<tr> 
		  <td style='background:#FFF; padding:10px 10px 60px 10px;'>
				<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' id='filelist'>
					<tr> 
					  <td height='30' class='listhead'><%=LANG["thread_name"]%></td><td height='30' class='listhead'><%=LANG["geturl_title"]%></td>
					</tr>
					<%=outputHTML%>
				</table>
			</td>
		</tr>
		<tr> 
		<td height="35" style="font-size:12px;color:white;">
		<a href="https://www.wftpserver.com/" target="_blank">Wing FTP Server</a> ©2003-2020 <b>wftpserver.com</b> All Rights Reserved
		</td>
		</tr>
	  </table>
	  </td>
  </tr>
</table>
</body>
</html>

<% 
else
	print("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>")
	print("<script>alert('The web link does not exist!');</script>")
end 
%>
