<%
include("language.html")
if _SESSION["logined"] ~= nil then
	local FileMask = c_GetGlobalFileMaskList()
		FileMask = json.encode_s(FileMask)

	local IpMask = c_GetGlobalIPMaskList()
		IpMask = json.encode_s(IpMask)

	math.randomseed(os.time())
	local imageID = math.random(1,10000)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>System General setting</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, must-revalidate" />
<style type="text/css">
a {text-decoration:none;}
a,a:visited {color:#000;background:inherit;}
html, body {height: 100%;margin:0px;padding:0px;}
<%if _COOKIE["admin_lang"] == "schinese" or _COOKIE["admin_lang"] == "tchinese" or _COOKIE["admin_lang"] == "japanese" then%>
body,td,span {font:12px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
<%else%>
body,td,span {font:11px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
<%end%>
img {border:0px;}
input,select,textarea{margin:4px;}
input,textarea{background-color:expression((this.disabled && this.disabled==true)?"#D4D0C8":"")}
fieldset {  
    border-color: #999;  
    border-style: solid;  
    border-width: 1px;  
}

button{
border:none;background:none;padding:0;
margin:0;width:auto;overflow:visible;text-align:center;
white-space:nowrap;height:24px;line-height:24px;
cursor:pointer;
color:#000;
margin-left:2px;
margin-top:2px;
}
button span, button em{
display:block;height:24px;line-height:22px;margin:0;
}	
button span{
font-size:8pt;
padding-left:12px;
background:url("images/button_left.gif") no-repeat 0 0;
}
<%if _COOKIE["admin_lang"] == "schinese" or _COOKIE["admin_lang"] == "tchinese" or _COOKIE["admin_lang"] == "japanese" then%>
button em{
font-style:normal;padding-right:14px;
background:url("images/button.gif") no-repeat 101% 0;
}
<%else%>
button em{
font-style:normal;padding-right:10px;
background:url("images/button.gif") no-repeat 100% 0;
}
<%end%>
button:hover{
filter:alpha(opacity=60);
opacity:0.60;
color:#5488C9;
}
button span:hover{
filter:alpha(opacity=60);
opacity:0.60;
color:#5488C9;
}
.buttonhover{
filter:alpha(opacity=60);
opacity:0.60;
color:#5488C9;
}


.listhead
{
		border-top: 1px solid white; border-right: 1px solid #ACA899; border-left: 1px solid white; border-bottom: 2px solid #E1E2E3;
		font: 12px/22px arial; cursor: hand; text-align: center; background-color: #EFEFEF; overflow:hidden; height:18px;
}

.listhead2
{
		border-top: 1px solid white; border-right: 1px solid #ACA899; border-left: 1px solid white; border-bottom: 2px solid #FCC247;
		font: 12px/22px arial; cursor: hand; text-align: center; background-color: #FAF9F4; overflow:hidden; height:18px;
}

.listtr01
{
		background-color: #FFFFFF;
		text-align: left;
		padding: 3px;
}

.listtr02
{
		background-color: #3366CC;
		color: #FFF;
		text-align: left;
		padding: 3px;
}

#tabDiv {
	width: 740px;
	margin: 0px auto 0px auto;
	position: relative;
	border:1px solid transparent;
	border:1px solid #E6E6E6;
}
#tabDiv ul {
	padding: 0px;
	position: absolute;
	margin: 4px;
}
#tabDiv li {
	list-style-type: none;
	float: left;
	margin-right: 1px;
	height: 24px;
	line-height: 24px;
	padding: 0px;
}
#tabDiv li a {
	display: block;
	text-decoration: none;
	padding-right: 10px;
	padding-left: 10px;
}
.tagContent {
	clear:both;
	float:none;
	margin-top: 27px;
	border: 1px solid #919B9C;
}
.tagContent div {
	margin-top: 0px;
	height: 485px;
	overflow-y:auto;
	background-image: url('images/tabbg.gif');
	background-repeat: repeat-x;
	background-color: #fff;
	padding: 12px;
	display: none;
}
.selectedTag {
	background-image: url('images/tableft.gif');
	background-repeat: no-repeat;
	background-position: left top;
}
.selectedTag a {
	background-image: url('images/tabright.gif');
	background-repeat: no-repeat;
	background-position: right top;
	color:#000;
}
.normalTag {
	background-image: url('images/tableft.gif');
	background-repeat: no-repeat;
	background-position: left bottom;
}
.normalTag a {
	background-image: url('images/tabright.gif');
	background-repeat: no-repeat;
	background-position: right bottom;
	color:#49658F
}
.emptyTag { width:20px;}
</style>

<script language="javascript" src="include/common.js"></script>
<script language="javascript" src="include/json.js"></script>
<script language="javascript">
var ajaxlock = false;
var selectedRow = null;
var lastObj = null;
var lastObjIndex = -1;

var ThreadNum = <%=c_GetGlobalOptionInt(GOPTION_MAX_THREADPOOL_INT)%>;
var SftpLogLevel = <%=c_GetGlobalOptionInt(GOPTION_SSHLOG_LEVEL)%>;
var EnableFips = <%=c_GetGlobalOptionInt(GOPTION_ENABLE_FIPS)%>;
var DisableTlsv1 = <%=c_GetGlobalOptionInt(GOPTION_DISABLE_TLSV1)%>;
var DisableTlsv11 = <%=c_GetGlobalOptionInt(GOPTION_DISABLE_TLSV11)%>;
var NoCache = <%=c_GetGlobalOptionInt(GOPTION_OPENSSL_NO_CACHE)%>;
var NoResumption = <%=c_GetGlobalOptionInt(GOPTION_OPENSSL_NO_RESUMPTION)%>;
var NoRenegotiation = <%=c_GetGlobalOptionInt(GOPTION_OPENSSL_NO_RENEGOTIATION)%>;
var OpensslCiphers = "<%=c_GetGlobalOptionStr(GOPTION_OPENSSL_CIPHERS)%>";
var EnableOldWebadmin = <%=c_GetGlobalOptionInt(GOPTION_OLD_WEBADMIN)%>;

var xmlhttp,page,post;
xmlhttp = isIE ? new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest();

function ajaxRequest(pagename,poststring,method)
{
	if(ajaxlock == false)
	{	
		delete xmlhttp;
		xmlhttp = isIE ? new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest();

		ajaxlock = true;
		page = pagename;
		post = poststring;

		if(method == "GET")
			xmlhttp.open("GET",page+".html"+post);
		else
			xmlhttp.open("POST",page+".html");

		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.onreadystatechange = ajaxResponse;
		if(method != "GET")
			xmlhttp.send(post);
		else
			xmlhttp.send("");
		$("waitingdiv").style.display = "";
	}
}

function ajaxResponse()
{
	ajaxlock = false;
	$("waitingdiv").style.display = "none";
	if (xmlhttp.readyState == 4)
	{
		if (xmlhttp.status == 200)
		{
			try
			{
				switch(page)
				{
					case 'admin_set_system_general':	doSubmit_result();break;
					case 'admin_make_logo':	makeLogo_result();break;
				}
			}
			catch(e)
			{
				alert("<%=LANG['error_ajax']%>");
			}
		}
		else
		{
			alert("<%=LANG['error_ajax']%>");
		}
	}
}

function doSubmit()
{
	var paramStr = "";
	var enable_systemlog = ($("enable_systemlog").checked ? 1:0);
	var systemlog_filename = encodeURIComponent($("systemlog_filename").value);
	var systemlog_maxsize = $("systemlog_maxsize").value;
	var enable_auditing = ($("enable_auditing").checked ? 1:0);
	var audit_db_filename = encodeURIComponent($("audit_db_filename").value);
	//var enable_logfile_system = ($("enable_logfile_system").checked ? 1:0);
	//var enable_logscrn_system = ($("enable_logscrn_system").checked ? 1:0);
	//var enable_logfile_task = ($("enable_logfile_task").checked ? 1:0);
	//var enable_logscrn_task = ($("enable_logscrn_task").checked ? 1:0);
	var enable_list_cache = ($("enable_list_cache").checked ? 1:0);
	var enable_thumbnail = ($("enable_thumbnail").checked ? 1:0);
	//var enable_ed2k_link = ($("enable_ed2k_link").checked ? 1:0);
	var enable_ed2k_link = 1;
	var enable_online_edit = ($("enable_online_edit").checked ? 1:0);
	//var disable_sslv3 = ($("disable_sslv3").checked ? 1:0);
	var disable_sslv3 = 1;
	var disable_tlsv1 = ($("disable_tlsv1").checked ? 1:0);
	var disable_tlsv11 = ($("disable_tlsv11").checked ? 1:0);
	var no_resumption = ($("no_resumption").checked ? 1:0);
	var no_renegotiation = ($("no_renegotiation").checked ? 1:0);
	var no_cache = ($("no_cache").checked ? 1:0);
	var enable_fips = ($("enable_fips").checked ? 1:0);
	var restrict_session_ip = ($("restrict_session_ip").checked ? 1:0);
	var enable_mfmt = ($("enable_mfmt").checked ? 1:0);
	var real_owner_group = ($("real_owner_group").checked ? 1:0);
	var enable_chmod = ($("enable_chmod").checked ? 1:0);
	var max_download_speed = $("max_download_speed").value;
	var max_upload_speed = $("max_upload_speed").value;
	var max_thread_num = $("max_thread_num").value;
	var IpMaskString = urlEncode(JSON.stringify(ipmasks));
	var FileMaskString = urlEncode(JSON.stringify(filemasks));
	var file_permissions = $("file_permissions").value;
	var folder_permissions = $("folder_permissions").value;
	var opensslciphers = urlEncode($("opensslciphers").value);
	var sftp_kex_algos = urlEncode($("sftp_kex_algos").value);
	var sftp_enc_algos = urlEncode($("sftp_enc_algos").value);
	var sftp_mac_algos = urlEncode($("sftp_mac_algos").value);
	var sftp_hostkey_algos = urlEncode($("sftp_hostkey_algos").value);
	var sftplog_level = $("sftplog_level").value;
	var weblink_path = $("strWebLinkPath").value;
	var uploadlink_path = $("strUploadLinkPath").value;
	var sqlite_path = $("strSQLitePath").value;
	var enable_old_webadmin = ($("enable_old_webadmin").checked ? 1:0);

	if(weblink_path == uploadlink_path)
	{
		alert("<%=LANG['str_weblinkfolder_error']%>");
		return false;
	}

	if(max_thread_num <= 1 || max_thread_num == null) max_thread_num = 1;

	if(max_thread_num != ThreadNum || enable_fips != EnableFips || disable_tlsv1 != DisableTlsv1 || disable_tlsv11 != DisableTlsv11 || no_cache != NoCache || no_resumption != NoResumption || no_renegotiation != NoRenegotiation || $("opensslciphers").value != OpensslCiphers)
	{
		alert("<%=LANG['str_restart_note']%>");
	}

	paramStr = "enable_systemlog="+enable_systemlog+"&systemlog_filename="+systemlog_filename+"&systemlog_maxsize="+systemlog_maxsize+"&enable_auditing="+enable_auditing+"&audit_db_filename="+audit_db_filename+"&enable_list_cache="+enable_list_cache+"&enable_thumbnail="+enable_thumbnail+"&enable_ed2k_link="+enable_ed2k_link+"&enable_online_edit="+enable_online_edit+"&disable_sslv3="+disable_sslv3+"&disable_tlsv1="+disable_tlsv1+"&disable_tlsv11="+disable_tlsv11+"&no_resumption="+no_resumption+"&no_renegotiation="+no_renegotiation+"&no_cache="+no_cache+"&enable_fips="+enable_fips+"&restrict_session_ip="+restrict_session_ip+"&enable_mfmt="+enable_mfmt+"&real_owner_group="+real_owner_group+"&enable_chmod="+enable_chmod+"&file_permissions="+file_permissions+"&folder_permissions="+folder_permissions+"&max_download_speed="+max_download_speed+"&max_upload_speed="+max_upload_speed+"&max_thread_num="+max_thread_num+"&ipmask="+IpMaskString+"&filemask="+FileMaskString+"&opensslciphers="+opensslciphers+"&sftp_kex_algos="+sftp_kex_algos+"&sftp_enc_algos="+sftp_enc_algos+"&sftp_mac_algos="+sftp_mac_algos+"&sftp_hostkey_algos="+sftp_hostkey_algos+"&sftplog_level="+sftplog_level+"&weblink_path="+weblink_path+"&uploadlink_path="+uploadlink_path+"&sqlite_path="+sqlite_path+"&enable_old_webadmin="+enable_old_webadmin+"&r="+Math.random();

	ajaxRequest("admin_set_system_general",paramStr);
}

function doSubmit_result()
{
	var enable_old_webadmin = ($("enable_old_webadmin").checked ? 1:0);
	if(enable_old_webadmin != EnableOldWebadmin)
	{
		if(enable_old_webadmin)
		{
			top.location = location.origin+"/main.html";
		}
		else
		{
			top.location = location.origin+"/";
		}
	}
	else
	{
		top.closewindow(1);
	}
}



var ipmasks = new Array();
var filemasks = new Array();

function Init()
{
	var FileMask = '<%=FileMask%>';
	if(FileMask != "")
	{
		try
		{
			var FileMaskObject = JSON.parse(FileMask);
			filemasks = (FileMaskObject != null ? FileMaskObject : new Array());
			AddBlockfile_updateview();
		}
		catch(e)
		{
		}
	}

	var IpMask = '<%=IpMask%>';
	if(IpMask != "")
	{
		try
		{
			var IpMaskObject = JSON.parse(IpMask);
			ipmasks = (IpMaskObject != null ? IpMaskObject : new Array());
			AddBlockIP_updateview();
		}
		catch(e)
		{
		}
	}
}

function AddBlockIP()
{
	showMessagebox("<%=LANG['str_addblockip']%>","<span style='padding:5px;'><%=LANG['str_ipmask_tip']%><span><br><br><table width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-left:10px;'><tr><td height=30 width=100 align=right><%=LANG['str_ip']%>:</td><td align=left><input type='text' style='width:210px' id='blockip'></td></tr><tr><td height=30 width=100 align=right><%=LANG['str_comment']%>:</td><td align=left><input type='text' style='width:210px' id='comment'></td></tr><tr><td height=30 width=100 align=right><%=LANG['str_access']%>:</td><td align=left><input type='radio' name='radio' id='radio_deny' checked><%=LANG['str_denied']%> <input type='radio' name='radio' id='radio_allow'><%=LANG['str_allowed']%></td></tr><td  height=50 colspan=2 valign='bottom'><button id='btn_submit' type='submit' onclick='return AddBlockIP_submit()'><span><em><%=LANG['button_submit']%></em></span></button>&nbsp;<button id='btn_cancel' onclick='top.closewindow();'><span><em><%=LANG['button_cancel']%></em></span></button></td></tr></table>",null,370,230);
	top.$("blockip").focus();

	top.$("btn_submit").onclick = function(){return AddBlockIP_submit();};
	top.$("btn_cancel").onclick = function(){top.closewindow();};
}

function AddBlockIP_updateview()
{
	var htmltext = "<table id='listtable2' width='100%' border='0' cellpadding='2' cellspacing='0' style='table-layout:fixed;'><tbody>";
	for(var i=0;i<ipmasks.length;i++)
	{
		var refuse = ipmasks[i].refuse ? "<font color='red'><%=LANG['str_deny']%></font>":"<font color='green'><%=LANG['str_allow']%></font>";
		htmltext += "<tr class='listtr01' onmouseup='do_list_click2(this);'><td width='50%' f_id='"+i+"'>"+ipmasks[i].ip+"</td><td width='20%'>"+refuse+"</td><td>"+ipmasks[i].comment+"</td></tr>";
	}
	htmltext += "</tbody></table>";
	clear("listview_div2");
	write("listview_div2",htmltext);
	selectedRow = null;
	lastsortcol = -1;
}

function AddBlockIP_submit()
{
	var blockip = htmldecode(top.$("blockip").value);
	if(blockip.length == 0 || blockip.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalidip']%>");
		top.$("blockip").focus();
		return;
	}

	var comment = htmldecode(top.$("comment").value);
	if(comment.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalidip']%>");
		top.$("comment").focus();
		return;
	}
	var mask = new Object();
	mask.ip = blockip;
	mask.comment = comment;
	mask.refuse = top.$("radio_deny").checked ? true:false;
	ipmasks.push(mask);
	mask = null;
	AddBlockIP_updateview();
	top.closewindow();
}

function do_list_click2(obj)
{
	var row_index = obj.rowIndex;
	if(selectedRow != $("listtable2").rows[row_index])
	{
		if(lastObj != null)
			lastObj.className = "listtr01";

		selectedRow = $("listtable2").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
		try{
			lastObjIndex = parseInt(selectedRow.cells[0].innerHTML);
		}catch(e){
			lastObjIndex = -1;
		}
	}
	else
	{
		ModifyBlockIP();
	}

	return false;
}

function ModifyBlockIP()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	var f_ip = ipmasks[f_id].ip;
	var f_comment = ipmasks[f_id].comment;
	var f_deny = ipmasks[f_id].refuse ? "checked":"";
	var f_allow = ipmasks[f_id].refuse ? "":"checked";

	showMessagebox("<%=LANG['str_addblockip']%>","<span style='padding:5px;'><%=LANG['str_ipmask_tip']%><span><br><br><input type='hidden' id='blockip_id' value='"+f_id+"'><table width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-left:10px;'><tr><td height=30 width=100 align=right><%=LANG['str_ip']%>:</td><td align=left><input type='text' style='width:210px' id='blockip' value='"+f_ip+"'></td></tr><tr><td height=30 width=100 align=right><%=LANG['str_comment']%>:</td><td align=left><input type='text' style='width:210px' id='comment' value='"+f_comment+"'></td></tr><tr><td height=30 width=100 align=right><%=LANG['str_access']%>:</td><td align=left><input type='radio' name='radio' id='radio_deny' "+f_deny+"><%=LANG['str_denied']%> <input type='radio' name='radio' id='radio_allow' "+f_allow+"><%=LANG['str_allowed']%></td></tr><td  height=60 colspan=2 valign='bottom'><button id='btn_submit' type='submit' onclick='return ModifyBlockIP_submit()'><span><em><%=LANG['button_submit']%></em></span></button>&nbsp;<button id='btn_cancel' onclick='top.closewindow();'><span><em><%=LANG['button_cancel']%></em></span></button></td></tr></table>",null,370,230);

	top.$("btn_submit").onclick = function(){return ModifyBlockIP_submit();};
	top.$("btn_cancel").onclick = function(){top.closewindow();};
}

function ModifyBlockIP_submit()
{
	var f_id = parseInt(htmldecode(top.$("blockip_id").value));
	var blockip = htmldecode(top.$("blockip").value);
	if(blockip.length == 0 || blockip.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalidip']%>");
		top.$("blockip").focus();
		return;
	}
	var comment = htmldecode(top.$("comment").value);
	if(comment.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalidip']%>");
		top.$("comment").focus();
		return;
	}
	ipmasks[f_id].ip = blockip;
	ipmasks[f_id].comment = comment;
	ipmasks[f_id].refuse = top.$("radio_deny").checked ? true:false;
	AddBlockIP_updateview();
	top.closewindow();
}

function DeleteBlockIP()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}

	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	ipmasks.splice(f_id,1);
	AddBlockIP_updateview();
}

function UpBlockIP()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id > 0)
	{
		var temp = ipmasks[f_id-1]; 
		ipmasks[f_id-1] = ipmasks[f_id];
		ipmasks[f_id] = temp;
	}

	AddBlockIP_updateview();

	if(f_id > 0)
	{
		for(var i=0; i < ipmasks.length; i++)
		{
			var tempID = parseInt($("listtable2").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id-1)
			{
				$("listtable2").rows[i].className = "listtr02";
				lastObj = $("listtable2").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}

function DownBlockIP()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id < ipmasks.length-1)
	{
		var temp = ipmasks[f_id+1]; 
		ipmasks[f_id+1] = ipmasks[f_id];
		ipmasks[f_id] = temp;
	}

	AddBlockIP_updateview();

	if(f_id < ipmasks.length-1)
	{
		for(var i=0; i < ipmasks.length; i++)
		{
			var tempID = parseInt($("listtable2").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id+1)
			{
				$("listtable2").rows[i].className = "listtr02";
				lastObj = $("listtable2").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}





function AddBlockfile()
{
	showMessagebox("<%=LANG['str_addblockfile']%>","<span style='padding:5px;'><%=LANG['str_filemask_tip']%><span><br><br><%=LANG['str_filemask']%>: <input type='text' style='width:190px' id='blockfilename'><br><input type='radio' name='radio' id='radio_deny' checked><%=LANG['str_denied']%> <input type='radio' name='radio' id='radio_allow'><%=LANG['str_allowed']%><br><br><br><button id='btn_submit' type='submit' onclick='return AddBlockfile_submit()'><span><em><%=LANG['button_submit']%></em></span></button>&nbsp;<button id='btn_cancel' onclick='top.closewindow();'><span><em><%=LANG['button_cancel']%></em></span></button>",null,340,190);
	top.$("blockfilename").focus();

	top.$("btn_submit").onclick = function(){return AddBlockfile_submit();};
	top.$("btn_cancel").onclick = function(){top.closewindow();};
}

function AddBlockfile_updateview()
{
	var htmltext = "<table id='listtable3' width='100%' border='0' cellpadding='2' cellspacing='0' style='table-layout:fixed;'><tbody>";
	for(var i=0;i<filemasks.length;i++)
	{
		var refuse = filemasks[i].refuse ? "<font color='red'><%=LANG['str_deny']%></font>":"<font color='green'><%=LANG['str_allow']%></font>";
		htmltext += "<tr class='listtr01' onmouseup='do_list_click3(this);'><td width='70%' f_id='"+i+"'>"+filemasks[i].filename+"</td><td width='30%'>"+refuse+"</td></tr>";
	}
	htmltext += "</tbody></table>";
	clear("listview_div3");
	write("listview_div3",htmltext);
	selectedRow = null;
	lastsortcol = -1;
}

function AddBlockfile_submit()
{
	var blockfilename = htmldecode(top.$("blockfilename").value);
	if(blockfilename.length == 0 || blockfilename.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalid_filename']%>");
		top.$("blockfilename").focus();
		return;
	}
	var mask = new Object();
	mask.filename = blockfilename;
	mask.refuse = top.$("radio_deny").checked ? true:false;
	filemasks.push(mask);
	mask = null;
	AddBlockfile_updateview();
	top.closewindow();
}

function do_list_click3(obj)
{
	var row_index = obj.rowIndex;
	if(selectedRow != $("listtable3").rows[row_index])
	{
		if(lastObj != null)
			lastObj.className = "listtr01";

		selectedRow = $("listtable3").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
		try{
			lastObjIndex = parseInt(selectedRow.cells[0].innerHTML);
		}catch(e){
			lastObjIndex = -1;
		}
	}
	else
	{
		ModifyBlockfile();
	}

	return false;
}

function ModifyBlockfile()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	var f_filename = filemasks[f_id].filename;
	var f_deny = filemasks[f_id].refuse ? "checked":"";
	var f_allow = filemasks[f_id].refuse ? "":"checked";
	showMessagebox("<%=LANG['str_modifyblockfile']%>","<span style='padding:5px;'><%=LANG['str_filemask_tip']%><span><br><input type='hidden' id='blockfileid' value='"+f_id+"'><br><%=LANG['str_filemask']%>: <input type='text' style='width:190px' id='blockfilename' value='"+f_filename+"'><br><input type='radio' name='radio' id='radio_deny' "+f_deny+"><%=LANG['str_denied']%> <input type='radio' name='radio' id='radio_allow' "+f_allow+"><%=LANG['str_allowed']%><br><br><br><button id='btn_submit' type='submit' onclick='return ModifyBlockfile_submit()'><span><em><%=LANG['button_submit']%></em></span></button>&nbsp;<button id='btn_cancel' onclick='top.closewindow();'><span><em><%=LANG['button_cancel']%></em></span></button>",null,340,190);

	top.$("btn_submit").onclick = function(){return ModifyBlockfile_submit();};
	top.$("btn_cancel").onclick = function(){top.closewindow();};
}

function ModifyBlockfile_submit()
{
	var f_id = parseInt(htmldecode(top.$("blockfileid").value));
	var blockfilename = htmldecode(top.$("blockfilename").value);
	if(blockfilename.length == 0 || blockfilename.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalid_filename']%>");
		top.$("blockfilename").focus();
		return;
	}
	filemasks[f_id].filename = blockfilename;
	filemasks[f_id].refuse = top.$("radio_deny").checked ? true:false;
	AddBlockfile_updateview();
	top.closewindow();
}

function DeleteBlockfile()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}

	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	filemasks.splice(f_id,1);
	AddBlockfile_updateview();
}

function UpBlockfile()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id > 0)
	{
		var temp = filemasks[f_id-1]; 
		filemasks[f_id-1] = filemasks[f_id];
		filemasks[f_id] = temp;
	}

	AddBlockfile_updateview();

	if(f_id > 0)
	{
		for(var i=0; i < filemasks.length; i++)
		{
			var tempID = parseInt($("listtable3").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id-1)
			{
				$("listtable3").rows[i].className = "listtr02";
				lastObj = $("listtable3").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}

function DownBlockfile()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id < filemasks.length-1)
	{
		var temp = filemasks[f_id+1]; 
		filemasks[f_id+1] = filemasks[f_id];
		filemasks[f_id] = temp;
	}

	AddBlockfile_updateview();

	if(f_id < filemasks.length-1)
	{
		for(var i=0; i < filemasks.length; i++)
		{
			var tempID = parseInt($("listtable3").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id+1)
			{
				$("listtable3").rows[i].className = "listtr02";
				lastObj = $("listtable3").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}

var charArray = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
function generateRandom(len) 
{
    var result = "";
    for(var i=0; i<len; i++) 
	{
        var index = Math.ceil(Math.random()*35);
        result += charArray[index];
    }
    return result;
}

function chooseLogoFile()
{
	showMessagebox("<%=LANG['str_choosefile']%>","<iframe src='admin_file_selector.html' width=550 height=500 border=0 frameborder=0></iframe>",callback_return,550,500);
}

function callback_return(value)
{
	if(value != null)
		$("strLogoPath").value = value;
	$("strLogoPath").focus();
}

function makeLogo()
{
	if(trim($("strLogoPath").value) == "")
	{
		alert("<%=LANG['str_no_logofile']%>");
		return false;
	}
	ajaxRequest("admin_make_logo","path="+encodeURIComponent($("strLogoPath").value)+"&r="+Math.random());
}

function resetLogo()
{
	ajaxRequest("admin_make_logo","reset=1&r="+Math.random());
}

function makeLogo_result()
{
	$("logoPreview<%=imageID%>").src = "images/logo.png?r="+generateRandom(4);
}

function clearThumbcache()
{
	if(confirm("<%=LANG['str_clearthumb_tip']%>"))
		ajaxRequest("admin_clear_thumbcache","");
}

function resetCiphers()
{
	$("opensslciphers").value = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384";
}

function resetKexAlgos()
{
	$("sftp_kex_algos").value = "curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512";
}

function resetEncAlgos()
{
	$("sftp_enc_algos").value = "aes256-ctr,aes192-ctr,aes128-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com";
}

function resetMacAlgos()
{
	$("sftp_mac_algos").value = "hmac-sha2-256,hmac-sha2-512,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com";
}

function resetHostkeyAlgos()
{
	$("sftp_hostkey_algos").value = "ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519";
}

function chooseWebLinkPath()
{
	showMessagebox("<%=LANG['str_choosedir']%>","<iframe src='admin_dir_selector.html' width=550 height=500 border=0 frameborder=0></iframe>",weblink_callback,550,500);
}

function weblink_callback(value)
{
	if(value != null)
		$("strWebLinkPath").value = value;
	$("strWebLinkPath").focus();
}

function chooseUploadLinkPath()
{
	showMessagebox("<%=LANG['str_choosedir']%>","<iframe src='admin_dir_selector.html' width=550 height=500 border=0 frameborder=0></iframe>",uploadlink_callback,550,500);
}

function uploadlink_callback(value)
{
	if(value != null)
		$("strUploadLinkPath").value = value;
	$("strUploadLinkPath").focus();
}

function chooseSQLitePath()
{
	showMessagebox("<%=LANG['str_choosedir']%>","<iframe src='admin_dir_selector.html' width=550 height=500 border=0 frameborder=0></iframe>",sqlite_callback,550,500);
}

function sqlite_callback(value)
{
	if(value != null)
		$("strSQLitePath").value = value;
	$("strSQLitePath").focus();
}
</script>
</head>
<body style="background-color:#E6E6E6;">

<div id="waitingdiv" style="position:absolute; z-index:100; top:0px; left:0px; width:100%; height:100%; background:#777; filter:alpha(opacity=60); opacity:0.60; display:none;" align="center">
<div style="position:absolute; top:20%; left:20%; width:250px; height:100px;"><img src="images/loading2.gif" border="0">
<H2><b><%=LANG["title_updating"]%></b></H2></div></div>

<div id="tabDiv">
  <ul id="tags">
  	<li class="emptyTag"></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent1',this)"><%=LANG["str_miscellaneous"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent2',this)"><%=LANG["str_field_security"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent3',this)">UI</a></li>
    <li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent4',this)"><%=LANG["str_systemlog"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent5',this)"><%=LANG["title_blockip"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent6',this)"><%=LANG["title_blockfile"]%></a></li>
  </ul>
  <div id="tagContent" class="tagContent">
	<div id="tagContent1">
		<table cellSpacing="0" cellPadding="0" border="0">
		<tr><td colspan="2" height="30"><input type="checkbox" id="enable_list_cache" <%if c_GetGlobalOptionInt(GOPTION_ENABLE_LIST_CACHE_INT) == 1 then print("checked") end%>><b><%=LANG["str_enable_dircache"]%></b></td></tr>
		<tr><td colspan="2" height="30"><input type="checkbox" id="enable_thumbnail" <%if c_GetGlobalOptionInt(GOPTION_ENABLE_THUMBNAIL_INT) == 1 then print("checked") end%>><b><%=LANG["str_enable_thumbnail"]%></b>&nbsp;&nbsp;<button onclick='clearThumbcache();'><span><em><%=LANG["str_clear_thumb"]%></em></span></button>
		</td></tr>
		<tr><td colspan="2" height="30"><input type="checkbox" id="enable_online_edit" <%if c_GetGlobalOptionInt(GOPTION_ENABLE_ONLINE_EDIT_INT) == 1 then print("checked") end%>><b><%=LANG["str_enable_onlineedit"]%></b></td></tr>
		<tr><td colspan="2" height="30"><input type="checkbox" id="real_owner_group" <%if c_GetGlobalOptionInt(GOPTION_LIST_WITH_REAL_USERGROUP) == 1 then print("checked") end%>><b><%=LANG["str_real_owner_group"]%></b></td></tr>
		<tr><td colspan="2">
		<table cellSpacing="0" cellPadding="0" border="0">
		<tr><td>
		<table cellSpacing="0" cellPadding="0" border="0">
		<tr><td height="30">
		<input type="checkbox" id="enable_chmod" <%if c_GetGlobalOptionInt(GOPTION_ENABLE_CHMOD) == 1 then print("checked") end%>><b><%=LANG["str_enable_chmod"]%></b>
		</td></tr>
		<tr><td height="30">
		<input type="checkbox" id="enable_mfmt" <%if c_GetGlobalOptionInt(GOPTION_ENABLE_MFMT) == 1 then print("checked") end%>><b><%=LANG["str_enable_mfmt"]%></b>
		</td></tr>
		</table>
		</td>
		<td style="padding-left:20px;">
		<fieldset>
			<legend><b><%=LANG["str_default_permissions"]%></b></legend>
			<table cellSpacing="0" cellPadding="0" border="0">
			<tr><td>&nbsp;<%=LANG["title_file"]%></td><td>&nbsp;<%=LANG["title_directory"]%></td></tr>
			<tr><td><input id="file_permissions" type="text" size="8" value="<%=c_GetGlobalOptionStr(GOPTION_DEFAULT_FILE_PERM)%>" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></td>
			<td><input id="folder_permissions" type="text" size="8" value="<%=c_GetGlobalOptionStr(GOPTION_DEFAULT_FOLDER_PERM)%>" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></td></tr>
			</table>
		</fieldset>
		</td></tr>
		</table>
		</td>
		</tr>
		<tr><td colspan="2" height="8">&nbsp;</td></tr>
		<tr>			
		<td style="padding-left:10px;" height="30"><b><%=LANG["str_weblink_path"]%>:</b></td>
		<td>
			<input id="strWebLinkPath" type="text" style="width:250px;" value="<%=c_GetGlobalOptionStr(GOPTION_WEBLINK_PATH)%>">
			<button onclick='chooseWebLinkPath();'><span><em><%=LANG["button_choose"]%></em></span></button>
			<button onclick='weblink_callback("_WEBLINK");'><span><em><%=LANG["button_resetdefault"]%></em></span></button>
		</td>
		</tr>
		<tr>			
		<td style="padding-left:10px;" height="30"><b><%=LANG["str_uploadlink_path"]%>:</b></td>
		<td>
			<input id="strUploadLinkPath" type="text" style="width:250px;" value="<%=c_GetGlobalOptionStr(GOPTION_UPLOADLINK_PATH)%>">
			<button onclick='chooseUploadLinkPath();'><span><em><%=LANG["button_choose"]%></em></span></button>
			<button onclick='uploadlink_callback("_UPLOADLINK");'><span><em><%=LANG["button_resetdefault"]%></em></span></button>
		</td>
		</tr>
		<tr>			
		<td style="padding-left:10px;" height="30"><b><%=LANG["str_sqlite_path"]%>:</b></td>
		<td>
			<input id="strSQLitePath" type="text" style="width:250px;" value="<%=c_GetGlobalOptionStr(GOPTION_SQLITE_DB_FOLDER)%>">
			<button onclick='chooseSQLitePath();'><span><em><%=LANG["button_choose"]%></em></span></button>
			<button onclick='sqlite_callback("Data");'><span><em><%=LANG["button_resetdefault"]%></em></span></button>
		</td>
		</tr>

		<tr><td colspan="2" style="padding-top:5px;padding-left:10px;" align="left">
			<b><%=LANG["str_workerthread"]%>:</b>
			<select id="max_thread_num" style="width:60px;">
			<option value="2">2</option>
			<option value="4">4</option>
			<option value="8">8</option>
			<option value="16">16</option>
			<option value="32">32</option>
			<option value="64">64</option>
			<option value="128">128</option>
			<option value="256">256</option>
			</select>
			<span>(<%=LANG["str_workerthread_tip"]%>)</span>
		</td></tr>
		<tr><td colspan="2" style="padding-top:10px;padding-left:10px;">
		<fieldset>
			<legend><%=LANG["str_maximum_speed"]%> (0 = <%=LANG["str_nolimit"]%>)</legend>
			<table width="100%" border="0" cellpadding="2" cellspacing="1">
			<tr>
			<td><%=LANG["str_download"]%>:</td><td><input id="max_download_speed" type="text" size="12" value="<%=c_GetGlobalOptionInt(GOPTION_MAX_DOWNLOAD_SPEED_INT)%>" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> KB/s</td>
			<td><%=LANG["str_upload"]%>:</td><td><input id="max_upload_speed" type="text" size="12" value="<%=c_GetGlobalOptionInt(GOPTION_MAX_UPLOAD_SPEED_INT)%>" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> KB/s</td>
			</tr>
			</table>
		</fieldset>
		</td></tr>
		</table>
	</div>
	<div id="tagContent2">
		<table cellSpacing="0" cellPadding="0" border="0">
		<tr><td colspan="2" height="30">
		<input type="checkbox" id="enable_fips" <%if c_GetGlobalOptionInt(GOPTION_ENABLE_FIPS) == 1 then print("checked") end%>><b><%=LANG["str_enable_fips"]%></b>
		<input type="checkbox" id="disable_tlsv1" <%if c_GetGlobalOptionInt(GOPTION_DISABLE_TLSV1) == 1 then print("checked") end%>><b><%=LANG["str_disable_tlsv1"]%></b>
		<input type="checkbox" id="disable_tlsv11" <%if c_GetGlobalOptionInt(GOPTION_DISABLE_TLSV11) == 1 then print("checked") end%>><b><%=LANG["str_disable_tlsv11"]%></b>
		</td></tr>
		<tr><td colspan="2" height="30"><input type="checkbox" id="restrict_session_ip" <%if c_GetGlobalOptionInt(GOPTION_RESTRICT_SESSION_IP) == 1 then print("checked") end%>><b><%=LANG["str_restrict_session_ip"]%></b></td></tr>
		<tr><td colspan="2" height="30">
		<input type="checkbox" id="no_cache" <%if c_GetGlobalOptionInt(GOPTION_OPENSSL_NO_CACHE) == 1 then print("checked") end%>><b><%=LANG["str_no_cache"]%></b>
		</td></tr>
		<tr><td colspan="2" height="30">
		<input type="checkbox" id="no_resumption" <%if c_GetGlobalOptionInt(GOPTION_OPENSSL_NO_RESUMPTION) == 1 then print("checked") end%>><b><%=LANG["str_no_resumption"]%></b>
		</td></tr>
		<tr><td colspan="2" height="30">
		<input type="checkbox" id="no_renegotiation" <%if c_GetGlobalOptionInt(GOPTION_OPENSSL_NO_RENEGOTIATION) == 1 then print("checked") end%>><b><%=LANG["str_no_renegotiation"]%></b>
		</td></tr>
		<tr><td colspan="2" height="10">&nbsp;</td></tr>
		<tr><td colspan="2">&nbsp;<b><%=LANG["str_opensslciphers"]%>:</b></td></tr>
		<tr><td><textarea id="opensslciphers" style="width:490px;height:40px;font-size:9pt;"><%=c_GetGlobalOptionStr(GOPTION_OPENSSL_CIPHERS)%></textarea></td>
		<td><button onclick='resetCiphers();'><span><em><%=LANG["button_resetdefault"]%></em></span></button></td></tr>
		<tr><td colspan="2">&nbsp;<b><%=LANG["str_sftpkex_algos"]%>:</b></td></tr>
		<tr><td><textarea id="sftp_kex_algos" style="width:490px;height:40px;font-size:9pt;"><%=c_GetGlobalOptionStr(GOPTION_SFTP_KEX_ALGOS)%></textarea></td>
		<td><button onclick='resetKexAlgos();'><span><em><%=LANG["button_resetdefault"]%></em></span></button></td></tr>
		<tr><td colspan="2">&nbsp;<b><%=LANG["str_sftpenc_algos"]%>:</b></td></tr>
		<tr><td><textarea id="sftp_enc_algos" style="width:490px;height:25px;font-size:9pt;"><%=c_GetGlobalOptionStr(GOPTION_SFTP_ENC_ALGOS)%></textarea></td>
		<td><button onclick='resetEncAlgos();'><span><em><%=LANG["button_resetdefault"]%></em></span></button></td></tr>
		<tr><td colspan="2">&nbsp;<b><%=LANG["str_sftpmac_algos"]%>:</b></td></tr>
		<tr><td><textarea id="sftp_mac_algos" style="width:490px;height:25px;font-size:9pt;"><%=c_GetGlobalOptionStr(GOPTION_SFTP_MAC_ALGOS)%></textarea></td>
		<td><button onclick='resetMacAlgos();'><span><em><%=LANG["button_resetdefault"]%></em></span></button></td></tr>
		<tr><td colspan="2">&nbsp;<b><%=LANG["str_sftphostkey_algos"]%>:</b></td></tr>
		<tr><td><textarea id="sftp_hostkey_algos" style="width:490px;height:25px;font-size:9pt;"><%=c_GetGlobalOptionStr(GOPTION_SFTP_HOST_KEY)%></textarea></td>
		<td><button onclick='resetHostkeyAlgos();'><span><em><%=LANG["button_resetdefault"]%></em></span></button></td></tr>
		</table>
	</div>
	<div id="tagContent3">
		<table cellSpacing="0" cellPadding="0" border="0">
		<tr><td style="padding-top:15px;">
		<input type="checkbox" id="enable_old_webadmin" <%if c_GetGlobalOptionInt(GOPTION_OLD_WEBADMIN) == 1 then print("checked") end%>><b><%=LANG["str_old_webadmin"]%></b>
		</td></tr>
		<tr><td style="padding-top:40px;">
		<fieldset>
			<legend><b><%=LANG["str_customlogo"]%></b></legend>
			<table width="100%" border="0" cellpadding="2" cellspacing="1">
			<tr>
			<td><%=LANG["str_logopath"]%>: </td><td>
			<input id="strLogoPath" type="text" style="width:270px;">
			<button id="chooseLogo" onclick='chooseLogoFile();'><span><em><%=LANG["button_choose"]%></em></span></button>
			</td>
			</tr>
			<tr>
			<td></td>
			<td>
			<button onclick='makeLogo();'><span><em><%=LANG["str_makelogo"]%></em></span></button>
			<button onclick='resetLogo();'><span><em><%=LANG["button_resetdefault"]%></em></span></button>
			</td>
			</tr>
			<tr>
			<td colspan="2" height="10">&nbsp;</td>
			</tr>
			<tr>
			<td>&nbsp;</td><td>
			<img src="images/logo.png?r=<%=imageID%>" id="logoPreview<%=imageID%>">
			</td>
			</tr>
			</table>
		</fieldset>
		</td></tr>
		</table>
	</div>
  	<div id="tagContent4">
		<table width="100%" cellSpacing="0" cellPadding="2" border="0">
		<tr><td colspan="2"><input type="checkbox" id="enable_auditing" <%if c_GetGlobalOptionInt(GOPTION_AUDIT_ENABLE_INT) == 1 then print("checked") end%>><b><%=LANG["str_enable_audit"]%></b></td></tr>
		<tr><td height="30" width="32%"><%=LANG["str_audit_database"]%>:</td><td><input id="audit_db_filename" type="text" style="width:240px;" disabled value="<%=c_GetGlobalOptionStr(GOPTION_AUDITDB_FILENAME_STR)%>"></td></tr>
		<tr><td height="20" colspan="2">&nbsp;</td></tr>
		<tr><td colspan="2"><input type="checkbox" id="enable_systemlog" <%if c_GetGlobalOptionInt(GOPTION_SYSTEM_LOGFILE_ENABLE_INT) == 1 then print("checked") end%>><b><%=LANG["str_systemlog_enable"]%></b></td></tr>
		<tr><td height="30"><%=LANG["str_log_filename"]%>:</td><td><input id="systemlog_filename" type="text" style="width:240px;" disabled value="<%=c_GetGlobalOptionStr(GOPTION_SYSTEM_LOGFILE_FILENAME_STR)%>"></td></tr>
		<tr><td height="20" colspan="2"><%=LANG["str_logwildcard_tip"]%>:</td></tr>
		<tr><td height="20" colspan="2">%Y=<%=LANG["str_year"]%>&nbsp;&nbsp;&nbsp;%M=<%=LANG["str_month"]%>&nbsp;&nbsp;&nbsp;%D=<%=LANG["str_day"]%>&nbsp;&nbsp;&nbsp;%MM=<%=LANG["str_month"]%> (01-12)&nbsp;&nbsp;&nbsp;%DD=<%=LANG["str_day"]%> (01-31)&nbsp;&nbsp;&nbsp;%HH=<%=LANG["str_hour"]%> (00-23)</td></tr>
		<tr><td height="50"><%=LANG["str_log_maxsize"]%>:</td><td><input id="systemlog_maxsize" type="text" style="width:120px;" disabled value="<%=c_GetGlobalOptionInt(GOPTION_SYSTEM_LOGFILE_MAXSIZE_INT)%>">KB (0 = <%=LANG["str_nolimit"]%>)</td></tr>
		
		<tr><td height="20" colspan="2">&nbsp;</td></tr>
		<tr><td height="30">
			<b><%=LANG["str_sftplog_level"]%>:</b>
		</td><td>
			<select id="sftplog_level" style="width:180px;">
			<option value="0">SSH_LOG_NOLOG</option>
			<option value="1">SSH_LOG_WARNING</option>
			<option value="2">SSH_LOG_PROTOCOL</option>
			<option value="3">SSH_LOG_PACKET</option>
			<option value="4">SSH_LOG_FUNCTIONS</option>
			</select> (<%=c_GetGlobalOptionStr(GOPTION_SSHLOG_PATH)%>)
		</td></tr>

		<!--
		<tr><td height="20" colspan="2">&nbsp;</td></tr>
		<tr><td colspan="2">
		<table cellSpacing="0" cellPadding="0" border="0">
		<tr><td width="40"><b><%=LANG["str_log_file"]%></b></td><td width="80"><b><%=LANG["str_log_screen"]%></b></td><td><b><%=LANG["str_log_field"]%></b></td></tr>
		<tr><td><input type="checkbox" id="enable_logfile_system" <%if c_GetGlobalOptionInt(GOPTION_SYSTEM_LOGFILE_SYSTEM_ENABLE_INT) == 1 then print("checked") end%>></td><td><input type="checkbox" id="enable_logscrn_system" <%if c_GetGlobalOptionInt(GOPTION_SYSTEM_LOGSCREEN_SYSTEM_ENABLE_INT) == 1 then print("checked") end%>></td><td><%=LANG["str_field_system"]%></td></tr>
		<tr><td><input type="checkbox" id="enable_logfile_task" <%if c_GetGlobalOptionInt(GOPTION_SYSTEM_LOGFILE_TASK_ENABLE_INT) == 1 then print("checked") end%>></td><td><input type="checkbox" id="enable_logscrn_task" <%if c_GetGlobalOptionInt(GOPTION_SYSTEM_LOGSCREEN_TASK_ENABLE_INT) == 1 then print("checked") end%>></td><td><%=LANG["str_field_task"]%></td></tr>
		</table>	
		</td></tr>
		-->
		</table>
	</div>
	<div id="tagContent5">
		<table id="listhead2" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">

		<tr><td>
		<table cellSpacing="0" cellPadding="0" border="0"><tr>
		<td><img src="images/ip48.png">&nbsp;&nbsp;&nbsp;</td><td><%=LANG["str_serverip_tip"]%></td>
		</tr></table>
		</td></tr>

		<tr>
		<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #919B9C;">
			<tr>
			<td class="listhead" width="50%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable2', 0);"><%=LANG["title_ip"]%></td>
			<td class="listhead" width="20%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable2', 1);"><%=LANG["title_allowdeny"]%></td>
			<td class="listhead" width="30%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable2', 2);"><%=LANG["str_comment"]%></td>
			</tr>
			<tr>
			<td colspan="3">
			<span id="listview_div2" style="float:left; height:250px; width:100%; background-color:#FFF; overflow:auto; overflow-x:hidden;">
			<table id="listtable2" width="100%" border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed;"></table>
			</span>
			</td></tr>
		</table>
		</td></tr>

		<tr>
		<td>
		<button onclick="AddBlockIP();"><span><em><%=LANG["button_addblockip"]%></em></span></button><button onclick="ModifyBlockIP();"><span><em><%=LANG["button_modify"]%></em></span></button><button onclick="DeleteBlockIP();"><span><em><%=LANG["button_delete"]%></em></span></button><button onclick="UpBlockIP();"><span><em><%=LANG["button_up"]%></em></span></button><button onclick="DownBlockIP();"><span><em><%=LANG["button_down"]%></em></span></button>
		</td>
		</tr>
		</table>
	</div>
	<div id="tagContent6">
		<table id="listhead3" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">

		<tr><td>
		<table cellSpacing="0" cellPadding="0" border="0"><tr>
		<td><img src="images/file48.png">&nbsp;&nbsp;&nbsp;</td><td><%=LANG["str_serverfile_tip"]%></td>
		</tr></table>
		</td></tr>

		<tr>
		<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #919B9C;">
			<tr>
			<td class="listhead" width="70%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable3', 0);"><%=LANG["title_file"]%></td>
			<td class="listhead" width="30%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable3', 1);"><%=LANG["title_allowdeny"]%></td>
			</tr>
			<tr>
			<td colspan="2">
			<span id="listview_div3" style="float:left; height:250px; width:100%; background-color:#FFF; overflow:auto; overflow-x:hidden;">
			<table id="listtable3" width="100%" border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed;"></table>
			</span>
			</td></tr>
		</table>
		</td></tr>

		<tr>
		<td>
		<button onclick="AddBlockfile();"><span><em><%=LANG["button_addblockfile"]%></em></span></button><button onclick="ModifyBlockfile();"><span><em><%=LANG["button_modify"]%></em></span></button><button onclick="DeleteBlockfile();"><span><em><%=LANG["button_delete"]%></em></span></button><button onclick="UpBlockfile();"><span><em><%=LANG["button_up"]%></em></span></button><button onclick="DownBlockfile();"><span><em><%=LANG["button_down"]%></em></span></button>			
		</td>
		</tr>
		</table>
	</div>

  </div>	
</div>

<div style="padding:3px;text-align:right;margin-right:10px;">
<button type='submit' onclick='doSubmit();'><span><em><%=LANG["button_submit"]%></em></span></button>&nbsp;
<button onclick='top.closewindow();'><span><em><%=LANG["button_cancel"]%></em></span></button>
</div>

<script type="text/javascript">

Init();

$("max_thread_num").value = ThreadNum;
$("sftplog_level").value = SftpLogLevel;

$("tagContent1").style.display="block";
$("tags").getElementsByTagName("li")[1].className="selectedTag";


$("enable_systemlog").onclick = function()
{
	$("systemlog_filename").disabled = ($("enable_systemlog").checked ? false : true);
	$("systemlog_maxsize").disabled = ($("enable_systemlog").checked ? false : true);
}

if($("enable_systemlog").checked)
{
	$("systemlog_filename").disabled = ($("enable_systemlog").checked ? false : true);
	$("systemlog_maxsize").disabled = ($("enable_systemlog").checked ? false : true);
}

$("enable_auditing").onclick = function()
{
	$("audit_db_filename").disabled = ($("enable_auditing").checked ? false : true);
}

if($("enable_auditing").checked)
{
	$("audit_db_filename").disabled = ($("enable_auditing").checked ? false : true);
}

//$("enable_fips").onclick = function()
//{
//	alert("<%=LANG['str_enablefips_tip']%>");
//}


function switchTag(tagContent,obj){

	for(var i=1; i<$("tags").getElementsByTagName("li").length; i++)
	{
		$("tags").getElementsByTagName("li")[i].className="normalTag";
	}
	obj.parentNode.className="selectedTag";
	
	for(var j=0; j<$("tagContent").getElementsByTagName("div").length; j++)
	{
		$("tagContent").getElementsByTagName("div")[j].style.display="none";
	}
	$(tagContent).style.display="block";
	selectedRow = null;
	lastsortcol = -1;
	if(lastObj != null)
		lastObj.className = "listtr01";
}

</script>
</body>
</html>

<% 
else
	print("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>")
	print("<script>alert('"..LANG["session_expire"].."');top.location='admin_login.html';</script>")
end 
%>

<noscript><center><H2><%=LANG["error_nojavascript"]%></H2></center></noscript>