www.gusucode.com > 易心博客[圣诞版] 3.5手动安装码程序 > Admin_Plugin.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="Conn.asp"--> <!--#include file="Ex_Cls/Ex_SkinCls.asp"--> <!--#include file="Ex_Cls/Ex_RefreshCls.asp"--> <!--#include file="Ex_Cls/Ex_ZipCls.asp"--> <!--#include file="Ex_Cls/Ex_XmlCls.asp"--> <!--#include file="Ex_Cls/Ex_UploadCls.asp"--> <!--#include file="Ex_Cls/Ex_SplitPageCls.asp"--> <!--#include file="Ex_Cls/Ex_ImgCls.asp"--> <!--#include file="Ex_Cls/Ex_FilterHtmlCls.asp"--> <!--#include file="Plugin/Includes.asp"--> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head> <link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css"> <script src="inc/main.js"></script> <script src="inc/jquery.js"></script> <body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor"> <% Dim Action,ExComm,ExRefresh,ExXml,ExSkin Set ExComm=new Ex_CommonCls Set ExXml=new Ex_XmlCls Set ExRefresh=new Ex_Refreshcls Set ExSkin=new Ex_SkinCls ExComm.IsAdLogin ExComm.IsIpAllow Action=Request.QueryString("action") Select Case Action Case "install" Install Case "uninstall" UnInstall Case "open" Open Case "close" Close Case "plugininstallform" PluginInstallForm Case "plugininstall" PluginInstall Case Else ShowState End Select Function IsExistTable(TableName) On Error Resume Next Conn.Exeucte "Create table "&TableName&" (id counter)" If Err.Number<>0 Then IsExistTable=True Else IsExistTable=False End If End Function Function IsExistColumn(TableName,ColumnName) Dim I,Rs Set Rs=Conn.Exeucte("select * from "&TableName) For i = 0 to RS.Fields.Count - 1 If RS.Fields(i).Name=ColumnName then IsExistColumn=True Exit For Else IsExistColumn=False End If Next End Function Sub ShowState %> <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="border tablebg"> <tr> <th colspan="5" class="topbg">插件状态管理</th> </tr> <tr> <td width="21%" class="tdbg" style="text-align:center">插件名称</td> <td width="16%" class="tdbg" style="text-align:center">插件作者 </td> <td width="31%" class="tdbg" style="text-align:center">支持站点</td> <td width="10%" class="tdbg" style="text-align:center">插件状态</td> <td width="22%" class="tdbg" style="text-align:center">操作</td> </tr> <% Dim ExFso,Folders,XmlObj,Item,Includes,Stream Set ExFso=server.CreateObject("scripting.filesystemobject") Set Folders=ExFso.GetFolder(Server.Mappath("Plugin")) Set XmlObj=Server.CreateObject("Microsoft.XMLDOM") Includes="<!--插件引用-->"&vbcrlf Dim pluginname,Author,WebSite,State,Msg For each item in Folders.SubFolders With XmlObj .Load(Server.Mappath("plugin/"&Item.Name&"/info.xml")) pluginname=.selectSingleNode("//pluginname").text Author=.selectSingleNode("//author").text WebSite=.selectSingleNode("//website").text State=.selectSingleNode("//state").text Includes=Includes&"<!-- #include file="""&Item.Name&"/Functions.asp"" -->"&vbcrlf End With Response.Write("<tr>") Response.Write("<td class=""tdbg""> "&pluginname&"</td>") Response.Write("<td class=""tdbg""> "&Author&"</td>") Response.Write("<td class=""tdbg""> "&WebSite&"</td>") Response.Write("<td class=""tdbg""> "&State&"</td>") If Trim(State)<>"卸载" Then Msg="alert('必须先卸载再安装');return false;" Else Msg="" End If Response.Write("<td class=""tdbg""> <a href=""?action=open&plugin="&Item.Name&""">开启</a> <a href=""?action=close&plugin="&Item.Name&""">关闭</a> <a href=""?action=install&plugin="&Item.Name&""" onclick="""&Msg&""">安装</a> <a href=""?action=uninstall&plugin="&Item.Name&""" onclick=""if(!confirm('是否卸载?\n卸载后此插件生成的数据将被全部删除')) return false;"">卸载</a></td>") Response.Write("</tr>") Next Set Stream = ExFso.CreateTextFile(Server.Mappath("plugin/includes.asp"),True) Stream.Write Includes Stream.Close %> <tr> <td class="tdbg"> </td> <td class="tdbg"> </td> <td class="tdbg"> </td> <td class="tdbg"> </td> <td class="tdbg"> </td> </tr> <tr> <td colspan="5" class="tdbg"> </td> </tr> </table> <p> <% End Sub Sub Install Dim PluginName PluginName=Trim(Request.QueryString("plugin")) Eval("Install_"&PluginName) ExSkin.RefreshSkinCache ExXml.letFilePath="plugin/"&PluginName&"/info.xml" ExXml.modifyNodeValue "//state","开启" ExComm.ShowMsg "安装成功",Request.Servervariables("http_referer") End Sub Sub UnInstall Dim PluginName PluginName=Trim(Request.QueryString("plugin")) Eval("UnInstall_"&PluginName) ExSkin.RefreshSkinCache ExXml.letFilePath="plugin/"&PluginName&"/info.xml" ExXml.modifyNodeValue "//state","卸载" ExComm.ShowMsg "卸载成功",Request.Servervariables("http_referer") End Sub Sub Open Dim PluginName PluginName=Trim(Request.QueryString("plugin")) Eval("Open_"&PluginName) ExSkin.RefreshSkinCache ExXml.letFilePath="plugin/"&PluginName&"/info.xml" ExXml.modifyNodeValue "//state","开启" ExComm.ShowMsg "开启成功",Request.Servervariables("http_referer") End Sub Sub Close Dim PluginName PluginName=Trim(Request.QueryString("plugin")) Eval("Close_"&PluginName) ExSkin.RefreshSkinCache ExXml.letFilePath="plugin/"&PluginName&"/info.xml" ExXml.modifyNodeValue "//state","关闭" ExComm.ShowMsg "关闭成功",Request.Servervariables("http_referer") End Sub Sub PluginInstallForm %> </p> <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="border tablebg"> <tr> <th colspan="4" class="topbg">博客插件安装</th> </tr> <form action="?action=plugininstall&installtype=local" method="post" enctype="multipart/form-data" name="form1" id="form1"> <tr> <td width="14%" class="tdbg" style="text-align:center">本地导入插件:</td> <td class="tdbg" style="text-align:center"><label> <input type="file" name="pluginfile" id="pluginfile"> </label></td> <td class="tdbg" style="text-align:center"><label> <input type="submit" name="Submit" value="导入" onClick="if(document.getElementById('pluginfile').value==''){alert('请选择本地插件安装文件');return false;}"> </label></td> <td class="tdbg" style="text-align:center"><div align="left"> 提示:从本地上传插件文件后程序会自动安装,无需再进行在线插件安装</div></td> </tr> </form> <form action="?action=plugininstall&installtype=net" method="post" name="form1" id="form1"> <tr> <td class="tdbg"><div align="center"><span class="tdbg" style="text-align:center">在线安装插件</span>:</div></td> <td width="26%" class="tdbg"><label> <div align="center"> <select name="selectplugin" id="selectplugin"> <option value="">请选择插件安装文件</option> <% Dim ExFso,ExFiles,I Set ExFso=new Ex_FsoCls ExFiles=ExFso.GetSubFiles("temp/plugindata") ExFiles=Split(ExFiles,"|") For I=0 To UBound(ExFiles) Response.Write("<option value=""temp/plugindata/"&ExFiles(I)&""">"&ExFiles(I)&"</option>"&vbcrlf) Next %> </select> </div> </label></td> <td width="8%" class="tdbg"><label> <div align="center"> <input type="submit" name="Submit2" value="安装" onClick="if(document.getElementById('selectplugin').value==''){alert('请选择插件安装文件');return false;}"> </div> </label></td> <td class="tdbg"> 提示:从博客中查找插件安装文件。</td> </tr> </form> <tr> <td colspan="4" class="tdbg"> </td> </tr> </table> <% End Sub Sub PluginInstall Dim InstallType,FilePath,ExUpload,oFile,ExZip,ExFso InstallType=Request.QueryString("installtype") Set ExFso=new Ex_FsoCls If installtype="net" Then FilePath=Request.Form("selectplugin") Else Set ExUpload=new Ex_UploadCls ExUpload.AllowExt="exzip" ExUpload.GetData(1024*10) Select Case ExUpload.Err Case 1 ExComm.ShowMsg "请选择上传插件安装文件","" Case 2 ExComm.ShowMsg "您的上传数据超过了10M","" Case 3 ExComm.ShowMsg "插件安装文件格式不正确\n格式应该为ExZip","" End Select Set oFile = ExUpload.File("pluginfile") ExFso.CreateRoute "Temp/PluginData" FilePath="Temp/PluginData/"&oFile.FileName oFile.SaveToFile Server.Mappath(FilePath) End If Set ExZip=new Ex_ZipCls ExZip.UZip FilePath ExFso.CopyOneFile FilePath,"Plugin/"&Replace(LCase(oFile.FileName),".exzip","")&"/Data.ExZip" ExComm.ShowMsg "安装文件解压成功,请到状态管理中点“开启”连接以启用此插件。","admin_Plugin.asp" End Sub %> <p> </p> </body> </html>