<!--#include file="sdcms_check.asp"-->
<%
set sdcms=new Sdcms_Admin
sdcms.Check_admin
sdcms.Check_lever 1
set sdcms=nothing
select case action
case else:title="系统设置"
end select
sd_table="sd_const"
sdcms_head
Function clear_bad(t0)
clear_bad=Replace(t0,"""","")
clear_bad=Replace(t0,CHR(10),"")
End Function
%>
<div class="sdcms_notice"><span>管理操作：</span><a href="?">基本设置</a><!--　┊　<a href="?">会员设置</a>--></div>
<br>
<ul id="sdcms_sub_title">
	<li class="sub"><a href="javascript:void(0)" onClick="selectTag('tagContent0',this)"><%=title%></a></li>
	<li class="unsub"><a href="javascript:void(0)" onClick="selectTag('tagContent1',this)">评论设置</a></li>
	<li class="unsub"><a href="javascript:void(0)" onClick="selectTag('tagContent2',this)">过滤设置</a></li>
	<li class="unsub"><a href="javascript:void(0)" onClick="selectTag('tagContent3',this)">偏好设置</a></li>
	<!--<li class="unsub" title="未开放">水印设置</li>-->
</ul>
<div id="sdcms_right_b">
<%
select case action
case "save":save
case else:main
end select
closedb
sub main
sql="select id,webname,weburl,sysdir,filetxt,webkey,webdec,webcopy,comment_pass,comment_ispass,comment_html,comment_event,comment_badtext,syscookies,editor_type,upfiledir,create_set,filename,htmldir from "&sd_table&" where id=1"
set rs=conn.execute(sql)
if rs.eof then
echo "请勿非法提交参数":Died
end if
check_info
%><form name="add" method="post" action="?action=save&act=save&id=<%=id%>" onSubmit='return checkadd()'>
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1"  id="tagContent0">
    <tr>
      <td width="12%" align="center" class="tdbg">网站名称：      </td>
      <td class="tdbg"><input name="t0" type="text" class="input" value="<%=rs(1)%>" size="30"></td>
    </tr>
    <tr class="tdbg">
      <td align="center">网站域名：      </td>
      <td><input name="t1" type="text" class="input" value="<%=rs(2)%>"  size="30"> <span>形式为：http://www.sdcms.cn　不需要加“/”</span></td>
    </tr>
	<tr class="tdbg">
      <td align="center">系统目录：</td>
      <td><input name="t2" type="text" class="input" value="<%=rs(3)%>"  size="30"> <span>根目录为："/",虚拟目录形式为："/sdcms/"</span></td>
    </tr>
	<tr class="tdbg">
      <td align="center">Cookies：</td>
      <td><input name="t12" type="text" class="input" value="<%=rs(13)%>"  size="30"> <span>如果有多个站点，请设置不同的值</span></td>
    </tr>
	<tr class="tdbg">
      <td align="center">编 辑 器：</td>
      <td><select name="t13" id="t13">
        <option value="0" <%=w_select(rs(14),0)%>>WYSIWYG Editor</option>
        <option value="1" <%=w_select(rs(14),1)%>>ewebeditor(仅IE使用)</option>
      </select> 
      </td>
    </tr>
	<tr class="tdbg">
      <td align="center">附件目录：</td>
      <td><input name="t14" type="text" class="input" value="<%=rs(15)%>"  size="30"> <span>更改默认设置后请手动更改文件夹名称,可能会影响以前的信息</span></td>
    </tr>
	<tr class="tdbg">
      <td align="center">关 键 字：</td>
      <td><textarea name="t4"  rows="5"  class="inputs" id="t4"><%=rs(5)%></textarea></td>
    </tr>
	<tr class="tdbg">
      <td align="center">网站描述：</td>
      <td><textarea name="t5"  rows="5"  class="inputs" id="t5"><%=rs(6)%></textarea></td>
	</tr>
	<!--<tr class="tdbg">
      <td align="center">版权信息：</td>
      <td><textarea name="t6"  rows="6"  class="inputs" id="t6"><%=rs(7)%></textarea></td>
	</tr>-->
	</table>
	
	<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1"  class="dis" id="tagContent1">
	<tr class="tdbg">
      <td align="center" width="14%">评论开关：</td>
      <td><input name='t7' type='radio' value='0' <%=w_check(rs(8),0)%>>关闭 <input name='t7' type='radio'  value='1' <%=w_check(rs(8),1)%>>开启</td>
    </tr>
	<tr class="tdbg">
      <td align="center" width="12%">评论审核：</td>
      <td><input name='t8' type='radio' value='0' <%=w_check(rs(9),0)%>>关闭 <input name='t8' type='radio'  value='1' <%=w_check(rs(9),1)%>>开启</td>
    </tr>
	</table>
	<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1"  class="dis" id="tagContent2">
	<tr class="tdbg">
      <td align="center">HTML标签过滤：</td>
      <td><textarea name="t9"  rows="6" class="inputs"><%=rs(10)%></textarea><span><br>多标签请用“|”分隔</span></td>
	</tr>
	<tr class="tdbg">
      <td align="center">HTML事件过滤：</td>
      <td><textarea name="t10" rows="6" class="inputs"><%=rs(11)%></textarea><span><br>多标签请用“|”分隔</span></td>
	</tr>
	<tr class="tdbg">
      <td align="center">脏话过滤：</td>
      <td><textarea name="t11" rows="6" class="inputs"><%=rs(12)%></textarea><span><br>多标签请用“|”分隔</span></td>
	</tr>
	</table>
	<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="dis" id="tagContent3">
	<tr class="tdbg">
      <td align="center">生成目录：</td>
      <td><input name="t17" type="text" class="input" value="<%=rs(18)%>"  size="30"> <span>根目录为空",也可以指定为某一目录，形式为："sdcms/"</span></td>
    </tr>
	<tr class="tdbg">
      <td align="center">文件名称：</td>
      <td><input name="t16" type="text" class="input" value="<%=rs(17)%>"  size="30"> <span><br>可用标签：{id}：编号　{y}:年　{m}:月　{d}:日　{h}:时　{mm}:分　{s}:秒,不支持"/"</span></td>
    </tr>
	<tr class="tdbg">
      <td align="center">文件后缀：</td>
      <td><select name="t3" id="t3">
	    <option selected>请选择文件后缀</option>
		<option value=".htm" <%=w_select(rs(4),".htm")%>>.htm</option>
        <option value=".html" <%=w_select(rs(4),".html")%>>.html</option>
        <option value=".shtml" <%=w_select(rs(4),".shtml")%>>.shtml(需要空间支持)</option>
      </select> 
        <span>如果更改了后缀需要生成全站才会生效</span>
      </td>
    </tr>
	<tr class="tdbg">
      <td align="center">公告管理：</td>
      <td><%all_set="生成首页|生成分类|生成信息":all_set=split(all_set,"|"):for i=0 to ubound(all_set)%><input name="t15" type="checkbox" value="<%=i+1%>" <%if instr(", "&rs(16)&", ",", "&i+1&", ")>0 then echo "checked"%> id="<%=i+1%>"><label for="<%=i+1%>"><%=all_set(i)%></label>
	  <%next%></td>
    </tr>
	<tr class="tdbg">
      <td align="center">分类管理：</td>
      <td><%all_set="生成分类|生成地图":all_set=split(all_set,"|"):for i=0 to ubound(all_set)%><input name="t15" type="checkbox" value="<%=i+4%>" <%if instr(", "&rs(16)&", ",", "&i+4&", ")>0 then echo "checked"%> id="<%=i+4%>"><label for="<%=i+4%>"><%=all_set(i)%></label>
	  <%next%></td>
    </tr>
	<tr class="tdbg">
      <td align="center">信息管理：</td>
      <td><%all_set="允许评论|生成首页|生成分类|生成关联信息|生成信息":all_set=split(all_set,"|"):for i=0 to ubound(all_set)%><input name="t15" type="checkbox" value="<%=i+6%>" <%if instr(", "&rs(16)&", ",", "&i+6&", ")>0 then echo "checked"%> id="<%=i+6%>"><label for="<%=i+6%>"><%=all_set(i)%></label>
	  <%next%></td>
    </tr>
	</table>
	<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
    <tr class="tdbg">
	  <td>&nbsp;</td>
      <td><input name="Submit" type="submit" class="bnt" value="保 存"></td>
    </tr>
	</table>
	</form>
  
<%
end sub
sub save

t0=clear_bad(trim(request("t0")))
t1=clear_bad(trim(request("t1")))
t2=clear_bad(trim(request("t2")))
t3=clear_bad(trim(request("t3")))
t4=clear_bad(trim(request("t4")))
t5=clear_bad(trim(request("t5")))
t6=clear_bad(trim(request("t6")))
t7=clear_bad(trim(request("t7")))
t8=clear_bad(trim(request("t8")))
t9=clear_bad(trim(request("t9")))
t10=clear_bad(trim(request("t10")))
t11=clear_bad(trim(request("t11")))
t12=clear_bad(trim(request("t12")))
t13=trim(request("t13"))
t14=dir_check(trim(request("t14")))
t15=trim(request("t15"))
t16=trim(request("t16"))
t17=dir_check(trim(request("t17")))
if t17<>"" then t17=t17&"/"
select case t3
case ".htm",".html",".shtml"
case else:t3=".html"
end select
select case t13
case "0","1"
case else:t13=0
end select
set sdcms_f=new sdcms_function
t9=sdcms_f.check_event(t9,"|"):t10=sdcms_f.check_event(t10,"|"):t11=sdcms_f.check_event(t11,"|")
set sdcms_f=nothing

set rs=server.CreateObject("adodb.recordset")
sql="select webname,weburl,sysdir,filetxt,webkey,webdec,webcopy,comment_pass,comment_ispass,comment_html,"
sql=sql&"comment_event,comment_badtext,syscookies,editor_type,upfiledir,create_set,filename,htmldir from "&sd_table&" where id=1"
rs.open sql,conn,1,3
rs.update
rs(0)=left(t0,255)
rs(1)=left(t1,255)
rs(2)=left(t2,255)
rs(3)=left(t3,255)
rs(4)=left(t4,255)
rs(5)=left(t5,255)
rs(6)=left(t6,255)
rs(7)=left(t7,255)
rs(8)=left(t8,255)
rs(9)=left(t9,2550)
rs(10)=left(t10,2550)
rs(11)=left(t11,2550)
rs(12)=left(t12,50)
rs(13)=left(t13,50)
rs(14)=left(t14,50)
rs(15)=t15
rs(16)=left(t16,255)
rs(17)=left(t17,255)
rs.update
conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','修改系统设置')")
rs.close
set rs=nothing
set fso=server.CreateObject("scripting.filesystemobject")
set info=fso.CreateTextFile(Server.mappath("../inc/const.asp"),true)
info.write "<" & "%" & vbcrlf
info.write "'网站名称" & vbcrlf
info.write "Const sdcms_webname=" & chr(34) & t0 & chr(34) & "" & vbcrlf
info.write "'网站域名" & vbcrlf
info.write "Const sdcms_weburl=" & chr(34) & t1 & chr(34) & "" & vbcrlf
info.write "'系统目录，根目录为：""/"",虚拟目录形式为：""/sdcms/""" & vbcrlf
info.write "Const sdcms_root=" & chr(34) & t2 & chr(34) & "           " & vbcrlf  
info.write "'生成目录，根目录为空,也可以指定为某一目录，形式为：""sdcms/"",必须以：""/""结束" & vbcrlf
info.write "Const sdcms_htmdir=" & chr(34) & t17 & chr(34) & "           " & vbcrlf 
info.write "'如果有多个站点，请设置不同的值" & vbcrlf
info.write "Const sdcms_cookies=" & chr(34) & t12 & chr(34) & "           " & vbcrlf  
info.write "'系统生成文件的后缀名，建议不要改动" & vbcrlf
info.write "Const sdcms_filetxt=" & chr(34) & t3 & chr(34) & "           " & vbcrlf
info.write "'系统生成文件的默认文件名，建议不要改动" & vbcrlf
info.write "Const sdcms_filename=" & chr(34) & t16 & chr(34) & "           " & vbcrlf
info.write "'附件目录" & vbcrlf
info.write "Const sdcms_upfiledir=" & chr(34) & t14 & chr(34) & "           " & vbcrlf
info.write "'生成偏好设置,系统自动生成，请务随意改动" & vbcrlf
info.write "Const sdcms_create_set=" & chr(34) & t15 & chr(34) & "           " & vbcrlf
info.write "'编辑器选择" & vbcrlf
info.write "Const sdcms_editor_type="  & t13 & "" & vbcrlf
info.write "'版权信息" & vbcrlf
info.write "'Const sdcms_webcopy=" & chr(34) & t6 & chr(34) & "" & vbcrlf
info.write "'评论开关" & vbcrlf
info.write "Const sdcms_comment_pass=" &  t7 &  "" & vbcrlf
info.write "'评论审核" & vbcrlf
info.write "Const sdcms_comment_ispass=" &  t8 &  "" & vbcrlf
info.write "'html标签过滤" & vbcrlf
info.write "Const sdcms_badhtml=" & chr(34) & t9 & chr(34) & "" & vbcrlf
info.write "'html标签事件过滤" & vbcrlf
info.write "Const sdcms_badEvent=" & chr(34) & t10 & chr(34) & "" & vbcrlf
info.write "'脏话过滤" & vbcrlf
info.write "Const sdcms_badtext=" & chr(34) & t11 & chr(34) & "" & vbcrlf
info.write "%" & ">"
info.close
set info=nothing
set fso=nothing

echo "<script>alert('修改成功！');location.href='?';</script>"
end sub

sub check_info
with response
.write("	<script>")
.write("	function checkadd()")
.write("	{")
.write("	if (document.add.t0.value=='')")
.write("	{")
.write("	alert('网站名称不能为空');")
.write("	document.add.t0.focus;")
.write("	return false")
.write("	}")
.write("	if (document.add.t1.value=='')")
.write("	{")
.write("	alert('网站域名不能为空');")
.write("	document.add.t1.focus;")
.write("	return false")
.write("	}")
.write("	if (document.add.t2.value=='')")
.write("	{")
.write("	alert('系统路径不能为空');")
.write("	document.add.t2.focus;")
.write("	return false")
.write("	}")
.write("	if (document.add.t3.value=='')")
.write("	{")
.write("	alert('请选择文件后缀');")
.write("	document.add.t3.focus;")
.write("	return false")
.write("	}")
.write("	}")
.write("	</script>")
end with
end sub
%>  
</div>

</body>
</html>