<%

		Function GetLinkList(LinkType,ClassID,LinkSorts,ListNumber,Content,Before,After)
 
			 Dim SqlStr, Para, SK_SiteName, TitleStr, WIDthStr, LinkRegStr
			 Dim LinkRs:Set LinkRs=Server.CreateObject("ADODB.RECORDSET")
			 Dim k, I, NoLinkRowNumber,skwebSQL
 
 			 If Ucase(Left(Trim(LinkSorts),2))<>"ID" Then  LinkSorts=LinkSorts & ",ID Desc"
 
			 ClassLinkID = CInt(ClassID):LinkType = CInt(LinkType)
			 Para = " Where Locked=0 And sh=1"
			 
			 If ClassLinkID <> 0 Then
			   Para = Para & " And ClassLinkID=" & ClassLinkID
			 End If
			 
			 If LinkType = 2 Then
			   Para = Para & " Order BY Rec Desc,"& LinkSorts
			 ElseIf LinkType = 1 Then
			   Para = Para & " And Logo<>'' Order BY Rec desc,"& LinkSorts
			 else
			   Para = Para & " And Logo='' Order BY Rec desc,"& LinkSorts 
			 End If
 	 		 	 
			 If ListNumber = 0 Then                     '列出所有友情链接站点
			   SqlStr = "Select ID,Webadmin,SK_SiteName,Description,Logo,AddDate,ClassLinkID,Url From Link_skweb" & Para
			 Else
			   SqlStr = "Select TOP " & ListNumber & " ID,Webadmin,SK_SiteName,Description ,Logo,AddDate,ClassLinkID,Url From Link_skweb" & Para
			 End If
			 
 			 Set LinkRs=skweboa.SK_axe(SqlStr)
	 	 
 			 If LinkRs.EOF Then	 GetLinkList="":LinkRs.Close:Set LinkRs=Nothing:Exit Function

 
					skwebSQL=LinkRs.GetRows(-1):Set LinkRs = Nothing
					Dim skwebNum,LinkContents:skwebNum=Ubound(skwebSQL,2)
  					For K=0 To skwebNum
						LinkContents=Content
 						If InStr(LinkContents, "#Link") > 0  Then
						   LinkContents = Replace(LinkContents, "#Link",skwebSQL(7,K))
						End if
						If InStr(LinkContents, "#Title") > 0  Then
						   LinkContents = Replace(LinkContents, "#Title",skwebSQL(2,K))
						End if
					
						If InStr(LinkContents, "#Logo") > 0  Then
							If Trim(skwebSQL(4,K))<>"" Then 
 							   LinkContents = Replace(LinkContents, "#Logo",skwebSQL(4,K))
							Else
 							   LinkContents = Replace(LinkContents, "#Logo",skweboa.SKCMS_sysimg(17))
							End If 
						End If
						
						
 						If InStr(LinkContents, "#AutoID") > 0  Then
						   LinkContents = Replace(LinkContents, "#AutoID",K+1)
						End if
						
						
  						If InStr(LinkContents, "#ModID") > 0  Then
 							If  K Mod 2 =0 Then ModID=0 Else ModID=1
						    LinkContents = Replace(LinkContents, "#ModID",ModID)
						End If
						
                
 						If InStr(LinkContents, "#yun") > 0  and K=0 Then
						   LinkContents = Replace(LinkContents, "#yun",yunlink())
						 else
							   LinkContents = Replace(LinkContents, "#yun","") 
						End if
						
						If InStr(LinkContents, "#Description") > 0  Then
							If Trim(skwebSQL(3,K))<>"" Then 
 							   LinkContents = Replace(LinkContents, "#Description",skwebSQL(3,K))
							Else
 							   LinkContents = Replace(LinkContents, "#Description","")
							End If 
  						End If
 					   GetLinkList = GetLinkList & LinkContents& vbCrLf
 					Next 
 
 		End Function
		
		
Function yunlink()		
senddata="web="&skweboa.SK_sys(6)&"&name="&skweboa.SK_sys(1)&""
Set xmlhttp1 = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
xmlhttp1.setTimeouts 10000, 10000, 10000, 30000
xmlhttp1.Open "POST","http://app.skcms.net/api/link.asp",False
xmlhttp1.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp1.setRequestHeader "Content-Length",len(senddata)
xmlhttp1.send (senddata)
If xmlhttp1.status = 200 Then
getTxt=xmlhttp1.responseText
end if 
yunlink=getTxt
End Function 
 

		%>