<!--#include file="include.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>插件安装</title>
 <link href="../../Images/style.css" rel="stylesheet" type="text/css">
 <link href="Images/New.css" rel="stylesheet" type="text/css">
</head>
<body>
 <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  <tr>
    <td class="bg_tr">您现在的位置：插件样式 &gt;&gt; 查看插件的可用更新 </td>
  </tr>
  <tr>
    <td>
	
	
	 
 <div class="md-head" >
<div class="zsj"></div>
<a href="fy.Theme.ACTList.asp" class="a10 wrap"  >在线安装插件</a>
<a href="fy.Theme.Reg.asp" class="a10 wrap"  >我的帐号</a>
<a href="Index.asp" class="a10 wrap cur wid"  >插件管理</a>
<a href="fy.Theme.Check.asp" class="a10 wrap"  >查看插件的可用更新</a>
</div>

 

</td>
  </tr>
</table>
 <%
Action=Request.QueryString("act")
Dim fso, f, f1, fc, s, t, i, n, m

Set fso = CreateObject(fycms.FsoName)
Set f = fso.GetFolder(Tpath & ThemePath)
Set fc = f.SubFolders

If Action="" Then
	Echo "<span id=""loading"">正在载入页面, 请稍候... 如果长时间停止响应, 请 <a href=""javascript:window.location.reload();"" title=""点此重试"">[点此重试]</a><img  align=""absmiddle"" src=""../../Images/loading.gif"" /></span>"
	Response.Flush

	Echo "<div class=""top1""><span style="" margin-left:10px"" ><strong>提示：</strong> 以下列出了您需要更新的插件:</span></div>"
	Echo "<p class=""status-box"" id=""notfound"" style=""display:none;"">!! 暂时没有找到需要更新的插件.</p>"
	Response.Flush

	UpdateNeeded=False

	For Each f1 in fc

		
		
		
 
		If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "Theme.xml") Then

		
			
			Dim  Install_Data,Install_Pack
			Dim strXmlDataWeb,strXmlDataLocal
 			Dim Item_ID_Web,Item_Name_Web,Item_Url_Web,Item_Version_Web,Item_PubDate_Web,Item_Modified_Web
 			Dim Item_ID_Local,Item_Name_Local,Item_Url_Local,Item_Version_Local,Item_PubDate_Local,Item_Modified_Local,UpdateNeeded
 			
			Set XML=fycms.NoAppGetXMLFromFile(Tpath&ThemePath &f1.name& "\verchk.xml")
 			Response.Flush
 			If IsObject(XML) And XML.readyState=4  And  XML.parseError.errorCode =0 Then
				Item_ID_Web=GetNode("id")
				Item_Name_Web=GetNode("name")
				Item_Url_Web=GetNode("url")
				Item_Version_Web=GetNode("version")
				Item_PubDate_Web=GetNode("pubdate")
				Item_Modified_Web=GetNode("modified")
				If Item_Version_Web="" Then Item_Version_Web="Undefine"
				If Item_PubDate_Web="" Then Item_PubDate_Web="Undefine"
				If Item_Modified_Web="" Then Item_Modified_Web="Undefine"
		
			End If 
			Set XML=Nothing
 			Set XML=fycms.NoAppGetXMLFromFile(Tpath & ThemePath & f1.name & "\Theme.xml")
 			Response.Flush
 			If IsObject(XML) And XML.readyState=4  And  XML.parseError.errorCode =0 Then
				Item_ID_Local=GetNode("id")
				Item_Name_Local=GetNode("name")
				Item_Url_Local=GetNode("url")
				Item_Version_Local=GetNode("version")
				Item_PubDate_Local=GetNode("pubdate")
				Item_Modified_Local=GetNode("modified")
				If Item_Version_Local="" Then Item_Version_Local="Undefine"
				If Item_PubDate_Local="" Then Item_PubDate_Local="Undefine"
				If Item_Modified_Local="" Then Item_Modified_Local="Undefine"
			End If 
			 
 			If fso.FileExists(Tpath & ThemePath & f1.name & "\" & "verchk.xml") Then
		'		XmlDataWeb=(LoadFromFile(Tpath & ThemePath & f1.name & "/" & "Update.xml","utf-8"))
		 echo "<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""table""> <tr><td class=""bg_tr"">查看插件</td></tr><tr><td   colspan=""2"" >"

				Echo "<p class=""download-box"">"
				Echo "插件: <b>"& Item_Name_Local &"</b> <b class=""notice"">发现可用的新版本!</b><br/><br/>"

				Echo "当前插件版本为: <b>"& Item_Version_Local &"</b>. 发布日期为: <b>"& Item_PubDate_Local &"</b>. 最后修改日期为: <b>"& Item_Modified_Local &"</b>.<br/>"
				Echo "最新可用版本为: <b>"& Item_Version_Web &"</b>. 发布日期为: <b>"& Item_PubDate_Web &"</b>. 最后修改日期为: <b>"& Item_Modified_Web &"</b><br/><br/>"

				If Item_Url_Web<>Empty Then
					Echo "<a href="""& Item_Url_Web &""" target=""_blank"" title=""查看插件的发布页面"">[点此查看插件的发布信息!]</a> "
				End If

				Echo "<a class=""notice"" href=""fy.Theme.Install.Asp?act=confirm&amp;url=" & Server.URLEncode(Update_URL & f1.name) & """ title=""升级此插件"">[升级此插件]</a>"

				Echo "</p>"
				Response.Flush
				 echo"</td></tr> </table>"
				UpdateNeeded=True
			End If

		End If

		Set XML=Nothing

	Next

	If UpdateNeeded Then
		Echo "<script language=""JavaScript"" type=""text/javascript"">try{document.getElementById('found').style.display = 'block';}catch(e){};</script>"
	Else
		Echo "<script language=""JavaScript"" type=""text/javascript"">try{document.getElementById('notfound').style.display = 'block';}catch(e){};</script>"
	End If

		 echo "<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""table""> <tr><td class=""bg_tr"">查看插件</td></tr><tr><td   colspan=""2"" >"
	Echo "<p><input onclick=""window.scrollTo(0,0);"" type=""button""  class=""btn btn_primary""   value=""返回页面顶部""  title=""返回页面顶部"" /> <input onclick=""self.location.href='fy.Theme.Check.asp?act=check&n=0';"" type=""button""  class=""btn btn_primary""  value=""查找更新"" title=""查找插件的可用更新"" />  <input onclick=""self.location.href='fy.Theme.Check.asp?act=clear';"" type=""button""  class=""btn btn_primary""  value=""清除更新提示"" title=""清除更新提示"" /></p>"
	Echo "</form>"

	Call display("loading")
End If



If Action="clear" Then
	Echo "<span id=""loading"">正在载入页面, 请稍候... 如果长时间停止响应, 请 <a href=""javascript:window.location.reload();"" title=""点此重试"">[点此重试]</a><img  align=""absmiddle"" src=""../../Images/loading.gif"" /></span>"
	Response.Flush

	Echo "<span id=""found"" style=""display:none;"">!! 已清除以下插件的更新提示:</span>"
	Echo "<span class=""top1"" id=""notfound"" style=""display:none;"">!! 没有更新提示可清除.</span>"
	Response.Flush

	m=False

	For Each f1 in fc
 		If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "Theme.xml") Then

 			Set XML=fycms.NoAppGetXMLFromFile(Tpath & ThemePath & f1.name & "\Theme.xml")
 			Response.Flush
 			If IsObject(XML) And XML.readyState=4  And  XML.parseError.errorCode =0 Then
 				Item_Name_Local=GetNode("name")
 			End If 

			If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "verchk.xml") Then
			echo "<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""table""> <tr><td class=""bg_tr"">检测    <b class=red>" & Item_Name_Local & "</b></td></tr><tr><td   colspan=""2"" >"
				fso.DeleteFile(Tpath & ThemePath & f1.name & "/" & "verchk.xml")

				Echo "<p class=""status-box"">"
				Echo "插件: <b>"& Item_Name_Local &"</b> <b class=""allright"">的新版提示已清除!</b>"
				Echo "</p>"
				Response.Flush
				 echo"</td></tr> </table>"
				m=True

			End If

			If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "error.log") Then
			echo "<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""table""> <tr><td class=""bg_tr"">检测    <b class=red>" & Item_Name_Local & "</b></td></tr><tr><td   colspan=""2"" >"
				fso.DeleteFile(Tpath & ThemePath & f1.name & "/" & "error.log")

				Echo "<p class=""status-box"">"
				Echo "插件: <b>"& Item_Name_Local &"</b> <b class=""allright"">的不支持更新提示已清除!</b>"
				Echo "</p>"
				Response.Flush
				 echo"</td></tr> </table>"
				m=True

			End If
		End If

		Set xml=Nothing

	Next

	If m Then
		Echo "<script language=""JavaScript"" type=""text/javascript"">try{document.getElementById('found').style.display = 'block';}catch(e){};</script>"
	Else
		Echo "<script language=""JavaScript"" type=""text/javascript"">try{document.getElementById('notfound').style.display = 'block';}catch(e){};</script>"
	End If
	echo "<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""table""> <tr><td class=""bg_tr"">    <b class=red>查找更新</b></td></tr><tr><td   colspan=""2"" >"

 	Echo "<p><input onclick=""window.scrollTo(0,0);"" type=""button""  class=""btn btn_primary""   value=""返回页面顶部""  title=""返回页面顶部"" /> <input onclick=""self.location.href='fy.Theme.Check.asp?act=check&n=0';"" type=""button""  class=""btn btn_primary""  value=""查找更新"" title=""查找插件的可用更新"" />  <input onclick=""self.location.href='fy.Theme.Check.asp?act=clear';"" type=""button""  class=""btn btn_primary""  value=""清除更新提示"" title=""清除更新提示"" />"
 
	Call display("loading")
 	 echo"</td></tr> </table>"
End If


If Action="check" Then
	Echo "<span id=""loading"">正在载入页面, 请稍候... 如果长时间停止响应, 请 <a href=""javascript:window.location.reload();"" title=""点此重试"">[点此重试]</a><img  align=""absmiddle"" src=""../../Images/loading.gif"" /></span>"
	Response.Flush
 
	Echo "<div class=""top1""><span style="" margin-left:10px"" ><strong>提示：</strong> 查找更新的过程会消耗一些时间, 时间长短会因您安装的插件数量而异, 请耐心等候..</span></div>"
	Response.Flush
 	i=0
	n=Request.QueryString("n")
	n=Int(n)
	m=True

	For Each f1 in fc

	'	Set objXmlVerChk=New ThemeSapper_CheckVersionViaXML

		If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "Theme.xml") Then

 			Set XML=fycms.NoAppGetXMLFromFile(Tpath & ThemePath & f1.name & "\Theme.xml")
 			Response.Flush
 			If IsObject(XML) And XML.readyState=4  And  XML.parseError.errorCode =0 Then
				Item_ID_Local=GetNode("id")
				Item_Name_Local=GetNode("name")
				Item_Url_Local=GetNode("url")
				Item_Version_Local=GetNode("version")
				Item_PubDate_Local=GetNode("pubdate")
				Item_Modified_Local=GetNode("modified")
 			End If 

	
	
			echo "<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""table""> <tr><td class=""bg_tr"">检测    <b class=red>" & Item_Name_Local & "</b></td></tr><tr><td   colspan=""2"" >"

			If i>=n Then
				Echo "<p   id=""checking"">>>> 插件: " & Item_Name_Local & " 正在检查中...</p>"
				Response.Flush
			Else
				If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "verchk.xml") Then
					t="<b class=""notice""> 发现新版本!</b><a class=""notice"" href=""fy.Theme.Install.Asp?act=update&amp;url=" & Server.URLEncode(Update_URL & f1.name) & """ title=""升级插件""><b >升级插件!</b></a>"
				ElseIf fso.FileExists(Tpath & ThemePath & f1.name & "/" & "error.log") Then
					t="<span class=""red"">该插件不支持在线更新.</span>"
				Else
					t="<span class=""green"">未发现新版本.</span>"
				End If

				Echo ">>> 插件: " & Item_Name_Local & "  "& t & ""
				Response.Flush
			End If

			If i>=n Then
 				
 			Install_Data = getHTTPPage(Resource_URL & f1.name )
			Call fycms.CreateFolder(fycms.ActSys&fycms.SysPlusPath&"/"&f1.name &"/")
			Install_Data=Replace(Install_Data,"utf-8","gb2312")
			Install_Pack = Tpath&ThemePath&f1.name & "\verchk.xml"
			Call SaveToFile(Install_Pack,Install_Data)
			Set XML=fycms.NoAppGetXMLFromFile(Tpath&ThemePath &f1.name & "\verchk.xml")
 			Response.Flush
 			If IsObject(XML) And XML.readyState=4  And  XML.parseError.errorCode =0 Then
				Item_ID_Web=GetNode("id")
				Item_Name_Web=GetNode("name")
				Item_Url_Web=GetNode("url")
				Item_Version_Web=GetNode("version")
				Item_PubDate_Web=GetNode("pubdate")
				Item_Modified_Web=GetNode("modified")
				If Item_Version_Web="" Then Item_Version_Web="Undefine"
				If Item_PubDate_Web="" Then Item_PubDate_Web="Undefine"
				If Item_Modified_Web="" Then Item_Modified_Web="Undefine"
		
			End If 
  		'    DeleteFile(Tpath&ThemePath&Install_ID& "\Update.xml")
				
 				'XmlDataWeb=(s)
 			Set XML=fycms.NoAppGetXMLFromFile(Tpath & ThemePath & f1.name & "\Theme.xml")
 			Response.Flush
 			If IsObject(XML) And XML.readyState=4  And  XML.parseError.errorCode =0 Then
				Item_ID_Local=GetNode("id")
				Item_Name_Local=GetNode("name")
				Item_Url_Local=GetNode("url")
				Item_Version_Local=GetNode("version")
				Item_PubDate_Local=GetNode("pubdate")
				Item_Modified_Local=GetNode("modified")
				If Item_Version_Local="" Then Item_Version_Local="Undefine"
				If Item_PubDate_Local="" Then Item_PubDate_Local="Undefine"
				If Item_Modified_Local="" Then Item_Modified_Local="Undefine"
			End If 
			If (DateDiff("d",Item_PubDate_Web,Item_PubDate_Local)>0 Or DateDiff("d",Item_Modified_Web,Item_Modified_Local)>0) Then
				 Call DeleteFile(Tpath&ThemePath&f1.name& "\verchk.xml")
			ElseIf Item_Version_Web<>Item_Version_Local Or Item_PubDate_Local<>Item_PubDate_Web Or Item_Modified_Local<>Item_Modified_Web Then
				UpdateNeeded=True
			Else
				 Call DeleteFile(Tpath&ThemePath&f1.name& "\verchk.xml")
			End If
			If (Item_ID_Web<>Item_ID_Local) Then Call DeleteFile(Tpath&ThemePath&f1.name& "\verchk.xml")

			 

				If fso.FileExists(Tpath & ThemePath & f1.name & "/" & "verchk.xml") Then
					t="<b class=red>" & Item_Name_Local & "</b> <b class=""notice"">检查完毕,发现新版本!</b><a class=""notice"" href=""fy.Theme.Install.Asp?act=update&amp;url=" & Server.URLEncode(Update_URL & f1.name) & """ title=""升级插件""><b >发现该插件的新版本!</b></a>"
				ElseIf fso.FileExists(Tpath & Item_Name_Local & f1.name & "/" & "error.log") Then
					t="<b class=red>" & Item_Name_Local & "</b> <b class=""notice"">检查完毕,该插件不支持在线更新.</b>"
				Else
					t="<b class=red>" & Item_Name_Local & "</b> <b class=""notice"">检查完毕,未发现新版本.</b>"
				End If

				
				
				
				i=i+1

				Echo "<script language=""JavaScript"" type=""text/javascript"">try{document.getElementById('checking').style.display = 'none';}catch(e){};</script>"
				Echo "<p>" & t & "</p>"
				Echo "<script>setTimeout(""self.location.href='fy.Theme.Check.asp?act=check&n=" & i & "'"",3000);</script>"
				Response.Flush
 				m=False
 				Exit For

			End If

			i=i+1

		End If

	'	Set objXmlVerChk=Nothing
		echo"</td></tr> </table>"
	Next

	If m Then
		echo "<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""table""> <tr><td class=""bg_tr"">所有插件已检查完成</td></tr><tr><td   colspan=""2"" >"
 		Echo "<p><input onclick=""window.scrollTo(0,0);"" type=""button""  class=""btn btn_primary""   value=""返回页面顶部""  title=""返回页面顶部"" /> <input onclick=""self.location.href='fy.Theme.Check.asp';"" type=""button""  class=""btn btn_primary""  value=""查看需要更新的插件"" title=""查看更新结果"" />"
 		Echo "<script language=""JavaScript"" type=""text/javascript"">try{document.getElementById('loading').style.display = 'none';}catch(e){};</script>"
 End If

End If

Set fso = nothing
Err.Clear
%>
 
</td></tr> </table>
</body>
</html>
 