<%@ CodePage=65001 Language="VBScript"%> <% Option Explicit %> <% sBBSLangPage = "category" BBS.SetupBBS BBS.SetScheme(0) dim sCategoryList, iCatLock, bFirstRecord, iCategoryID, SQL, vCategoryList, vForumsList, index, iForumsIndex, iUpperBound dim iForumsUpperBound, bCanView, sLastThreadLink, sWelcomeCenter, sFragmentWelcome, sLastPosterName dim bCanViewThread, vForumInfo, vThreadInfo, sLastThreadActivity, sLastThreadSubject if not(BBS.HasPermission(PERM_ViewBBS, -1)) then response.redirect sBBSForumRoot & "/logon.asp?error=needregistration" if request("showall") = "true" then response.cookies("catlock") = "" response.cookies("catlock").path = "/" end if bFirstRecord = True if len(Trim(request.querystring("catlock"))) > 0 then iCatLock = BBS.ValidateNumeric(request.querystring("catlock")) else iCatLock = BBS.ValidateNumeric(request.cookies("catlock")) end if ' Generate the forum/category listing ' If the category is locked, then only return records from that category if iCatLock > 0 then SQL = "select categoryid, name, url, locked from categories where categoryid=" & BBS.ValidateNumeric(iCatLock) & ";" else SQL = "select categoryid, name, url, locked from categories order by sortorder asc;" end if rsMaster.open SQL, dbConnection, adOpenForwardOnly, adLockReadOnly BBS.AddQuery(SQL) if not(rsMaster.EOF) then vCategoryList = rsMaster.GetRows rsMaster.Close iUpperBound = UBOUND(vCategoryList, 2) ' Generate the category header Filesystem.ExecuteFragmentTemplate ("/category-view-header.asp") sCategoryList = sCategoryList & sBBSFragmentOutput sBBSFragmentOutput = "" for index = 0 to iUpperBound bFirstRecord = True SQL = "select forumid, lastactivethread from forums where categoryid=" & vCategoryList(0, index) & " order by sortorder asc;" rsMaster.open SQL, dbConnection, adOpenForwardOnly, adLockReadOnly BBS.AddQuery(SQL) if not(rsMaster.EOF) then vForumsList = rsMaster.GetRows rsMaster.Close iForumsUpperBound = UBOUND(vForumsList, 2) for iForumsIndex = 0 to iForumsUpperBound vForumInfo = Forum.GetForumInfo(vForumsList(0, iForumsIndex)) vThreadInfo = Forum.GetThreadInfo(vForumsList(1, iForumsIndex)) bCanView = BBS.HasPermission(PERM_FORUMVIEW, vForumInfo(FI_ForumID)) bCanViewThread = BBS.HasPermission(PERM_FORUMACCESS, vForumInfo(FI_ForumID)) if bCanView then ' If this is the first forum in a category, write the category header if bFirstRecord = True then dictEnvironment.item("U-CATEGORYIMGURL") = BBS.ValidateField(sBBSForumRoot & "/images/forums/" & vCategoryList(2, index)) dictEnvironment.item("U-CATEGORYLINKALL") = BBS.ValidateField(sBBSForumRoot & "/images/forums/" & vCategoryList(2, index) & "&showall=true") dictEnvironment.item("U-CATEGORYLINK") = sBBSForumRoot & "/category-view.asp?catlock=" & vCategoryList(0, index) dictEnvironment.item("V-CATEGORYID")= vCategoryList(0, index) dictEnvironment.item("V-CATEGORYNAME")= BBS.ValidateField(vCategoryList(1, index)) dictEnvironment.item("C-ISCATLOCK")= vCategoryList(3, index) ' Generate the category header Filesystem.ExecuteFragmentTemplate ("/category-view-catrow.asp") sCategoryList = sCategoryList & sBBSFragmentOutput sBBSFragmentOutput = "" bFirstRecord = False end if ' Write the forum dictEnvironment.item("U-FORUMLINK") = sBBSForumRoot & "/forums/forum-view.asp?fid=" & vForumInfo(FI_ForumID) dictEnvironment.item("U-IMGURL") = BBS.ValidateField(sBBSForumRoot & "/images/forums/" & vForumInfo(FI_URL)) dictEnvironment.item("V-FORUMNAME") = vForumInfo(FI_ForumName) dictEnvironment.item("V-DESCRIPTION") = vForumInfo(FI_ForumDescription) if bCanView then dictEnvironment.item("V-THREADCOUNT") = vForumInfo(FI_ThreadCount) dictEnvironment.item("V-POSTCOUNT") = vForumInfo(FI_PostCount) else dictEnvironment.item("V-THREADCOUNT") = "" dictEnvironment.item("V-POSTCOUNT") = "" end if ' Show the last active thread in the forum if dictConfiguration("bCATEGORYLINKLASTTHREAD") = 1 and bCanViewThread then sLastThreadLink = sBBSForumRoot & "/forums/thread-view.asp?tid=" & vForumInfo(FI_LastActiveThread) & "&posts=" & vThreadInfo(TI_TotalPosts) & "#M" & BBS.ValidateField(vThreadInfo(TI_LastPostID)) sLastThreadSubject = BBS.FilterView(BBS.ValidateField(Forum.GetMessageInfo(vThreadInfo(TI_LastPostID))(MI_Subject))) if vThreadInfo(TI_LastPosterAnonymous) = 0 then if vThreadInfo(TI_LastPosterIsRegistered) = 1 then sLastPosterName= ""& BBS.ValidateField(BBS.GetUsername(vThreadInfo(TI_LastPosterMemberID))) & "" else sLastPosterName= ""& BBS.ValidateField(vThreadInfo(TI_LastPosterGuestName)) & "" end if else sLastPosterName= "" & dictLanguage.item("CATEGORY-8") & "" end if sLastThreadActivity = BBS.GetShortDateTime(vThreadInfo(TI_LastActivity)) else sLastThreadSubject = "" sLastTHreadLink = "" sLastPosterName = "" sLastThreadActivity = "" end if if sLastThreadSubject = "" then dictEnvironment.item("C-SHOWLASTTHREAD") = False else dictEnvironment.item("C-SHOWLASTTHREAD") = BBS.ValidateBoolean(bCanViewThread) end if dictEnvironment.item("V-LASTTHREADSUBJECT") = sLastThreadSubject dictEnvironment.item("V-LINKLASTTHREAD") = sLastTHreadLink dictEnvironment.item("V-LASTPOSTER") = sLastPosterName dictEnvironment.item("V-LASTACTIVITY") = sLastThreadActivity dictEnvironment.item("V-MODERATORLIST") = BBS.ListMembers (MODULE_FORUMS, USERLEVEL_Moderator, vForumInfo(FI_ForumID)) Filesystem.ExecuteFragmentTemplate ("/category-view-forumrow.asp") sCategoryList = sCategoryList & sBBSFragmentOutput sBBSFragmentOutput = "" end if next else rsMaster.Close end if next end if dictEnvironment.item("C-STATSLOCATION") = dictConfiguration.item("sCATEGORYSTATISTICSLOCATION") dictEnvironment.add "V-CATEGORYLIST", sCategoryList & "" sBBSFragmentOutput = "" if dictEnvironment.item("C-STATSLOCATION") = "TOP" or dictEnvironment.item("C-STATSLOCATION") = "BOTTOM" then dictEnvironment.add "V-WELCOMEBOX", Extender.WriteInfoCenter() dictEnvironment.add "V-TITLE", dictLanguage.item("CATEGORY-TITLE") dictEnvironment.add "C-SHOWRANDOMQUOTES", dictConfiguration("bDISPLAYBBSQUOTES") if iBBSUserLevel >= USERLEVEL_SupportAdministrator then dictEnvironment.add "C-SHOWADMINLINK", 1 'Load page %> <% Filesystem.ExecuteBBSTemplate("/category-view.asp") %>