<!--#include file="QvodCms_Conn.asp"-->
<!--#include file="QvodCms_Check.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<TITLE>管理页面</TITLE>
<link href="skins/css/jaja_main.css" rel="stylesheet" type="text/css" />
</head>
<body><%
Dim Action,Allnumber,Pagenumber
Action=Trim(Request.QueryString("action"))
Allnumber=QvodCms_Clng(Request.Form("allnumber"))'共生成多少
Pagenumber=QvodCms_Clng(Request.Form("pagenumber"))'每页多少
Call OpenConn()
Select  Case Action
	Case "baidu" : Call MakeBaidu
	Case "google" : Call MakeGoogle
	Case "rss" : Call MakeRss
	Case Else : Call SiteMap
End Select
Call CloseConn()
%></body>
</html>
<%
Sub MakeBaidu
	Set Crs = Server.CreateObject("adodb.recordset")
	sql = "select top "&Allnumber&" name_id,class_id,data_name,data_picbig,data_intro,data_inputer,data_lastdate,data_status,data_py from qvodcms_name where data_status=1 order by data_lastdate desc"
	Crs.Open sql, Conn, 1, 1
	If Not (Crs.bof And Crs.eof) Then
		Crs.pagesize=Pagenumber'每页数据
		m=Crs.recordcount     '总记录
		n=Crs.PageCount       '总页数
		Response.Write("总共需要生成"&n&"页...正在生成...<br>")
		For i=1 to n
		moban =  "<?xml version=""1.0"" encoding=""GB2312"" ?>"& vbCrLf
		moban = moban + "<document>"& vbCrLf
		moban = moban + "<webSite>"&Config(9)&"/</webSite>"& vbCrLf
		moban = moban + "<webMaster>"&Config(18)&"</webMaster>"& vbCrLf
		moban = moban + "<updatePeri>1440</updatePeri>"& vbCrLf
		ii=0
		Do while not Crs.eof  and ii<Pagenumber
			DataPath=GetDataLink(Crs("class_id"),Crs("name_id"),Crs("data_py"))
			If Config(0)<>"/" Then DataPath=Replace(DataPath,Config(0),"/")		
			vintro=Crs("data_intro") : if isnull(vintro) then vintro=""
			vname=Crs("data_name") : if isnull(vName) then vName=""
			moban = moban + "<item>"& vbCrLf
			moban = moban + "<title>"&server.htmlencode(vName)&"</title>"& vbCrLf
			moban = moban + "<link>"&Config(9)&DataPath&"</link>"& vbCrLf		
			moban = moban + "<text>"&server.htmlencode(left(vintro, 300))&"</text>"& vbCrLf
			If instr(Crs("data_picbig"),"")>0  Then
			moban = moban + "<image>"&Crs("data_picbig")&"</image>"& vbCrLf
			Else
			moban = moban + "<image>"&Config(9)&"/"&Crs("data_picbig")&"</image>"& vbCrLf
			End If
			moban = moban + "<keywords>"&Crs("data_name")&"</keywords>"& vbCrLf
			moban = moban + "<author>"&Crs("data_inputer")&"</author>"& vbCrLf
			moban = moban + "<source>QvodCms</source>"& vbCrLf
			moban = moban + "<pubDate>" & Year(Crs("data_lastdate")) & "-" & Right("0" & Month(Crs("data_lastdate")), 2) & "-" & Right("0" & Day(Crs("data_lastdate")), 2) & "</pubDate>"& vbCrLf
			'moban = moban + "<pubDate>"&Crs("data_lastdate")&"</pubDate>"& vbCrLf
			moban = moban + "</item>"& vbCrLf
		Crs.movenext
		ii=ii+1
		Loop
		moban = moban + "</document>" & vbCrLf
		moban = "" + moban + ""
		moban = "" & moban & ""
		Call MakeHtml("../baidumap_"&i&".xml",moban) 
		Response.Write("生成页面（<a href='../baidumap_"&i&".xml' target='_blank'>"&Config(9)&"/baidumap_"&i&".xml</a>）<font color=red>成功!</font><br>")
		'If i=n Then Response.Write("请通过  <a href='news.baidu.com/newsop.html' target='_blank'>news.baidu.com/newsop.html</a>  提交!<br>")
		'Response.flush
		Next		
	Else
		Response.Write("暂时没有数据无需生成！")	
	End If
	Crs.Close
	Set Crs=nothing
End Sub

Sub MakeGoogle
	Set Crs = Server.CreateObject("adodb.recordset")
	sql = "select top "&Allnumber&" name_id,class_id,data_name,data_picbig,data_intro,data_inputer,data_lastdate,data_status,data_py from qvodcms_name where data_status=1 order by name_id desc"
	Crs.Open sql, Conn, 1, 1
	If Not (Crs.bof And Crs.eof) Then
		Crs.pagesize=Pagenumber'每页数据
		m=Crs.recordcount     '总记录
		n=Crs.PageCount       '总页数
		Response.Write("总共需要生成"&n&"页...正在生成...<br>")
		For i=1 to n
		moban =  "<?xml version=""1.0"" encoding=""UTF-8""?>"
		moban = moban + "<!--Google Site Map File Generated by "&Config(9)&" " & return_RFC822_Date(now,"GMT") & "-->"
		moban = moban + "<urlset xmlns=""www.google.com/schemas/sitemap/0.84"">"
		moban = moban + "<url>"
		moban = moban + "<loc>"&Config(9)&"/</loc> "
		moban = moban + "</url>"
		ii=0
		Do while not Crs.eof  and ii<Pagenumber
			DataPath=GetDataLink(Crs("class_id"),Crs("name_id"),Crs("data_py"))
			If Config(0)<>"/" Then DataPath=Replace(DataPath,Config(0),"/")
			moban = moban + "<url>"
			moban = moban + "<loc>"&Config(9)&DataPath&"</loc> "  '修改为你的文件名称和id
			moban = moban + "</url>"
		Crs.movenext
		ii=ii+1
		Loop
		moban = moban + "</urlset>" 
		moban = "" + moban + ""
		moban = "" & moban & ""
		Call MakeHtml("../sitemap_"&i&".xml",moban) 
		Response.Write("生成页面（<a href='../sitemap_"&i&".xml' target='_blank'>"&Config(9)&"/sitemap_"&i&".xml</a>）<font color=red>成功!</font><br>")
		If i=n Then Response.Write("请通过  <a href='www.google.com/webmasters/tools/' target='_blank'>www.google.com/webmasters/tools/</a>  添加它!<br>")
		Response.flush
		Next
	Else
		Response.Write("暂时没有数据无需生成！")	
	End If
	Crs.Close
	Set Crs=nothing
End Sub

Sub MakeRss
	Set Crs = Server.CreateObject("adodb.recordset")
	sql = "select top "&Allnumber&" name_id,class_id,data_name,data_picbig,data_intro,data_inputer,data_lastdate,data_status,data_py from qvodcms_name where data_status=1 order by data_lastdate desc"
	Crs.Open sql, Conn, 1, 1
	If Not (Crs.bof And Crs.eof) Then
		moban =  "<?xml version=""1.0"" encoding=""GB2312"" ?>"& vbCrLf
		moban = moban + "<rss version='2.0'>" & vbCrLf
		moban = moban + "<channel>" & vbCrLf
		moban = moban + "<title>"&Config(8)&"</title>" & vbCrLf
		moban = moban + "<description>"&Config(8)&"</description>" & vbCrLf
		moban = moban + "<link>"&Config(9)&"</link>" & vbCrLf
		moban = moban + "<language>zh-cn</language>" & vbCrLf
		moban = moban + "<docs>"&Config(8)&"</docs>" & vbCrLf
		moban = moban + "<generator>Rss Powered By "&Config(9)&"</generator>" & vbCrLf
		moban = moban + "<image>" & vbCrLf
		moban = moban + "<title>"&Config(8)&"</title>" & vbCrLf
		moban = moban + "<link>"&Config(9)&"/</link>" & vbCrLf
		moban = moban + "<url>"&Config(9)&"/images/logo.gif</url>" & vbCrLf
		moban = moban + "</image>" & vbCrLf	
		Do while not Crs.eof
			DataPath=GetDataLink(Crs("class_id"),Crs("name_id"),Crs("data_py"))
			If Config(0)<>"/" Then DataPath=Replace(DataPath,Config(0),"/")		
			moban = moban + "<item>"& vbCrLf
			moban = moban + "<title><![CDATA["&Crs("data_name")&"]]></title>"& vbCrLf
			moban = moban + "<link>"&Config(9)&DataPath&"</link>"& vbCrLf
			moban = moban + "<author>"&Crs("data_inputer")&"</author>"& vbCrLf
			moban = moban + "<pubDate>"&Crs("data_lastdate")&"</pubDate>"& vbCrLf
			moban = moban + "<description><![CDATA["&server.htmlencode(left(ReplaceHtml(Crs("data_intro")), 300))&"]]></description>"& vbCrLf			
			moban = moban + "</item>"& vbCrLf
		Crs.movenext
		Loop
		moban = moban + "</channel></rss>" & vbCrLf
		Call MakeHtml("../rss.xml",moban) 
		Response.Write("生成页面（<a href='../rss.xml' target='_blank'>"&Config(9)&"/rss.xml</a>）<font color=red>成功!</font><br>")
		Response.flush	
	Else
		Response.Write("暂时没有数据无需生成！")	
	End If
	Crs.Close
	Set Crs=nothing
End Sub

Function return_RFC822_Date(byVal myDate, byVal TimeZone)
	Dim myDay, myDays, myMonth, myYear
	Dim myHours, myMinutes, mySeconds
	myDate = CDate(myDate)
	myDay = EnWeekDayName(myDate)
	myDays = Right("00" & Day(myDate),2)
	myMonth = EnMonthName(myDate)
	myYear = Year(myDate)
	myHours = Right("00" & Hour(myDate),2)
	myMinutes = Right("00" & Minute(myDate),2)
	mySeconds = Right("00" & Second(myDate),2) 
	return_RFC822_Date = myDay&", "& _
	myDays&" "& _
	myMonth&" "& _ 
	myYear&" "& _
	myHours&":"& _
	myMinutes&":"& _
	mySeconds&" "& _ 
	" " & TimeZone
End Function 

Function EnWeekDayName(InputDate)
	Dim Result
	Select Case WeekDay(InputDate,1)
	Case 1:Result="Sun"
	Case 2:Result="Mon"
	Case 3:Result="Tue"
	Case 4:Result="Wed"
	Case 5:Result="Thu"
	Case 6:Result="Fri"
	Case 7:Result="Sat"
	End Select
	EnWeekDayName = Result
End Function

Function EnMonthName(InputDate)
	Dim Result
	Select Case Month(InputDate)
	Case 1:Result="Jan"
	Case 2:Result="Feb"
	Case 3:Result="Mar"
	Case 4:Result="Apr"
	Case 5:Result="May"
	Case 6:Result="Jun"
	Case 7:Result="Jul"
	Case 8:Result="Aug"
	Case 9:Result="Sep"
	Case 10:Result="Oct"
	Case 11:Result="Nov"
	Case 12:Result="Dec"
	End Select
	EnMonthName = Result
End Function

Sub SiteMap%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<th colspan=8 class="title" background="Skins/images/tdbg.gif">&nbsp;请选择生成网站地图</th>
</tr>
<form name="form1" method="post" action="?action=rss">
<tr><td class="td1" style="height:30px;"><img src="images/rss.gif" width="36" height="14"> 生成网站最新的ＲＳＳ文件。总输出数量:<input name="allnumber" type="text" value="30" size="5"> <input type="submit" name="Submit3" value="开始生成"></td></tr>
</form>
<!-- -->
<form name="form1" method="post" action="?action=google">
<tr><td class="td2"><img src="images/GoogleSiteMaplogo.gif" width="110" height="48"> 生成GOOGLE规范的XML地图。总输出数量<input name="allnumber" type="text" value="500" size="5"> 每页连接数<input name="pagenumber" type="text" value="100" size="5"> <input type="submit" name="Submit" value="开始生成"></td></tr>
</form>
<!-- -->
<form name="form1" method="post" action="?action=baidu">
<tr>
<td class="td1"><img src="images/BaiduSiteMaplogo.gif" width="137" height="46"> 生成BaiDu规范的XML格式地图。总输出数量<input name="allnumber" type="text" value="450" size="5"> 每页连接数<input name="pagenumber" type="text" value="90" size="5"> <input type="submit" name="Submit2" value="开始生成"></td>
</tr>
</form>
<!-- -->
</table>
<%End Sub%>