" & strTxtNoForums & ""
'Else there the are forum's to write the HTML to display it the forum names and a discription
Else
'Write the HTML of the forum descriptions as hyperlinks to the forums
Response.Write ("" & strForumName & "")
End If
'Clean up
rsForum.Close
%>

")
End If
Response.Write("

")
%>

Now() - " & intShowTopicsFrom & ") OR (" & strDbTable & "Topic.Priority > 0))) OR (" & strDbTable & "Topic.Priority = 3) "
End If
strSQL = strSQL & "ORDER BY " & strDbTable & "Topic.Priority DESC, " & strDbTable & "Topic.Last_entry_date DESC;"
End If
'Set the cursor type property of the record set to dynamic so we can naviagate through the record set
rsForum.CursorType = 1
'Query the database
rsForum.Open strSQL, adoCon
'Set the number of records to display on each page
rsForum.PageSize = intTopicPerPage
'Check there are Topic's to display
If rsForum.EOF Then
'If there are no Topic's to display then display the appropriate error message
Response.Write vbCrLf & "

" & strTxtNoTopicsToDisplay & " " & strShowTopicsFrom & "

"
'Else there the are topic's so write the HTML to display the topic names and a discription
Else
'Get the record poistion to display from
rsForum.AbsolutePage = intRecordPositionPageNum
'If there are no records on this page and it's above the frist page then set the page position to 1
If rsForum.EOF AND intRecordPositionPageNum > 1 Then rsForum.AbsolutePage = 1
'Count the number of pages there are in the recordset calculated by the PageSize attribute set above
intTotalNumOfPages = rsForum.PageCount
'Craete a Recodset object for the topic details
Set rsTopic = Server.CreateObject("ADODB.Recordset")
'Loop round to read in all the Topics in the database
For intRecordLoopCounter = 1 to intTopicPerPage
'If there are no records left in the recordset to display then exit the for loop
If rsForum.EOF Then Exit For
'Read in Topic details from the database
lngTopicID = CLng(rsForum("Topic_ID"))
lngPollID = CLng(rsForum("Poll_ID"))
intMovedForumID = CInt(rsForum("Moved_ID"))
lngNumberOfViews = CLng(rsForum("No_of_views"))
strSubject = rsForum("Subject")
blnTopicLocked = CBool(rsForum("Locked"))
intPriority = CInt(rsForum("Priority"))
'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 importent then display the forum topics bar
If intNonPriorityTopicNum = 1 Then Response.Write vbCrLf & "

" & StrTxtForumTopics & "

"
'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 & "

" & strTxtImportantTopics & "

"
'Initalise the strSQL variable with an SQL statement to query the database to get the Author and subject from the database for the topic
If strDatabaseType = "SQLServer" Then
strSQL = "EXECUTE " & strDbProc & "LastAndFirstThreadAuthor @lngTopicID = " & lngTopicID
Else
strSQL = "SELECT " & strDbTable & "Thread.Thread_ID, " & strDbTable & "Thread.Author_ID, " & strDbTable & "Thread.Message, " & strDbTable & "Thread.Message_date, " & strDbTable & "Author.Username "
strSQL = strSQL & "FROM " & strDbTable & "Author, " & strDbTable & "Thread "
strSQL = strSQL & "WHERE " & strDbTable & "Author.Author_ID = " & strDbTable & "Thread.Author_ID AND " & strDbTable & "Thread.Topic_ID = " & lngTopicID & " "
strSQL = strSQL & "ORDER BY " & strDbTable & "Thread.Message_date ASC;"
End If
'Set the cursor type property of the record set to forward only so we can navigate through the record set
rsTopic.CursorType = 1
'Query the database
rsTopic.Open strSQL, adoCon
'If there is info in the database relating to the topic then get them from the record set
If NOT rsTopic.EOF Then
'Read in the subject and author and number of replies from the record set
strTopicStartUsername = rsTopic("Username")
strFirstPostMsg = Mid(rsTopic("Message"), 1, 275)
lngTopicStartUserID = CLng(rsTopic("Author_ID"))
lngNumberOfReplies = CLng((rsTopic.RecordCount) - 1)
dtmFirstEntryDate = CDate(rsTopic("Message_date"))
'Move to the last record in the record set to get the date and username of the last entry
rsTopic.MoveLast
'Read in the username and date of the last entry from the record set
lngLastEntryMessageID = CLng(rsTopic("Thread_ID"))
strLastEntryUsername = rsTopic("Username")
lngLastEntryUserID = CLng(rsTopic("Author_ID"))
dtmLastEntryDate = CDate(rsTopic("Message_date"))
'Remove HTML from message for subject link title
strFirstPostMsg = removeHTML(strFirstPostMsg)
'Trim the number of characters down to 150 for the subject link title
strFirstPostMsg = Mid(Trim(strFirstPostMsg), 1, 150)
'If the length of the message is over 150 then append ... to it
If CLng(Len(strFirstPostMsg)) = 150 Then strFirstPostMsg = Trim(strFirstPostMsg) & "..."
End If
'Set the booleon varible if this is a new post since the users last visit and has not been read
If (CDate(Session("dtmLastVisit")) < dtmLastEntryDate) AND (Request.Cookies("RT")("TID" & lngTopicID) = "") Then
blnNewPost = True
'Else this is not a new post so don't set the booleon to true
Else
blnNewPost = False
End If
'Write the HTML of the Topic descriptions as hyperlinks to the Topic details and message
Response.Write(vbCrLf & "

")
Response.Write(vbCrLf & "

")
'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(vbCrLf & "

")
Response.Write(vbCrLf & "

")
'If the user is a forum admin or a moderator then give let them delete the topic
If blnAdmin OR blnModerator Then Response.Write(vbCrLf & " ")
'If the topic is moved to another forum display moved next to it
If intMovedForumID = intForumID AND intMovedForumID <> 0 Then Response.Write(strTxtMoved)
'If there is a poll display a poll text
If lngPollID > 0 Then Response.Write(strTxtPoll)
'Display the subject of the topic
Response.Write(vbCrLf & " " & 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(vbCrLf & "")
'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(vbCrLf & " 8")
'Else display the last 2 pages
Else
Response.Write(" ...")
Response.Write(vbCrLf & " " & intNumberOfTopicPages - 1 & "")
Response.Write(vbCrLf & " " & intNumberOfTopicPages & "")
End If
Exit For
End If
'Display the links to the other pages
Response.Write(vbCrLf & " " & intTopicPagesLoopCounter & "")
Next
End If
%>

")
Response.Write("alert('" & strTxtTheTopicIsNowDeleted & "')")
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
%>