%
'=========================================================
' File: announcements.asp
' Version:5.0
' Date: 2002-9-28
' Script Written by satan
'=========================================================
' Copyright (C) 2001,2002 AspSky.Net. All rights reserved.
' Web: http://www.aspsky.net,http://www.dvbbs.net
' Email: info@aspsky.net,eway@aspsky.net
'=========================================================
dim abgcolor
dim canpostann,caneditann
dim canmodifyusername
dim username
canpostann=false
caneditann=false
canmodifyusername=false
if (master or superboardmaster or boardmaster) and Cint(GroupSetting(25))=1 then
canpostann=true
else
canpostann=false
end if
if FoundUserPer and Cint(GroupSetting(25))=1 then
canpostann=true
elseif FoundUserPer and Cint(GroupSetting(25))=0 then
canpostann=false
end if
if (master or superboardmaster or boardmaster) and Cint(GroupSetting(26))=1 then
caneditann=true
else
caneditann=false
end if
if FoundUserPer and Cint(GroupSetting(26))=1 then
caneditann=true
elseif FoundUserPer and Cint(GroupSetting(26))=0 then
caneditann=false
end if
stats="浏览论坛公告"
call nav()
if BoardID=0 or not isInteger(BoardID) then
BoardID=0
call head_var(2,0,"","")
else
BoardID=clng(BoardID)
call head_var(1,BoardDepth,0,0)
end if
if canpostann or caneditann then
response.write "
发布公告 | 管理公告
"
end if
if request("action")="AddAnn" then
call addann()
elseif request("action")="SaveAnn" then
call saveann()
elseif request("action")="EditAnn" then
call editann()
elseif request("action")="EditAnnInfo" then
call EditAnnInfo()
elseif request("action")="SaveEdit" then
call SaveEdit()
elseif request("action")="delann" then
call delann()
else
call main()
end if
if founderr then call dvbbs_error()
call footer()
sub main()
response.write ""
set rs=server.createobject("adodb.recordset")
sql="select * from bbsnews where boardid="&BoardID&" order by id desc"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
%>
| >> 当前没有任何公告 << |
请进入论坛管理页面来发布一个公告(必须是管理员或者版主)。 当你发布一次公告后,本公告就会自动消失,无需你手动删除!
|
| 发布人: 本站的默认公告
| 发布时间: <%=Now()%>
| |
<%
else
do while not rs.eof
%>
| >> <%=htmlencode(rs("title"))%> << |
<%=dvbcode(rs("content"),1,2)%>
|
| 发布人: <%=htmlencode(rs("username"))%>
| 发布时间: <%=rs("addtime")%>
| |
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
response.write "
"
call activeonline()
end sub
sub AddAnn()
if not canpostann then
Errmsg=Errmsg+"
您没有执行此操作的权限。"
founderr=true
exit sub
end if
%>
<%
end sub
sub SaveAnn()
if not canpostann then
Errmsg=Errmsg+"
您没有执行此操作的权限。"
founderr=true
exit sub
end if
dim username,title,content
if request("username")="" then
Errmsg=Errmsg+"
"+"请输入发布者。"
founderr=true
else
username=checkstr(request("username"))
end if
if request("title")="" then
Errmsg=Errmsg+"
"+"请输入新闻标题。"
founderr=true
else
title=checkstr(request("title"))
end if
if request("content")="" then
Errmsg=Errmsg+"
"+"请输入新闻内容。"
founderr=true
else
content=checkstr(request("content"))
end if
if founderr then exit sub
set rs=server.createobject("adodb.recordset")
sql="select * from bbsnews"
rs.open sql,conn,1,3
rs.addnew
rs("username")=username
rs("title")=title
rs("content")=content
rs("addtime")=Now()
rs("boardid")=boardid
rs.update
rs.close
set rs=nothing
sucmsg="您已经成功的发布了公告。"
'Empty cache
myCache.name="AnnounceMents"&BoardID
myCache.makeEmpty
call dvbbs_suc()
end sub
sub EditAnn()
if not caneditann then
Errmsg=Errmsg+"
您没有执行此操作的权限。"
founderr=true
exit sub
end if
%>
<%
end sub
sub EditAnnInfo()
dim trs
if not caneditann then
Errmsg=Errmsg+"
您没有执行此操作的权限。"
founderr=true
exit sub
end if
if not isnumeric(request("id")) then
Errmsg=Errmsg+"
错误的参数。"
founderr=true
exit sub
end if
set rs=conn.execute("select * from bbsnews where id="&request("id"))
%>
<%
end sub
sub SaveEdit()
if not caneditann then
Errmsg=Errmsg+"
您没有执行此操作的权限。"
founderr=true
exit sub
end if
dim username,title,content
if not isnumeric(request("id")) then
Errmsg=Errmsg+"
"+"错误的公告参数。"
founderr=true
end if
if request("username")="" then
Errmsg=Errmsg+"
"+"请输入发布者。"
founderr=true
else
username=checkstr(request("username"))
end if
if request("title")="" then
Errmsg=Errmsg+"
"+"请输入新闻标题。"
founderr=true
else
title=checkstr(request("title"))
end if
if request("content")="" then
Errmsg=Errmsg+"
"+"请输入新闻内容。"
founderr=true
else
content=checkstr(request("content"))
end if
if founderr then exit sub
set rs=server.createobject("adodb.recordset")
sql="select * from bbsnews where id="&cstr(request("id"))
rs.open sql,conn,1,3
rs("username")=username
rs("title")=title
rs("content")=content
rs("addtime")=Now()
rs("boardid")=boardid
rs.update
rs.close
sucmsg="修改公告成功!"
'Empty cache
myCache.name="AnnounceMents"&BoardID
myCache.makeEmpty
call dvbbs_suc()
end sub
sub delann()
if not caneditann then
Errmsg=Errmsg+"
您没有执行此操作的权限。"
founderr=true
exit sub
end if
dim delid
delid=replace(request.form("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
conn.execute("delete from bbsnews where id in ("&delid&")")
sucmsg="删除公告成功。"
'Empty cache
myCache.name="AnnounceMents"&BoardID
myCache.makeEmpty
call dvbbs_suc()
end sub
%>