<% @ Language=VBScript %> <% Option Explicit %> <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Forums(TM) '** http://www.webwizforums.com '** '** Copyright (C)2001-2008 Web Wiz(TM). All Rights Reserved. '** '** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS UNDER LICENSE FROM 'WEB WIZ'. '** '** IF YOU DO NOT AGREE TO THE LICENSE AGREEMENT THEN 'WEB WIZ' IS UNWILLING TO LICENSE '** THE SOFTWARE TO YOU, AND YOU SHOULD DESTROY ALL COPIES YOU HOLD OF 'WEB WIZ' SOFTWARE '** AND DERIVATIVE WORKS IMMEDIATELY. '** '** If you have not received a copy of the license with this work then a copy of the latest '** license contract can be found at:- '** '** http://www.webwizguide.com/license '** '** For more information about this software and for licensing information please contact '** 'Web Wiz' at the address and website below:- '** '** Web Wiz, Unit 10E, Dawkins Road Industrial Estate, Poole, Dorset, BH15 4JD, England '** http://www.webwizguide.com '** '** Removal or modification of this copyright notice will violate the license contract. '** '**************************************************************************************** '*************************** SOFTWARE AND CODE MODIFICATIONS **************************** '** '** MODIFICATION OF THE FREE EDITIONS OF THIS SOFTWARE IS A VIOLATION OF THE LICENSE '** AGREEMENT AND IS STRICTLY PROHIBITED '** '** If you wish to modify any part of this software a license must be purchased '** '**************************************************************************************** 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 sarryPosts 'Holds the posts recordset Dim strForumName 'Holds the forum name Dim intCatID 'Holds the cat ID Dim strCatName 'Holds the cat name Dim intMasterForumID 'Holds the main forum ID Dim strMasterForumName 'Holds the main forum name Dim lngTopicID 'Holds the topic number Dim strSubject 'Holds the topic subject Dim strUsername 'Holds the Username of the thread Dim lngUserID 'Holds the ID number of the user Dim dtmPostDate 'Holds the date the thread was made Dim strMessage 'Holds the post to display Dim strTopicIcon 'Holds the topic icon Dim lngMessageID 'Holds the message ID number Dim strAuthorHomepage 'Holds the homepage of the Username if it is given Dim strAuthorLocation 'Holds the location of the user if given Dim strAuthorAvatar 'Holds the authors avatar Dim strAuthorSignature 'Holds the authors signature Dim lngAuthorNumOfPosts 'Holds the number of posts the user has made to the forum Dim dtmAuthorRegistration 'Holds the registration date of the user Dim lngNumberOfViews 'Holds the number of times the topic has been viewed to save back to the database Dim intStatus 'Holds the users interger status Dim strStatus 'Holds the users status Dim strMode 'Holds the mode of the page that is being passed Dim intTopicPageNumber 'Holds the topic page position to link back to Dim blnIsModerator 'Set to true if the user who posted the message is a forum moderator Dim blnForumLocked 'Set to true if the forum is locked Dim blnTopicLocked 'set to true if the topic is locked Dim intThreadNo 'Holds the number of threads in the topic Dim intPriority 'Holds the priority level of the topic Dim intRecordPositionPageNum 'Holds the recorset page number to show the Threads for Dim intTotalRecordsPages 'Holds the number of pages Dim intTopicPageLoopCounter 'Loop counter for other thread page link Dim intTotalRecords 'Holds the total number of therads in this topic Dim strAuthorIP 'Holds the authors IP Dim strSearchKeywords 'Holds the keywords to search for Dim sarySearchWord 'Array to hold the search words Dim strGroupName 'Holds the authors group name Dim intRankStars 'Holds the number of stars for the group Dim strRankCustomStars 'Holds custom stars for the user group Dim lngPollID 'Holds the poll ID Dim blnPollNoReply 'Set to true if users can't reply to a poll Dim blnBannedIP 'Set to true if the user is using a banned IP Dim dtmLastEntryDate 'Holds the date of the last post entry to the topic Dim intIndexPosition 'Holds the idex poistion in the emiticon array Dim intNumberOfOuterLoops 'Holds the outer loop number for rows Dim intLoop 'Holds the loop index position Dim intInnerLoop 'Holds the inner loop number for columns Dim strMemberTitle 'Holds the members title Dim blnIsUserOnline 'Set to true if the user is online Dim blnHidePost 'Set to true if post is hidden Dim strPostTableRowClass 'Post row colour Dim intStartPosition 'Holds the start poition for records to be shown Dim intEndPosition 'Holds the end poition for records to be shown Dim intCurrentRecord 'Holds the current records for the posts Dim strGuestUsername 'Holds the Guest Username if it is a guest posting Dim blnHideTopic 'Set to true if topic is hidden Dim lngGetPostID 'Holds the post to go straight to Dim strSortBy 'Holds the direction the posts are listed in Dim strPostTableSideClass 'Holds the post message side column css class Dim strPostTableTopClass 'Holds the post table top details Dim dtmEventDate 'Holds the date if this is a calendar event Dim dtmEventDateEnd 'Holds the date if this is a calendar event Dim intPageLinkLoopCounter 'Loop counter for page links include Dim intPostRowsSpan 'Holds the rowspam number for post table formatting Dim strForumPassword 'Holds the forum password Dim intUnReadForumPostsLoop 'Loop counter for unread loop array Dim intAutoLockTopicsAmount 'Holds the amount topics are auto closed at Dim blnUnreadPost 'Set to true if the post is un-read 'Initialise variables strMode = "reply" lngMessageID = 0 lngGetPostID = 0 intForumID = 0 lngTopicID = 0 intThreadNo = 0 blnIsModerator = False blnPollNoReply = False blnBannedIP = False blnHidePost = False intPriority = 0 blnHideTopic = False blnUnreadPost = False intAutoLockTopicsAmount = 15000 'Topics with more than 15,000 posts are auto locked as users with higher amounts have reported performance and database issues 'See if the user is using a banned IP address If bannedIP() Then 'If the user is using a banned IP then set the banned IP variable to true and active member variable to false blnBannedIP = True End If 'If this is the first time the page is displayed then the Forum Thread 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 Thread record postion is set to the Record Position number Else intRecordPositionPageNum = CInt(Request.QueryString("PN")) End If 'Read in the Topic ID for the topic to display If isNumeric(Request.QueryString("TID")) Then lngTopicID = CLng(Request.QueryString("TID")) Else lngTopicID = 0 'If there is no Topic ID then redirect the user to the main forum page If lngTopicID = 0 Then 'Clean up Call closeDatabase() 'Redirect Response.Redirect("default.asp" & strQsSID1) End If 'Read in the post ID if we are going straight to a post If isNumeric(Request.QueryString("PID")) Then lngGetPostID = CLng(Request.QueryString("PID")) 'Fix for stupid IE 6 redirect bug (IE SUCKS!!!) MS have fixed this for IE7 If lngGetPostID = 0 AND Request.QueryString("PID") <> "" Then 'Remove the '#' hash anchor mark IE 6 includes in the string when doing a redirect (IE SUCKS!!) If InStr(Request.QueryString("PID"), "#") Then lngGetPostID = CLng(Mid(Request.QueryString("PID"), 1, InStr(Request.QueryString("PID"), "#")-1)) End If 'Read in the keywords if comming from a search strSearchKeywords = Trim(Mid(Request.QueryString("KW"), 1, 35)) 'Split up the keywords to be searched sarySearchWord = Split(Trim(strSearchKeywords), " ") 'Sort the direction of db results from session If Request.QueryString("OB") = "DESC" Then strSortBy = "DESC" ElseIf Request.QueryString("OB") = "ASC" Then strSortBy = "ASC" ElseIf getSessionItem("OB") = "DESC" Then strSortBy = "DESC" Else strSortBy = "ASC" End If 'Save the sort results order to app session If isNumeric(Request.QueryString("OB")) AND Request.QueryString("OB") <> "" Then Call saveSessionItem("OB", Request.QueryString("OB")) 'If this is a top priority post across all forums then read in the forum ID form the querystring and ingnore the real topic forum ID If Request.QueryString("PR") = "3" Then intForumID = Cint(Request.QueryString("FID")) strSQL = "" & _ "SELECT" & strDBTop1 & " " & strDbTable & "Category.Cat_ID, " & strDbTable & "Category.Cat_name, " & strDbTable & "Forum.Forum_ID AS ForumID, " & 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 AS forumLocked, " & strDbTable & "Topic.Poll_ID, " & strDbTable & "Topic.Subject, " & strDbTable & "Topic.Icon, " & strDbTable & "Topic.Locked AS topicLocked, " & strDbTable & "Topic.Priority, " & strDbTable & "Topic.No_of_views, " & strDbTable & "Topic.Hide, " & strDbTable & "Topic.Event_date, " & strDbTable & "Topic.Event_date_end, " & strDbTable & "Permissions.* " & _ "FROM " & strDbTable & "Category" & strDBNoLock & ", " & strDbTable & "Forum" & strDBNoLock & ", " & strDbTable & "Forum AS " & strDbTable & "Forum2" & strDBNoLock & ", " & strDbTable & "Permissions" & strDBNoLock & ", " & strDbTable & "Topic" & strDBNoLock & " " & _ "WHERE " & strDbTable & "Category.Cat_ID = " & strDbTable & "Forum.Cat_ID " & _ "AND " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Permissions.Forum_ID " 'Get the forum ID from the topic table If intForumID = 0 Then strSQL = strSQL & _ "AND " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Topic.Forum_ID " 'Else this is a priority post so get the forum ID from the querystring (security built in later to make sure the user is not trying to view a post they shouldn't) Else strSQL = strSQL & "" & _ "AND " & strDbTable & "Forum.Forum_ID = " & intForumID & " " End If strSQL = strSQL & "" & _ "AND (" & strDbTable & "Forum.Forum_ID = " & intForumID & " OR " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Topic.Forum_ID) " & _ "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 & "Topic.Topic_ID = " & lngTopicID & " " & _ "AND (" & strDbTable & "Permissions.Author_ID = " & lngLoggedInUserID & " OR " & strDbTable & "Permissions.Group_ID = " & intGroupID & ") " & _ "ORDER BY " & strDbTable & "Forum.Sub_ID, " & strDbTable & "Forum.Forum_Order, " & strDbTable & "Permissions.Author_ID DESC" & strDBLimit1 & ";" 'Set error trapping On Error Resume Next 'Query the database rsCommon.Open strSQL, adoCon 'If an error has occurred write an error to the page If Err.Number <> 0 Then Call errorMsg("An error has occurred while executing SQL query on database.", "get_forum_data", "forum_posts.asp") 'Disable error trapping On Error goto 0 'If there is no record returended then set a message to say that If rsCommon.EOF Then 'If there are no thread's to display then display the appropriate error message strSubject = strTxtNoThreads 'Else get the details of the forum, permissions, and topic details Else 'Read in forum details from the database intForumID = Cint(rsCommon("ForumID")) 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("forumLocked")) blnHideTopic = CBool(rsCommon("Hide")) If isDate(rsCommon("Event_date")) Then dtmEventDate = CDate(rsCommon("Event_date")) If isDate(rsCommon("Event_date_end")) Then dtmEventDateEnd = CDate(rsCommon("Event_date_end")) '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")) blnModerator = CBool(rsCommon("Moderate")) blnCheckFirst = CBool(rsCommon("Display_post")) strForumPassword = rsCommon("Password") 'Read in the topic details lngPollID = CLng(rsCommon("Poll_ID")) strSubject = rsCommon("Subject") strTopicIcon = rsCommon("Icon") blnTopicLocked = CBool(rsCommon("topicLocked")) intPriority = CInt(rsCommon("Priority")) 'Clean up input to prevent XXS hack strSubject = formatInput(strSubject) 'If the user has no read writes then kick them out 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 strForumPassword <> "" AND (getCookie("fID", "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?RP=PT&FID=" & intForumID & "&TID=" & lngTopicID & strQsSID3) End If 'Update no. of views, if not a bot (bots can index a poge 100's of times thus making the view count unreliable If NOT OSType = "Search Robot" Then 'Read in the number of views for the page form the database lngNumberOfViews = CLng(rsCommon("No_of_views")) 'Add 1 to the number of views the Topic has had lngNumberOfViews = lngNumberOfViews + 1 'Write the number of times the Topic has been viewed back to the database 'Initalise the strSQL variable with the SQL string strSQL = "UPDATE " & strDbTable & "Topic" & strRowLock & " " & _ "SET " & strDbTable & "Topic.No_of_views = " & lngNumberOfViews & " " & _ "WHERE (((" & strDbTable & "Topic.Topic_ID) = " & lngTopicID & "));" 'Set error trapping On Error Resume Next 'Write to the database adoCon.Execute(strSQL) 'If an error has occurred write an error to the page If Err.Number <> 0 Then Call errorMsg("An error has occurred while writing to the database.", "update_no._views", "forum_posts.asp") 'Disable error trapping On Error goto 0 End If End If 'clean up rsCommon.Close 'Securtiy check - if this isn't a Priority post and the user is just trying to view a post in a forum they don't have permission to 'then reload the page without the forum ID If Request.QueryString("PR") = "3" AND NOT intPriority = 3 Then 'Reset Server Objects Call closeDatabase() 'Redirect back to this page without the forum ID Response.Redirect("forum_posts.asp?TID=" & lngTopicID & strQsSID3) End If 'Use the application session to pass around what forum this user is within Call saveSessionItem("FID", intForumID) 'Intilise SQL query to get all the posts 'Use a LEFT JOIN for the Guest name as there may not be a Guest name and so we want to include null values strSQL = "" & _ "SELECT " & strDbTable & "Thread.Thread_ID, " & strDbTable & "Thread.Message, " & strDbTable & "Thread.Message_date, " & strDbTable & "Thread.Show_signature, " & strDbTable & "Thread.IP_addr, " & strDbTable & "Thread.Hide, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Username, " & strDbTable & "Author.Homepage, " & strDbTable & "Author.Location, " & strDbTable & "Author.No_of_posts, " & strDbTable & "Author.Join_date, " & strDbTable & "Author.Signature, " & strDbTable & "Author.Active, " & strDbTable & "Author.Avatar, " & strDbTable & "Author.Avatar_title, " & strDbTable & "Group.Name, " & strDbTable & "Group.Stars, " & strDbTable & "Group.Custom_stars, " & strDbTable & "GuestName.Name " & _ "FROM (" & strDbTable & "Group INNER JOIN (" & strDbTable & "Author INNER JOIN " & strDbTable & "Thread ON " & strDbTable & "Author.Author_ID = " & strDbTable & "Thread.Author_ID) ON " & strDbTable & "Group.Group_ID = " & strDbTable & "Author.Group_ID) LEFT JOIN " & strDbTable & "GuestName ON " & strDbTable & "Thread.Thread_ID = " & strDbTable & "GuestName.Thread_ID " & _ "WHERE " & strDbTable & "Thread.Topic_ID = " & lngTopicID & " " '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 & "Thread.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 strSQL = strSQL & "ORDER BY " & strDbTable & "Thread.Message_date " & strSortBy & ";" 'Set error trapping On Error Resume Next 'Query the database rsCommon.Open strSQL, adoCon 'If an error has occurred write an error to the page If Err.Number <> 0 Then Call errorMsg("An error has occurred while executing SQL query on database.", "get_topic_posts_data", "forum_posts.asp") 'Disable error trapping On Error goto 0 'If there is a topic in the database then get the post data If NOT rsCommon.EOF Then 'Read in the topic recordset into an array sarryPosts = rsCommon.GetRows() 'Clean up rsCommon.Close 'SQL Query Array Look Up table '0 = tblThread.Thread_ID, '1 = tblThread.Message, '2 = tblThread.Message_date, '3 = tblThread.Show_signature, '4 = tblThread.IP_addr, '5 = tblThread.Hide, '6 = tblAuthor.Author_ID, '7 = tblAuthor.Username, '8 = tblAuthor.Homepage, '9 = tblAuthor.Location, '10 = tblAuthor.No_of_posts, '11 = tblAuthor.Join_date, '12 = tblAuthor.Signature, '13 = tblAuthor.Active, '14 = tblAuthor.Avatar, '15 = tblAuthor.Avatar_title, '16 = tblGroup.Name, '17 = tblGroup.Stars, '18 = tblGroup.Custom_stars '19 = tblGuestName.Name 'Count the number of records intTotalRecords = Ubound(sarryPosts,2) + 1 'Count the number of pages for the topics using '\' so that any fraction is omitted intTotalRecordsPages = intTotalRecords \ intThreadsPerPage 'If there is a remainder or the result is 0 then add 1 to the total num of pages If intTotalRecords Mod intThreadsPerPage > 0 OR intTotalRecordsPages = 0 Then intTotalRecordsPages = intTotalRecordsPages + 1 'Get the record poistion to display from 'If the page number to show from is higher than the last page number then the last page number is the highest page If (intRecordPositionPageNum > intTotalRecordsPages) OR (Request.QueryString("get") = "last") Then 'Set the page position number to the highest page number intRecordPositionPageNum = intTotalRecordsPages End If 'If we need to jump straight to a particular post calculate which page to go to If NOT lngGetPostID = 0 AND NOT intTotalRecordsPages = 1 Then 'Calculate how many posts are before the post we want For intLoop = 0 to (intTotalRecords - 1) 'If we have found the post then calcualte the page it is on If CLng(sarryPosts(0,intLoop)) = lngGetPostID Then 'Calculate page number (use FIX to get the whole number) intRecordPositionPageNum = FIX(intLoop / intThreadsPerPage) + 1 'Exit Loop Exit For End If Next End If 'Start position intStartPosition = ((intRecordPositionPageNum - 1) * intThreadsPerPage) 'End Position intEndPosition = intStartPosition + intThreadsPerPage 'Get the start position intCurrentRecord = intStartPosition 'Get the last post date to set the read session cookie for the un-read post icon 'If displayed 'Newest Post First' then it will be the first post that has the last post date If strSortBy = "DESC" Then dtmLastEntryDate = CDate(sarryPosts(2,0)) 'If displayed 'Oldest Post First' it will be the last post that has the last post date Else dtmLastEntryDate = CDate(sarryPosts(2,intTotalRecords-1)) End If 'To prevent performance issues, topics are auto closed when they reach xxxx posts If intTotalRecords > intAutoLockTopicsAmount Then strSQL = "UPDATE " & strDbTable & "Topic" & strRowLock & " " & _ "SET " & strDbTable & "Topic.Locked = " & strDBTrue & " " & _ "WHERE " & strDbTable & "Topic.Topic_ID = " & lngTopicID & ";" 'Set error trapping On Error Resume Next 'Write to the database adoCon.Execute(strSQL) 'If an error has occurred write an error to the page If Err.Number <> 0 Then Call errorMsg("An error has occurred while writing to the database.", "auto_lock_topic", "forum_posts.asp") 'Disable error trapping On Error goto 0 'Set the locked bulletin to true blnTopicLocked = True End If 'Else if no record is retuned we do not want to be displaying a foum title Else strSubject = "" rsCommon.Close End If 'If we have not yet checked for unread posts since last visit run it now If Session("dtmUnReadPostCheck") = "" Then Call UnreadPosts() 'Read in array if at application level ElseIf isArray(Application("sarryUnReadPosts" & strSessionID)) Then sarryUnReadPosts = Application("sarryUnReadPosts" & strSessionID) 'Read in the unread posts array ElseIf isArray(Session("sarryUnReadPosts")) Then sarryUnReadPosts = Session("sarryUnReadPosts") End If 'Page to link to for mutiple page (with querystrings if required) strLinkPage = "forum_posts.asp?TID=" & lngTopicID & "&" If Request.QueryString("KW") <> "" Then strLinkPage = strLinkPage & "KW=" & Server.URLEncode(Request.QueryString("KW")) & "&" If Request.QueryString("FID") <> "" Then strLinkPage = strLinkPage & "FID=" & intForumID & "&" If Request.QueryString("PR") <> "" Then strLinkPage = strLinkPage & "PR=" & CInt(Request.QueryString("PR")) & "&" 'If active users is enabled update the active users application array If blnActiveUsers Then 'If there are keywords this is a search If Request.QueryString("KW") <> "" Then 'Call active users function saryActiveUsers = activeUsers(strTxtViewingTopic & " " & strTxtSearchResults, strSubject, strLinkPage & "PN=" & intRecordPositionPageNum, intForumID) 'Else normal topic Else 'Call active users function saryActiveUsers = activeUsers(strTxtViewingTopic, strSubject, strLinkPage & "PN=" & intRecordPositionPageNum, intForumID) End If End If 'Set bread crumb trail 'Display the category name strBreadCrumbTrail = strBreadCrumbTrail & strNavSpacer & "" & strCatName & "" & strNavSpacer 'Display if there is a main forum to the sub forums name If intMasterForumID <> 0 Then strBreadCrumbTrail = strBreadCrumbTrail & "" & strMasterForumName & "" & strNavSpacer 'Display forum name If strForumName = "" Then strBreadCrumbTrail = strBreadCrumbTrail & strTxtNoForums Else strBreadCrumbTrail = strBreadCrumbTrail & "" & strForumName & "" 'Set the status bar tools 'Active Topics Links strStatusBarTools = strStatusBarTools & "   " & strTxtActiveTopics & "" 'If RSS XML enabled then display an RSS button to link to XML file If blnRSS AND (isNull(strForumPassword) OR strForumPassword = "") AND dtmLastEntryDate > DateAdd("ww", -intRSSLinkDisplayWeeks, now()) Then strStatusBarTools = strStatusBarTools & " " 'Write the HTML head of the page %> <% = strMainForumName & ": " & strSubject %> <% '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** Response.Write("" & vbCrLf) '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** 'If RSS Feed is enabled then have an alt link to the XML file for supporting browsers 'Only display if the last post was less than xx weeks ago, to reduce the amount of consumed bandwidth If blnRSS AND (isNull(strForumPassword) OR strForumPassword = "") AND dtmLastEntryDate > DateAdd("ww", -intRSSLinkDisplayWeeks, now()) Then Response.Write(vbCrLf & "") 'Display javascript for form checking If blnActiveMember AND blnForumLocked = false AND blnReply AND (intRecordPositionPageNum = intTotalRecordsPages) Then %> <% End If %>

<% 'If the forum is locked show a locked pad lock icon If blnForumLocked Then Response.Write ("") 'If the topic is locked then have a locked icon ElseIf blnTopicLocked Then Response.Write ("") End If 'If a calendar event then display so If isDate(dtmEventDate) Then Response.Write(strSubject & " - " & strTxtEventDate & ": " & stdDateFormat(dtmEventDate, False)) 'If over multiple dates If isDate(dtmEventDateEnd) Then Response.Write(" - " & stdDateFormat(dtmEventDateEnd, False)) Else Response.Write(strSubject) End If %>

 <% = strTxtPostReply %> <% = strTxtPostReply %>
<% 'If there is a poll then display the poll include If lngPollID > 0 Then %><% End If 'If there are posts display them If intTotalRecords > 0 Then %> <% 'Calculate the post number intThreadNo = (intRecordPositionPageNum - 1) * intThreadsPerPage 'Do....While Loop to loop through the recorset to display the topic posts Do While intCurrentRecord < intEndPosition 'If there are no post records left to display then exit loop If intCurrentRecord >= intTotalRecords Then Exit Do 'Calculate the thread number intThreadNo = intThreadNo + 1 'Initliase the unread post variable blnUnreadPost = False 'SQL Query Array Look Up table '0 = tblThread.Thread_ID, '1 = tblThread.Message, '2 = tblThread.Message_date, '3 = tblThread.Show_signature, '4 = tblThread.IP_addr, '5 = tblThread.Hide, '6 = tblAuthor.Author_ID, '7 = tblAuthor.Username, '8 = tblAuthor.Homepage, '9 = tblAuthor.Location, '10 = tblAuthor.No_of_posts, '11 = tblAuthor.Join_date, '12 = tblAuthor.Signature, '13 = tblAuthor.Active, '14 = tblAuthor.Avatar, '15 = tblAuthor.Avatar_title, '16 = tblGroup.Name, '17 = tblGroup.Stars, '18 = tblGroup.Custom_stars '19 = tblGuestName.Name 'Read in threads details for the topic from the database lngMessageID = CLng(sarryPosts(0,intCurrentRecord)) strMessage = sarryPosts(1,intCurrentRecord) dtmPostDate = CDate(sarryPosts(2,intCurrentRecord)) strAuthorIP = sarryPosts(4,intCurrentRecord) blnHidePost = CBool(sarryPosts(5,intCurrentRecord)) lngUserID = CLng(sarryPosts(6,intCurrentRecord)) strUsername = sarryPosts(7,intCurrentRecord) strAuthorHomepage = sarryPosts(8,intCurrentRecord) strAuthorLocation = sarryPosts(9,intCurrentRecord) lngAuthorNumOfPosts = CLng(sarryPosts(10,intCurrentRecord)) dtmAuthorRegistration = CDate(sarryPosts(11,intCurrentRecord)) strAuthorSignature = sarryPosts(12,intCurrentRecord) strAuthorAvatar = sarryPosts(14,intCurrentRecord) strMemberTitle = sarryPosts(15,intCurrentRecord) strGroupName = sarryPosts(16,intCurrentRecord) intRankStars = CInt(sarryPosts(17,intCurrentRecord)) strRankCustomStars = sarryPosts(18,intCurrentRecord) strGuestUsername = sarryPosts(19,intCurrentRecord) 'If there is a newer post than the last time the unread posts array was initilised run it again If dtmPostDate > CDate(Session("dtmUnReadPostCheck")) Then Call UnreadPosts() 'Mark if this post has been read, if the unread posts array exists If isArray(sarryUnReadPosts) AND dtmPostDate > dtmLastVisitDate Then 'Loop through the unread posts array For intUnReadForumPostsLoop = 0 to UBound(sarryUnReadPosts,2) 'Mark the post as read If CLng(sarryUnReadPosts(0,intUnReadForumPostsLoop)) = lngMessageID Then If sarryUnReadPosts(3,intUnReadForumPostsLoop) = "1" Then blnUnreadPost = True 'mark post as read sarryUnReadPosts(3,intUnReadForumPostsLoop) = "0" 'save back to session 'Save the array at applicion level If isArray(Application("sarryUnReadPosts" & strSessionID)) Then Application.Lock Application("sarryUnReadPosts" & strSessionID) = sarryUnReadPosts Application.UnLock 'save the array at session level ElseIf isArray(Session("sarryUnReadPosts")) Then Session("sarryUnReadPosts") = sarryUnReadPosts End If 'Exit for to save some processing time Exit For End If Next End If 'Calculate the row colour If intCurrentRecord MOD 2 = 0 Then strPostTableRowClass = "msgEvenTableRow" strPostTableSideClass = "msgEvenTableSide" strPostTableTopClass = "msgEvenTableTop" Else strPostTableRowClass = "msgOddTableRow" strPostTableSideClass = "msgOddTableSide" strPostTableTopClass = "msgOddTableTop" End If 'If this is a hidden post then change the row colour to highlight it If blnHidePost Then strPostTableRowClass = "msgHiddenTableRow" 'If the poster is a guest see if they have entered their name in the GuestName table and get it If lngUserID = 2 AND strGuestUsername <> "" Then strUsername = strGuestUsername 'If the post contains a quote or code block then format it If InStr(1, strMessage, "[QUOTE=", 1) > 0 AND InStr(1, strMessage, "[/QUOTE]", 1) > 0 Then strMessage = formatUserQuote(strMessage) If InStr(1, strMessage, "[QUOTE]", 1) > 0 AND InStr(1, strMessage, "[/QUOTE]", 1) > 0 Then strMessage = formatQuote(strMessage) If InStr(1, strMessage, "[CODE]", 1) > 0 AND InStr(1, strMessage, "[/CODE]", 1) > 0 Then strMessage = formatCode(strMessage) 'If the Post or signature contains Flash or YouTube BBcodes then display them If blnFlashFiles Then 'Flash If InStr(1, strMessage, "[FLASH", 1) > 0 AND InStr(1, strMessage, "[/FLASH]", 1) > 0 Then strMessage = formatFlash(strMessage) If InStr(1, strAuthorSignature, "[FLASH", 1) > 0 AND InStr(1, strAuthorSignature, "[/FLASH]", 1) > 0 Then strAuthorSignature = formatFlash(strAuthorSignature) 'YouTube If InStr(1, strMessage, "[TUBE]", 1) > 0 AND InStr(1, strMessage, "[/TUBE]", 1) > 0 Then strMessage = formatYouTube(strMessage) If InStr(1, strAuthorSignature, "[TUBE]", 1) > 0 AND InStr(1, strAuthorSignature, "[/TUBE]", 1) > 0 Then strMessage = formatYouTube(strAuthorSignature) End If 'If the message has been edited parse the 'edited by' XML into HTML for the post If InStr(1, strMessage, "", 1) Then strMessage = editedXMLParser(strMessage) 'Call the function to highlight search words if coming froma search page If strSearchKeywords <> "" Then strMessage = searchHighlighter(strMessage, sarySearchWord) 'Calulate rowspan amount for table below side bar If CBool(sarryPosts(3,intCurrentRecord)) AND strAuthorSignature <> "" Then intPostRowsSpan = 3 Else intPostRowsSpan = 2 End If 'If we are showing ads increase by 1 If intCurrentRecord = 0 AND strMyGoogleAdSenseID <> "pub-9026955576675812" Then intPostRowsSpan = intPostRowsSpan + 1 %> " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " " & _ vbCrLf & " <% 'Move to the next record intCurrentRecord = intCurrentRecord + 1 Loop %>
<% = strTxtAuthor %>
<% = strTxtMessage %><% If strSortBy = "DESC" Then Response.Write(" ") %>
<% 'Topic Search Link Response.Write ("   " & strTxtTopic & " " & strTxtSearch & "") 'Modertor Tools If blnAdmin OR blnModerator Then Response.Write("   " & strTxtModeratorTools & "" & _ "
" & _ "
" & strTxtHiddenTopics & "
" & _ "
" & strTxtTopicAdmin & "
") 'Lock or un-lock forum if admin If blnTopicLocked Then Response.Write("
" & strTxtUnLockTopic & "
") Else Response.Write("
" & strTxtLockTopic & "
") End If 'Hide or show topic If blnHideTopic = false Then Response.Write("
" & strTxtHideTopic & "
") Else Response.Write("
" & strTxtShowTopic & "
") End If Response.Write("
" & strTxtDeleteTopic & "
") Response.Write("
") End If 'Topic Options drop down Response.Write("   2 AND blnEmail AND blnLoggedInUserEmail AND blnActiveMember Then Response.Write("getAjaxData('ajax_email_notify.asp?TID=" & lngTopicID & "&PN=" & intRecordPositionPageNum & strQsSID2 & "', 'ajaxEmailSub');") Response.Write("showDropDown('topicOptions', 'optionsMenu', 122, 26);"" class=""dropDownPointer""> " & strTxtTopicOptions & "" & _ "
" & _ "
" & strTxtPostReply & "
" & _ "
" & strTxtCreateNewTopic & "
") If blnPollCreate Then Response.Write("
" & strTxtCreateNewPoll & "
") Response.Write("
" & strTxtPrintVersion & "
") 'Email Topic Option If intGroupID <> 2 AND blnEmail AND blnActiveMember Then Response.Write("
" & strTxtEmailTopic & "
") 'Display option to subscribe or un-subscribe to topic If intGroupID <> 2 AND blnEmail AND blnLoggedInUserEmail AND blnActiveMember Then Response.Write("") %>
<% = strUsername %> <% = strTxtViewDropDown %>
<% = strGroupName %>
" alt="<% = strGroupName %>" title="<% = strGroupName %>" />
<% 'If the user has an avatar then display it If blnAvatar = True AND strAuthorAvatar <> "" Then Response.Write("") 'If there is a title for this member then display it If strMemberTitle <> "" Then Response.Write(vbCrLf & "
" & strMemberTitle) 'If not a guest post then display some details If lngUserID <> 2 Then 'Show the joined date Response.Write(vbCrLf & "

" & strTxtJoined & ": " & DateFormat(dtmAuthorRegistration)) 'If the is a location display it If strAuthorLocation <> "" Then Response.Write(vbCrLf & "
" & strTxtLocation & ": " & strAuthorLocation) 'If active users is enabled see if the user is online If blnActiveUsers Then 'Display if the user is online blnIsUserOnline = False 'Loop through the active users array For intLoop = 1 To UBound(saryActiveUsers, 2) If saryActiveUsers(1, intLoop) = lngUserID Then blnIsUserOnline = True Next 'Display if the user is online If blnIsUserOnline Then Response.Write(vbCrLf & "
" & strTxtOnlineStatus & ": " & strTxtOnLine2) Else Response.Write(vbCrLf & "
" & strTxtOnlineStatus & ": " & strTxtOffLine) End If 'Display the num of posts Response.Write(vbCrLf & "
" & strTxtPosts & ": " & lngAuthorNumOfPosts) End If %>
<% 'Disply post options if there are any for this user If (blnTopicLocked = False) OR (blnAdmin OR blnModerator) Then Response.Write(vbCrLf & " ") 'Post options drop down If intGroupID <> 2 Then Response.Write(vbCrLf & " " & strTxtPostOptions & "" & _ vbCrLf & "
") 'If the topic is not locked put in a link for someone to quote this message If blnTopicLocked = False AND blnPollNoReply = False AND blnHidePost = False Then Response.Write(vbCrLf & "
" & strTxtPostReply & "
" & _ vbCrLf & "
" & strTxtQuote & " " & strUsername & "
") End If 'Display the report post feature if email is enabled. If (blnEmail AND intGroupID <> 2 AND lngUserID <> lngLoggedInUserID AND blnActiveMember) AND (blnAdmin = false AND blnModerator = false) Then Response.Write(vbCrLf & "
" & strTxtReportPost & "
") 'If the logged in user is the person who posted the message or the forum administrator/moderator then allow them to edit or delete the message If (lngLoggedInUserID = lngUserID AND blnForumLocked = False AND blnActiveMember AND blnTopicLocked = False) OR (blnAdmin OR blnModerator) Then 'Only let the user edit the post if they have edit rights If blnEdit OR blnAdmin Then Response.Write(vbCrLf & "
" & strTxtEditPost & "
") End If 'Only let a normal user delete there post if someone hasn't posted a reply If (intTotalRecords = intThreadNo) OR (blnAdmin OR blnModerator) Then 'Only let the user delete the post if they have delete rights If blnDelete OR blnAdmin Then Response.Write(vbCrLf & "
" & strTxtDeletePost & "
") End If End If End If 'If the user is the forum admin or a moderator If blnAdmin OR blnModerator Then 'Let them hide the post If blnHidePost Then Response.Write(vbCrLf & "
" & strTxtApprovePost & "
") Else Response.Write(vbCrLf & "
" & strTxtHidePost & "
") End If 'Let them move the post to another forum Response.Write(vbCrLf & "
" & strTxtMovePost & "
") 'Display the IP address for IP blocking to admin/moderators If strAuthorIP <> "" Then Response.Write(vbCrLf & "
" & strTxtBlockUsersIP & "
") End If Response.Write(vbCrLf & "
") End If 'If the topic is not locked put in a link for someone to quote this message If blnTopicLocked = False AND blnPollNoReply = False AND blnHidePost = False Then Response.Write(vbCrLf & "    " & strTxtQuote & "  " & _ "" & strTxtReply & "") End If Response.Write(vbCrLf & "
") End If 'If unread post display an un-read post icon next to the post If blnUnreadPost Then Response.Write(vbCrLf & " ") 'Else display a bullet incon with direct link to post Else 'Display direct link to post Response.Write(vbCrLf & " ") End If 'If first record display topic title If intCurrentRecord = 0 Then Response.Write("") 'If a calendar event then display so If isDate(dtmEventDate) Then Response.Write(strTxtCalendarEvent & ": ") Else Response.Write(strTxtTopic & ": ") Response.Write(strSubject & "
    ") End If 'Display message post date and time Response.Write(strTxtPosted & " " & DateFormat(dtmPostDate) & " " & strTxtAt & " " & TimeFormat(dtmPostDate)) 'Display IP if admin or moderator If blnAdmin OR blnModerator Then Response.Write(" - " & strTxtIP & ": " & strAuthorIP) %>
<% = strMessage %>
<% 'If the user wants there signature the display it If CBool(sarryPosts(3,intCurrentRecord)) AND strAuthorSignature <> "" Then Response.Write(vbCrLf & "
" & _ formatSignature(strAuthorSignature)) End If 'Show your Google ads If intCurrentRecord = 0 AND strMyGoogleAdSenseID <> "pub-9026955576675812" Then Response.Write(vbCrLf & "
") Response.Write(strAdSenseCodePost) End If %>
<% = strTxtBackToTop %>
<% 'Else display there are no posts to display so display error message Else %>
<% = strTxtError %> <% = strTxtError %>
<% = strTxtNoThreads %>
<% End If %>
 <% = strTxtPostReply %> <% = strTxtPostReply %> <% 'Display table for email and/or page links If intTotalRecordsPages > 1 Then %><% End If %>
<% 'Quick Reply !!!! If blnBannedIP = false AND blnActiveMember AND blnBanned = False AND blnForumLocked = false AND blnReply AND blnTopicLocked = false AND blnPollNoReply = false AND intRecordPositionPageNum = intTotalRecordsPages Then %><% End If %>

<% 'Clear server objects Call closeDatabase() '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** If blnLCode = True Then If blnTextLinks = True Then Response.Write("Bulletin Board Software by Web Wiz Forums® version " & strVersion & "") If blnACode Then Response.Write(" [Free Express Edition]") Else Response.Write("") If blnACode Then Response.Write("
Powered by Web Wiz Forums Free Express Edition") End If Response.Write("
Copyright ©2001-2008 Web Wiz") 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 & "
") Response.Write("
") 'Display an alert message if the user is watching this topic for email notification If Request.QueryString("EN") = "TS" Then Response.Write("") End If 'Display an alert message if the user is not watching this topic for email notification If Request.QueryString("EN") = "TU" Then Response.Write("") End If 'Display an alert message if the user is posting in a moderated forum If Request.QueryString("MF") = "Y" Then Response.Write("") End If %>