<% dim ID, objCom, subtype, return,ForumSubscription,ThreadSubscription, objRS dim T,S, allforum, rights, threadID, allowedToSubscribe, notAllowedSubscriptionMsg allowedToSubscribe = true if isGuest then allowedToSubscribe = false notAllowedSubscriptionMsg = rightviolationmessage end if if Application(dbName&"enableSubscribe")=0 or Application(dbName&"maildll") = "NoMail" then allowedToSubscribe = false notAllowedSubscriptionMsg = SiteWideSubscriptionDisabledMessage end if appid = request.queryString("appid")' it is the appid (forumID) people want to subscribe. When this value is passed, ID is not included threadID = request.queryString("threadID") 'it is the threadID people what to subscribe. When this value is passed, appid is also included for permission checking allForum = Application(dbName&"foruminfo") if isArray(allForum) then if appid <> "" then 'if people selects forum instead of thread, ID is changed to forumID ID = allForum(0,appid) subtype = 0 elseif threadID <> "" then 'if people selects thread instead of forum, ID is changed to threadID ID = threadID subtype = 1 appid = "" else ID="" end if if ID <> "" then 'going to subscribe to a forum or message if subtype = 1 then 'derive appid from threadID Dim forumID set objRS = server.createobject("adodb.recordset") with objRS .CacheSize = 1 .open "SELECT forumID from pgd_messages where threadID="&threadID, datastore, , , adCmdText If not (.EOF or .BOF) then forumID = objRS(0) else 'there is not such thing available rights = 0 End if .close end with set objRS=nothing if not isEmpty(forumID) then appid = ForumIdToAppid(forumID) end if if len(appid&"")<>0 then Dim objPermission Set objPermission = new PermissionSetting With objPermission .memID = memID .appid = appid .GetPermission(false) rights = .post End With Set objPermission = nothing end if if rights < 1 then allowedToSubscribe = false notAllowedSubscriptionMsg = rightviolationmessage end if end if if allowedToSubscribe then If ID<>"" then set objCom = server.createobject("adodb.command") With objCom .activeConnection = datastore .commandText = dbOwnerPrefix&"spSubscription" .commandType = adCmdStoredProc .Parameters.Append .Createparameter("@RETURN_VALUE", adInteger, adParamReturnValue, 0) .Parameters.Append .Createparameter("@mem", adInteger, adParamInput, 0, memID) .Parameters.Append .Createparameter("@ID", adInteger, adParamInput, 0, ID) .Parameters.Append .Createparameter("@type", adInteger, adParamInput, 0, subtype) .Parameters.Append .Createparameter("@getMail", adInteger, adParamInput, 0, 1) .execute , , adExecuteNoRecords return = .Parameters("@RETURN_VALUE") End With set objCom = nothing if return = -1 then allowedToSubscribe = false notAllowedSubscriptionMsg = SubscriptionErrorMessage else response.redirect("subscribe.asp") response.end end if end if set objRS = server.createobject("adodb.recordset") With objRS .open dbOwnerPrefix&"spGetSubscription("&memID&")", datastore, , , adCmdStoredProc if not (.eof and .bof) then ForumSubscription = .getrows set objRS = .nextRecordset if not (objRS.eof and objRS.bof) then ThreadSubscription = objRS.getrows objRS.close End With set objRS = nothing allforum = Application(dbName&"foruminfo") Dim allCat, p, q allcat = Application(dbName&"Category") 'get a list of readable forums if isArray(allforum) then Dim objSearchableForum, finalforums Set objSearchableForum = new searchableForum With objSearchableForum .memID = memID .SearchType = "all" finalforums = .GetSearchableForums End With Set objSearchableForum = nothing else finalforums = "-5" end if end if end if %> <%= Application(dbName&"forumtitle") %> <%= OutputCSS() %> > <% call headerHTML() %> <% if allowedToSubscribe then%>
<%= subsForumDesc %>
class="c2"> <% Dim fStr, isCategroyAccessible, forumIDUnderCat:forumIDUnderCat = "" Dim isAnyForumSubscribable:isAnyForumSubscribable = false Set fStr = New StringBuilder Set objPermission = new PermissionSetting With objPermission .memID = memID if isarray(allForum) then response.write ("") for p=0 to ubound (allCat,2) isCategroyAccessible = false for q = 0 to ubound(allForum,2) .appid = q if allForum(5,q)=allCat(0,p) and Instr(1, "," & finalforums & ",", "," & allForum(0,q) & ",", 0) > 0 _ and allforum(16,q)=2 then isCategroyAccessible = true fStr.append("") fStr.append("" &vbcrlf) forumIDUnderCat = forumIDUnderCat & allForum(0,q) & "," end if next if isCategroyAccessible then response.write (""&vbcrlf) response.write (fStr.Value) isAnyForumSubscribable = true end if fStr.reset forumIDUnderCat = "" next response.write ("
     ") fStr.append(" ") fStr.append(""& allForum(1,q) & ""&iff(.Moderator()," ","")&"
") response.write (""& allCat(1,p) &"
") end if End With Set objPermission = nothing Set fStr = nothing if not isAnyForumSubscribable then response.write (subsNoForumYet) %>


> <% if isArray(ThreadSubscription) then for T = 0 to ubound(ThreadSubscription,2) if Instr(1, "," & finalforums & ",", "," & ThreadSubscription(3,T) & ",", 0) > 0 then %> <% end if next erase ThreadSubscription else%> <%end if%>
<%= subsThreadDesc %>
<%= subscribeDesc %> <%= subsGetMailDesc %> <%= ttTopic %> <%= srForumProDesc %> <%= srByNameDesc %>
align="center"> align="center"> > class="c2"> <%= SQLOut(ThreadSubscription(1,T)) %> class="c2"> <%= SQLOut(ThreadSubscription(4,T)) %> class="c2"> <%= SQLOut(ThreadSubscription(5,T)) %>
colspan='5' class="c2"> <%= subsNoThreadYet %>

<% else %> <%= notAllowedSubscriptionMsg %> <% end if %>

<% call footerHTML() %>