<!--#include file="sdcms_check.asp"-->
<%
set sdcms=new Sdcms_Admin
sdcms.Check_admin
sdcms.Check_lever 6
set sdcms=nothing
select case action
case "add","edit","save","del","pass","nice","top","makehtml":title="基本设置"
case else:stype="main":title="信息管理"
end select
sd_table="sd_info"
sd_table01="sd_count"
sd_table02="sd_comment"
sdcms_head
set sdcms_f=new sdcms_function
classid=sdcms_f.Requestint(classid)
keyword=trim(request("keyword"))
if classid<>0 then tj=" and classid in("&sdcms_f.get_son_classid(classid)&") "
set sdcms_f=nothing
page=request.querystring("page")
if page="" or not isnumeric(page) then
page=1
end if
%>
<div class="sdcms_notice"><span>管理操作：</span><a href="?action=add">添加信息</a>　┊　<a href="?">信息管理</a></div>
<br>
<ul id="sdcms_sub_title">
	<li class="sub"><a<%if stype<>"main" then%> href="javascript:void(0)" onClick="selectTag('tagContent0',this)"<%end if%>><%=title%></a></li>
	<%if stype<>"main" then%>
	<li class="unsub"><a href="javascript:void(0)" onClick="selectTag('tagContent1',this)">参数设置</a></li><li class="unsub"><a href="javascript:void(0)" onclick="$('upfiles').style.visibility='inherit'">附件上传</a></li>
	<%end if%>
	<%if stype="main" then%><li class="unsub"><a onclick="$('search').style.visibility='inherit'">信息搜索</a></li><%end if%>
</ul><div style="visibility:hidden;position:absolute;margin:0 0 0 176px;*margin:-27px 0 0 176px;border:1px solid #FCBA72;background:#fff;padding:5px 10px;width:300px;" id="upfiles"><img src="images/close.gif"  style="position:absolute;margin:10px 0 0 242px;cursor:pointer;" onclick="$('upfiles').style.visibility='hidden'" alt="关闭" /><%admin_upfile 3,"280","30",1%></div><div style="visibility:hidden;position:absolute;margin:0 0 0 176px;*margin:-27px 0 0 88px;border:1px solid #FCBA72;background:#fff;padding:5px 10px;" id="search"><form action="?classid=<%=classid%>&page=<%=page%>">关键字：<input name="keyword" class="input" value="<%=keyword%>" /> <input type="submit" class="bnt01" value="搜索"></form>
</div>
<div id="sdcms_right_b">
<%
select case action
case "add":add
case "edit":edit
case "save":save
case "pass":pass
case "nice":nice
case "top":top
case "makehtml":makehtml
case "del":del
case else:main
end select
closedb
sub main
%>
  <table border="0" align="center" cellpadding="3" cellspacing="1" class="table_b">
   <form name="add" action="?" method="post"  onSubmit="return confirm('确定要执行选定的操作吗？');"> 
	<tr>
	  <td class="title_bg">选择</td>
      <td width="200"  class="title_bg">标题</td>
      <td class="title_bg">评论</td>
      <!--<td class="title_bg">人气</td> -->
	  <td class="title_bg">外部连接</td>
	  <td class="title_bg">图片标题</td>
	  <td class="title_bg">状态</td>
      <td class="title_bg">管理</td>
    </tr>
	<%
	pages = 20
	set rs=server.CreateObject("adodb.recordset")
	sql="select id,title,comment_num,hits,"
	if Is_sql=0 then
		sql=sql&"(iif(isurl=0,'<span>否</span>','是')),(iif(ispic=0,'<span>否</span>','是'))"
	else
		sql=sql&"(case isurl when 0 then '<span>否</span>' else '是' end),(case ispic when 0 then'<span>否</span>' else '是' end)"
	end if
	sql=sql&",ispass,isnice,ontop,classid,htmlname,iscreate from "&sd_table&" "
	if session(sdcms_cookies&"sdcms_admin")=0 then
		if session(sdcms_cookies&"sdcms_infolever")<>"" then
		set sdcms=new sdcms_admin
			sql=sql&" where (title like '%"&keyword&"%' or id like '%"&keyword&"%') and "&sdcms.check_info_lever&" "&tj&" "
		set sdcms=nothing
		else
		  sql=sql&" where (title like '%"&keyword&"%' or id like '%"&keyword&"%') and classid<0 "
		end if
	else
		sql=sql&" where (title like '%"&keyword&"%' or id like '%"&keyword&"%') "&tj&" "
	end if
	sql=sql&" order by ontop desc,id desc"
	'echo sql:died
	rs.open sql,conn,1,1
	if rs.eof then
	else
	rs.pagesize = pages
	maxpagecount=rs.pagecount
	rs.absolutepage = page 
	rcount1=0
	pagestart=page-5
	pageend=page+5
	if pagestart<1 then
	pagestart=1
	end if
	if pageend>maxpagecount then
	pageend=maxpagecount
	end if
	rcount=rs.RecordCount
	do while not rs.eof and rcount1 <rs.pagesize  
	%>
    <tr onmouseover=this.bgColor='#EBFFDC'; onmouseout=this.bgColor='#ffffff';  bgcolor='#ffffff'>
	<td align="center"><input name="id"  type="checkbox" onClick="unselectall()"   value="<%=rs(0)%>"></td>
	 <%for i=1 to 5%>
	 	<%if i<> 3 then%>
      <td <%if i<>1 then%>align="center"<%end if%>  class="tdbg"><a <%
	  set sdcms=new sdcms_function
	  select case i
	  case "1":echo "href="&sdcms_root&sdcms_htmdir&sdcms.LoadRecord("classdir","sd_class",rs(9))&rs(10)&sdcms_filetxt&" target=""_blank"""
	  case "2":echo "href=sdcms_comment.asp?classid="&rs(0)&""
	  end select
	  set sdcms=nothing
	  %>><%=rs(i)%></a></td>
	  	<%end if%>
      <%next%>
	  <td align="center" class="tdbg">
	  <%
	  select case rs(6)
	  case "1":echo "已验证"
	  case else:echo "<span>未验证</span>"
	  end select
	  echo "&nbsp;"
	  select case rs(7)
	  case "1":echo "已推荐"
	  case else:echo "<span>未推荐</span>"
	  end select
	  echo "&nbsp;"
	  select case rs(8)
	  case "1":echo "已置顶"
	  case else:echo "<span>未置顶</span>"
	  end select
	  echo "&nbsp;"
	  select case rs(11)
	  case "1":echo "已生成"
	  case else:echo "<span>未生成</span>"
	  end select
	  %>
	  </td>
      <td align="center"><a href="?action=makehtml&id=<%=rs(0)%>">生成</a> <a href="?action=edit&id=<%=rs(0)%>">编辑</a> <a href="?action=del&id=<%=rs(0)%>" onclick='return confirm("真的要删除?不可恢复!");'>删除</a></td>
    </tr>
	<%
	rs.movenext
	rcount1=rcount1+1
	loop
	end if         
	%>
	<tr>
      <td colspan="7" class="tdbg" >
	  <span class="right"><select onchange="location.href='?classid='+this.value+'&page=<%=page%>'"><option value="0">所有分类</option><%ssort 0,classid%></select></span>　<input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox"> 全选 
              <select name="action">
			  <option>→操作</option>
			  <option value="pass">通过验证</option>
			  <option value="nice">设为推荐</option>
			  <option value="top">设为置顶</option>
			  <option value="makehtml">生成信息</option>
			  <option value="del">删除信息</option>
			  </select>  
      <input type="submit" class="bnt01" value="执行">

</td>
    </tr>
	<%if rcount>0 then%>
	<tr>
      <td colspan="8" class="tdbg" align="center">
	  <span class="right">转到第
		 <select onChange="location.href='?page='+this.value+'&page=<%=page%>&classid=<%=classid%>&keyword=<%=keyword%>'">
		 <%for i=1 to maxpagecount%>
		 <option value="<%=i%>" <%if clng(page)=clng(i) then echo "selected" end if%>><%=i%></option>
		 <%next%>
		 </select>页</span>
<%
if page<>"1" then
echo "<a href=?page="&page-1&"&classid="&classid&"&keyword="&keyword&">上一页</a> "
else
echo "上一页 "
end if
for i=pagestart to pageend
if i=0 then 
i=1
end if
if i=clng(page) then
str="<font color=red><b>"&i&"</b></font>"
else
str=i
end if
strurl="[<a href=?page="&i&"&classid="&classid&"&keyword="&keyword&">"&str&"</a>]"
echo strurl
next
if page=maxpagecount then
echo " 下一页"
elseif  page<>""&maxpagecount&"" then
echo " <a href=?page="&page+1&"&classid="&classid&"&keyword="&keyword&">下一页</a>"
else
echo " 下一页"
end if
echo " 页次:"&page&"/"&maxpagecount&" 页   每页: "&pages&" 条  总数: "&rcount&" 条"
rs.close
set rs=nothing
%>
</td>
    </tr>
	<%end if%>
	</form>
  </table>

<%
end sub
sub add
check_info
set sdcms_f=new Sdcms_Function
%><form name="add" method="post" action="?action=save&act=add" onSubmit='return checkadd()'>
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" id="tagContent0">
	<tr>
      <td width="100" align="center" class="tdbg">信息标题：      </td>
      <td  class="tdbg"><input name="t0" type="text" class="input" id="t0" size="40"><input type="checkbox" onclick='Display("sdcms_pic")' />图片标题<input type="checkbox" onclick='Display("sdcms_tags")' />标签</td>
    </tr>
    <tr class="tdbg" id="sdcms_pic" style="display:none">
      <td align="center" >图片标题：</td>
      <td><input name="t11" type="text" class="input" id="t11" size="40"> <span>可以为空</span><input type="checkbox" onclick='Display("sdcms_uppic")' />上传图片<span id="sdcms_uppic" style="display:none"><%admin_upfile 1,"40%","30",0%></span></td>
    </tr>
	<tr>
      <td  align="center" class="tdbg">类别选择：      </td>
      <td class="tdbg"><select name='t13'><option value="">请选择分类</option><%ssort 0,0%></select></td>
    </tr>
	<tr id="sdcms_tags" style="display:none;">
      <td align="center" class="tdbg">标签索引：      </td>
      <td  class="tdbg"><input name="t17" type="text" class="input" id="t17" size="40" maxlength="250"> <span>如果有多个，请用“,”格开</span></td>
    </tr>
    <tr class="tdbg">
      <td align="center">外部连接：</td>
      <td><input name='t2' type='radio' onClick=$("flag").style.display='none';this.form.t3.disabled=true;$("c").style.display='block';this.form.t4.disabled=false;  checked value='0' >否 <input name='t2' type='radio' onClick=$("flag").style.display='block';this.form.t3.disabled=false;$("c").style.display='none';this.form.t4.disabled=true; value='1' >是</td>
    </tr>
    <tr class="tdbg dis" id='flag'>
      <td align="center">连接地址：</td>
      <td><input name="t3" type="text" disabled="disabled" class="input" id="t3" size="40"> <span>请填写完整路径 如：http://www.sdcms.cn</span></td>
    </tr>
   <tr class="tdbg" id="c">
      <td align="center">信息内容：</td>
      <td><%if sdcms_editor_type=0 then%><span id="loadedit" style="font-size:12px"><img src='../editor/loading.gif' align='absbottom'> 正在载入编辑器...</span><%elseif sdcms_editor_type=1 then
	  set sdcms=new Sdcms_Function
	sdcms.ewebEditor "t4","600","300"
	set sdcms=nothing
	 end if%><textarea name="t4" id="t4" style="display:none"></textarea><br><input name="t15" id="t15" type="checkbox" value="1" /><label for="t15">保存远程图片</label><%all_set="允许评论|生成首页|生成分类|生成关联信息|生成信息":all_set=split(all_set,"|"):for i=0 to ubound(all_set)%><input name="up<%=i+1%>" type="checkbox" value="1" <%if instr(", "&sdcms_create_set&", ",", "&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" id="tagContent1" class="dis">
	<tr class="tdbg">
      <td align="center" width="100">作　者：      </td>
      <td><input name="t1" value="" type="text" class="input" id="t1" size="40"></td>
    </tr>
	<tr class="tdbg">
      <td align="center">人　气：      </td>
      <td><input name="t5"   type="text" maxlength="6" value="0" onKeypress='if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;' class="input" id="t5" size="40"> <span>可自定义数字，最高不超过“999999”</span></td>
    </tr>
	<tr class="tdbg">
      <td align="center">推　荐：      </td>
      <td><input type='radio' name='t6' value='1'>是 <input type='radio' name='t6' value='0' checked="checked">否</td>
    </tr>
	<tr class="tdbg">
      <td align="center">置　顶：      </td>
      <td><input type='radio' name='t7' value='1'>是 <input type='radio' name='t7' value='0' checked="checked">否</td>
    </tr>
	<tr class="tdbg">
      <td align="center">验　证：      </td>
      <td><input type='radio' name='t8' value='1' checked="checked">是 <input type='radio' name='t8' value='0'>否</td>
    </tr>
	<tr class="tdbg">
      <td align="center">文件名：      </td>
      <td><input name="t16" value="<%=sdcms_filename%>"  type="text" class="input" size="40" /><%=sdcms_filetxt%>　<br><span>可自定义文件名，也可以使用系统标签进行搭配 如："{id}：编号　{y}:年　{m}:月　{d}:日"</span>
	  </td>
    </tr>
	<tr class="tdbg">
      <td align="center">关键字：      </td>
      <td><input name="t9"  type="text" class="input" id="t9" size="40"></td>
    </tr>
	<tr class="tdbg">
      <td align="center">描　述：      </td>
      <td valign="top"><textarea name="t10" cols="60" rows="6" class="inputs"></textarea><span><br>如果不填写则自动截取内容部分,不支持HTML</span></td>
    </tr>
	</table>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" >
    <tr class="tdbg">
	  <td width="100">&nbsp;</td>
      <td><input name="Submit" type="submit" class="bnt" value="添 加">
      <input type="button" onClick="history.go(-1)" class="bnt" value="返 回"> <%if sdcms_editor_type=1 then%><input type="button" onClick="eWebEditor1.insertHTML('$show_page$')" class="bnt" value="插入分页"><%end if%></td>
    </tr>
  </table>
  </form>
<%
if sdcms_editor_type=0 then
	sdcms_f.HtmlEditor 1,"t4","600","260",0
end if
set sdcms_f=nothing
end sub
sub edit
sql="select title,author,isurl,url,content,hits,isnice,ontop,ispass,keyword,jj,pic,ispic,classid,htmlname,tags,iscreate,iscomment  from "&sd_table&" where id="&id&""
set rs=conn.execute(sql)
if rs.eof then
echo "请勿非法提交参数":Died
end if
check_info
set sdcms_f=new Sdcms_Function
%>
  <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" value="<%=rs(0)%>" class="input" id="t0" size="40"><input type="checkbox" onclick='Display("sdcms_pic")' />图片标题<input type="checkbox" onclick='Display("sdcms_tags")' />标签</td>
    </tr>
    <tr class="tdbg" id="sdcms_pic" <%if rs(12)=0 then%>style="display:none"<%end if%>>
      <td align="center">图片标题：      </td>
      <td><input name="t11" type="text" value="<%=rs(11)%>" class="input" id="t11" size="40"> <span>可以为空</span><input type="checkbox" onclick='Display("sdcms_uppic")' />上传图片<span id="sdcms_uppic" style="display:none"><%admin_upfile 1,"40%","30",0%></span></td>
    </tr>
	<tr>
      <td align="center" class="tdbg">类别选择：      </td>
      <td class="tdbg"><select name='t13'><option>请选择分类</option><%ssort 0,rs(13)%></select></td>
    </tr>
	<tr id="sdcms_tags" <%if len(rs(15))<=0 then%>style="display:none;"<%end if%>>
      <td align="center" class="tdbg">标签索引：      </td>
      <td  class="tdbg"><input name="t17" type="text" value="<%=rs(15)%>" class="input" id="t17" size="40" maxlength="250"> <span>如果有多个，请用“,”格开</span></td>
    </tr>
    <tr class="tdbg">
      <td align="center">外部连接：</td>
      <td><input name='t2' type='radio' onClick=$("flag").style.display='none';this.form.t3.disabled=true;$('c').style.display='block';this.form.t4.disabled=false;  checked value='0' <%=w_check(rs(2),0)%>>否 <input name='t2' type='radio' onClick=$("flag").style.display='block';this.form.t3.disabled=false;$('c').style.display='none';this.form.t4.disabled=true; value='1' <%=w_check(rs(2),1)%>>是</td>
    </tr>
    <tr class="tdbg<%if rs(2)=0 then%> dis<%end if%>" id="flag">
      <td align="center">连接地址：</td>
      <td><input name="t3" type="text" value="<%=rs(3)%>" <%if rs(2)=0 then%>disabled="disabled"<%end if%> class="input" id="t3" size="40"> <span>请填写完整路径 如：http://www.sdcms.cn</span></td>
    </tr>
   <tr class="tdbg<%if rs(2)=1 then%> dis<%end if%>" id="c">
      <td align="center">信息内容：</td>
      <td><%if sdcms_editor_type=0 then%><span id="loadedit" style="font-size:12px"><img src='../editor/loading.gif' align='absbottom'> 正在载入编辑器...</span><%elseif sdcms_editor_type=1 then
	sdcms_f.ewebEditor "t4","600","300"
	 end if%><textarea name="t4" id="t4" style="display:none" <%if rs(2)=1 then%>disabled="disabled"<%end if%>><%if rs(2)=0 then echo sdcms_f.TempEncode(rs(4)) end if%></textarea>
	  <br><input name="t15" id="t15" type="checkbox" value="1" /><label for="t15">保存远程图片</label><%all_set="允许评论|生成首页|生成分类|生成关联信息|生成信息":all_set=split(all_set,"|"):for i=0 to ubound(all_set)%><input name="up<%=i+1%>" type="checkbox" value="1" <%if i=0 then%><%=w_check(rs(17),1)%><%else%><%if instr(", "&sdcms_create_set&", ",", "&i+6&", ")>0 then echo "checked"%><%end if%> 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" id="tagContent1" class="dis">
	<tr class="tdbg">
      <td align="center" width="12%">作　者：      </td>
      <td><input name="t1" value="<%=rs(1)%>" type="text" class="input" id="t1" size="40"></td>
    </tr>
	<tr class="tdbg">
      <td align="center">人　气：      </td>
      <td><input name="t5"   type="text" value="<%=rs(5)%>" maxlength="6" onKeypress='if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;' class="input" id="t5" size="40"> <span>可自定义数字，最高不超过“999999”</span></td>
    </tr>
	<tr class="tdbg">
      <td align="center">推　荐：      </td>
      <td><input type='radio' name='t6' value='1' <%=w_check(rs(6),1)%>>是 <input type='radio' name='t6' value='0' <%=w_check(rs(6),0)%>>否</td>
    </tr>
	<tr class="tdbg">
      <td align="center">置　顶：      </td>
      <td><input type='radio' name='t7' value='1' <%=w_check(rs(7),1)%>>是 <input type='radio' name='t7' value='0' <%=w_check(rs(7),0)%>>否</td>
    </tr>
	<tr class="tdbg">
      <td align="center">验　证：      </td>
      <td><input type='radio' name='t8' value='1' <%=w_check(rs(8),1)%>>是 <input type='radio' name='t8' value='0' <%=w_check(rs(8),0)%>>否</td>
    </tr>
	<tr class="tdbg">
      <td align="center">文件名：      </td>
      <td><input name="t16" value="<%=rs(14)%>"  type="text" class="input" size="40" /><%=sdcms_filetxt%> <br><span>可自定义文件名，也可以使用系统标签进行搭配 如："{id}：编号　{y}:年　{m}:月　{d}:日"</span></td>
    </tr>
	<tr class="tdbg">
      <td align="center">关键字：      </td>
      <td><input name="t9"  type="text" class="input" id="t9" value="<%=rs(9)%>" size="40"></td>
    </tr>
	<tr class="tdbg">
      <td align="center">描　述：      </td>
      <td valign="top"><textarea name="t10" cols="60" rows="6" class="inputs"><%=rs(10)%></textarea><span>如果不填写则自动截取内容部分,不支持HTML</span></td>
    </tr>
	</table>
	 
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" >
    <tr class="tdbg">
	  <td width="100">&nbsp;</td>
      <td><input name="Submit" type="submit" class="bnt" value="保 存">
      <input type="button" onClick="history.go(-1)" class="bnt" value="返 回"> <%if sdcms_editor_type=1 then%><input type="button" onClick="eWebEditor1.insertHTML('$show_page$')" class="bnt" value="插入分页"><%end if%></td>
    </tr>
  </table>
 </form>
<%
if sdcms_editor_type=0 then
	sdcms_f.HtmlEditor 1,"t4","600","260",0
end if
set sdcms_f=nothing
end sub
sub save

t0=trim(request("t0"))
t1=trim(request("t1"))
t2=trim(request("t2"))
t3=trim(request("t3"))
t4=request("t4")
t5=trim(request("t5"))
t6=trim(request("t6"))
t7=trim(request("t7"))
t8=trim(request("t8"))
t9=trim(request("t9"))
t10=trim(request("t10"))
t11=trim(request("t11"))
t13=trim(request("t13"))
t15=trim(request("t15"))
t16=Replace_filename(dir_check(trim(request("t16"))),0)
t17=trim(request("t17"))
set sdcms_f=new sdcms_function
t17=sdcms_f.check_event(t17,",")
set sdcms_f=nothing

up1=trim(request("up1"))
up2=trim(request("up2"))
up3=trim(request("up3"))
up4=trim(request("up4"))
up5=trim(request("up5"))
if t15<>"" and t2=0 then t4=ReplaceRemoteUrl(t4)
if t5="" or not isnumeric(t5) then
t5=0
end if
set sdcms=new Sdcms_Function
t12=sdcms.Check_ispic(t11)
t14=sdcms.is_sdcms(t11)
set sdcms=nothing

set rs=server.CreateObject("adodb.recordset")
sql="select title,author,isurl,url,content,hits,isnice,ontop,ispass,keyword,jj,pic,"
sql=sql&"ispic,classid,issdcms,id,htmlname,tags,iscreate,iscomment,lastupdate from "&sd_table&""
if act="save" then 
 sql=sql&" where id="&id&""
end if
rs.open sql,conn,1,3

if act="add" then 
  rs.addnew
else
  rs.update
end if
if rs(0)=""&t0&"" then
ischanage=0
else
ischanage=1
end if
rs(0)=left(t0,255)
rs(1)=left(t1,50)
rs(2)=t2
if t2=1 then
rs(3)=left(t3,255)
else
rs(4)=t4
end if
rs(5)=left(t5,6)
rs(6)=t6
rs(7)=t7
rs(8)=t8
rs(9)=left(t9,255)
rs(11)=t11
rs(12)=t12
if act="save" then
    set sdcms_f=new sdcms_function
	if rs(16)<>t16 or t13<>rs(13)  then
		sdcms_f.DelHtml sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",rs(13))&rs(16)&sdcms_filetxt
	end if
	set sdcms_f=nothing
end if
rs(13)=t13
rs(14)=t14
rs(16)=left(t16,50)
if  t2=0 and t10="" and t4<>"" then
	set sdcms=new Sdcms_Function
	rs(10)=left(sdcms.Removehtml(t4),200)
	set sdcms=nothing
else
	set sdcms=new Sdcms_Function
	rs(10)=left(sdcms.Removehtml(t10),200)
	set sdcms=nothing
end if
if act="save" then
	 '先减去原来的次数
	 Lost_tags(rs(17))
end if
	 '再增加使用次数
	 Add_tags(t17)
rs(17)=t17
if len(up5)>0 then rs(18)=1
if len(up1)>0 then rs(19)=1 else rs(19)=0
rs(20)=now()
rs.update
id=rs(15)
'如果包含标签{id},则要替换掉
if instr(t16,"{id}")>0 then
	conn.execute("update "&sd_table&" set htmlname='"&replace(t16,"{id}",id)&"' where id="&id&"")
end if
set sdcms_c=new sdcms_create
if act="add" then
	conn.execute("update "&sd_table01&" set info_num=info_num+1 where id=1")
	conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','添加信息："&rs(0)&"')")
	if len(up4)>0 then
		set rs_pp=conn.execute("select top 1 id from "&sd_table&" where id<"&id&" and classid="&t13&" order by id desc")
		if not rs_pp.eof then
			sdcms_c.Create_info_show rs_pp(0)
		end if
	end if
else
	conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','修改信息："&rs(0)&"')")
	'更新上下条信息
	if len(up4)>0 then
		set rs_pp=conn.execute("select top 1 id from "&sd_table&" where id<"&id&" and classid="&t13&" order by id desc")
		if not rs_pp.eof then
		sdcms_c.Create_info_show rs_pp(0)
		end if
		
		set rs_nn=conn.execute("select top 1 id from "&sd_table&" where id>"&id&" and classid="&t13&"")
		if not rs_nn.eof then
		sdcms_c.Create_info_show rs_nn(0)
		end if
	end if
end if
'更新相关分类列表
if len(up3)>0 then
	set sdcms_f=new Sdcms_Function
	part_classid=sdcms_f.get_part_classid(t13)
	set sdcms_f=nothing
	if instr(part_classid,",")>0 then
		part_classid=split(part_classid,",")
			for i=0 to ubound(part_classid)
				sdcms_c.Create_class_list part_classid(i)
			next
	else
		sdcms_c.Create_class_list t13
	end if
end if
if len(up5)>0 then sdcms_c.Create_info_show id
if showmsg then echo"信息生成成功<br>"
if act="save" and len(up5)>0 then conn.execute("update "&sd_table&" set iscreate=1 where id="&id&"")
if len(up2)>0 then sdcms_c.Create_index
application.Contents.Remove(sdcms_cookies&"comment"&id)
echo "信息保存成功"
set sdcms_c=nothing
end sub

sub makehtml
if id<>"" then
conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','生成信息：编号为"&id&"')")
	if instr(id,", ")>0 then
	id=split(id,", ")
		for i=0 to ubound(id)
		  conn.execute("update "&sd_table&" set iscreate=1 where id="&id(i)&"")
		  set sdcms=new sdcms_create
		  sdcms.Create_info_show id(i)
		  set sdcms=nothing
		Next
	Else
	    conn.execute("update "&sd_table&" set iscreate=1 where id="&id&"")
		set sdcms=new sdcms_create
		sdcms.Create_info_show id
		set sdcms=nothing
	End if
if showmsg then echo"信息生成成功"
else
  response.Redirect("?")
end if
end sub

sub del
if id<>"" then
conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','删除信息：编号为"&id&"')")
   if instr(id,", ")>0 then
	id=split(id,", ")
		for i=0 to ubound(id)
			gotclassid=conn.execute("select classid from "&sd_table&" where id="&id(i)&"")(0)
			
			set sdcms=new sdcms_function
			Lost_tags sdcms.LoadRecord("tags",sd_table,id(i))
			sdcms.DelHtml sdcms_root&sdcms_htmdir&sdcms.LoadRecord("classdir","sd_class",gotclassid)&sdcms.LoadRecord("htmlname",sd_table,id(i))&sdcms_filetxt
			set sdcms=nothing
			conn.execute("update "&sd_table01&" set info_num=info_num-1 where id=1")
			conn.execute("delete from "&sd_table02&" where infoid="&id(i)&"")
			conn.execute("delete from "&sd_table&" where id="&id(i)&"")
			
			'set sdcms_c=new sdcms_create
			'sdcms_c.Create_class_list gotclassid:sdcms_c.Create_index
			'set rs_pp=conn.execute("select top 1 id from "&sd_table&" where id<"&id(i)&" and classid="&gotclassid&" order by id desc")
			'if not rs_pp.eof then
			'sdcms_c.Create_info_show rs_pp(0)
			'end if
		
			'set rs_nn=conn.execute("select top 1 id from "&sd_table&" where id>"&id(i)&" and classid="&gotclassid&"")
			'if not rs_nn.eof then
			'sdcms_c.Create_info_show rs_nn(0)
			'end if
			'set sdcms_c=nothing
		Next
				 
	Else
		gotclassid=conn.execute("select classid from "&sd_table&" where id="&id&"")(0)
		set sdcms=new sdcms_function
		Lost_tags sdcms.LoadRecord("tags",sd_table,id)
		sdcms.DelHtml sdcms_root&sdcms_htmdir&sdcms.LoadRecord("classdir","sd_class",gotclassid)&sdcms.LoadRecord("htmlname",sd_table,id)&sdcms_filetxt
		set sdcms=nothing
		conn.execute("update "&sd_table01&" set info_num=info_num-1 where id=1")
		conn.execute("delete from "&sd_table02&" where infoid="&id&"")
		conn.execute("delete from "&sd_table&" where id="&id&"") 

		set sdcms_c=new sdcms_create
		sdcms_c.Create_class_list gotclassid:sdcms_c.Create_index
		'set rs_pp=conn.execute("select top 1 id from "&sd_table&" where id<"&id&" and classid="&gotclassid&" order by id desc")
		'if not rs_pp.eof then
		'sdcms_c.Create_info_show rs_pp(0)
		'end if
		
		'set rs_nn=conn.execute("select top 1 id from "&sd_table&" where id>"&id&" and classid="&gotclassid&"")
		'if not rs_nn.eof then
		'sdcms_c.Create_info_show rs_nn(0)
		'end if
		
		set sdcms_c=nothing
	End if
	    
end if
	response.Redirect("?")
end sub

sub pass
  select case request("t")
  case "0"
  case else:t=1
  end select
if id<>"" then
conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','审核信息：编号为"&id&"')")
	if instr(id,", ")>0 then
		id=split(id,", ")
		for i=0 to ubound(id)
		  conn.execute("update   "&sd_table&" set ispass="&t&" where id="&id(i)&"")
		next
	 else
		conn.execute("update   "&sd_table&" set ispass="&t&" where id="&id&"")
	 end if
end if
  response.Redirect("?") 
end sub

sub nice
  select case request("t")
  case "0"
  case else:t=1
  end select
if id<>"" then
conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','推荐信息：编号为"&id&"')")
	if instr(id,", ")>0 then
		id=split(id,", ")
		for i=0 to ubound(id)
		  conn.execute("update  "&sd_table&" set isnice="&t&" where id="&id(i)&"")
		next
	 else
		conn.execute("update  "&sd_table&" set isnice="&t&" where id="&id&"")
	 end if
end if
  response.Redirect("?") 
end sub

sub top
  select case request("t")
  case "0"
  case else:t=1
  end select
if id<>"" then
conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','置顶信息：编号为"&id&"')")
	if instr(id,", ")>0 then
		id=split(id,", ")
		for i=0 to ubound(id)
		  conn.execute("update   "&sd_table&" set ontop="&t&" where id="&id(i)&"")
		next
	 else
		conn.execute("update   "&sd_table&" set ontop="&t&" where id="&id&"")
	 end if
end if
  response.Redirect("?") 
end sub

dim iii
iii=0
sub ssort(t,classid)
with response
if session(sdcms_cookies&"sdcms_admin")=1 then
	sql="Select id,title,ordnum,followid From [sd_class] where  followid="&t&"  order by ordnum desc"
else
	if t=0 then
	   sql="Select id,title,ordnum,followid From [sd_class] where  "
	   if session(sdcms_cookies&"sdcms_infolever")<>"" then
	   sql=sql&" id in ("&session(sdcms_cookies&"sdcms_infolever")&") and followid="&t&" order by ordnum desc"
	   else
	   sql=sql&"  followid<"&t&" order by ordnum desc"
	   end if
	else
		sql="Select id,title,ordnum,followid From [sd_class] where followid="&t&"   order by ordnum desc"
	end if
end if

Set rs1=Conn.Execute(sql)
do while not rs1.eof
.write("<option value='"&rs1(0)&"' ")
if clng(classid)=rs1(0) then
.write("selected")
end if
.write(">")
if t<>0 then
.write(""&string(iii,"　")&"")
set rsn=conn.execute("select max(ordnum),min(ordnum) from sd_class where followid="&Rs1(3)&"")
if rs1(2)=rsn(0) and rs1(2)=rsn(1) then
.write("└")
elseif rs1(2)=rsn(0) and rs1(2)>rsn(1) then
.write("├")
elseif rs1(2)<rsn(0) and rs1(2)=rsn(1) then
.write("└")
elseif rs1(2)<rsn(0) and rs1(2)>rsn(1) then
.write("├")
rsn.close
end if
end if
.write(" "&rs1(1)&"</option>")
iii=iii+1
ssort rs1(0),classid
iii=iii-1
rs1.Movenext
loop
Set Rs1 = Nothing
end with
end sub

sub check_info
with response
.write("	<script>")
.write("	function checkadd()")
if sdcms_editor_type=0 then
.write("	{document.add.elements.t4.value = oEdit1.getHTMLBody();")
elseif sdcms_editor_type=1 then
.write("	{document.add.elements.t4.value =eWebEditor1.getHTML();")
end if
.write("	if (document.add.t0.value=='')")
.write("	{")
.write("	alert('信息标题不能为空');")
.write("	document.add.t0.focus;")
.write("	return false")
.write("	}")
.write("	if (document.add.t13.value=='')")
.write("	{")
.write("	alert('请选择分类');")
.write("	document.add.t13.focus;")
.write("	return false")
.write("	}") 
.write("	if (!document.add.t3.disabled && document.add.t3.value=='')")
.write("	{")
.write("	alert('连接地址不能为空');")
.write("	document.add.t3.focus;")
.write("	return false")
.write("	}")
.write("	if (!document.add.t4.disabled && document.add.elements.t4.value =='')")
.write("	{")
.write("	alert('内容不能为空');")
.write("	document.add.t4.focus;")
.write("	return false")
.write("	}")

.write("	}")
.write("	</script>")
end with
end sub
%>  
</div>
</body>
</html>