📄 admin_forum.asp
字号:
<!-- #include file="include/admin_onlogin.asp" -->
<%
dim classid,forumid,ddim,len_forum_config
len_forum_config=20
classid=trim(request.querystring("class_id"))
forumid=trim(request.querystring("forum_id"))
if not(isnumeric(classid)) then classid=0
if not(isnumeric(forumid)) then forumid=0
index_url="forum"
call admin_master(0,0)
tit_fir="论坛"
tit="论坛管理"
call admin_header(0,0)
%>
<tr><td align=center colspan=2 height=30>
<table border=0>
<tr>
<td><a href='?'>管理首页</a></td>
<td width=10></td>
<td><a href='?action=add'>添加新论坛</a></td>
<td width=10></td>
<td><a href='?action=mod'>合并论坛数据</a></td>
<td width=10></td>
<td><a href='?action=order'>重新计数排序</a></td>
<td width=10></td>
<td><a href='?action=event'>清理论坛日记</a></td>
<!--
<td width=10></td>
<td><a href='?action=delete'>批量删除数据</a></td>
-->
<% call joekoe_is_js("",tit_fir) %>
</tr>
</table>
</td></tr>
</table>
<%
call admin_table(1)
select case action
case "js"
call forum_js()
case "del"
call forum_del()
case "mod"
call forum_mod()
case "event"
call forum_event()
case "restore"
call forum_restore()
case "order"
call forum_order()
case "orders"
call forum_orders()
case "add"
call forum_add()
case "edit"
call forum_edit()
case "edit_parameter"
call forum_edit_parameter()
case else
call forum_main()
end select
call admin_ender(1)
sub forum_js()
dim file_name,temp1,fi,fnum,total_num
file_name="style/data_forum.asp"
fi=0
fnum=0
sql="select count(forum_id) from bbs_forum where forum_hidden=0"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
total_num=int(rs(0))
end if
rs.close
if total_num>0 then total_num=total_num-1
sql="select class_id,forum_id,forum_star,forum_name from bbs_forum where forum_hidden=0 order by class_id,forum_order"
call joekoe_cms.exec(sql,-1)
rs.open sql,conn,1,1
if not rs.eof then
fnum=rs.recordcount
end if
temp1=temp1&"<"&"%" & _
vbcrlf&"dim forum_list_sorts("&total_num&")"
for fi=0 to fnum-1
temp1=temp1&vbcrlf&"forum_list_sorts("&fi&")="""&rs("forum_id")&"|"&rs("class_id")&"|"&rs("forum_star")&"|"&rs("forum_name")&""""
rs.movenext
next
rs.close
temp1=temp1&vbcrlf&"%"&">"
call create_file(file_name,temp1)
call admin_msg("成功更新了论坛分类数据!","?",1)
end sub
sub forum_del()
dim num_topic,num_data,fparent
sql="select top 1 forum_parent from bbs_forum where forum_id="&forumid
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
rs.close
call admin_msg("要删除的论坛ID("&forumid&")不存!","?",1)
exit sub
end if
fparent=rs("forum_parent")
rs.close
sql="select count(forum_id) from bbs_forum where forum_f="&forumid
set rs=joekoe_cms.exec(sql,1)
if rs(0)>0 then
rs.close
call admin_msg("要删除的论坛ID("&forumid&")含有下级论坛!请先删除下级论坛。","?",1)
exit sub
end if
rs.close
sql="select count(id) from bbs_topic where forum_id="&forumid
set rs=joekoe_cms.exec(sql,1)
num_topic=rs(0)
rs.close
sql="select count(id) from bbs_data where forum_id="&forumid
set rs=joekoe_cms.exec(sql,1)
num_data=rs(0)
rs.close
sql="delete from bbs_topic where forum_id="&forumid
call joekoe_cms.exec(sql,0)
sql="delete from bbs_data where forum_id="&forumid
call joekoe_cms.exec(sql,0)
sql="delete from bbs_forum where forum_id="&forumid
call joekoe_cms.exec(sql,0)
if var_null(fparent)<>"" then
sql="update bbs_forum set forum_n=forum_n-1,forum_topic_num=forum_topic_num-"&num_topic&",forum_data_num=forum_data_num-"&num_data&" where forum_id in("&fparent&")"
call joekoe_cms.exec(sql,0)
end if
sql="update configs set num_topic=num_topic-"&num_topic&",num_data=num_data-"&num_data
call joekoe_cms.exec(sql,0)
if isarray(application(joekoe_cms.web_cookies&"_configs")) then
application.lock
application(joekoe_cms.web_cookies&"_configs")(1,0)=application(joekoe_cms.web_cookies&"_configs")(1,0)-num_topic
application(joekoe_cms.web_cookies&"_configs")(2,0)=application(joekoe_cms.web_cookies&"_configs")(2,0)-num_data
application.unlock
end if
call admin_msg("成功删除论坛ID("&forumid&")!","?",1)
end sub
sub forum_event()
dim data_type,clear_msg
call admin_td("清理论坛日记")
if joekoe_cms.chk() then
data_type=trim(request.form("data_type"))
select case data_type
case "all"
sql="delete from bbs_event"
clear_msg="所有"
case "week"
if joekoe_cms.web_vt=1 then
sql="delete from bbs_event where datediff(d,tim,getdate())>7" 'SQL
else
sql="delete from bbs_event where datediff("&s_d&"d"&s_d&",tim,"&s_tim&")>7"
end if
clear_msg="一周前"
case else '"month"
if joekoe_cms.web_vt=1 then
sql="delete from bbs_event where datediff(d,tim,getdate())>30" 'SQL
else
sql="delete from bbs_event where datediff("&s_d&"d"&s_d&",tim,"&s_tim&")>30"
end if
clear_msg="一个月前"
end select
call joekoe_cms.exec(sql,0)
call admin_msg("已成功清理了"&clear_msg&"的论坛日记!",pageurl&"action="&action,1)
exit sub
end if
call form_first()
%>
<form name=event_frm action='<%response.write pageurl%>action=<%response.write action%>' method=post>
<input type=hidden name=chk value='yes'>
<td width='20%' class=htd>注意:<br>清除后将不能再恢复</td>
<td width='80%'>
<table border=0>
<tr><td><input type=radio name=data_type value='month' checked> 清除一个月前的论坛日记</td></tr>
<tr><td><input type=radio name=data_type value='week'> 清除一周前的论坛日记</td></tr>
<tr><td><input type=radio name=data_type value='all'> 清除所有的论坛日记</td></tr>
</table>
</td>
</tr>
<tr>
<td></td>
<td><input type=submit value='执行清除操作' onclick="javascript:return click_return('执行清除操作',0);"></td>
</form>
<%
end sub
sub forum_restore()
dim forumparent,forumw,forumn,forumtopicnum,forumdatanum,forumnewinfo,forumnewnum,frs,fsql,nforumid,ntopic
sql="select top 1 forum_parent,forum_w from bbs_forum where forum_id="&forumid
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
rs.close
call admin_msg("要进行数据修复的论坛ID("&forumid&")不存!","?",1)
exit sub
end if
forumparent=rs("forum_parent")
forumw=rs("forum_w")
rs.close
forumn=0
forumtopicnum=0
forumdatanum=0
forumnewinfo=""
forumnewnum=0
if not forumw then
sql="select forum_id,forum_topic_num,forum_data_num,forum_new_num from bbs_forum where forum_hidden=0 and left(forum_parent,"&(len(forumparent)+1)&")='"&forumparent&",'"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
nforumid=rs(0)
forumn=forumn+1
forumtopicnum=forumtopicnum+rs(1)
forumdatanum=forumdatanum+rs(2)
forumnewnum=forumnewnum+rs(3)
rs.movenext
loop
rs.close
end if
if int(forumn)=0 then
sql="select count(id) from bbs_topic where forum_id="&forumid
set rs=joekoe_cms.exec(sql,1)
forumtopicnum=forumtopicnum+rs(0)
rs.close
sql="select count(id) from bbs_data where forum_id="&forumid
set rs=joekoe_cms.exec(sql,1)
forumdatanum=forumdatanum+rs(0)
rs.close
if joekoe_cms.web_vt=1 then
sql="select count(id) from bbs_data where forum_id="&forumid&" and tim>'"&joekoe_cms.time_type(joekoe_cms.now_time,4)&" 00:00:00'"
else
sql="select count(id) from bbs_data where forum_id="&forumid&" and tim>#"&joekoe_cms.time_type(joekoe_cms.now_time,4)&" 00:00:00#"
end if
set rs=joekoe_cms.exec(sql,1)
forumnewnum=forumnewnum+rs(0)
rs.close
end if
response.write 3
sql="select top 1 id,topic,username,tim from bbs_topic where forum_id="&forumid&" order by re_tim desc"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then
ntopic=rs("topic")
ntopic=replace(ntopic,"'","")
ntopic=replace(ntopic,"|","")
forumnewinfo=rs("username")&"|"&rs("tim")&"|"&rs("id")&"|"&ntopic
end if
rs.close
sql="update bbs_forum set forum_topic_num="&forumtopicnum&",forum_data_num="&forumdatanum&",forum_new_info='"&forumnewinfo&"',forum_new_num="&forumnewnum&" where forum_id="&forumid
response.write sql
call joekoe_cms.exec(sql,0)
call admin_msg("成功对论坛(ID:"&forumid&")进行了数据修复!","?",1)
end sub
sub forum_order()
if trim(request.querystring("chk"))<>"yes" then
call admin_td("重新计数排序")
%>
<tr>
<td>注意:</td>
<td height=60 class=htd>现在正在执行重新计算所有论坛计数、所属下级论坛、论坛排序等操作;<br>根据您的服务器情况可能会执行一到两秒钟左右的时间,请在些期间不要关闭本页!</td>
</tr>
<tr><td height=40 colspan=2 align=center><input type=button value='执行重新计数排序操作' onclick="javascript:location.href='?action=order&chk=yes';"></td></tr>
<%
exit sub
end if
dim star_min
sql="select top 1 forum_star from bbs_forum order by forum_star"
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
rs.close
call admin_msg("暂时还没有论坛分类!","?",1)
exit sub
end if
star_min=rs(0)
rs.close
if not isnumeric(star_min) then star_min=0
if int(star_min)>0 then
call admin_msg("论坛分类出现严重错误!请与开发人员联系。","?",1)
exit sub
end if
classid=1
sql="select forum_id,class_id from bbs_forum where forum_star="&star_min&" order by class_id,forum_id"
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
forumid=rs("forum_id")
call joekoe_cms.exec("update bbs_forum set class_id="&classid&",forum_f=0,forum_n=0,forum_order=0,forum_star=0,forum_parent='"&forumid&"' where forum_id="&forumid,0)
call forum_order_board(classid,forumid,1,forumid,1,1)
rs.movenext
classid=classid+1
loop
rs.close
call admin_msg("成功对所有论坛进行了重新计数排序!","?",1)
end sub
sub forum_order_board(cid,fid,fstar,fparent,forder,fh)
dim rsb,sqlb,nfid,ffp,fhh,nf_id,nf_topic,nf_username,nf_tim
ffp=fparent&","
if fparent="" then
ffp=""
end if
sqlb="select forum_id,forum_star,forum_hidden,forum_topic_num,forum_data_num from bbs_forum where forum_f="&fid&" order by forum_order,forum_id"
set rsb=joekoe_cms.exec(sqlb,1)
do while not rsb.eof
fhh=fh
nfid=rsb("forum_id")
nf_id=""
nf_topic=""
nf_username=""
nf_tim=""
call joekoe_cms.exec("update bbs_forum set class_id="&cid&",forum_f="&fid&",forum_n=0,forum_order="&forder&",forum_star="&fstar&",forum_parent='"&ffp&nfid&"' where forum_id="&nfid,0)
forder=forder+1
if rsb("forum_hidden")=true then fhh=0
if int(fhh)=1 then
call joekoe_cms.exec("update bbs_forum set forum_n=forum_n+1 where class_id="&cid&" and forum_id in("&fparent&")",0)
end if
call forum_order_board(cid,nfid,fstar+1,ffp&nfid,forder,fhh)
rsb.movenext
loop
rsb.close
set rsb=nothing
end sub
sub forum_orders()
dim star_min,actions,forumf,forumorder,forumstar,forumparent,num1,num2,num3
actions=trim(request.querystring("actions"))
if forumid<1 or (actions<>"up" and actions<>"down") then
call admin_msg("论坛排序参数出错!","?",1)
exit sub
end if
sql="select top 1 class_id,forum_f,forum_order,forum_star,forum_parent from bbs_forum where forum_id="&forumid
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
rs.close
call admin_msg("论坛ID("&forumid&")不存在!","?",1)
exit sub
end if
classid=rs("class_id")
forumf=rs("forum_f")
forumorder=rs("forum_order")
forumstar=rs("forum_star")
forumparent=rs("forum_parent")
rs.close
sql="select top 1 forum_star from bbs_forum order by forum_star"
set rs=joekoe_cms.exec(sql,1)
star_min=rs(0)
rs.close
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -