%
Dim allforum, from, objRS, strSQL, todelete, forumID, i, rdcount, objCommand, SQL, objCom
Dim parent, howmany, objDS, appid, threadID, lastupdate, action,m, fastsort, objCon, reloadlink,mode
Dim frompage , adminProAccess 'frompage is for refreshing the frame
from = request("from")
allforum = Application(dbName&"foruminfo")
frompage=request("frompage")
'response.write frompage&", "
'response.write (request("appid"))
'response.end
reloadlink=request("http_referer")
adminProAccess = true
if isArray(allforum) then
if not isAdmin then
if from = "dm" or from = "nail" or from = "lock" or from = "move" or from = "approve" or from = "FAQ" then 'moderator access code allowed
Dim objPermission
Set objPermission = new PermissionSetting
With objPermission
.memID = memID
.appid = request("appid")
mode = .moderator()
End With
Set objPermission = nothing
if not mode then
' if from = "dm" then 'self delete modification
' set objCom = server.createobject("adodb.command")
' With objCom
' .activeConnection = datastore
' .commandText = dbOwnerPrefix&"spAdminCheckDeltePermission"
' .commandType = adCmdStoredProc
' .Parameters.Append .Createparameter("@RETURN_VALUE", adInteger, adParamReturnValue, 0)
' .Parameters.Append .Createparameter("@int_forumID", adInteger, adParamInput, 0, allforum(0,request("appid")))
' .Parameters.Append .Createparameter("@int_memID", adInteger, adParamInput, 0, memID)
' .Parameters.Append .Createparameter("@int_msgID", adInteger, adParamInput, 0, request("m"))
' .execute , , adExecuteNoRecords
' if .parameters("@RETURN_VALUE") = -1 then adminProAccess = false
' End With
' set objCom = nothing
' else
adminProAccess = false
' end if
end if
else
adminProAccess = false
end if
end if
end if
if not adminProAccess then
response.clear
response.redirect ("redirect.asp")
response.end
end if
SQL = "UPDATE pgd_config SET "
set objCon = server.CreateObject("adodb.connection")
with objCon
SELECT CASE from
CASE "dm"
Server.ScriptTimeout = 200
Dim arrUpfiles, oriSort, iFile, objFSO, deletefile, deleteMsgID
deleteMsgID = request("m")
Dim num_Total,num_Topics, returnVal
Set objCom = server.createobject("adodb.command")
with objCom
.activeconnection = datastore
.commandTimeout = 200
.commandText = dbOwnerPrefix&"spDelete"
.commandType = adCmdStoredProc
.Parameters.Append .Createparameter("@RETURN_VALUE", adInteger, adParamReturnValue, 0 )
.Parameters.Append .Createparameter("@int_ForumID", adInteger, adParamOutput, 0 )
.Parameters.Append .Createparameter("@num_Topics", adInteger, adParamOutput, 0 )
.Parameters.Append .Createparameter("@num_Total", adInteger, adParamOutput, 0 )
.Parameters.Append .Createparameter("@num_deleted", adInteger, adParamOutput, 0 )
.Parameters.Append .Createparameter("@int_msgID", adInteger, adParamInput, 0, deleteMsgID)
.execute , , adExecuteNoRecords
returnVal = .Parameters("@RETURN_VALUE")
forumID = .Parameters("@int_ForumID")
num_Total = .Parameters("@num_Total")
num_Topics = .Parameters("@num_Topics")
howmany = .Parameters("@num_deleted")
end with
set objcom = nothing
if returnVal = -1 then
howmany = 0
else
appid = ForumIdToAppid(forumID)
allforum(4,appid) = num_Topics
allforum(3,appid) = num_Total
Application.lock
Application(dbName&"foruminfo") = allforum
Application.unlock
end if
if frompage = "frame" then
if deleteMsgID <> request("threadID") then
response.write (variousSuccessHTML("opener.location.href='"&forumdir&"m.asp?m="&request("threadID")&"'"))
else
response.write (variousSuccessHTML("opener.location.href='"&forumdir&"tt.asp?appid="&appid&"'"))
end if
elseif frompage = "manage" or frompage="deletepage" then
response.write (variousSuccessHTML("opener.location.reload()"))
else
response.redirect(reloadlink)
end if
CASE "lock"
m = request("m")
action = request("actions")
if action = "lock" then SQL = "UPDATE pgd_messages SET locked=1 WHERE threadID="&m else _
SQL = "UPDATE pgd_messages SET locked=0 WHERE threadID="&m
.open datastore
.execute SQL, , adCmdText+adExecuteNoRecords
.close
response.write (variousSuccessHTML("opener.location.reload()"))
'response.redirect(reloadlink)
CASE "FAQ"
m = request("m")
action = request("actions")
if action = "faq" then SQL = "UPDATE pgd_messages SET isFAQ=1 WHERE threadID="&m else _
SQL = "UPDATE pgd_messages SET isFAQ=0 WHERE threadID="&m
.open datastore
.execute SQL, , adCmdText+adExecuteNoRecords
.close
response.write (variousSuccessHTML("opener.location.reload()"))
CASE "nail"
m = request("m")
action = request("actions")
if action = "nail" then SQL = dbOwnerPrefix&"spNail(1,"&m&")" else SQL = dbOwnerPrefix&"spNail(0,"&m&")"
.open datastore
.execute SQL, , adCmdStoredProc+adExecuteNoRecords
.close
response.write (variousSuccessHTML("opener.location.reload()"))
'response.redirect(reloadlink)
CASE "move"
dim leaving, oriForumID
oriForumID = request("oriForumID")
m = request("m")
forumID = request("forumID")
leaving = request("leaving")
if leaving = "on" then leaving = "yes" else leaving = "no"
if forumID="" then
response.write ("Please select a forum to move to!
")
response.write ("back")
response.end
end if
SQL = dbOwnerPrefix&"spMove("&m&", "&forumID&", '"&leaving&"', "&oriForumID&", '"&forumdir&"')"
.open datastore
.execute SQL, , adCmdStoredProc+adExecuteNoRecords
.close
call updateForum
response.write (variousSuccessHTML("opener.location.reload()"))
CASE "approve"
.open datastore
.execute "UPDATE pgd_messages SET moderated = 0 WHERE messageID = "&CLng(request("m"))
.close
'generate list to send subscription mails
Dim allData
set objRS = server.createobject("adodb.recordset")
with objRS
.CacheSize = 150
.open _
"SELECT p.login, messageID, parent, threadID, forumID, subject, body, m.mem FROM pgd_messages m inner join pgd_members p on m.mem = p.mem WHERE messageID = "&CLng(request("m")) _
, datastore, , , adCmdText
If not (.EOF or .BOF) then
allData = .getrows
End if
.close
end with
set objRS=nothing
Dim subsLogin,subsMessageID,subsPostOrReply,substhreadID,subsforumID,subsmSubject, subsmBody,subsmemID
if isArray(allData) then
subsLogin = allData(0,0)
subsMessageID = allData(1,0)
if allData(2,0) = 0 then subsPostOrReply = 0 else subsPostOrReply = 1
substhreadID = allData(3,0)
subsforumID = allData(4,0)
subsmSubject = allData(5,0)
subsmBody = allData(6,0)
subsmemID = allData(7,0)
call SendSubscription(subsLogin,subsMessageID,subsPostOrReply,substhreadID,subsforumID,subsmSubject,subsmBody, subsmemID)
End if
'end
response.redirect(reloadlink)
END SELECT
end with
set objCon = nothing
%>