📄 pop_moderate.asp
字号:
<%
'#################################################################################
'## Snitz Forums 2000 v3.4.05
'#################################################################################
'## Copyright (C) 2000-05 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'##
'## Support can be obtained from our support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## manderson@snitz.com
'##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header_short.asp" -->
<!--#INCLUDE FILE="inc_func_secure.asp" -->
<!--#INCLUDE FILE="inc_subscription.asp" -->
<!--#INCLUDE FILE="inc_func_count.asp" -->
<%
Server.ScriptTimeout = 90
' -- Declare the variables and initialize them with the values from either the querystring (1st time
' -- into the form) or the form (all other times through the form)
' -- Mode - 1 = Approve, 2 = Hold, 3 = Reject
Dim Mode, ModLevel, CatID, ForumID, TopicID, ReplyID, Password, Result, Comments
CatID = clng("0" & Request("CAT_ID"))
ForumID = clng("0" & Request("FORUM_ID"))
TopicID = clng("0" & Request("TOPIC_ID"))
if Request("REPLY_ID") = "X" then
ReplyID = "X"
else
ReplyID = clng("0" & Request("REPLY_ID"))
end if
Comments = trim(Request.Form("COMMENTS"))
' Mode: 1 = Approve, 2 = Hold, 3 = Reject
Mode = Request("MODE")
if Mode = "" then
Mode = 0
end if
' Set the ModLevel for the operation
if Mode > 0 then
if CatID = "0" or CatID = "" then
ModLevel = "BOARD"
elseif ForumID = "0" or ForumID = "" then
ModLevel = "CAT"
elseif TopicID = "0" or TopicID = "" then
ModLevel = "FORUM"
elseif ReplyId = "0" or ReplyID = "" then
ModLevel = "TOPIC"
elseif ReplyId = "X" then
ModLevel = "ALLPOSTS"
else
ModLevel = "REPLY"
end if
end if
if mlev = 0 then
Response.Write " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """>There Was A Problem With Your Details</font></p>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>You must be logged in to Moderate posts.</font></p>" & vbNewLine
elseif Mode = "" or Mode = 0 then
ModeForm
else
if ModLevel = "BOARD" or ModLevel = "CAT" then
if mlev < 4 then
Response.Write " <p><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Only Admins May "
if Mode = 1 then
Result = "Approve "
elseif Mode = 2 then
Result = "Hold "
else
Result = "Reject "
end if
if ModLevel = "BOARD" then
Result = Result & "all Topics and Replies for the Forum. "
else
Result = Result & "the Topics and Replies for this Category. "
end if
Response.Write Result & "</font></p>" & vbNewline
LoginForm
elseif Mode = 1 or Mode = 2 then
Approve_Hold
else
Delete
end if
else
' -- Not an admin or moderator. Can't do...
if mlev < 4 and chkforumModerator(ForumID, strDBNTUserName) <> "1" then
Response.Write " <p><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Only Admins and Moderators May "
if Mode = 1 then
Result = "Approve "
elseif Mode = 2 then
Result = "Hold "
else
Result = "Reject "
end if
if ModLevel = "FORUM" then
Result = Result & "all Topics and Replies for the Forum. "
elseif ModLevel = "TOPIC" then
Result = Result & "this Topic. "
elseif ModLevel = "ALLPOSTS" then
Result = Result & "all Posts for this Topic. "
else
Result = Result & "this Reply. "
end if
Response.Write Result & "</font></p>" & vbNewline
LoginForm
elseif Mode = 1 or Mode = 2 then
' -- Do the approval/Hold
Approve_Hold
else
Delete
end if
end if
end if
WriteFooterShort
Response.End
sub Approve_Hold
' Loop through the topic table to determine which records need to be updated.
if ModLevel <> "Reply" then
strSql = "SELECT T.CAT_ID, "
strSql = strSql & "T.FORUM_ID, "
strSql = strSql & "T.TOPIC_ID, "
strSql = strSql & "T.T_LAST_POST as Post_Date, "
strSql = strSql & "M.M_NAME, "
strSql = strSql & "M.MEMBER_ID "
strSql = strSql & " FROM " & strTablePrefix & "TOPICS T, "
strSql = strSql & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE (T.T_STATUS = 2 OR T.T_STATUS = 3) "
strSql = strSql & " AND T.T_AUTHOR = M.MEMBER_ID"
' Set the appropriate level of moderation based on the passed mode.
if ModLevel <> "BOARD" then
if Modlevel = "CAT" then
strSql = strSql & " AND T.CAT_ID = " & CatID
elseif Modlevel = "FORUM" then
strSql = strSql & " AND T.FORUM_ID = " & ForumID
else
strSql = strSql & " AND T.TOPIC_ID = " & TopicID
end if
end if
set rsLoop = my_Conn.Execute (strSql)
if rsLoop.EOF or rsLoop.BOF then
' Do nothing - No records meet this criteria
else
do until rsLoop.EOF
LoopCatID = rsLoop("CAT_ID")
LoopForumID = rsLoop("FORUM_ID")
LoopTopicID = rsLoop("TOPIC_ID")
LoopMemberID = rsLoop("MEMBER_ID")
LoopMemberName = rsLoop("M_NAME")
LoopPostDate = rsLoop("POST_DATE")
strSql = "UPDATE " & strTablePrefix & "TOPICS "
strSql = strSql & " set T_STATUS = "
if Mode = 1 then
StrSql = StrSql & " 1"
strSql = strSql & " , T_LAST_POST = '" & DateToStr(strForumTimeAdjust) & "'"
strSql = strSql & " , T_LAST_POST_REPLY_ID = " & 0
LoopPostDate = DateToStr(strForumTimeAdjust)
else
StrSql = StrSql & " 3"
end if
strSql = strSql & " WHERE CAT_ID = " & LoopCatID
strSql = strSql & " AND FORUM_ID = " & LoopForumID
strSql = strSql & " AND TOPIC_ID = " & LoopTopicID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
' -- If approving, make sure to update the appropriate counts..
if Comments <> "" then
Send_Comment_Email LoopMemberName, LoopMemberID, LoopCatID, LoopForumID, LoopTopicID, 0
end if
if Mode = 1 then
doPCount
doTCount
UpdateForum "Topic", LoopForumID, LoopMemberID, LoopPostDate, LoopTopicID, 0
UpdateUser LoopMemberID, LoopForumID, LoopPostDate
ProcessSubscriptions LoopMemberID, LoopCatID, LoopForumID, LoopTopicID, "No"
end if
rsLoop.MoveNext
loop
end if
rsLoop.Close
set rsLoop = nothing
end if
' Update the replies if appropriate
strSql = "SELECT R.CAT_ID, " & _
"R.FORUM_ID, " & _
"R.TOPIC_ID, " & _
"R.REPLY_ID, " & _
"R.R_DATE as Post_Date, " & _
"M.M_NAME, " & _
"M.MEMBER_ID " & _
" FROM " & strTablePrefix & "REPLY R, " & _
strMemberTablePrefix & "MEMBERS M" & _
" WHERE (R.R_STATUS = 2 OR R.R_STATUS = 3) " & _
" AND R.R_AUTHOR = M.MEMBER_ID "
if ModLevel <> "BOARD" then
if ModLevel = "CAT" then
strSql = strSql & " AND R.CAT_ID = " & CatID
elseif ModLevel = "FORUM" then
strSql = strSql & " AND R.FORUM_ID = " & ForumID
elseif ModLevel = "TOPIC" or ModLevel = "ALLPOSTS" then
strSql = strSql & " AND R.TOPIC_ID = " & TopicID
else
strSql = strSql & "AND R.REPLY_ID = " & ReplyID
end if
end if
set rsLoop = my_Conn.Execute (strSql)
if rsLoop.EOF or rsLoop.BOF then
' Do nothing - No records matching the criteria were found
else
do until rsLoop.EOF
LoopMemberName = rsLoop("M_NAME")
LoopMemberID = rsLoop("MEMBER_ID")
LoopCatID = rsLoop("CAT_ID")
LoopForumID = rsLoop("FORUM_ID")
LoopTopicID = rsLoop("TOPIC_ID")
LoopReplyID = rsLoop("REPLY_ID")
LoopPostDate = rsLoop("POST_DATE")
StrSql = "UPDATE " & strTablePrefix & "REPLY "
StrSql = StrSql & " set R_STATUS = "
if Mode = 1 then
StrSql = StrSql & " 1"
strSql = strSql & " , R_LAST_EDIT = '" & DateToStr(strForumTimeAdjust) & "'"
LoopPostDate = DateToStr(strForumTimeAdjust)
else
StrSql = StrSql & " 3"
end if
StrSql = StrSql & " WHERE REPLY_ID = " & LoopReplyID
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
if Comments <> "" then
Send_Comment_Email LoopMemberName, LoopMemberID, LoopCatID, LoopForumID, LoopTopicID, LoopReplyID
end if
if Mode = 1 then
doPCount
UpdateTopic LoopTopicID, LoopMemberID, LoopPostDate, LoopReplyID
UpdateForum "Post", LoopForumID, LoopMemberID, LoopPostDate, LoopTopicID, LoopReplyID
UpdateUser LoopMemberID, LoopForumID, LoopPostDate
ProcessSubscriptions LoopMemberID, LoopCatID, LoopForumID, LoopTopicID, "No"
end if
rsLoop.MoveNext
loop
end if
rsLoop.Close
set rsLoop = nothing
' ## Build final result message
if ModLevel = "BOARD" then
Result = "All Topics and Replies have "
elseif ModLevel = "CAT" then
Result = "All Topics and Replies in this Category have "
elseif ModLevel = "FORUM" then
Result = "All Topics and Replies in this Forum have "
elseif ModLevel = "TOPIC" then
Result = "This Topic has "
elseif ModLevel = "ALLPOSTS" then
Result = "All posts for this topic have "
else
Result = "This Reply has "
end if
if Mode = 2 then
Result = Result & " Been Placed on Hold."
elseif Mode = 3 then
Result = Result & " Been Deleted."
else
Result = Result & " Been Approved."
end if
Response.Write " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>" & Result & "</font></p>" & vbNewline & _
" <script language=""javascript1.2"">self.opener.location.reload();</script>" & vbNewLine
end sub
sub Delete
' Loop through the topic table to determine which records need to be updated.
if ModLevel <> "Reply" then
strSql = "SELECT T.CAT_ID, "
strSql = strSql & "T.FORUM_ID, "
strSql = strSql & "T.TOPIC_ID, "
strSql = strSql & "T.T_LAST_POST as Post_Date, "
strSql = strSql & "M.M_NAME, "
strSql = strSql & "M.MEMBER_ID "
strSql = strSql & " FROM " & strTablePrefix & "TOPICS T, "
strSql = strSql & strMemberTablePrefix & "MEMBERS M"
strSql = strSql & " WHERE (T.T_STATUS = 2 OR T.T_STATUS = 3) "
strSql = strSql & " AND T.T_AUTHOR = M.MEMBER_ID"
' Set the appropriate level of moderation based on the passed mode.
if ModLevel <> "BOARD" then
if Modlevel = "CAT" then
strSql = strSql & " AND T.CAT_ID = " & CatID
elseif Modlevel = "FORUM" then
strSql = strSql & " AND T.FORUM_ID = " & ForumID
else
strSql = strSql & " AND T.TOPIC_ID = " & TopicID
end if
end if
set rsLoop = my_Conn.Execute (strSql)
if rsLoop.EOF or rsLoop.BOF then
' Do nothing - No records meet this criteria
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -