📄 forum.asp
字号:
if nDays = "" then
nDays = 30
end if
defDate = DateToStr(dateadd("d",-(nDays),strForumTimeAdjust))
'## Forum_SQL - Get all topics from DB
strSql ="SELECT T.T_STATUS, T.CAT_ID, T.FORUM_ID, T.TOPIC_ID, T.T_VIEW_COUNT, T.T_SUBJECT, "
strSql = strSql & "T.T_AUTHOR, T.T_STICKY, T.T_REPLIES, T.T_UREPLIES, T.T_LAST_POST, T.T_LAST_POST_AUTHOR, "
strSql = strSql & "T.T_LAST_POST_REPLY_ID, M.M_NAME, MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME "
strSql2 = " FROM " & strMemberTablePrefix & "MEMBERS M, "
strSql2 = strSql2 & strActivePrefix & "TOPICS T, "
strSql2 = strSql2 & strMemberTablePrefix & "MEMBERS AS MEMBERS_1 "
strSql3 = " WHERE M.MEMBER_ID = T.T_AUTHOR "
strSql3 = strSql3 & " AND T.T_LAST_POST_AUTHOR = MEMBERS_1.MEMBER_ID "
strSql3 = strSql3 & " AND T.FORUM_ID = " & Forum_ID & " "
if nDays = "-1" then
if strStickyTopic = "1" then
strSql3 = strSql3 & " AND (T.T_STATUS <> 0 OR T.T_STICKY = 1)"
else
strSql3 = strSql3 & " AND T.T_STATUS <> 0 "
end if
end if
if nDays > "0" then
if strStickyTopic = "1" then
strSql3 = strSql3 & " AND (T.T_LAST_POST > '" & defDate & "' OR T.T_STICKY = 1)"
else
strSql3 = strSql3 & " AND T.T_LAST_POST > '" & defDate & "'"
end if
end if
' DEM --> if not a Moderator, all unapproved posts should not be viewed.
if AdminAllowed = 0 then
strSql3 = strSql3 & " AND ((T.T_AUTHOR <> " & MemberID
strSql3 = strSql3 & " AND T.T_STATUS < " ' Ignore unapproved/rejected posts
if Moderation = "Y" then
strSql3 = strSql3 & "2" ' Ignore unapproved posts
else
strSql3 = strSql3 & "3" ' Ignore any hold posts
end if
strSql3 = strSql3 & ") OR T.T_AUTHOR = " & MemberID & ")"
end if
strSql4 = " ORDER BY"
if strStickyTopic = "1" then
strSql4 = strSql4 & " T.T_STICKY DESC, "
end if
if strtopicsortfld = "author" then
strSql4 = strSql4 & " M." & strSortCol & " "
else
strSql4 = strSql4 & " T." & strSortCol & " "
end if
if strDBType = "mysql" then 'MySql specific code
if mypage > 1 then
intOffset = cLng((mypage-1) * strPageSize)
strSql5 = strSql5 & " LIMIT " & intOffset & ", " & strPageSize & " "
end if
'## Forum_SQL - Get the total pagecount
strSql1 = "SELECT COUNT(TOPIC_ID) AS PAGECOUNT "
set rsCount = my_Conn.Execute(strSql1 & strSql2 & strSql3)
iPageTotal = rsCount(0).value
rsCount.close
set rsCount = nothing
If iPageTotal > 0 then
inttotaltopics = iPageTotal
maxpages = (iPageTotal \ strPageSize )
if iPageTotal mod strPageSize <> 0 then
maxpages = maxpages + 1
end if
if iPageTotal < (strPageSize + 1) then
intGetRows = iPageTotal
elseif (mypage * strPageSize) > iPageTotal then
intGetRows = strPageSize - ((mypage * strPageSize) - iPageTotal)
else
intGetRows = strPageSize
end if
else
iPageTotal = 0
inttotaltopics = iPageTotal
maxpages = 0
end if
if iPageTotal > 0 then
set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql & strSql2 & strSql3 & strSql4 & strSql5, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
arrTopicData = rs.GetRows(intGetRows)
iTopicCount = UBound(arrTopicData, 2)
rs.close
set rs = nothing
else
iTopicCount = ""
end if
else 'end MySql specific code
set rs = Server.CreateObject("ADODB.Recordset")
rs.cachesize = strPageSize
rs.open strSql & strSql2 & strSql3 & strSql4, my_Conn, adOpenStatic
if not rs.EOF then
rs.movefirst
rs.pagesize = strPageSize
inttotaltopics = cLng(rs.recordcount)
rs.absolutepage = mypage '**
maxpages = cLng(rs.pagecount)
arrTopicData = rs.GetRows(strPageSize)
iTopicCount = UBound(arrTopicData, 2)
else
iTopicCount = ""
inttotaltopics = 0
end if
rs.Close
set rs = nothing
end if
Response.Write " <script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
" <!----- " & vbNewLine & _
" function jumpTo(s) {if (s.selectedIndex != 0) location.href = s.options[s.selectedIndex].value;return 1;}" & vbNewLine & _
vbNewLine & _
" function setDays() {document.DaysFilter.submit(); return 0;}" & vbNewLine & _
" // -->" & vbNewLine & _
" </script>" & vbNewLine
Response.Write " <table border=""0"" width=""100%"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""33%"" align=""left"" nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <a href=""default.asp"">" & getCurrentIcon(strIconFolderOpen,"All Forums","align=""absmiddle""") & "</a> <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","align=""absmiddle""")
if Cat_Status <> 0 then
Response.Write getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""")
else
Response.Write getCurrentIcon(strIconFolderClosed,"","align=""absmiddle""")
end if
Response.Write " <a href=""default.asp?CAT_ID=" & Cat_ID & """>" & ChkString(Cat_Name,"display") & "</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBlank,"","align=""absmiddle""") & getCurrentIcon(strIconBar,"","align=""absmiddle""")
if ArchiveView = "true" then
Response.Write getCurrentIcon(strIconFolderArchived,"","align=""absmiddle""")
else
if Cat_Status <> 0 and Forum_Status <> 0 then
Response.Write getCurrentIcon(strIconFolderOpenTopic,"","align=""absmiddle""")
else
Response.Write getCurrentIcon(strIconFolderClosedTopic,"","align=""absmiddle""")
end if
end if
Response.Write " <a href=""forum.asp?" & ArchiveLink & "FORUM_ID=" & Forum_ID & """>" & ChkString(Forum_Subject,"display") & "</a></font></td>" & vbNewLine & _
" <td align=""center"" valign=""bottom"" width=""33%""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine
call PostNewTopic()
Response.Write " </font></td>" & vbNewLine & _
" <form action=""" & Request.ServerVariables("SCRIPT_NAME") & "?" & ChkString(Request.Querystring,"sqlstring") & """ method=""post"" name=""DaysFilter"">" & vbNewLine & _
" <td align=""right"" valign=""bottom"" width=""33%"">" & vbNewLine & _
" <select name=""Days"" onchange=""javascript:setDays();"">" & vbNewLine & _
" <option value=""0""" & CheckSelected(ndays,0) & ">Show all topics</option>" & vbNewLine & _
" <option value=""-1""" & CheckSelected(ndays,-1) & ">Show all open topics</option>" & vbNewLine & _
" <option value=""1""" & CheckSelected(ndays,1) & ">Show topics from last day</option>" & vbNewLine & _
" <option value=""2""" & CheckSelected(ndays,2) & ">Show topics from last 2 days</option>" & vbNewLine & _
" <option value=""5""" & CheckSelected(ndays,5) & ">Show topics from last 5 days</option>" & vbNewLine & _
" <option value=""7""" & CheckSelected(ndays,7) & ">Show topics from last 7 days</option>" & vbNewLine & _
" <option value=""14""" & CheckSelected(ndays,14) & ">Show topics from last 14 days</option>" & vbNewLine & _
" <option value=""30""" & CheckSelected(ndays,30) & ">Show topics from last 30 days</option>" & vbNewLine & _
" <option value=""60""" & CheckSelected(ndays,60) & ">Show topics from last 60 days</option>" & vbNewLine & _
" <option value=""120""" & CheckSelected(ndays,120) & ">Show topics from last 120 days</option>" & vbNewLine & _
" <option value=""365""" & CheckSelected(ndays,365) & ">Show topics from the last year</option>" & vbNewLine & _
" </select>" & vbNewLine & _
" <input type=""hidden"" name=""Cookie"" value=""1"">" & vbNewLine & _
" </td></form>" & vbNewLine & _
" </tr>" & vbNewLine
if maxpages > 1 then
Response.Write " <tr>" & vbNewLine & _
" <td colspan=""3"" align=""right"" valign=""bottom"">" & vbNewLine & _
" <table border=""0"" align=""right"">" & vbNewLine & _
" <tr>" & vbNewLine
Call DropDownPaging(1)
Response.Write " </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
else
Response.Write " <tr>" & vbNewLine & _
" <td colspan=""3""><span style=""font-size: 6px;""><br /></span></td>" & vbNewLine & _
" </tr>" & vbNewLine
end if
Response.Write " </table>" & vbNewLine & _
" <table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" align=""center"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td bgcolor=""" & strTableBorderColor & """>" & vbNewLine & _
" <table border=""0"" width=""100%"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """> </font></b></td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>Topic</font></b></td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>Author</font></b></td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>Replies</font></b></td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>Read</font></b></td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>Last Post</font></b></td>" & vbNewLine
if mlev > 0 or (lcase(strNoCookies) = "1") then
Response.Write " <td align=""center"" bgcolor=""" & strHeadCellColor & """ nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine
if (AdminAllowed = 1) then
call ForumAdminOptions
else
Response.Write " " & vbNewLine
end if
Response.Write " </font></td>" & vbNewLine
end if
Response.Write " </tr>" & vbNewLine
if iTopicCount = "" then
Response.Write " <tr>" & vbNewLine & _
" <td colspan=""7"" bgcolor=""" & strForumCellColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><b>No Topics Found</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
else
tT_STATUS = 0
tCAT_ID = 1
tFORUM_ID = 2
tTOPIC_ID = 3
tT_VIEW_COUNT = 4
tT_SUBJECT = 5
tT_AUTHOR = 6
tT_STICKY = 7
tT_REPLIES = 8
tT_UREPLIES = 9
tT_LAST_POST = 10
tT_LAST_POST_AUTHOR = 11
tT_LAST_POST_REPLY_ID = 12
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -