%
'Links System
'Subs:
'DisplayLinkNavigation Displays the Categories upper the actual category
'DisplayCats Displays the cats under the actual category and the related forum
'DisplayLinks Displays the Links in the actual category
%>
<%
dim intPageCount
'dim catid
dim title
CatID = Request.QueryString("catid")
Public Sub DisplayLinkNavigation %>
|
<%
Dim arCatIDs()
Redim arCatIDs(1)
Set objNav = CreateObject("ADODB.Recordset")
Dim arCatTitles()
Redim arCatTitles(1)
Dim i
Dim ArraySize
CatID = Request.QueryString("catid")
If Request.QueryString("catid") = "" then
CatID = 0
End If
'Create a recordset with the top level categories in it.
strSQL = "SELECT ParentID, CatID, Title FROM " & strTablePrefix & "Site_Cats;"
Set objNav = my_Conn.Execute (strSQL)
i = 0
'Loop until the top level category is found.
DO UNTIL CatID = 0
'Create a filtered recordset with only one record.
objNav.Filter = "CatID = " & CatID
arCatIDs(i) = objNav("CatID")
arCatTitles(i) = objNav("Title")
If NOT objNav("ParentID") = 0 then
Redim Preserve arCatIDs(i+1)
Redim Preserve arCatTitles(i+1)
End If
CatID = objNav("ParentID")
i = i + 1
LOOP
'It might be the top level in which case Home shouldn't be a link.
If NOT Request.QueryString("catid") = "" then
Response.Write "Home >> "
Else
Response.Write "Home >> "
End If
'The array holds the information in the wrong order so read it backwards.
For i = UBound(arCatIDs) to 0 Step - 1
If i = 0 then
' Response.Write arCatTitles(i)
Else
'This is a stupid line of code. Remove it and see what happens to the first level of categories.
If NOT arCatIDs(i) = "" then
Response.Write ""&arCatTitles(i)&" : "
End If
End If
Next
'Cleany Cleany
If CatID > 0 Then
objNav.Close
Set objNav = Nothing
End If
%>
|
<%
End Sub 'DisplayLinkNavigation %>
<%
Public Sub DisplayCats
CatID = Request.QueryString("catid")
Set objCat = CreateObject("ADODB.Recordset")
Set objCat.ActiveConnection = my_Conn
objCat.LockType = 2
If Len(CatID) > 0 Then
' this is a subcat: display its data.
objCat.Open("SELECT Title, Forum_ID, IMG, Links, CatDesc FROM " & strTablePrefix & "Site_Cats WHERE CatID=" & CatID & "AND Links = 1")
if not objCat.eof then catDESC = objCat("CatDesc")%>
|
<%=objCat("Title")%>
|
<% if not strDisplayCatImg = "0" AND objCat("IMG") <>"" then %>
"> |
<% end if %>
<%=objCat("CatDesc")%>
|
|
<% ' check if we have a forums entry
If objCat("Forum_ID") <> "" Then
'display the related Forum
%>
|
Related Forum: |
<%
strSQL = "SELECT " & strTablePrefix & "FORUM.FORUM_ID, " & strTablePrefix & "FORUM.F_DESCRIPTION, " & strTablePrefix & "FORUM.F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & objCat("FORUM_ID")
set rsForum = my_Conn.Execute (strSql)
if rsForum.eof or rsForum.bof then
Response.Write """No Forum Found!"""
Else%>
<%
End If
rsForum.Close
set rsForum = nothing
%>
|
<% end if %>
|
<%
' read the subcategorys
objCat.Close
objCat.Open("SELECT * FROM " & strTablePrefix & "Site_Cats WHERE ParentID=" & CatID &" AND Links = 1 ORDER BY Title ASC;")
Else
objCat.Open("SELECT * FROM " & strTablePrefix & "Site_Cats WHERE ParentID = 0 AND Links = 1 ORDER BY Title ASC;")
End If
Set objRec2 = Server.CreateObject ("ADODB.Recordset")
objRec2.Open strTablePrefix & "Site_Links", my_Conn, 3, 3
Set objRec3 = Server.CreateObject ("ADODB.Recordset")
objRec3.Open strTablePrefix & "Site_Cats", my_Conn, 3, 3
If objCat.EOF or objCat.BOF then
Response.Write " "
Else%>
<%
cellwidth = 100 mod strNumCols
i = 1
DO UNTIL objCat.EOF
if i-1 mod strNumCols = 0 then
response.write "
"
end if
response.write ""
response.write " " & objCat("Title") & ""
if not strDisplayCatStats = "0" then
response.write "  "
'Find the Number of Resources
objRec2.Filter = "CatID="&objCat("CatID")
'Display amount of resources.
If objRec2.RecordCount = 0 then
Response.Write ""
ElseIf objRec2.RecordCount = 1 then
Response.Write "(1 Link) "
Else
Response.Write "(" & objRec2.RecordCount & " Links) "
End If
objRec2.Filter = 0
objRec3.Filter = "ParentID="&objCat("CatID")
'Display the amount of categories.
If objRec3.RecordCount = 0 then
Response.Write "(0 Categories)"
ElseIf objRec3.RecordCount = 1 then
Response.Write "(1 Category)"
Else
Response.Write "(" & objRec3.RecordCount & " Categories)"
End If
Response.Write ""
end if
if not strDisplayCatDesc = "0" then
response.write " "& catDESC &""
end if
If mLev >= 3 Then %>
<% End If
response.write " | "
if i mod strNumCols = 0 then
response.write "
"
end if
i = i+1
objCat.MoveNext
LOOP
do until i mod strNumCols = 0
response.write " | "
i=i+1
LOOP
response.write " |
"
' response.write ""
end if
End Sub 'DisplayCats
%>
<%
Public Sub Displaylinks
If Request.QueryString("catid") = "" then
CatID = 0
CatTitle = SiteName
Else
CatID = Request.QueryString("catid")
CatTitle = Request.QueryString("cattitle")
End If
nPageNum = Request.QueryString("PageNum")
If nPageNum = "" Then
nPageNum = 1
End If
PageSize = 10
'Create a recordset with the top level categories in it.
Set objContent = CreateObject("ADODB.Recordset")
Set objContent.ActiveConnection = my_Conn
If mLev = 4 Then
SQL = "SELECT * FROM " & strTablePrefix & "Site_Links WHERE CatID = " & CatID & " AND LinkType = 4 ORDER BY Added DESC;"
Else
SQL = "SELECT * FROM " & strTablePrefix & "Site_Links WHERE CatID = " & CatID & " AND LinkType = 4 AND Validated = 1 ORDER BY Name, Hits DESC;"
End If
objContent.CursorLocation = 3 'adUseClient
objContent.CursorType = 3 'adOpenStatic
objContent.Activeconnection = my_conn
objContent.open sql
objContent.PageSize = PageSize
objContent.CacheSize = objContent.PageSize
intPageCount = objContent.PageCount
if objContent.EOF = false then
nLastPage=intPageCount
objContent.AbsolutePage = nPageNum
if cint(strLinkAddPermission) <= mlev then
%>
<%
end if
if intPageCount > 1 then %>
| Page <%=nPageNum%> of <%=intPageCount %> |
<% Call Paging(intPageCount, CatID) %> |
<% else %>
<% end if
for counter = 1 to ObjContent.PageSize
if not ObjContent.EOF then
If objContent("Votes") <> "0" then
Rate = round(objContent("Score")/objContent("Votes"))
star = 0
Rating = ""
DO UNTIL star = Rate
Rating = Rating & "
"
star = star +1
Loop
Else
Rating = "Not Rated"
End If
LinkStatus = objContent("Badlink")
Select Case LinkStatus
Case 0
LinkStatus = "Working"
Case Else
LinkStatus = "Down!!"
End Select
' begin display of a link%>
<%end if %>
<%
objContent.MoveNext
end if
next
else
' no records found
end if
if intPageCount > 1 then %>
| Page <%=nPageNum%> of <%= intPageCount %> |
<% Call Paging(intPageCount, CatID) %> |
<%
else
%>
<%
end if
if cint(strLinkAddPermission) <= mlev then
%>
<%
end if
End Sub ' Displaylinks
Public Sub Paging(intPageCount, CatID)
if intPageCount > 1 then
if Request.QueryString("PageNum") = "" then
sPageNumber = 1
else
sPageNumber = Request.QueryString("PageNum")
end if
' response.write sPagenumber & "
"
if Request.QueryString("method") = "" then
sMethod = "postsdesc"
else
sMethod = Request.QueryString("method")
end if
' response.write sMethod & "
"
sScriptName = Request.ServerVariables("script_name")
' response.write sScriptName & "
"
Response.Write("")
for counter = 1 to intPageCount
if counter <> cint(sPageNumber) then
sNum = "| " & " " & widenum(counter) & "" & counter & " | "
Response.Write sNum
else
Response.Write("" & " " & widenum(counter) & "" & counter & " | ")
end if
if counter mod strPageNumberSize = 0 then
Response.Write("
")
end if
next
Response.Write("
")
end if
End Sub 'Displaylinks
%>