<% @ Language=VBScript codepage=1255 %> <% Option Explicit %> <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide - Web Wiz Forums '** '** Copyright 2001-2003 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: - '** info@webwizguide.info '** '** or at: - '** '** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom '** '**************************************************************************************** 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 rsCommonT 'Holds the forum permisisons to be checked Dim strForumName 'Holds the forum name Dim strForumDescription 'Holds the description of the forum Dim lngTopicID 'Holds the topic number Dim lngMessageID 'Holds the message ID 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 strAuthorSignature 'Holds the authors signature Dim dtmTopicDate 'Holds the date the thread was made Dim strMessage 'Holds the message body of the thread Dim intForumID 'Holds the ID number of the forum 'Initialise variables lngTopicID = 0 'Read in the Forum ID to display the Topics for lngTopicID = CLng(Request.QueryString("TID")) 'If there no Topic ID then redirect the user to the main forum page If lngTopicID = 0 Then 'Clean up Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing 'Redirect Response.Redirect "default.asp" End If 'Get the posts from the database 'Initalise the strSQL variable with an SQL statement to query the database get the thread details strSQL = "SELECT " & strDbTable & "Forum.Forum_ID, " & strDbTable & "Thread.Thread_ID, " & strDbTable & "Thread.Message, " & strDbTable & "Thread.Message_date, " & strDbTable & "Thread.Show_signature, " & strDbTable & "Forum.Forum_name, " & strDbTable & "Forum.Forum_description, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Username, " & strDbTable & "Author.Signature, " & strDbTable & "Topic.Subject " strSQL = strSQL & "FROM (" & strDbTable & "Forum INNER JOIN " & strDbTable & "Topic ON " & strDbTable & "Forum.Forum_ID = " & strDbTable & "Topic.Forum_ID) INNER JOIN (" & strDbTable & "Author INNER JOIN " & strDbTable & "Thread ON " & strDbTable & "Author.Author_ID = " & strDbTable & "Thread.Author_ID) ON " & strDbTable & "Topic.Topic_ID = " & strDbTable & "Thread.Topic_ID " strSQL = strSQL & "WHERE (((" & strDbTable & "Thread.Topic_ID)=" & lngTopicID & ")) " strSQL = strSQL & "ORDER by " & strDbTable & "Thread.Message_Date ASC;" 'Query the database rsCommon.Open strSQL, adoCon 'If there is no topic in the database then display the appropraite mesasage If rsCommon.EOF Then 'If there are no thread's to display then display the appropriate error message strSubject = strNoThreads Else 'Read in the thread subject strSubject = rsCommon("Subject") 'Read in the forum ID to check if the user can view the post intForumID = rsCommon("Forum_ID") End If 'Create a recordset to check if the user is allowe to view posts in this forum Set rsCommonT = Server.CreateObject("ADODB.Recordset") 'Read in the forum name and forum permssions from the database 'Initalise the strSQL variable with an SQL statement to query the database If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "ForumsAllWhereForumIs @intForumID = " & intForumID Else strSQL = "SELECT " & strDbTable & "Forum.* FROM " & strDbTable & "Forum WHERE " & strDbTable & "Forum.Forum_ID = " & intForumID & ";" End If 'Query the database rsCommonT.Open strSQL, adoCon 'If there is a record returned by the recordset then check to see if you need a password to enter it If NOT rsCommonT.EOF Then 'Check the user is welcome in this forum Call forumPermisisons(intForumID, intGroupID, CInt(rsCommonT("Read")), CInt(rsCommonT("Post")), CInt(rsCommonT("Reply_posts")), CInt(rsCommonT("Edit_posts")), CInt(rsCommonT("Delete_posts")), 0, CInt(rsCommonT("Poll_create")), CInt(rsCommonT("Vote")), CInt(rsCommonT("Attachments")), CInt(rsCommonT("Image_upload"))) 'If the user has no read writes then kick them If blnRead = False Then 'Reset Server Objects rsCommonT.Close Set rsCommonT = Nothing Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing 'Redirect to a page asking for the user to enter the forum password Response.Redirect "insufficient_permission.asp" 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 rsCommonT("Password") <> "" AND Request.Cookies(strCookieName)("Forum" & intForumID) <> rsCommonT("Forum_code") Then 'Reset Server Objects rsCommonT.Close Set rsCommonT = Nothing Set rsCommon = Nothing adoCon.Close Set adoCon = Nothing '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 End If End If 'Clean up rsCommonT.Close %> <% = strMainForumName %>: <% = strSubject %>
<% = strTxtPrintPage %> | <% = strTxtCloseWindow %>

<% strTableQuoteBorderColour = "#CCCCCC" strTableQuoteColour = "#FFFFFF" 'If there are no threads returned by the qury then display an error message If rsCommon.EOF Then %>
<% = strNoThreads %>
<% 'Display the threads Else 'Read in threads details for the topic from the database lngMessageID = CLng(rsCommon("Thread_ID")) strMessage = rsCommon("Message") lngUserID = CLng(rsCommon("Author_ID")) strUsername = rsCommon("Username") dtmTopicDate = CDate(rsCommon("Message_date")) strForumName = rsCommon("Forum_name") strForumDescription = rsCommon("Forum_description") strAuthorSignature = rsCommon("Signature") 'If the poster is a guest see if they have entered their name in the GuestName table and get it If lngUserID = 2 Then 'Initalise the strSQL variable with an SQL statement to query the database If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "GuestPoster @lngThreadID = " & lngMessageID Else strSQL = "SELECT " & strDbTable & "GuestName.Name FROM " & strDbTable & "GuestName WHERE " & strDbTable & "GuestName.Thread_ID = " & lngMessageID & ";" End If 'Query the database rsCommonT.Open strSQL, adoCon 'Read in the guest posters name If NOT rsCommonT.EOF Then strUsername = rsCommonT("Name") 'Close the recordset rsCommonT.Close End If 'If the message has been edited remove who edited the post If InStr(1, strMessage, "", 1) Then strMessage = removeEditorAuthor(strMessage) 'Convert message to text strMessage = ConvertToText(strMessage) '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 contains a flash link then format it If blnFlashFiles Then 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) End If 'If the user wants there signature shown then attach it to the message If rsCommon("Show_signature") Then strAuthorSignature = ConvertToText(strAuthorSignature) strMessage = strMessage & "

-------------
" & strAuthorSignature End If 'Strip long text strings from message strMessage = removeLongText(strMessage) %> <% = strSubject %>

<% = strTxtPrintedFrom %>: <% = strWebsiteName %>
<% = strTxtForumName %>: <% = strForumName %>
<% = strTxtForumDiscription %>: <% = strForumDescription %>
<% = strTxtURL %>: <% = strForumPath %>/forum_posts.asp?TID=<% = lngTopicID %>
<% = strTxtPrintedDate %>: <% = DateFormat(Now(), saryDateTimeData) & " " & strTxtAt & " " & TimeFormat(Now(), saryDateTimeData) %> <% If blnLCode = True Then %>
<% = strTxtSoftwareVersion %>: Web Wiz Forums <% = strVersion %> - http://www.webwizforums.com<% End If %>


<% = strTxtTopic %>: <% = strSubject %>

<% = strTxtPostedBy %>: <% = strUsername %>
<% = strTxtSubjectFolder %>: <% = strSubject %>
<% = strTxtDatePosted %>: <% = DateFormat(dtmTopicDate, saryDateTimeData) %> <% = strTxtAt %> <% = TimeFormat(dtmTopicDate, saryDateTimeData) %>

<% = strMessage %>


<% 'Move to the next database record rsCommon.MoveNext If NOT rsCommon.EOF Then Response.Write "" & strTxtReplies & ": " %>
<% 'Loop round to read in all the thread's in the database Do While NOT rsCommon.EOF 'Read in threads details for the topic from the database lngMessageID = CLng(rsCommon("Thread_ID")) strMessage = rsCommon("Message") lngUserID = CLng(rsCommon("Author_ID")) strUsername = rsCommon("Username") dtmTopicDate = CDate(rsCommon("Message_date")) strAuthorSignature = rsCommon("Signature") 'If the poster is a guest see if they have entered their name in the GuestName table and get it If lngUserID = 2 Then 'Initalise the strSQL variable with an SQL statement to query the database If strDatabaseType = "SQLServer" Then strSQL = "EXECUTE " & strDbProc & "GuestPoster @lngThreadID = " & lngMessageID Else strSQL = "SELECT " & strDbTable & "GuestName.Name FROM " & strDbTable & "GuestName WHERE " & strDbTable & "GuestName.Thread_ID = " & lngMessageID & ";" End If 'Query the database rsCommonT.Open strSQL, adoCon 'Read in the guest posters name If NOT rsCommonT.EOF Then strUsername = rsCommonT("Name") 'Close the recordset rsCommonT.Close End If 'If the message has been edited remove who edited the post If InStr(1, strMessage, "", 1) Then strMessage = removeEditorAuthor(strMessage) 'Convert message to text strMessage = ConvertToText(strMessage) '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 contains a flash link then format it If blnFlashFiles Then 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) End If 'If the user wants there signature shown then attach it to the message If rsCommon("Show_signature") Then strAuthorSignature = ConvertToText(strAuthorSignature) strMessage = strMessage & "

-------------
" & strAuthorSignature End If 'Strip long text strings from message strMessage = removeLongText(strMessage) %>
<% = strTxtPostedBy %>: <% = strUsername %>
<% = strTxtDatePosted %>: <% = DateFormat(dtmTopicDate, saryDateTimeData) %> <% = strTxtAt %> <% = TimeFormat(dtmTopicDate, saryDateTimeData) %>

<% = strMessage %>


<% 'Move to the next database record rsCommon.MoveNext Loop %>

<% End If 'Reset server variables rsCommon.Close Set rsCommon = Nothing Set rsCommonT = Nothing adoCon.Close Set adoCon = Nothing %>
<% = strTxtPrintPage %> | <% = strTxtCloseWindow %>

<% '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** If blnLCode = True Then Response.Write("Powered by Web Wiz Forums version " & strVersion & " - http://www.webwizforums.com") Response.Write("
Copyright ©2001-2003 Web Wiz Guide - http://www.webwizguide.info") End If '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** %>