<% @ Language=VBScript %> <% Option Explicit %> <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide - Web Wiz Forums '** http://www.webwizforums.com '** '** Copyright 2001-2006 Bruce Corkhill All Rights Reserved. '** '** This program is free software; you can modify (at your own risk) any part of it '** under the terms of the License that accompanies this software and use it both '** privately and commercially. '** '** All copyright notices must remain in tacked in the scripts and the '** outputted HTML. '** '** You may use parts of this program in your own private work, but you may NOT '** redistribute, repackage, or sell the whole or any part of this program even '** if it is modified or reverse engineered in whole or in part without express '** permission from the author. '** '** You may not pass the whole or any part of this application off as your own work. '** '** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place '** and must remain visible when the pages are viewed unless permission is first granted '** by the copyright holder. '** '** This program is distributed in the hope that it will be useful, '** but WITHOUT ANY WARRANTY; without even the implied warranty of '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER '** WARRANTIES WHETHER EXPRESSED OR IMPLIED. '** '** You should have received a copy of the License along with this program; '** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom. '** '** '** No official support is available for this program but you may post support questions at: - '** http://www.webwizguide.info/forum '** '** Support questions are NOT answered by e-mail ever! '** '** For correspondence or non support questions contact: - '** '** Web Wiz Guide, Unit 10E, Dawkins Road Industrial Estate, Poole, Dorset, UK, BH15 4JD '** '**************************************************************************************** 'Set the response buffer to true as we maybe redirecting Response.Buffer = True 'Make sure this page is not cached Response.Expires = -1 Response.ExpiresAbsolute = Now() - 2 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "No-Store" 'Dimension variables Dim intForumID 'Holds the forum ID number Dim strForumName 'Holds the forum name Dim intCatID 'Holds the cat ID Dim strCatName 'Holds the cat name Dim lngNumberOfReplies 'Holds the number of replies for a topic Dim lngTopicID 'Holds the topic ID Dim strSubject 'Holds the topic subject Dim strTopicIcon 'Holds the topic icon Dim strTopicStartUsername 'Holds the username of the user who started the topic Dim lngTopicStartUserID 'Holds the users Id number for the user who started the topic Dim lngNumberOfViews 'Holds the number of views a topic has had Dim lngLastEntryMessageID 'Holds the message ID of the last entry Dim strLastEntryUsername 'Holds the username of the last person to post a message in a topic Dim lngLastEntryUserID 'Holds the user's ID number of the last person to post a meassge in a topic Dim dtmLastEntryDate 'Holds the date the last person made a post in the topic Dim intRecordPositionPageNum 'Holds the recorset page number to show the topics for Dim intRecordLoopCounter 'Holds the loop counter numeber Dim intTopicPageLoopCounter 'Holds the number of pages there are in the forum Dim intShowTopicsFrom 'Holds when to show the topics from Dim strShowTopicsFrom 'Holds the display text from when the topics are shown from Dim blnForumLocked 'Set to true if the forum is locked Dim blnTopicLocked 'set to true if the topic is locked Dim intPriority 'Holds the priority level of the topic Dim intNumberOfTopicPages 'Holds the number of topic pages Dim intTopicPagesLoopCounter 'Holds the number of loops Dim lngPollID 'Holds the Poll ID Dim blnNewPost 'Set to true if the post is a new post since the users last visit Dim intShowTopicsWithin 'Holds the amount of time to show topics within Dim intMovedForumID 'If the post is moved this holds the moved ID Dim intNonPriorityTopicNum 'Holds the record count for non priority topics Dim strFirstPostMsg 'Holds the first message in the topic Dim dtmFirstEntryDate 'Holds the date of the first message Dim lngLastEntryTopicID 'Holds the topic ID of the last entry Dim strLastEntryUser 'Holds the the username of the user who made the last entry Dim strForumDiscription 'Holds the forum description Dim strForumPassword 'Holds the forum password if there is one Dim lngNumberOfTopics 'Holds the number of topics in a forum Dim lngNumberOfPosts 'Holds the number of Posts in the forum Dim blnHideForum 'Set to true if this is a hidden forum Dim intForumColourNumber 'Holds the number to calculate the table row colour Dim lngLastEntryMeassgeID 'Holds the message ID of the last entry Dim intMasterForumID 'Holds the main forum ID Dim strMasterForumName 'Holds the main forum name Dim blnHideTopic 'Set to true if the topic is hidden Dim strTableRowColour 'Holds the row colour for the table Dim sarryTopics 'Holds the topics to display Dim sarrySubForums 'Holds the sub forums to display Dim intSubForumID 'Holds the sub forum ID Dim intCurrentRecord 'Holds the current record position Dim intTotalRecords 'Holds the number of records in the topics array Dim intTotalRecordsPages 'Holds the total number of pages Dim intStartPosition 'Holds the start poition for records to be shown Dim intEndPosition 'Holds the end poition for records to be shown Dim intSubCurrentRecord 'Holds the current records for the sub forums Dim strSortDirection 'Holds the sort order Dim strSortBy 'Holds the way the records are sorted Dim strLinkPage 'Holds the page to link to Dim strShowTopicsDate 'Holds the show topics date Dim dtmEventDate 'Holds the date if this is a calendar event Dim intPageLinkLoopCounter 'Initlaise variables Const intMaxResults = 500 intNonPriorityTopicNum = 0 blnHideTopic = false intSubCurrentRecord = 0 intCurrentRecord = 0 strShowTopicsFrom = " '" & strTxtAnyDate & "'" 'Read in the Forum ID to display the Topics for If isNumeric(Request.QueryString("FID")) Then intForumID = CInt(Request.QueryString("FID")) Else intForumID = 0 'If there is no Forum ID to display the Topics for then redirect the user to the main forum page If intForumID = 0 Then 'Clean up Call closeDatabase() 'Redirect Response.Redirect("default.asp" & strQsSID1) End If 'If this is the first time the page is displayed then the Forum Topic record position is set to page 1 If isNumeric(Request.QueryString("PN")) = false Then intRecordPositionPageNum = 1 ElseIf Request.QueryString("PN") < 1 Then intRecordPositionPageNum = 1 'Else the page has been displayed before so the Forum Topic record postion is set to the Record Position number Else intRecordPositionPageNum = CInt(Request.QueryString("PN")) End If 'Read in the forum details inc. cat name, forum details, and permissions (also reads in the main forum name if in a sub forum, saves on db call later) 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "" & _ "SELECT" & strDBTop1 & " " & strDbTable & "Category.Cat_ID, " & strDbTable & "Category.Cat_name, " & strDbTable & "Forum.Forum_ID, " & strDbTable & "Forum.Sub_ID, " & strDbTable & "Forum.Forum_name, " & strDbTable & "Forum2.Forum_name AS Main_forum, " & strDbTable & "Forum.Password, " & strDbTable & "Forum.Forum_code, " & strDbTable & "Forum.Locked, " & strDbTable & "Forum.Show_topics, " & strDbTable & "Permissions.* " & _ "FROM " & strDbTable & "Category" & strDBNoLock & ", " & strDbTable & "Forum" & strDBNoLock & ", " & strDbTable & "Forum AS " & strDbTable & "Forum2" & strDBNoLock & ", " & strDbTable & "Permissions" & strDBNoLock & " " & _ "WHERE " & strDbTable & "Category.Cat_ID = " & strDbTable & "Forum.Cat_ID " & _ "AND " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Permissions.Forum_ID " & _ "AND " & strDbTable & "Forum.Forum_ID = " & intForumID & " " & _ "AND (" & strDbTable & "Forum.Sub_ID = " & strDbTable & "Forum2.Forum_ID OR (" & strDbTable & "Forum.Sub_ID = 0 AND " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Forum2.Forum_ID)) " & _ "AND (" & strDbTable & "Permissions.Author_ID = " & lngLoggedInUserID & " OR " & strDbTable & "Permissions.Group_ID = " & intGroupID & ") " & _ "ORDER BY " & strDbTable & "Forum.Sub_ID, " & strDbTable & "Forum.Forum_Order" & strDBLimit1 & ";" 'Set error trapping On Error Resume Next 'Query the database rsCommon.Open strSQL, adoCon 'If an error has occured write an error to the page If Err.Number <> 0 Then Call errorMsg("An error has occured while executing SQL query on database.", "get_forum_data", "forum_topics.asp") 'Disable error trapping On Error goto 0 'If there is a record returned by the recordset then check to see if you need a password to enter it If NOT rsCommon.EOF Then 'Read in forum details from the database intCatID = CInt(rsCommon("Cat_ID")) strCatName = rsCommon("Cat_name") strForumName = rsCommon("Forum_name") strMasterForumName = rsCommon("Main_forum") intMasterForumID = CLng(rsCommon("Sub_ID")) blnForumLocked = CBool(rsCommon("Locked")) intShowTopicsWithin = CInt(rsCommon("Show_topics")) 'Read in the forum permissions blnRead = CBool(rsCommon("View_Forum")) blnPost = CBool(rsCommon("Post")) blnReply = CBool(rsCommon("Reply_posts")) blnEdit = CBool(rsCommon("Edit_posts")) blnDelete = CBool(rsCommon("Delete_posts")) blnPriority = CBool(rsCommon("Priority_posts")) blnPollCreate = CBool(rsCommon("Poll_create")) blnVote = CBool(rsCommon("Vote")) blnAttachments = CBool(rsCommon("Attachments")) blnImageUpload = CBool(rsCommon("Image_upload")) blnModerator = CBool(rsCommon("Moderate")) blnCheckFirst = CBool(rsCommon("Display_post")) 'If the user has no read writes then kick them If blnRead = False Then 'Reset Server Objects rsCommon.Close Call closeDatabase() 'Redirect to a page asking for the user to enter the forum password Response.Redirect("insufficient_permission.asp" & strQsSID1) End If 'If the forum requires a password and a logged in forum code is not found on the users machine then send them to a login page If rsCommon("Password") <> "" AND (Request.Cookies(strCookieName)("Forum" & intForumID) <> rsCommon("Forum_code") AND getSessionItem("Forum" & intForumID) <> rsCommon("Forum_code")) Then 'Reset Server Objects rsCommon.Close Call closeDatabase() 'Redirect to a page asking for the user to enter the forum password Response.Redirect("forum_password_form.asp?FID=" & intForumID & strQsSID2) End If End If 'Clean up rsCommon.Close 'Get what date to show topics till from querystring If isNumeric(Request.QueryString("TS")) AND Request.QueryString("TS") <> "" Then Call saveSessionItem("TS", Request.QueryString("TS")) intShowTopicsFrom = CInt(Request.QueryString("TS")) 'Get what date to show topics ElseIf getSessionItem("TS") <> "" Then intShowTopicsFrom = CInt(getSessionItem("TS")) 'Else if there is no cookie use the default set by the forum Else intShowTopicsFrom = intShowTopicsWithin End If 'Get the sort critiria Select Case Request.QueryString("SO") Case "T" strSortBy = strDbTable & "Topic.Subject " Case "A" strSortBy = strDbTable & "Author.Username " Case "R" strSortBy = strDbTable & "Topic.No_of_replies " Case "V" strSortBy = strDbTable & "Topic.No_of_views " Case Else strSortBy = "LastThread.Message_date " End Select 'Sort the direction of db results If Request.QueryString("OB") = "desc" Then strSortDirection = "asc" strSortBy = strSortBy & "DESC" Else strSortDirection = "desc" strSortBy = strSortBy & "ASC" End If 'If this is the first time it is run the we want dates DESC If Request.QueryString("OB") = "" AND Request.QueryString("SO") = "" Then strSortDirection = "asc" strSortBy = "LastThread.Message_date DESC" End If 'Read in all the topics for this forum and place them in an array strSQL = "" & _ "SELECT " If strDatabaseType = "SQLServer" OR strDatabaseType = "Access" Then strSQL = strSQL & " TOP " & intMaxResults & " " End If strSQL = strSQL & _ " " & strDbTable & "Topic.Topic_ID, " & strDbTable & "Topic.Poll_ID, " & strDbTable & "Topic.Moved_ID, " & strDbTable & "Topic.Subject, " & strDbTable & "Topic.Icon, " & strDbTable & "Topic.Start_Thread_ID, " & strDbTable & "Topic.Last_Thread_ID, " & strDbTable & "Topic.No_of_replies, " & strDbTable & "Topic.No_of_views, " & strDbTable & "Topic.Locked, " & strDbTable & "Topic.Priority, " & strDbTable & "Topic.Hide, " & strDbTable & "Thread.Message_date, " & strDbTable & "Thread.Message, " & strDbTable & "Thread.Author_ID, " & strDbTable & "Author.Username, LastThread.Message_date, LastThread.Author_ID, LastAuthor.Username, " & strDbTable & "Topic.Event_date " & _ "FROM " & strDbTable & "Topic" & strDBNoLock & ", " & strDbTable & "Thread" & strDBNoLock & ", " & strDbTable & "Thread AS LastThread" & strDBNoLock & ", " & strDbTable & "Author" & strDBNoLock & ", " & strDbTable & "Author AS LastAuthor" & strDBNoLock & " " & _ "WHERE (" 'Do the table joins strSQL = strSQL & " " & strDbTable & "Thread.Author_ID = " & strDbTable & "Author.Author_ID " & _ "AND LastThread.Author_ID = LastAuthor.Author_ID " & _ "AND " & strDbTable & "Topic.Start_Thread_ID = " & strDbTable & "Thread.Thread_ID " & _ "AND " & strDbTable & "Topic.Last_Thread_ID = LastThread.Thread_ID " 'If there is a date to show topics with then apply it to the SQL query If intShowTopicsFrom <> 0 Then strSQL = strSQL & "AND ((LastThread.Message_date > " 'If Access use # around dates, other DB's use ' around dates If strDatabaseType = "Access" Then strSQL = strSQL & "#" Else strSQL = strSQL & "'" End If 'Initialse the string to display when active topics are shown since Select Case intShowTopicsFrom Case 1 strShowTopicsFrom = strTxtLastVisitOn & " " & DateFormat(dtmLastVisitDate) & " " & strTxtAt & " " & TimeFormat(dtmLastVisitDate) strShowTopicsDate = internationalDateTime(dtmLastVisitDate) Case 2 strShowTopicsFrom = strTxtYesterday strShowTopicsDate = internationalDateTime(DateAdd("d", -1, now())) Case 3 strShowTopicsFrom = strTxtLastTwoDays strShowTopicsDate = internationalDateTime(DateAdd("d", -2, now())) Case 4 strShowTopicsFrom = strTxtLastWeek strShowTopicsDate = internationalDateTime(DateAdd("ww", -1, now())) Case 5 strShowTopicsFrom = strTxtLastMonth strShowTopicsDate = internationalDateTime(DateAdd("m", -1, now())) Case 6 strShowTopicsFrom = strTxtLastTwoMonths strShowTopicsDate = internationalDateTime(DateAdd("m", -2, now())) Case 7 strShowTopicsFrom = strTxtLastSixMonths strShowTopicsDate = internationalDateTime(DateAdd("m", -6, now())) Case 8 strShowTopicsFrom = strTxtLastYear strShowTopicsDate = internationalDateTime(DateAdd("yyyy", -1, now())) End Select 'If SQL server remove dash (-) from the ISO international date to make SQL Server safe If strDatabaseType = "SQLServer" Then strShowTopicsDate = Replace(strShowTopicsDate, "-", "", 1, -1, 1) 'Place into SQL query strSQL = strSQL & strShowTopicsDate 'If Access use # around dates, other DB's use ' around dates If strDatabaseType = "Access" Then strSQL = strSQL & "#" Else strSQL = strSQL & "'" End If strSQL = strSQL & ") OR (" & strDbTable & "Topic.Priority > 0)) " End If 'Select which topics to get strSQL = strSQL & "AND (" & strDbTable & "Topic.Priority = 3 " & _ "OR " & strDbTable & "Topic.Moved_ID = " & intForumID & " " & _ "OR " & strDbTable & "Topic.Forum_ID = " & intForumID & ") " & _ ") " 'If this isn't a moderator only display hidden posts if the user posted them If blnModerator = false AND blnAdmin = false Then strSQL = strSQL & "AND (" & strDbTable & "Topic.Hide = " & strDBFalse & " " 'Don't display hidden posts if guest If intGroupID <> 2 Then strSQL = strSQL & "OR " & strDbTable & "Thread.Author_ID = " & lngLoggedInUserID strSQL = strSQL & ") " End If 'Order by strSQL = strSQL & "ORDER BY " & strDbTable & "Topic.Priority DESC, " & strSortBy & " " 'mySQL limit operator If strDatabaseType = "mySQL" Then strSQL = strSQL & " LIMIT " & intMaxResults End If strSQL = strSQL & ";" 'Set error trapping On Error Resume Next 'Query the database rsCommon.Open strSQL, adoCon 'If an error has occured write an error to the page If Err.Number <> 0 Then Call errorMsg("An error has occured while executing SQL query on database.", "get_topics_data", "forum_topics.asp") 'Disable error trapping On Error goto 0 'SQL Query Array Look Up table '0 = tblTopic.Topic_ID '1 = tblTopic.Poll_ID '2 = tblTopic.Moved_ID '3 = tblTopic.Subject '4 = tblTopic.Icon '5 = tblTopic.Start_Thread_ID '6 = tblTopic.Last_Thread_ID '7 = tblTopic.No_of_replies '8 = tblTopic.No_of_views '9 = tblTopic.Locked '10 = tblTopic.Priority '11 = tblTopic.Hide '12 = tblThread.Message_date '13 = tblThread.Message, '14 = tblThread.Author_ID, '15 = tblAuthor.Username, '16 = LastThread.Message_date, '17 = LastThread.Author_ID, '18 = LastAuthor.Username '19 = tblTopic.Event_date 'Read in some details of the topics If NOT rsCommon.EOF Then 'Read in the topivc recordset into an array sarryTopics = rsCommon.GetRows() 'Count the number of records intTotalRecords = Ubound(sarryTopics,2) + 1 'Count the number of pages for the topics using FIX so that we get the whole number and not any fractions intTotalRecordsPages = FIX(intTotalRecords / intTopicPerPage) 'If there is a remainder or the result is 0 then add 1 to the total num of pages If intTotalRecords Mod intTopicPerPage > 0 OR intTotalRecordsPages = 0 Then intTotalRecordsPages = intTotalRecordsPages + 1 'Start position intStartPosition = ((intRecordPositionPageNum - 1) * intTopicPerPage) 'End Position intEndPosition = intStartPosition + intTopicPerPage 'Get the start position intCurrentRecord = intStartPosition End If 'Close the recordset rsCommon.Close 'Read the various forums from the database 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "" & _ "SELECT " & strDbTable & "Forum.Forum_ID, " & strDbTable & "Forum.Forum_name, " & strDbTable & "Forum.Forum_description, " & strDbTable & "Forum.No_of_topics, " & strDbTable & "Forum.No_of_posts, " & strDbTable & "Author.Username, " & strDbTable & "Forum.Last_post_author_ID, " & strDbTable & "Forum.Last_post_date, " & strDbTable & "Forum.Password, " & strDbTable & "Forum.Locked, " & strDbTable & "Forum.Hide, " & strDbTable & "Permissions.View_Forum " & _ "FROM " & strDbTable & "Forum" & strDBNoLock & ", " & strDbTable & "Permissions" & strDBNoLock & ", " & strDbTable & "Author" & strDBNoLock & " " & _ "WHERE " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Permissions.Forum_ID " & _ "AND " & strDbTable & "Forum.Last_post_author_ID = " & strDbTable & "Author.Author_ID " & _ "AND " & strDbTable & "Forum.Sub_ID = " & intForumID & " " & _ "AND (" & strDbTable & "Permissions.Author_ID = " & lngLoggedInUserID & " OR " & strDbTable & "Permissions.Group_ID=" & intGroupID & ") " & _ "ORDER BY " & strDbTable & "Forum.Forum_Order, " & strDbTable & "Permissions.Forum_ID;" 'Set error trapping On Error Resume Next 'Query the database rsCommon.Open strSQL, adoCon 'If an error has occured write an error to the page If Err.Number <> 0 Then Call errorMsg("An error has occured while executing SQL query on database.", "get_sub_forum_data", "forum_topics.asp") 'Disable error trapping On Error goto 0 'If there are sub forums to dsiplay, then display them If NOT rsCommon.EOF Then 'Read in the sub forum details into an array sarrySubForums = rsCommon.GetRows() End If 'Close the recordset rsCommon.Close 'Page to link to for mutiple page (with querystrings if required) strLinkPage = "forum_topics.asp?FID=" & intForumID & "&" 'If active users is enabled update the active users application array If blnActiveUsers Then 'Call active users function saryActiveUsers = activeUsers(strTxtViewingIndex, strForumName, "forum_topics.asp?FID=" & intForumID, 0) End If %> <% = strMainForumName %>: <% = strForumName %> <% '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** Response.Write("") '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** 'If RSS feed is enabled then have an alt link to it for browers that support RSS Feeds If blnRSS Then Response.Write(vbCrLf & "") %>
<% 'Display the forum name Response.Write(strForumName) 'If the forum is locked show a locked pad lock icon If blnForumLocked = True Then Response.Write (" ( " & strTxtForumLocked & ")") %>
<% 'If RSS XML enabled then display an RSS button to link to XML file If blnRSS Then Response.Write("
 
") %> <% = strMainForumName %><% 'Display the category name Response.Write (strNavSpacer & "" & strCatName & "" & strNavSpacer) 'Display if there is a main forum to the sub forums name If intMasterForumID <> 0 Then Response.Write ("" & strMasterForumName & "" & strNavSpacer) 'Display forum name If strForumName = "" Then Response.Write "" & strTxtNoForums & "" Else Response.Write ("" & strForumName & "") %>
<% '****************************************** '*** Display Sub Forums *** '****************************************** 'If there are sub forums to dsiplay, then display them If isArray(sarrySubForums) Then 'SQL Query Array Look Up table '0 = Forum_ID '1 = Forum_name '2 = Forum_description '3 = No_of_topics '4 = No_of_posts '5 = Username '6 = Last_post_author_ID '7 = Last_post_date '8 = Password '9 = Locked '10 = Hide '11 = Read 'First we need to loop through the array to see if the user can view any of the sub forums if not don't display them 'If we find a sub forum that the user can view we exit this loop to display the sub forum Do While intSubCurrentRecord <= Ubound(sarrySubForums,2) 'Read in details blnHideForum = CBool(sarrySubForums(10,intSubCurrentRecord)) blnRead = CBool(sarrySubForums(11,intSubCurrentRecord)) 'If this forum is to be shown then leave the loop and display the sub forums If blnHideForum = False OR blnRead = True Then Exit Do 'Move to next record intSubCurrentRecord = intSubCurrentRecord + 1 Loop 'If there are still records left in the array then these are the forums that the user can view so display them If intSubCurrentRecord <= Ubound(sarrySubForums,2) Then %>
<% 'Loop through the array and display the forums Do While intSubCurrentRecord <= Ubound(sarrySubForums,2) 'Initialise variables lngLastEntryTopicID = 0 'Read in the details for this forum intSubForumID = CInt(sarrySubForums(0,intSubCurrentRecord)) strForumName = sarrySubForums(1,intSubCurrentRecord) strForumDiscription = sarrySubForums(2,intSubCurrentRecord) lngNumberOfTopics = CLng(sarrySubForums(3,intSubCurrentRecord)) lngNumberOfPosts = CLng(sarrySubForums(4,intSubCurrentRecord)) strLastEntryUser = sarrySubForums(5,intSubCurrentRecord) If isNumeric(sarrySubForums(6,intSubCurrentRecord)) Then lngLastEntryUserID = CLng(sarrySubForums(6,intSubCurrentRecord)) Else lngLastEntryUserID = 0 If isDate(sarrySubForums(7,intSubCurrentRecord)) Then dtmLastEntryDate = CDate(sarrySubForums(7,intSubCurrentRecord)) Else dtmLastEntryDate = CDate("2001-01-01 00:00:00") strForumPassword = sarrySubForums(8,intSubCurrentRecord) blnForumLocked = CBool(sarrySubForums(9,intSubCurrentRecord)) blnHideForum = CBool(sarrySubForums(10,intSubCurrentRecord)) blnRead = CBool(sarrySubForums(11,intSubCurrentRecord)) 'If this forum is to be hidden but the user is allowed access to it set the hidden boolen back to false If blnHideForum = True AND blnRead = True Then blnHideForum = False 'If the forum is to be hidden then don't show it If blnHideForum = False Then 'Get the row number intForumColourNumber = intForumColourNumber + 1 'Write the HTML of the forum descriptions and hyperlinks to the forums 'Calculate row colour Response.Write(vbCrLf & " ") Else Response.Write("class=""oddTableRow"">") Response.Write(vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " ") End If 'Move to the next database record intSubCurrentRecord = intSubCurrentRecord + 1 'If there are more records in the array to display then run some test to see what record to display next and where If intSubCurrentRecord <= Ubound(sarrySubForums,2) Then 'Becuase the member may have an individual permission entry in the permissions table for this forum, 'it maybe listed twice in the array, so we need to make sure we don't display the same forum twice If intSubForumID = CInt(sarrySubForums(0,intSubCurrentRecord)) Then intSubCurrentRecord = intSubCurrentRecord + 1 'If there are no records left exit loop If intSubCurrentRecord > Ubound(sarrySubForums,2) Then Exit Do End If 'Loop back round for next forum Loop %>
  <% = strTxtSub & " " & strTxtForums %> <% = strTxtTopics %> <% = strTxtPosts %> <% = strTxtLastPost %>
") 'If the user has no access to a forum diplay a no access icon If blnRead = False Then Response.Write ("") 'If the forum requires a password diplay the password icon ElseIf strForumPassword <> "" Then Response.Write ("") 'If the forum is read only and has new posts show the locked new posts icon ElseIf CDate(dtmLastVisitDate) < dtmLastEntryDate AND (blnForumLocked = True) AND blnAdmin = False AND blnModerator = False Then Response.Write ("") 'If the forum is read only show the locked new posts icon ElseIf blnForumLocked Then Response.Write ("") 'If the forum has new posts show the new posts icon ElseIf CDate(dtmLastVisitDate) < dtmLastEntryDate Then Response.Write ("") 'If the forum is open but with no new replies Else Response.Write ("") End If Response.Write("") 'If this is the forum admin then let them have access to the forum admin pop up window If blnAdmin Then Response.Write("") 'Display forum Response.Write("" & strForumName & "") 'Display the number of people viewing in that forum If blnForumViewing AND blnActiveUsers Then If viewingForum(intSubForumID) > 0 Then Response.Write(" (" & viewingForum(intSubForumID) & " " & strTxtViewing & ")") End If 'Display forum details Response.Write("
" & strForumDiscription & "
" & lngNumberOfTopics & "" & lngNumberOfPosts & "") If lngNumberOfPosts <> 0 Then 'Don't disply last post details if there are none Response.Write(DateFormat(dtmLastEntryDate) & " " & strTxtAt & " " & TimeFormat(dtmLastEntryDate) & "" & _ "
" & strTxtBy & " " & strLastEntryUser & " ") End If Response.Write("

<% End If End If '****************************************** '*** Display Topics *** '****************************************** %> <% 'If there is more than one page display links to the others If intTotalRecordsPages > 1 Then %> <% End If %>
<% = strTxtShowTopics %> <% = strTxtNewTopic %><% 'If the user can create a poll disply a create poll link If blnPollCreate = True Then Response.Write ("") End If %>
<% 'if topic icons enabled display a column for them If blnTopicIcon Then %> <% End If %> <% 'If there are no topics to display, show a message saying so If intTotalRecords <= 0 Then 'If there are no Topic's to display then display the appropriate error message Response.Write vbCrLf & " " 'Else there the are topic's so write the HTML to display the topic names and a discription Else 'Do....While Loop to loop through the recorset to display the forum topics Do While intCurrentRecord < intEndPosition 'If there are no topic records left to display then exit loop If intCurrentRecord >= intTotalRecords Then Exit Do 'SQL Query Array Look Up table '0 = tblTopic.Topic_ID '1 = tblTopic.Poll_ID '2 = tblTopic.Moved_ID '3 = tblTopic.Subject '4 = tblTopic.Icon '5 = tblTopic.Start_Thread_ID '6 = tblTopic.Last_Thread_ID '7 = tblTopic.No_of_replies '8 = tblTopic.No_of_views '9 = tblTopic.Locked '10 = tblTopic.Priority '11 = tblTopic.Hide '12 = tblThread.Message_date '13 = tblThread.Message, '14 = tblThread.Author_ID, '15 = tblAuthor.Username, '16 = LastThread.Message_date, '17 = LastThread.Author_ID, '18 = LastAuthor.Username '19 = tblTopic.Event_date 'Read in Topic details from the database lngTopicID = CLng(sarryTopics(0,intCurrentRecord)) lngPollID = CLng(sarryTopics(1,intCurrentRecord)) intMovedForumID = CInt(sarryTopics(2,intCurrentRecord)) strSubject = sarryTopics(3,intCurrentRecord) strTopicIcon = sarryTopics(4,intCurrentRecord) lngNumberOfReplies = CLng(sarryTopics(7,intCurrentRecord)) lngNumberOfViews = CLng(sarryTopics(8,intCurrentRecord)) blnTopicLocked = CBool(sarryTopics(9,intCurrentRecord)) intPriority = CInt(sarryTopics(10,intCurrentRecord)) blnHideTopic = CBool(sarryTopics(11,intCurrentRecord)) dtmEventDate = sarryTopics(19,intCurrentRecord) 'Read in the first post details dtmFirstEntryDate = CDate(sarryTopics(12,intCurrentRecord)) strFirstPostMsg = Mid(sarryTopics(13,intCurrentRecord), 1, 275) lngTopicStartUserID = CLng(sarryTopics(14,intCurrentRecord)) strTopicStartUsername = sarryTopics(15,intCurrentRecord) 'Read in the last post details lngLastEntryMessageID = CLng(sarryTopics(6,intCurrentRecord)) dtmLastEntryDate = CDate(sarryTopics(16,intCurrentRecord)) lngLastEntryUserID = CLng(sarryTopics(17,intCurrentRecord)) strLastEntryUsername = sarryTopics(18,intCurrentRecord) 'Clean up input to prevent XXS hack strSubject = formatInput(strSubject) 'Remove HTML from message for subject link title strFirstPostMsg = removeHTML(strFirstPostMsg, 150, true) 'Clean up input to prevent XXS hack strFirstPostMsg = formatInput(strFirstPostMsg) 'Calculate the topic icon If strTopicIcon = "" OR isNull(strTopicIcon) Then strTopicIcon = strImagePath & "topic_icon.gif" 'Get a record number for the number of non priority posts If intPriority <= 1 Then intNonPriorityTopicNum = intNonPriorityTopicNum + 1 'If this is the first topic that is not important then display the forum topics bar If intNonPriorityTopicNum = 1 Then Response.Write vbCrLf & " " 'If this is the first topic and it is an important one then display a bar saying so If intRecordLoopCounter = 1 AND intPriority => 2 Then Response.Write vbCrLf & "" 'Set the booleon variable if this is a new post since the users last visit and has not been read If (CDate(dtmLastVisitDate) < dtmLastEntryDate) AND (Session("TID" & lngTopicID) = "") Then blnNewPost = True Else blnNewPost = False 'Calculate the row colour If intCurrentRecord MOD 2=0 Then strTableRowColour = "evenTableRow" Else strTableRowColour = "oddTableRow" 'If this is a hidden post then change the row colour to highlight it If blnHideTopic Then strTableRowColour = "hiddenTableRow" 'Write the HTML of the Topic descriptions as hyperlinks to the Topic details and message Response.Write(vbCrLf & " ") Response.Write(vbCrLf & " ") 'If topic icons are enabled disply them If blnTopicIcon Then Response.Write(vbCrLf & " ") Response.Write(vbCrLf & " <% 'Move to the next record intCurrentRecord = intCurrentRecord + 1 Loop End If %>
  <% = strTxtTopics %><% If Request.QueryString("SO") = "T" Then Response.Write(" ") %> <% = strTxtThreadStarter %><% If Request.QueryString("SO") = "A" Then Response.Write(" ") %> <% = strTxtReplies %><% If Request.QueryString("SO") = "R" Then Response.Write(" ") %> <% = strTxtViews %><% If Request.QueryString("SO") = "V" Then Response.Write(" ") %> <% = strTxtLastPost %><% If Request.QueryString("SO") = "" Then Response.Write(" ") %>

" & strTxtNoTopicsToDisplay & " " & strShowTopicsFrom & "

" & strTxtForum & " " & strTxtTopics & "
" & strTxtImportantTopics & "
") 'If the topic is pinned then display the pinned icon If intPriority = 1 Then Response.Write("") 'If the topic is top priorty and locked then display top priporty locked icon ElseIf blnTopicLocked = True AND intPriority > 0 Then Response.Write("") 'If the topic is top priorty then display top priporty icon ElseIf intPriority > 0 Then Response.Write("") 'If the topic is closed display a closed topic icon ElseIf blnTopicLocked = True Then Response.Write("") 'If the topic is moved to another forum display moved post icon ElseIf intMovedForumID = intForumID AND intMovedForumID <> 0 Then Response.Write("") 'If the topic is a hot topic and with new replies then display hot to new replies icon ElseIf (lngNumberOfReplies >= intNumHotReplies OR lngNumberOfViews >= intNumHotViews) AND (blnNewPost = True) Then Response.Write("") 'If this is a hot topic that contains a poll then display the hot topic poll icon ElseIf (lngPollID > 0) AND (lngNumberOfReplies >= intNumHotReplies OR lngNumberOfViews >= intNumHotViews) Then Response.Write("") 'If the topic is a hot topic display hot topic icon ElseIf lngNumberOfReplies >= intNumHotReplies OR lngNumberOfViews >= intNumHotViews Then Response.Write("") 'If the topic is has new replies display new replies icon ElseIf blnNewPost = True Then Response.Write("") 'If there is a poll in the post display the poll post icon ElseIf lngPollID > 0 Then Response.Write("") 'Display topic icon Else Response.Write("") End If Response.Write("") 'If the user is a forum admin or a moderator then give let them delete the topic If blnAdmin OR blnModerator Then Response.Write("") 'If the topic is moved to another forum display moved next to it If intMovedForumID = intForumID AND intMovedForumID <> 0 Then Response.Write(strTxtMoved) 'If calendar event display so If isDate(dtmEventDate) Then Response.Write(" ") 'Display if the post is hidden ElseIf blnHideTopic Then Response.Write(strTxtHidden & ": ") 'If there is a poll display a poll text ElseIf lngPollID > 0 Then Response.Write(strTxtPoll) End If 'Display the subject of the topic Response.Write("" & strSubject & "") 'Calculate the number of pages for the topic and display links if there are more than 1 page intNumberOfTopicPages = ((lngNumberOfReplies + 1)\intThreadsPerPage) 'If there is a remainder from calculating the num of pages add 1 to the number of pages If ((lngNumberOfReplies + 1) Mod intThreadsPerPage) > 0 Then intNumberOfTopicPages = intNumberOfTopicPages + 1 'If there is more than 1 page for the topic display links to the other pages If intNumberOfTopicPages > 1 Then Response.Write("
") 'Loop round to display the links to the other pages For intTopicPagesLoopCounter = 1 To intNumberOfTopicPages 'If there is more than 7 pages display ... last page and exit the loop If intTopicPagesLoopCounter > 7 Then 'If this is position 8 then display just the 8th page If intNumberOfTopicPages = 8 Then Response.Write(" 8") 'Else display the last 2 pages Else Response.Write(" ...") Response.Write(" " & intNumberOfTopicPages - 1 & "") Response.Write(" " & intNumberOfTopicPages & "") End If 'Exit the loop as we are finshed here Exit For End If 'Display the links to the other pages Response.Write(" " & intTopicPagesLoopCounter & "") Next End If %>
"><% = strTopicStartUsername %> <% = lngNumberOfReplies %> <% = lngNumberOfViews %> <% Response.Write(DateFormat(dtmLastEntryDate) & " " & strTxtAt & " " & TimeFormat(dtmLastEntryDate)) %>
<% = strTxtBy %> <% = strLastEntryUsername %> &PID=<% = lngLastEntryMessageID %><% = strQsSID2 %>#<% = lngLastEntryMessageID %>"><% = strTxtViewLastPost %>
<% 'Reset Server Objects Call closeDatabase() %> ") %>
<% 'Display a link to watch or un-watch this topic if email notification is enabled If blnRss = False AND blnEmail AND blnLoggedInUserEmail AND intGroupID <> 2 Then 'Create link Response.Write("" & strTxtWatchThisForum & "") 'Disply a non breaking space for Netscrape 4 bug Else Response.Write(" ") End If %>
<% = strTxtNewTopic %><% 'If the user can create a poll disply a create poll link If blnPollCreate = True Then Response.Write ("") End If Response.Write("
<% = strTxtOpenTopic %> <% = strTxtOpenTopic %> <% = strTxtHotTopic %> <% = strTxtHotTopic %>
<% = strTxtOpenTopicNewReplies %> <% = strTxtOpenTopicNewReplies %> <% = strTxtHotTopicNewReplies %> <% = strTxtHotTopicNewReplies %>
<% = strTxtLockedTopic %> <% = strTxtLockedTopic %> <% = strTxtHighPriorityPost %> <% = strTxtHighPriorityPost %>
<% = strTxtPinnedTopic %> <% = strTxtPinnedTopic %> <% = strTxtHighPriorityPostLocked %> <% = strTxtHighPriorityPostLocked %>

<% '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** If blnLCode = True Then Response.Write(strFooterAds) If blnTextLinks = True Then Response.Write("Powered by Web Wiz Forums version " & strVersion & "") Else Response.Write("") End If Response.Write("
Copyright ©2001-2006 Web Wiz Guide") End If '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** 'Display the process time If blnShowProcessTime Then Response.Write "

" & strTxtThisPageWasGeneratedIn & " " & FormatNumber(Timer() - dblStartTime, 3) & " " & strTxtSeconds & "
" %>
<% 'Display an alert message letting the user know the topic has been deleted If Request.QueryString("DL") = "1" Then Response.Write("") End If 'Display an alert message if the user is watching this forum for email notification If Request.QueryString("EN") = "FS" Then Response.Write("") End If 'Display an alert message if the user is not watching this forum for email notification If Request.QueryString("EN") = "FU" Then Response.Write("") End If %>