%
'#################################################################################
'## Copyright (C) 2000-01 Michael Anderson and Pierre Gorissen
'##
'## 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 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 support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'##
'## or
'##
'## Snitz Communications
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
'#################################################################################
'## Variable declaration
'#################################################################################
dim strSelecSize
dim intCols, intRows
%>
<%
'#################################################################################
'## Initialise variables
'#################################################################################
strSelectSize = Request.Form("SelectSize")
strRqMethod = Request.QueryString("method")
strRqTopicID = Request.QueryString("TOPIC_ID")
strRqForumID = Request.QueryString("FORUM_ID")
strRqCatID = Request.QueryString("CAT_ID")
strCkPassWord = Request.Cookies(strUniqueID & "User")("Pword")
'#################################################################################
'## Page-code start
'#################################################################################
if request("ARCHIVE") = "true" then
strActivePrefix = strTablePrefix & "A_"
ArchiveView = "true"
else
strActivePrefix = strTablePrefix
ArchiveView = ""
end if
if strSelectSize = "" or IsNull(strSelectSize) then
strSelectSize = Request.Cookies(strCookieURL & "strSelectSize")
end if
if not(IsNull(strSelectSize)) then
Response.Cookies(strCookieURL & "strSelectSize") = strSelectSize
Response.Cookies(strCookieURL & "strSelectSize").expires = Now() + 365
end if
%>
<%
if ArchiveView <> "" then
if MethodType = "Reply" or _
MethodType = "ReplyQuote" or _
MethodType = "TopicQuote" then
Go_Result "This is not allowed in the Archives."
end if
end if
if strRqMethod = "Edit" or _
strRqMethod = "EditTopic" or _
strRqMethod = "Reply" or _
strRqMethod = "ReplyQuote" or _
strRqMethod = "Topic" or _
strRqMethod = "TopicQuote" then
if strRqMethod <> "Topic" then
'## Forum_SQL - Find out if the Category, Forum or Topic is Locked or Un-Locked and if it Exists
strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_STATUS, " &_
strTablePrefix & "FORUM.F_STATUS, " &_
strActivePrefix & "TOPICS.T_STATUS " &_
" FROM " & strTablePrefix & "CATEGORY, " &_
strTablePrefix & "FORUM, " &_
strActivePrefix & "TOPICS " &_
" WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & strActivePrefix & "TOPICS.CAT_ID " &_
" AND " & strTablePrefix & "FORUM.FORUM_ID = " & strActivePrefix & "TOPICS.FORUM_ID " &_
" AND " & strActivePrefix & "TOPICS.TOPIC_ID = " & strRqTopicID & ""
else
'## Forum_SQL - Find out if the Category or Forum is Locked or Un-Locked and if it Exists
strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_STATUS, " &_
strTablePrefix & "FORUM.F_STATUS " &_
" FROM " & strTablePrefix & "CATEGORY, " &_
strTablePrefix & "FORUM " &_
" WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & strTablePrefix & "FORUM.CAT_ID " &_
" AND " & strTablePrefix & "FORUM.FORUM_ID = " & strRqForumID & ""
end if
set rsStatus = my_Conn.Execute(strSql)
if rsStatus.EOF or rsStatus.BOF then
Go_Result "Please don't attempt to edit the URL
to gain access to locked Forums/Categories."
else
blnCStatus = rsStatus("CAT_STATUS")
blnFStatus = rsStatus("F_STATUS")
if strRqMethod <> "Topic" then
blnTStatus = rsStatus("T_STATUS")
else
blnTStatus = 1
end if
rsStatus.close
set rsStatus = nothing
end if
if (mLev = 4) or (chkForumModerator(strRqForumID, ChkString(strDBNTUserName, "decode"))= "1") or (lcase(strNoCookies) = "1") then
AdminAllowed = 1
else
AdminAllowed = 0
end if
select case strRqMethod
case "Topic"
if (blnCStatus = 0) and (AdminAllowed = 0) then
Go_Result "You have attempted to post a New Topic to a Locked Category"
end if
if (blnFStatus = 0) and (AdminAllowed = 0) then
Go_Result "You have attempted to post a New Topic to a Locked Forum"
end if
case "EditTopic"
if ((blnCStatus = 0) or (blnFStatus = 0) or (blnTStatus = 0)) and (AdminAllowed = 0) then
Go_Result "You have attempted to edit a Locked Topic"
end if
case "Reply", "ReplyQuote", "TopicQuote"
if ((blnCStatus = 0) or (blnFStatus = 0) or (blnTStatus = 0)) and (AdminAllowed = 0) then
Go_Result "You have attempted to Reply to a Locked Topic"
end if
case "Edit"
if ((blnCStatus = 0) or (blnFStatus = 0) or (blnTStatus = 0)) and (AdminAllowed = 0) then
Go_Result "You have attempted to Edit a Reply to a Locked Topic"
end if
end select
end if
select case strSelectSize
case "1"
intCols = 45
intRows = 6
case "2"
intCols = 70
intRows = 12
case "3"
intCols = 90
intRows = 12
case "4"
intCols = 130
intRows = 15
case else
intCols = 70
intRows = 12
end select
%>
<%
if strRqMethod = "EditForum" then
if (mLev = 4) or (chkForumModerator(strRqForumId, strDBNTUserName) = "1") then
'## Do Nothing
else
Response.Write "
ERROR: Only moderators and administrators can edit forums
" & vbNewline
WriteFooter
Response.End
end if
end if
Msg = ""
select case strRqMethod
case "Reply"
if (strNoCookies = 1) or (strDBNTUserName = "") then
Msg = Msg & "Note: You must be registered in order to post a reply.
"
Msg = Msg & "To register, click here. Registration is FREE!
"
end if
case "ReplyQuote"
if (strNoCookies = 1) or (strDBNTUserName = "") then
Msg = Msg & "Note: You must be registered in order to post a reply.
"
Msg = Msg & "To register, click here. Registration is FREE!
"
end if
case "Topic"
if (strNoCookies = 1) or (strDBNTUserName = "") then
Msg = Msg & "Note: You must be registered in order to post a Topic.
"
Msg = Msg & "To register, click here. Registration is FREE!
"
end if
case "TopicQuote"
if (strNoCookies = 1) or (strDBNTUserName = "") then
Msg = Msg & "Note: You must be registered in order to post a reply.
"
Msg = Msg & "To register, click here. Registration is FREE!
"
end if
case "Forum"
Msg = Msg & "Note: You must be an administrator to create a new forum.
"
case "URL"
Msg = Msg & "Note: You must be an administrator to create a new web link.
"
case "Edit"
Msg = Msg & "Note: Only the poster of this message, and the Moderator can edit the message."
case "EditTopic"
Msg = Msg & "Note: Only the poster of this message, and the Moderator can edit the message."
case "EditForum"
Msg = Msg & "Note: Only the Moderator can edit the message."
case "EditCategory"
Msg = Msg & "Note: Only an administrator can edit the subject."
end select
if strRqMethod = "Edit" or _
strRqMethod = "ReplyQuote" then
'## Forum_SQL
strSql = "SELECT R_AUTHOR,R_MESSAGE "
strSql = strSql & " FROM " & strActivePrefix & "REPLY "
strSql = strSql & " WHERE " & strActivePrefix & "REPLY.REPLY_ID = " & Request.QueryString("REPLY_ID")
set rs = my_Conn.Execute (strSql)
strAuthor = rs("R_AUTHOR")
if strRqMethod = "Edit" then
TxtMsg = rs("R_MESSAGE")
else
if strRqMethod = "ReplyQuote" then
TxtMsg = "[quote]" & vbNewline
TxtMsg = TxtMsg & rs("R_MESSAGE") & vbNewline
TxtMsg = TxtMsg & "[/quote]"
end if
end if
'if strDBNTUserName = getMemberName(strAuthor) then
'boolReply =rs("R_MAIL")
'end if
end if
if strRqMethod = "EditTopic" or strRqMethod = "TopicQuote" then
'## Forum_SQL
strSql = "SELECT " & strActivePrefix & "TOPICS.CAT_ID, " &_
strActivePrefix & "TOPICS.FORUM_ID, " &_
strActivePrefix & "TOPICS.TOPIC_ID, " &_
strActivePrefix & "TOPICS.T_SUBJECT, " &_
strActivePrefix & "TOPICS.T_AUTHOR, " &_
strActivePrefix & "TOPICS.T_MESSAGE " &_
" FROM " & strActivePrefix & "TOPICS " &_
" WHERE " & strActivePrefix & "TOPICS.TOPIC_ID = " & strRqTopicID
set rs = my_Conn.Execute (strSql)
TxtSub = rs("T_SUBJECT")
strAuthor = rs("T_AUTHOR")
if strRqMethod = "EditTopic" then
TxtMsg = rs("T_MESSAGE")
else
if strRqMethod = "TopicQuote" then
TxtMsg = "[quote]" & vbNewline
TxtMsg = TxtMsg & rs("T_MESSAGE") & vbNewline
TxtMsg = TxtMsg & "[/quote]"
end if
end if
'if strDBNTUserName = getMemberName(strAuthor) then boolTopic = rs("T_MAIL")
end if
if strRqMethod = "EditForum" or _
strRqMethod = "EditURL" then
'## Forum_SQL
' DEM --> Added F_SUBSCRIPTION, F_MODERATION to the end of this select
strSql = "SELECT " & strTablePrefix & "FORUM.F_SUBJECT, " & strTablePrefix & "FORUM.F_URL, " & _
strTablePrefix & "FORUM.F_DESCRIPTION, " & strTablePrefix & "FORUM.F_PRIVATEFORUMS, " & _
strTablePrefix & "FORUM.F_PASSWORD_NEW, " & strTablePrefix & "FORUM.F_SUBSCRIPTION, " & _
strTablePrefix & "FORUM.F_MODERATION " & _
" FROM " & strTablePrefix & "FORUM " & _
" WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & strRqForumId
set rs = my_Conn.Execute (strSql)
if strRqMethod = "EditURL" then
TxtUrl = rs("F_URL")
end if
if strRqMethod = "EditForum" or _
strRqMethod = "EditURL" then
TxtSub = rs("F_SUBJECT")
TxtMsg = rs("F_DESCRIPTION")
' DEM --> Added fields to get them into local variables which is a faster run
ForumModeration = rs("F_MODERATION")
ForumSubscription = rs("F_SUBSCRIPTION")
end if
end if
' DEM --> Added editforum and forum to get the cat_subscription and cat_moderation for later use.
if strRqMethod = "EditCategory" or strRqMethod = "EditForum" or strRqMethod = "Forum" then
'## Forum_SQL
strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_NAME "
' DEM --> Added CAT_SUBSCRIPTION for subscription services
strSql = strSql & ", " & strTablePrefix & "CATEGORY.CAT_SUBSCRIPTION "
' DEM --> Added CAT_MODERATION for moderation processing
strSql = strSql & ", " & strTablePrefix & "CATEGORY.CAT_MODERATION "
strSql = strSql & " FROM " & strTablePrefix & "CATEGORY "
strSql = strSql & " WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & strRqCatID
' DEM --> Added if statement to use a different connection and to move the database fields to local variables
if strRqMethod = "EditForum" or strRqMethod = "Forum" then
set rs1 = my_Conn.Execute (strSql)
CatSubscription = rs1("CAT_SUBSCRIPTION")
CatModeration = rs1("CAT_MODERATION")
set rs1 = nothing
else
set rs = my_Conn.Execute (strSql)
CatSubscription = rs("CAT_SUBSCRIPTION")
CatModeration = rs("CAT_MODERATION")
end if
if strRqMethod = "EditCategory" then
TxtSub = rs("CAT_NAME")
end if
end if
select case strRqMethod
case "Category"
btn = "Post New Category"
case "Edit", "EditCategory", "EditForum", "EditTopic", "EditURL"
btn = "Post Changes"
case "Forum"
btn = "Post New Forum"
case "Reply", "ReplyQuote", "TopicQuote"
btn = "Post New Reply"
case "Topic"
btn = "Post New Topic"
case "URL"
btn = "Post New URL"
case else
btn = "Post"
end select
%>
<% =Msg %>
<%
if strRqMethod = "Edit" or strRqMethod = "EditTopic" or strRqMethod = "EditForum" or _
strRqMethod = "Reply" or strRqMethod = "ReplyQuote" or _
strRqMethod = "Topic" or strRqMethod = "TopicQuote" then
%>
<%
end if
%>
" & vbNewline & _
" | " & vbNewline & _
"
" & vbNewline & _
"
" & vbNewline & _
""
if strRqMethod = "Reply" or _
strRqMethod = "TopicQuote" or _
strRqMethod = "ReplyQuote" then
%>
size="<% =strDefaultFontSize %>" color="<% =strHeadFontColor %>">T O P I C R E V I E W |
<%
' DEM --> Added Select of Moderation Fields
strSQL = "SELECT " & strTablePrefix & "CATEGORY.CAT_MODERATION, "
strSQL = strSQL & strTablePrefix & "FORUM.F_MODERATION "
strSQL = strSQL & "FROM " & strTablePrefix & "CATEGORY, " & strTablePrefix & "FORUM "
strSQL = strSQL & " WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & strRqCatID
strSQL = strSQL & " AND " & strTablePrefix & "FORUM.FORUM_ID = " & strRqForumID
set rsa = my_Conn.Execute (strSql)
' ## Moderators and Admins can see unmoderated posts.
if (mLev = 4) or (chkForumModerator(strRqForumId, strDBNTUserName) = "1") then
Moderation = "N"
else
if strModeration = 1 and rsa("CAT_MODERATION") = 1 and (rsa("F_MODERATION") = 1 or rsa("F_MODERATION") = 3) then
Moderation = "Y"
else
Moderation = "N"
end if
end if
' DEM --> End of Moderation Code
'## Forum_SQL
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strActivePrefix & "TOPICS.T_MESSAGE "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, " & strActivePrefix & "TOPICS "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strActivePrefix & "TOPICS.T_AUTHOR AND "
strSql = strSql & " " & strActivePrefix & "TOPICS.TOPIC_ID = " & strRqTopicID
set rs = my_Conn.Execute (strSql)
Response.Write " " & vbNewline
Response.Write " " & ChkString(rs("M_NAME"),"display") & " | " & vbNewline
Response.Write " " & formatStr(rs("T_MESSAGE")) & " | " & vbNewline
Response.Write " " & vbNewline
'## Forum_SQL - Get all replies to Topic from the DB
strSql ="SELECT " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strActivePrefix & "REPLY.R_MESSAGE "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, " & strActivePrefix & "REPLY "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strActivePrefix & "REPLY.R_AUTHOR "
strSql = strSql & " AND TOPIC_ID = " & strRqTopicID & " "
' DEM --> Added check for moderation so that only admins and moderators can see the unapproved posts.
if Moderation = "Y" then
strSql = strSql & " AND R_STATUS < 2 " ' Ignore unapproved and rejected posts...
else
strSql = strSql & " AND R_STATUS < 3 " ' Ignore all rejected posts....
end if
strSql = strSql & " ORDER BY " & strActivePrefix & "REPLY.R_DATE"
set rs = Server.CreateObject("ADODB.Recordset")
' rs.cachesize=15
rs.open strSql, my_Conn, 3
strI = 0
if rs.EOF or rs.BOF then
Response.Write ""
else
rs.movefirst
do until rs.EOF
if strI = 0 then
CColor = strAltForumCellColor
else
CColor = strForumCellColor
end if
Response.Write " " & vbNewline & _
" " & ChkString(rs("M_NAME"),"display") & " | " & vbNewline & _
" " & formatStr(rs("R_MESSAGE")) & " | " & vbNewline & _
" " & vbNewline
rs.MoveNext
strI = strI + 1
if strI = 2 then
strI = 0
end if
loop
end if
Response.Write " " & vbNewline & _
" | " & vbNewline & _
"
" & vbNewline & _
"
" & vbNewline & _
"" & vbNewline
end if
WriteFooter
function Go_Result(message)
Response.write "
" & message & "
" &_
"
" &_
""
WriteFooter
Response.end
end function
%>