📄 board.asp
字号:
if not (rs.eof and rs.bof) then
parentid=rs(0)
end if
rs.close
'当循环次数大于1并且运行到最后一次循环的时候直接进行更新
if i=depth then
yxbbs.execute("update [yx_board] set child=child+1 where boardid="&parentid)
end if
next
'更新该版面排序以及大于本需要和同在本分类下的版面排序序号
yxbbs.execute("update [yx_board] set orders=orders+1 where rootid="&rootid&" and orders>"&orders)
yxbbs.execute("update [yx_board] set orders="&orders&"+1 where boardid="&newboardid&"")
else
'当上级分类深度为0的时候只要更新上级分类版面数
yxbbs.execute("update [yx_board] set child=child+1 where boardid="&parentid)
set rs=yxbbs.execute("select max(orders) from [yx_board]")
yxbbs.execute("update [yx_board] set orders="&rs(0)&"+1 where boardid="&newboardid )
rs.close
end if
end if
call suc("","成功的添加了论坛 <b>"&boardname&"</b> !","board.asp")
end sub
sub editboard
dim boardname,boardlock,boardtype,introduce,boardimg,parentid,boardadmin,boardgrade
set rs=yxbbs.execute("select parentid,boardname,boardadmin,boardgrade,boardlock,boardtype,introduce,boardimg from[yx_board] where boardid="&yxbbs.boardid&"")
if rs.eof then
call goback("","该版面不存在,可能已经删除了")
exit sub
else
parentid=rs(0)
boardname=rs(1)
boardadmin=rs(2)
boardgrade=rs(3)
boardlock=rs(4)
boardtype=rs(5)
introduce=rs(6)
boardimg=rs(7)
end if
rs.close%><form method=post style="margin:0" action="?action=saveeditboard">
<div class="ta">
<div class="th jz">论坛修改</div>
<div class="td1 h40">论坛名称:</div>
<div class="td2 h40"><input name="boardid" value="<%=yxbbs.boardid%>" type="hidden"><input name="boardname" type=text value="<%=boardname%>" size=30></div>
<div class="td1 h40">标志图片:<br />论坛版面logo地址,可以不填</div>
<div class="td2 h40"><input type=text name="boardimg" value="<%=boardimg%>" size=30></div>
<div class="td1 h40">论坛版主:<br />添加多版主请用@@分隔,如:name@@name</div>
<div class="td2 h40"><input type=text name="boardadmin" size=30 value="<%=boardadmin%>"><input type="hidden" name="oldboardadmin" size=30 value="<%=boardadmin%>"></div>
<div class="td1 h70">论坛介绍:</div>
<div class="td2 h70 w446"><textarea rows="3" name="introduce"><%=introduce%></textarea></div>
<div class="td1 h40">属于分类或论坛:</div>
<div class="td2 h40"><select size="1" name="parentid"><%=yxbbs.boardidlist(parentid,20)%></select></div>
<div class="td1 h40">限制用户等级:</div>
<div class="td2 h40"><select size="1" name="boardgrade">
<option value="0" selected>0级:游客</option>
<%
dim ug
set ug=conn.execute("select gradenum,gradename from yx_usergrade order by gradenum asc")
while not ug.eof
if ug(0)=boardgrade then
response.write "<option value="&ug(0)&" selected>"&ug(0)&"级:"&ug(1)&"</option>"
else
response.write "<option value="&ug(0)&">"&ug(0)&"级:"&ug(1)&"</option>"
end if
ug.movenext
wend
set ug=nothing
%></select></div>
<div class="td1 h40">是否认证版面:<br />认证版只有版主和人证会员</div>
<div class="td2 h40"><input type="radio" value="1" name="boardtype" <%if boardtype=1 then response.write "checked=""true"""%>>是 <input type="radio" value="0" name="boardtype" <%if boardtype=0 then response.write "checked=""true"""%>>否</div>
<div class="td1 h40">锁定版面:<br /> 锁定之后不可以发布帖子</div>
<div class="td2 h40"><input type="radio" value="1" name="boardlock" <%if boardlock=1 then response.write "checked=""true""" %>>是 <input type="radio" value="0" name="boardlock" <%if boardlock=0 then response.write "checked=""true"""%>>否</div>
<div style="clear: both;"></div><div class="tf jz"><input type="submit" value=" 提 交 "> <input type="reset" value=" 重 置 "></div>
</div></form>
<%
end sub
sub saveeditboard
dim boardid,boardname,introduce,boardadmin,oldboardadmin,boardgrade,boardlock,boardtype,boardimg,parentid,rootid,depth,child,orders,parentstr,i
dim newparentid,boardnum,p_rs
boardid=yxbbs.fun.getstr("boardid")
boardname=yxbbs.fun.getstr("boardname")
introduce=yxbbs.fun.getstr("introduce")
boardadmin=yxbbs.fun.getstr("boardadmin")
boardgrade=yxbbs.fun.getstr("boardgrade")
oldboardadmin=yxbbs.fun.getstr("oldboardadmin")
boardlock=yxbbs.fun.getstr("boardlock")
boardtype=yxbbs.fun.getstr("boardtype")
boardimg=yxbbs.fun.getstr("boardimg")
newparentid=yxbbs.fun.getstr("parentid")
if not isnumeric(newparentid) or boardname="" or introduce="" then
call goback("",""):exit sub
elseif boardid=newparentid then
call goback("","所属论坛不能指定自己!"):exit sub
end if
set rs=yxbbs.execute("select rootid,depth,child,orders,parentid,parentstr from[yx_board] where boardid="&boardid)
if rs.eof or rs.bof then
call goback("系统出错!","该版面不存在,可能已经删除了!")
exit sub
end if
rootid=rs(0)
depth=rs(1)
child=rs(2)
orders=rs(3)
parentid=rs(4)
parentstr=rs(5)
rs.close
if parentid=0 then
call goback("系统出错!","分类不能设置"):exit sub
elseif int(newparentid)<>int(parentid) then
'判断所指定的论坛是否其下属论坛
set rs=yxbbs.execute("select boardid from [yx_board] where parentstr like '%"&parentstr&","&boardid&"%' and boardid="&newparentid)
if not (rs.eof and rs.bof) then
call goback("","您不能指定该版面的下属子论坛作为所属论坛")
exit sub
end if
rs.close
'获得新选的父级
set p_rs=yxbbs.execute("select * from [yx_board] where boardid="&newparentid)
if p_rs("depth")+1> maxdepth or (child>0 and p_rs("depth")+2>maxdepth) then
p_rs.close:set p_rs=nothing
call goback("","本论坛限制了最多只能有" & maxdepth & "级论坛.")
exit sub
end if
end if
yxbbs.execute("update [yx_board] set boardname='"&boardname&"',introduce='"&introduce&"',boardadmin='"&boardadmin&"',boardgrade="&boardgrade&",boardlock="&boardlock&",boardtype="&boardtype&",boardimg='"&boardimg&"' where boardid="&boardid&"")
if boardadmin <> oldboardadmin then call addmaster(boardadmin,oldboardadmin,1)
if int(newparentid)<>int(parentid) then
'将一个分论坛移动到其他分论坛下
'获得所指定的论坛的相关信息
'得到其下属版面数
parentstr=parentstr & ","
boardnum=yxbbs.execute("select count(*) from [yx_board] where parentstr like '%"&parentstr & boardid&"%'")(0)
if isnull(boardnum) then boardnum=1
'在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
yxbbs.execute("update [yx_board] set orders=orders + "&boardnum&"+1 where rootid="&p_rs("rootid")&" and orders>"&p_rs("orders")&"")
'更新当前版面数据
if p_rs("parentstr")="0" then
yxbbs.execute("update [yx_board] set depth="&p_rs("depth")&"+1,orders="&p_rs("orders")&"+1,rootid="&p_rs("rootid")&",parentid="&newparentid&",parentstr='" & p_rs("boardid") & "' where boardid="&boardid)
else
yxbbs.execute("update [yx_board] set depth="&p_rs("depth")&"+1,orders="&p_rs("orders")&"+1,rootid="&p_rs("rootid")&",parentid="&newparentid&",parentstr='" & p_rs("parentstr") & ","& p_rs("boardid") &"' where boardid="&boardid)
end if
dim tempparentstr
i=1
'更新下属,同时获得移动总数i
'如果有则更新下属版面数据
'深度为原有深度加上当前所属论坛的深度
set rs=yxbbs.execute("select * from [yx_board] where parentstr like '%"&parentstr & boardid&"%' order by orders")
do while not rs.eof
i=i+1
if p_rs("parentstr")="0" then'如果其父级为类,那么其下属的版面数据
tempparentstr=p_rs("boardid") & "," & replace(rs("parentstr"),parentstr,"")
else
tempparentstr=p_rs("parentstr") & "," & p_rs("boardid") & "," & replace(rs("parentstr"),parentstr,"")
end if
yxbbs.execute("update [yx_board] set depth=depth+"&p_rs("depth")&"-"&depth&"+1,orders="&p_rs("orders")&"+"&i&",rootid="&p_rs("rootid")&",parentstr='"&tempparentstr&"' where boardid="&rs("boardid"))
rs.movenext
loop
rs.close
dim tempparentid,ii
tempparentid=newparentid
if rootid=p_rs("rootid") then'在同一分类下移动
'更新所指向的上级论坛版面数,i为本次移动过来的版面数
'更新其父类版面数
yxbbs.execute("update [yx_board] set child=child+"&i&" where (not parentid=0) and boardid="&tempparentid)
for ii=1 to p_rs("depth")
'得到其父类的父类的版面id
set rs=yxbbs.execute("select parentid from [yx_board] where (not parentid=0) and boardid="&tempparentid)
if not (rs.eof and rs.bof) then
tempparentid=rs(0)
'更新其父类的父类版面数
yxbbs.execute("update [yx_board] set child=child+"&i&" where (not parentid=0) and boardid="&tempparentid)
''''yxbbs.execute("update [yx_board] set child=child+"&i&" where (not parentid=0) and boardid in ())
end if
next
'更新其原父类版面数
yxbbs.execute("update [yx_board] set child=child-"&i&" where (not parentid=0) and boardid="&parentid)
'更新其原来所属论坛数据
for ii=1 to depth
'得到其原父类的父类的版面id
set rs=yxbbs.execute("select parentid from [yx_board] where (not parentid=0) and boardid="&parentid)
if not (rs.eof and rs.bof) then
parentid=rs(0)
'更新其原父类的父类版面数
yxbbs.execute("update [yx_board] set child=child-"&i&" where (not parentid=0) and boardid="&parentid)
end if
next
else
'更新所指向的上级论坛版面数,i为本次移动过来的版面数
'更新其父类版面数
yxbbs.execute("update [yx_board] set child=child+"&i&" where boardid="&tempparentid)
for ii=1 to p_rs("depth")
'得到其父类的父类的版面id
set rs=yxbbs.execute("select parentid from [yx_board] where boardid="&tempparentid)
if not (rs.eof and rs.bof) then
tempparentid=rs(0)
'更新其父类的父类版面数
yxbbs.execute("update [yx_board] set child=child+"&i&" where boardid="&tempparentid)
end if
next
'更新其原父类版面数
yxbbs.execute("update [yx_board] set child=child-"&i&" where boardid="&parentid)
'更新其原父类的其它版面排序
yxbbs.execute("update [yx_board] set orders=orders-"&i&" where rootid="&rootid&" and orders>"&orders)
'更新其原来所属论坛数据
for ii=1 to depth
'得到其原父类的父类的版面id
set rs=yxbbs.execute("select parentid from [yx_board] where boardid="&parentid)
if not (rs.eof and rs.bof) then
parentid=rs(0)
'更新其原父类的父类版面数
yxbbs.execute("update [yx_board] set child=child-"&i&" where boardid="&parentid)
end if
next
end if
p_rs.close:set p_rs=nothing
end if
call suc("","论坛修改成功 !","board.asp")
end sub
sub delboard
dim alltable,i,ii,depth,parentid,rootid,orders
set rs=yxbbs.execute("select depth,parentid,rootid,orders,child from[yx_board] where boardid="&yxbbs.boardid)
if rs.eof then
call goback("系统出错","不存在,论坛可能已经删除了 !")
exit sub
elseif rs(4)>0 then
call goback("系统出错","该论坛含有属下论坛,不能删除 !")
exit sub
else
depth=rs(0)
parentid=rs(1)
rootid=rs(2)
orders=rs(3)
end if
rs.close
alltable=split(yxbbs.bbstable(0),",")
for i=0 to ubound(alltable)
yxbbs.execute("delete from [yx_bbs"&alltable(i)&"] where boardid="&yxbbs.boardid&"")
next
set rs=yxbbs.execute("select topicid from[yx_topic] where boardid="&yxbbs.boardid&" and isvote ")
do while not rs.eof
yxbbs.execute("delete from [yx_topicvote] where topicid="&rs(0))
yxbbs.execute("delete from [yx_topicvoteuser] where topicid="&rs(0))
rs.movenext
loop
rs.close
'删除主题记录
yxbbs.execute("delete from[yx_topic] where boardid="&yxbbs.boardid)
yxbbs.execute("delete from[yx_board] where boardid="&yxbbs.boardid)
'更新其父类的版面数
yxbbs.execute("update [yx_board] set child=child-1 where boardid="&parentid)
'更新其父类的其它版面排序
yxbbs.execute("update [yx_board] set orders=orders-1 where rootid="&rootid&" and orders>"&orders)
'更新其所属论坛数据
for ii=1 to depth
'得到其父类的父类的版面id
set rs=yxbbs.execute("select parentid from [yx_board] where boardid="&parentid)
if not (rs.eof and rs.bof) then
parentid=rs(0)
'更新其父类的父类版面数
yxbbs.execute("update [yx_board] set child=child-1 where boardid="&parentid)
end if
rs.close
next
call suc("","成功的删除论坛版面 (包括该论坛的所有帖子)!","board.asp")
end sub
sub classorders
dim boardid
set rs=yxbbs.execute("select boardid,boardname,rootid from[yx_board] where depth=0 order by rootid")
if rs.eof then
call goback("","论坛没有分类!请先<a href=?action=addclass> 添加分类</a>")
exit sub
end if
%><form method=post style="margin:0" action="?action=saveclassorders">
<div class="ta">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -