<% '################################################################################# '## 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 '################################################################################# Dim ArchiveView Dim HeldFound, UnapprovedFound '################################################################################# if Request("FORUM_ID") = "" and (Request.Form("Method_Type") <> "login") and (Request.Form("Method_Type") <> "logout") then Response.Redirect "default.asp" end if Forum_ID = Request.QueryString("FORUM_ID") MyPage = Request("whichpage") %> <% nDays = Request.Cookies(strCookieURL & "NumDays") if mypage = "" then mypage = 1 end if if Request.form("cookie") = 1 then if strSetCookieToForum = "1" then Response.Cookies(strCookieURL & "NumDays").Path = strCookieURL end if Response.Cookies(strCookieURL & "NumDays") = Request.Form("days") Response.Cookies(strCookieURL & "NumDays").expires = strForumTimeAdjust + 365 nDays = Request.Form("Days") mypage = 1 end if if nDays = "" then nDays = 30 end if if request("ARCHIVE") = "true" then strActivePrefix = strTablePrefix & "A_" ArchiveView = "true" ArchiveLink = "ARCHIVE=true&" nDays = "0" else strActivePrefix = strTablePrefix ArchiveView = "" ArchiveLink = "" end if SortOrder = request.Form("newsort") SortImg = request.Form("sortimg") if SortOrder <> "" then mypage = 1 else SortOrder = request.Form("sort") end if defDate = DateToStr(dateadd("d", -(nDays), StrToDate(strForumTimeAdjust))) if (strAuthType = "nt") then set my_Conn = Server.CreateObject("ADODB.Connection") my_Conn.Open strConnString call NTauthenticate() if (ChkAccountReg() = "1") then call NTUser() end if end if %> <% if strPrivateForums = "1" then if Request("Method_Type") = "" and (mLev <> 4) then chkUser4(Forum_ID) end if end if if (mLev = 4) or (chkForumModerator(Forum_ID, STRdbntUserName)= "1") or (lcase(strNoCookies) = "1") then AdminAllowed = 1 else AdminAllowed = 0 end if '## Forum_SQL - Find out the Category/Forum status and if it Exists strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_STATUS, " & _ strTablePrefix & "CATEGORY.CAT_SUBSCRIPTION, " & _ strTablePrefix & "CATEGORY.CAT_MODERATION, " & _ strTablePrefix & "CATEGORY.CAT_ID, " & _ strTablePrefix & "FORUM.F_STATUS, " & _ strTablePrefix & "FORUM.F_SUBSCRIPTION, " & _ strTablePrefix & "FORUM.F_MODERATION, " & _ strTablePrefix & "FORUM.F_SUBJECT " & _ " FROM " & strTablePrefix & "CATEGORY, " & _ strTablePrefix & "FORUM " & _ " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & Forum_ID & _ " AND " & strTablePrefix & "CATEGORY.CAT_ID = " & strTablePrefix & "FORUM.CAT_ID" set rsCFStatus = my_Conn.Execute (StrSql) if rsCFStatus.EOF or rsCFStatus.BOF then rsCFStatus.close set rsCFStatus = nothing Response.Redirect("default.asp") else Cat_ID = rsCFStatus("CAT_ID") Cat_Status = rsCFStatus("CAT_STATUS") Cat_Subscription = rsCFStatus("CAT_SUBSCRIPTION") Cat_Moderation = rsCFStatus("CAT_MODERATION") Forum_Status = rsCFStatus("F_STATUS") Forum_Subject = rsCFStatus("F_SUBJECT") Forum_Subscription = rsCFStatus("F_SUBSCRIPTION") Forum_Moderation = rsCFStatus("F_MODERATION") rsCFStatus.close set rsCFStatus = nothing end if if strModeration = 1 and Cat_Moderation = 1 and (Forum_Moderation = 1 or Forum_Moderation = 2) then Moderation = "Y" end if ' DEM --> End of Code added for Moderation '## Forum_SQL - Get all topics from DB strSql ="SELECT " & strActivePrefix & "TOPICS.T_STATUS, " & strActivePrefix & "TOPICS.CAT_ID, " strSql = strSql & strActivePrefix & "TOPICS.FORUM_ID, " & strActivePrefix & "TOPICS.TOPIC_ID, " strSql = strSql & strActivePrefix & "TOPICS.T_VIEW_COUNT, " & strActivePrefix & "TOPICS.T_SUBJECT, " strSql = strSql & strActivePrefix & "TOPICS.T_AUTHOR, " strSql = strSql & strActivePrefix & "TOPICS.T_REPLIES, " & strActivePrefix & "TOPICS.T_LAST_POST, " strSql = strSql & strActivePrefix & "TOPICS.T_LAST_POST_AUTHOR, " strSql = strSql & strMemberTablePrefix & "MEMBERS.M_NAME, " strSql = strSql & "MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, " strSql = strSql & strActivePrefix & "TOPICS, " strSql = strSql & strMemberTablePrefix & "MEMBERS AS MEMBERS_1 " strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strActivePrefix & "TOPICS.T_AUTHOR " strSql = strSql & " AND " & strActivePrefix & "TOPICS.T_LAST_POST_AUTHOR = MEMBERS_1.MEMBER_ID " strSql = strSql & " AND " & strActivePrefix & "TOPICS.FORUM_ID = " & Forum_ID & " " if nDays = "-1" then strSql = strSql & " AND " & strActivePrefix & "TOPICS.T_STATUS <> 0 " end if if nDays > "0" then strSql = strSql & " AND " & strActivePrefix & "TOPICS.T_LAST_POST > '" & defDate & "'" end if ' DEM --> if not a Moderator, all unapproved posts should not be viewed. if AdminAllowed = 0 then strSql = strSql & " AND ((" & strActivePrefix & "TOPICS.T_AUTHOR <> " & MemberID strSql = strSql & " AND " & strActivePrefix & "TOPICS.T_STATUS < " ' Ignore unapproved/rejected posts if Moderation = "Y" then strSql = strSql & "2" ' Ignore unapproved posts else strSql = strSql & "3" ' Ignore any hold posts end if strSql = strSql & ") OR " & strActivePrefix & "TOPICS.T_AUTHOR = " & MemberID & ")" end if strSql = strSql & " ORDER BY " & strActivePrefix & "TOPICS.T_LAST_POST DESC " if strDBType = "mysql" then 'MySql specific code if mypage > 1 then intOffset = CInt((mypage-1) * strPageSize) strSql = strSql & " LIMIT " & intOffset & ", " & strPageSize & " " end if '## Forum_SQL - Get the total pagecount strSql2 = "SELECT COUNT(" & strActivePrefix & "TOPICS.TOPIC_ID) AS PAGECOUNT " strSql2 = strSql2 & " FROM " & strActivePrefix & "TOPICS " strSql2 = strSql2 & " WHERE " & strActivePrefix & "TOPICS.TOPIC_ID > 0 " strSql2 = strSql2 & " AND " & strActivePrefix & "TOPICS.FORUM_ID = " & Forum_ID & " " if nDays = "-1" then strSql2 = strSql2 & " AND " & strActivePrefix & "TOPICS.T_STATUS <> 0 " end if if nDays > "0" then strSql2 = strSql2 & " AND " & strActivePrefix & "TOPICS.T_LAST_POST > '" & defDate & "'" end if set rsCount = my_Conn.Execute(strSql2) if not rsCount.eof then maxpages = (rsCount("PAGECOUNT") \ strPageSize ) if rsCount("PAGECOUNT") mod strPageSize <> 0 then maxpages = maxpages + 1 end if else maxpages = 0 end if rsCount.close set rs = Server.CreateObject("ADODB.Recordset") rs.open strSql, my_Conn, 3 if not (rs.EOF or rs.BOF) then rs.movefirst end if else 'end MySql specific code set rs = Server.CreateObject("ADODB.Recordset") rs.cachesize=20 rs.open strSql, my_Conn, 3 if not (rs.EOF or rs.BOF) then rs.movefirst rs.pagesize = strPageSize maxpages = cint(rs.pagecount) rs.absolutepage = mypage end if end if %>
All Forums All Forums
<% If ArchiveView = "true" then Response.write "" Else Response.write "" End If %>  <% =ChkString(Forum_Subject,"display") %>
<% if (mlev = 4 or mlev = 3 or mlev = 2 or mlev = 1) or (lcase(strNoCookies) = "1") or (Request.Cookies(strUniqueID & "User")("Name") = "" or Request.Cookies(strUniqueID & "User")("Pword") = "") then %>
<% call PostNewTopic() %>
<% else %>   <% end if %>
" method="post" name="DaysFilter">
<% if maxpages > 1 then %>
Pages:   <% Call DropDownPaging() %>
<% else %>   <% end if %>
<% If mlev > 0 then response.write "" End If Response.write "" if rs.EOF or rs.BOF then %> <% else rec = 1 do until rs.EOF or (rec = strPageSize + 1) Topic_Status = rs("T_STATUS") Topic_ID = rs("TOPIC_ID") %> <% if IsNull(rs("T_LAST_POST_AUTHOR")) then strLastAuthor = "" else strLastAuthor = "
by: " if strUseExtendedProfile then strLastAuthor = strLastAuthor & "" else strLastAuthor = strLastAuthor & "" end if strLastAuthor = strLastAuthor & ChkString(rs("LAST_POST_AUTHOR_NAME"), "display") & "" end if %> <% if mlev > 0 then %> <% end if %> <% rec = rec + 1 rs.MoveNext loop end if %>
  Topic Author Replies Read Last Post" if (AdminAllowed = 1) or (lcase(strNoCookies) = "1") then call ForumAdminOptions() else call ForumMemberOptions() end if Response.write "
No Topics Found
<% if Cat_Status <> 0 and Forum_Status <> 0 and Topic_Status <> 0 then %><% =ChkIsNew(rs("T_LAST_POST")) %><% else if ArchiveView = "true" then Response.write "" elseif rs("T_LAST_POST") > Session(strCookieURL & "last_here_date") then Response.Write "" else Response.Write "" end if end if %> <% =ChkString(left(rs("T_SUBJECT"), 50),"display") %>  <% if strShowPaging = "1" then TopicPaging() end if %> <% =ChkString(rs("M_NAME"),"display") %> <% =rs("T_REPLIES") %> <% =rs("T_VIEW_COUNT") %><% =ChkDate(rs("T_LAST_POST")) %> <% =ChkTime(rs("T_LAST_POST")) %><%=strLastAuthor%> <% if AdminAllowed = 1 or strNoCookies = "1" then call TopicAdminOptions else call TopicMemberOptions end if%>
<% if maxpages > 1 then %>
There are <% =maxpages %> Pages of Topics:    <% Call Paging() %>
<% else %>   <% end if %>

New Posts New posts since last logon.
Old Posts Old Posts. <% if lcase(strHotTopic) = "1" then %>(Hot Topic <% =intHotTopicNum %> replies or more.)<% end if %>
Locked Topic Locked topic.
<% ' DEM --> Start of Code added for moderation if HeldFound = "Y" then Response.Write " Posts which have been held by the administrator/moderator.
" & vbNewline end if if UnapprovedFound = "Y" then Response.Write " Posts which have not been approved by the administrator/moderator.
" & vbNewline end if ' DEM --> End of Code added for moderation %>

<% if (mlev = 4 or mlev = 3 or mlev = 2 or mlev = 1) or (lcase(strNoCookies) = "1") then %>

<% call PostNewTopic() %>

<% else %>   <% end if %>
<% WriteFooter ' DEM --> Changed ChkIsNew to add the Full Moderation and to optimize the code Function ChkIsNew(dt) if ((CheckForUnModeratedPosts("TOPIC", Cat_ID, Forum_ID, Topic_ID) > 0) and AdminAllowed = 1) or (CheckForUnModeratedPosts("POSTAUTHOR", Cat_ID, Forum_ID, Topic_ID) > 0) then if Topic_Status <> 3 then UnApprovedFound = "Y" ChkIsNew = "Post(s) Need Approved" elseif Topic_Status = 3 and (AdminAllowed = 1 or rs("T_AUTHOR") = MemberID) then HeldFound = "Y" ChkIsNew = "Post is on hold" end if elseif dt > Session(strCookieURL & "last_here_date") then if rs("T_REPLIES") >= intHotTopicNum and lcase(strHotTopic) = "1" Then ChkIsNew = "Hot Topic" else ChkIsNew = "New Topic" end if elseif rs("T_REPLIES") >= intHotTopicNum and lcase(strHotTopic) = "1" Then ChkIsNew = "Hot Topic" else ChkIsNew = "" end if End Function ' DEM --> Changed ChkIsNew to add the Full Moderation and to optimize the code sub PostNewTopic() %> <% if Cat_Status = 0 or Forum_Status = 0 then if (AdminAllowed = 1) then %> ">Category Locked ">New Topic
<% else %> Category Locked Category Locked <% end if else if Forum_Status <> 0 then %> ">New Topic ">New Topic
<% else %> FORUM Locked Forum Locked <% end if end if ' DEM --> Start of Code added to handle subscription processing. if (strSubscription < 4 and strSubscription > 0) and (Cat_Subscription = 1 or Cat_Subscription = 2) and Forum_Subscription = 1 then CheckSubscription "FORUM", MemberID, Cat_ID, Forum_ID, 0, "", "" end if ' DEM --> End of code added to handle subscription processing. %>
<% end sub sub ForumAdminOptions() %> <% if (AdminAllowed = 1) or (lcase(strNoCookies) = "1") then if Cat_Status = 0 then if mlev = 4 then %> Un-Lock Category <% else %> Category Locked <% end if else if Forum_Status <> 0 then %> ')">Lock Forum <% else %> ')">Un-Lock Forum <% end if end if if (Cat_Status <> 0 and Forum_Status <> 0) or (AdminAllowed = 1) then %> &type=0">Edit Forum Properties <% end if %> ')">Delete Forum Archive Forum ">New Topic <% ' DEM --> Start of Code for Moderated Posting if (CheckForUnModeratedPosts("FORUM", Cat_ID, Forum_ID, 0) > 0) and (AdminAllowed = 1) then ForumString = "CAT_ID=" & Cat_ID & "&FORUM_ID=" & Forum_ID Response.Write " " & vbNewline end if ' DEM --> End of Code for Moderated Posting ' DEM --> Start of Code added to handle subscription processing. if (strSubscription < 4 and strSubscription > 0) and (Cat_Subscription > 0) and Forum_Subscription = 1 then CheckSubscription "FORUMNOTEXT", MemberID, Cat_ID, Forum_ID, 0, "", "" end if end if %> <% end sub sub ForumMemberOptions() %> ">New Topic <% ' DEM --> Start of Code added to handle subscription processing. if (strSubscription < 4 and strSubscription > 0) and (Cat_Subscription > 0) and Forum_Subscription > 0 then CheckSubscription "FORUMNOTEXT", MemberID, Cat_ID, Forum_ID, 0, "", "" end if end sub sub Paging() if maxpages > 1 then if mypage = "" then pge = 1 else pge = mypage end if scriptname = request.servervariables("script_name") Response.Write("" Response.Write ref else Response.Write("") end if if counter mod strPageNumberSize = 0 then Response.Write("") end if next Response.Write("
") for counter = 1 to maxpages if counter <> cint(pge) then ref = "" & " " & widenum(counter) & "" & counter & "" & " " & widenum(counter) & "" & counter & "
") end if end sub sub DropDownPaging() if maxpages > 1 then if mypage = "" then pge = 1 else pge = mypage end if scriptname = request.servervariables("script_name") Response.write "
" Response.write "" Response.write "" Response.write "" Response.Write(" of " & maxPages & "") Response.Write("
") end if end sub sub TopicPaging() mxpages = (rs("T_REPLIES") / strPageSize) if mxPages <> cint(mxPages) then mxpages = int(mxpages) + 1 end if if mxpages > 1 then Response.Write("") for counter = 1 to mxpages ref = "" Response.Write ref if counter mod strPageNumberSize = 0 then Response.Write("") end if next Response.Write("
" if ((mxpages > 9) and (mxpages > strPageNumberSize)) or ((counter > 9) and (mxpages < strPageNumberSize)) then ref = ref & " " end if ref = ref & widenum(counter) & "" & counter & "
 
") end if end sub sub TopicAdminOptions() if Cat_Status = 0 then %> Un-Lock Category <% else if Forum_Status = 0 then %> ')">Un-Lock Forum <% else if Topic_Status <> 0 then %> ')">Lock Topic <% else %> ')">Un-Lock Topic <% end if end if end if if (AdminAllowed = 1) or (Cat_Status <> 0 and Forum_Status <> 0 and Topic_Status <> 0) then %> &Forum_Title=<% =ChkString(Forum_Subject,"urlpath") %>&Topic_Title=<% =ChkString(rs("T_SUBJECT"),"urlpath") %>">Edit Message <% end if %> ')">Delete Topic <% if Topic_Status <= 1 and ArchiveView = "" then %> &Forum_Title=<% =ChkString(Forum_Subject,"urlpath") %>">Reply to Topic <% end if ' DEM --> Start of Code added to handle subscription processing. if (strSubscription < 4 and strSubscription > 0) and (Cat_Subscription > 0) and Forum_Subscription > 0 then CheckSubscription "TOPICNOTEXT", MemberID, Cat_ID, Forum_ID, Topic_ID, "", "" end if ' DEM --> End of code added to handle subscription processing. ' DEM --> Start of Code for Full Moderation if CheckForUnModeratedPosts("TOPIC", Cat_ID, Forum_ID, Topic_ID) > 0 then TopicString = "TOPIC_ID=" & Topic_ID & "&CAT_ID=" & Cat_ID & "&FORUM_ID=" & Forum_ID Response.Write "Approve/Hold/Reject All Unmoderated Posts for this Topic" & vbNewline end if ' DEM --> End of Code for Full Moderation end sub sub TopicMemberOptions() if ((Topic_Status > 0 and rs("T_AUTHOR") = MemberID) or (AdminAllowed = 1)) and ArchiveView = "" then %> &Forum_Title=<% =ChkString(Forum_Subject,"urlpath") %>&Topic_Title=<% =ChkString(rs("T_SUBJECT"),"urlpath") %>">Edit Message <% end if if Topic_Status <= 1 and ArchiveView = "" then %> &Forum_Title=<% =ChkString(Forum_Subject,"urlpath") %>">Reply to Topic <% end if ' DEM --> Start of Code added to handle subscription processing. if (strSubscription < 4 and strSubscription > 0) and (Cat_Subscription > 0) and Forum_Subscription > 0 then CheckSubscription "TOPICNOTEXT", MemberID, Cat_ID, Forum_ID, Topic_ID, "", "" end if ' DEM --> End of code added to handle subscription processing. end sub %>