%
'#################################################################################
'## Copyright (C) 2000 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
'#################################################################################
if Request.QueryString("FORUM_ID") = "" and (Request.Form("Method_Type") <> "login") and (Request.Form("Method_Type") <> "logout") then
Response.Redirect "default.asp"
end if
%>
<%
mypage = request("whichpage")
if mypage = "" then
mypage = 1
end if
nDays = Request.Cookies(strCookieURL & "NumDays")
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
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()
' end if
'end if
%>
<%
if strPrivateForums = "1" then
if Request("Method_Type") = "" and (mLev <> 4) then
chkUser4()
end if
end if
if (mLev = 4) or (chkForumModerator(Request.QueryString("FORUM_ID"), STRdbntUserName)= "1") or (lcase(strNoCookies) = "1") then
AdminAllowed = 1
else
AdminAllowed = 0
end if
'## Forum_SQL - Find out if the Category is Locked or Un-Locked and if it Exists
strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_STATUS "
strSql = strSql & " FROM " & strTablePrefix & "CATEGORY "
strSql = strSql & " WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & Request.QueryString("CAT_ID")
set rsCStatus = my_Conn.Execute (StrSql)
'## Forum_SQL - Find out if the Topic is Locked or Un-Locked and if it Exists
strSql = "SELECT " & strTablePrefix & "FORUM.F_STATUS "
strSql = strSql & " FROM " & strTablePrefix & "FORUM "
strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & Request.QueryString("FORUM_ID")
set rsFStatus = my_Conn.Execute (StrSql)
'## Forum_SQL - Get all topics from DB
strSql ="SELECT " & strTablePrefix & "TOPICS.T_STATUS, " & strTablePrefix & "TOPICS.CAT_ID, "
strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID, " & strTablePrefix & "TOPICS.TOPIC_ID, "
strSql = strSql & strTablePrefix & "TOPICS.T_VIEW_COUNT, " & strTablePrefix & "TOPICS.T_SUBJECT, "
strSql = strSql & strTablePrefix & "TOPICS.T_MAIL, " & strTablePrefix & "TOPICS.T_AUTHOR, "
strSql = strSql & strTablePrefix & "TOPICS.T_REPLIES, " & strTablePrefix & "TOPICS.T_LAST_POST, "
strSql = strSql & strTablePrefix & "TOPICS.T_LAST_POST_AUTHOR, "
strSql = strSql & strMemberTablePrefix & "MEMBERS.M_NAME, "
strSql = strSql & strMemberTablePrefix & "MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS, "
strSql = strSql & strTablePrefix & "TOPICS, "
strSql = strSql & strMemberTablePrefix & "MEMBERS AS " & strMemberTablePrefix & "MEMBERS_1 "
strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "TOPICS.T_AUTHOR "
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_LAST_POST_AUTHOR = "& strMemberTablePrefix & "MEMBERS_1.MEMBER_ID "
strSql = strSql & " AND " & strTablePrefix & "TOPICS.FORUM_ID = " & Request.QueryString("FORUM_ID") & " "
if nDays = "-1" then
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS <> 0 "
end if
if nDays > "0" then
strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_LAST_POST > '" & defDate & "'"
end if
strSql = strSql & " ORDER BY " & strTablePrefix & "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(" & strTablePrefix & "TOPICS.TOPIC_ID) AS PAGECOUNT "
strSql2 = strSql2 & " FROM " & strTablePrefix & "TOPICS "
strSql2 = strSql2 & " WHERE " & strTablePrefix & "TOPICS.TOPIC_ID > 0 "
strSql2 = strSql2 & " AND " & strTablePrefix & "TOPICS.FORUM_ID = " & Request.QueryString("FORUM_ID") & " "
if nDays = "-1" then
strSql2 = strSql2 & " AND " & strTablePrefix & "TOPICS.T_STATUS <> 0 "
end if
if nDays > "0" then
strSql2 = strSql2 & " AND " & strTablePrefix & "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.cachesize=20
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
'## Forum_SQL - Get all Forum Categories From DB
strSql = "SELECT CAT_ID FROM " & strTablePrefix & "CATEGORY"
set rsCat = my_Conn.Execute (StrSql)
%>
<%
if rsCStatus.EOF = true OR rsFStatus.EOF = true then
Response.Redirect("default.asp")
end if
%>
All Forums
 0 and rsFStatus("F_STATUS") <> 0 then Response.Write("icon_folder_open_topic.gif") else Response.Write("icon_folder_closed_topic.gif") %>" height=15 width=15 border="0"> <% =ChkString(Request.QueryString("FORUM_Title"),"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 %>
|
|
|
|
<% if maxpages > 1 then %>
| Pages: |
<% Call Paging() %> |
<% else %>
<% end if %>
|
| |
Topic |
Author |
Replies |
Read |
Last Post |
<% if (AdminAllowed = 1) or (lcase(strNoCookies) = "1") then %>
<% call ForumAdminOptions() %> |
<% end if %>
<% if rs.EOF or rs.BOF then %>
| No Topics Found |
<% else
rec = 1
do until rs.EOF or (rec = strPageSize + 1) %>
&FORUM_ID=<% =Request.QueryString("FORUM_ID") %>&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Topic_Title=<% =ChkString(left(rs("T_SUBJECT"), 50),"urlpath") %>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"urlpath") %>"><%
if rsCStatus("CAT_STATUS") <> 0 and rsFStatus("F_STATUS") <> 0 and rs("T_STATUS") <> 0 then %><% =ChkIsNew(rs("T_LAST_POST")) %><%
else
if rs("T_LAST_POST") > Session(strCookieURL & "last_here_date") then
Response.Write " "
else
Response.Write " "
end if
end if %> |
&FORUM_ID=<% =Request.QueryString("FORUM_ID") %>&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Topic_Title=<% =ChkString(left(rs("T_SUBJECT"), 50),"urlpath") %>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"urlpath") %>"><% =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") %> |
<%
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
%>
<% =ChkDate(rs("T_LAST_POST")) %> <% =ChkTime(rs("T_LAST_POST")) %><%=strLastAuthor%> |
<% if AdminAllowed = 1 or strNoCookies = "1" then %>
<% if rsCStatus("CAT_STATUS") = 0 then %>
')">
<% else
if rsFStatus("F_STATUS") = 0 then %>
&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"JSurlpath") %>')">
<% else
if rs("T_STATUS") <> 0 then %>
&FORUM_ID=<% =rs("FORUM_ID") %>&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Topic_Title=<% =ChkString(rs("T_SUBJECT"),"JSurlpath") %>')">
<% else %>
&FORUM_ID=<% =rs("FORUM_ID") %>&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Topic_Title=<% =ChkString(rs("T_SUBJECT"),"JSurlpath") %>')">
<% end if
end if
end if
if (AdminAllowed = 1) or (rsCStatus("CAT_STATUS") <> 0 and rsFStatus("F_STATUS") <> 0 and rs("T_STATUS") <> 0) then %>
&FORUM_ID=<% =rs("FORUM_ID") %>&CAT_ID=<% =rs("CAT_ID") %>&auth=<% =ChkString(rs("T_AUTHOR"),"urlpath") %>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"urlpath") %>&Topic_Title=<% =ChkString(rs("T_SUBJECT"),"urlpath") %>">
<% end if %>
&FORUM_ID=<% =rs("FORUM_ID") %>&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Topic_Title=<% =ChkString(rs("T_SUBJECT"),"JSurlpath") %>')">
&FORUM_ID=<% =rs("FORUM_ID") %>&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Topic_Title=<% =ChkString(rs("T_SUBJECT"),"urlpath") %>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"urlpath") %>">
|
<% end if %>
<% rec = rec + 1
rs.MoveNext
loop
end if %>
|
<% if maxpages > 1 then %>
| There are <% =maxpages %> Pages of Topics: |
<% Call Paging() %> |
<% else %>
<% end if %>
|
|
|
<% if (mlev = 4 or mlev = 3 or mlev = 2 or mlev = 1) or (lcase(strNoCookies) = "1") then %>
<% call PostNewTopic() %>
<% else %>
<% end if %>
|
|
<%
Function ChkIsNew(dt)
if lcase(strHotTopic) = "1" then
if dt > Session(strCookieURL & "last_here_date") then
if rs("T_REPLIES") >= intHotTopicNum Then
ChkIsNew = "
"
else
ChkIsNew = "
"
end if
Else
if rs("T_REPLIES") >= intHotTopicNum Then
ChkIsNew = "
"
else
ChkIsNew = "
"
end if
end if
else
if dt > Session(strCookieURL & "last_here_date") then
ChkIsNew = "
"
Else
ChkIsNew = "
"
end if
end if
End Function
sub PostNewTopic()
%>
<% if rsCStatus("CAT_STATUS") = 0 or rsFStatus("F_STATUS") = 0 then
if (AdminAllowed = 1) then %>
&CAT_ID=<% =Request.QueryString("CAT_ID")%>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"urlpath") %>">
&CAT_ID=<% =Request.QueryString("CAT_ID")%>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"urlpath") %>">New Topic
<% else %>
Category Locked
<% end if
else
if rsFStatus("F_STATUS") <> 0 then %>
&CAT_ID=<% =Request.QueryString("CAT_ID")%>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"urlpath") %>">
&CAT_ID=<% =Request.QueryString("CAT_ID")%>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"urlpath") %>">New Topic
<% else %>
Forum Locked
<% end if
end if %>
<%
end sub
sub ForumAdminOptions()
%>
<% if (AdminAllowed = 1) or (lcase(strNoCookies) = "1") then
if rsCStatus("CAT_STATUS") = 0 then
if mlev = 4 then %>
')">
<% else %>
<% end if
else
if rsFStatus("F_STATUS") <> 0 then %>
&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"JSurlpath") %>')">
<% else %>
&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"JSurlpath") %>')">
<% end if
end if
if (rsCStatus("CAT_STATUS") <> 0 and rsFStatus("F_STATUS") <> 0) or (AdminAllowed = 1) then %>
&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"JSurlpath") %>&type=0">
<% end if %>
&CAT_ID=<% =Request.QueryString("CAT_ID") %>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"JSurlpath") %>')">
&CAT_ID=<% =Request.QueryString("CAT_ID")%>&Forum_Title=<% =ChkString(Request.QueryString("FORUM_Title"),"JSurlpath") %>">
<% 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("")
for counter = 1 to maxpages
if counter <> cint(pge) then
ref = "| " & " " & widenum(counter) & "" & counter & " | "
Response.Write ref
else
Response.Write("" & " " & widenum(counter) & "" & counter & " | ")
end if
if counter mod strPageNumberSize = 0 then
Response.Write("
")
end if
next
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 = ""
if ((mxpages > 9) and (mxpages > strPageNumberSize)) or ((counter > 9) and (mxpages < strPageNumberSize)) then
ref = ref & " "
end if
ref = ref & widenum(counter) & "" & counter & " | "
Response.Write ref
if counter mod strPageNumberSize = 0 then
Response.Write("
| | ")
end if
next
Response.Write("
")
end if
end sub
%>