<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_plugin.asp
'* 最后更新 2012-03-22 by 56770.kingdge
'*****************************************
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_plugin.inc"
CurrentId = 8
CurrentUrl = "admin_plugin.asp"
LB_Head()
LB_Menu()
action = request("action")
%>
<div class="tabmenu mainwidth">
      <ul>
        <li <%If action = "" Then Response.Write("class=""current""") End If%>><a href="admin_plugin.asp"><span><%=Lang_Menu(167)%></span></a></li>
        <li <%If InStr(action,"flag") > 0 Then Response.Write("class=""current""") End If%>><a href="?action=flagall"><span><%=Lang_Menu(129)%></span></a></li>
		<li <%If InStr(action,"ptype") > 0 Then Response.Write("class=""current""") End If%>><a href="?action=ptype"><span><%=Lang_Menu(123)%></span></a></li>
		<li <%If action="add" Or action="add_ok" Then Response.Write("class=""current""") End If%>><a href="?action=add"><span><%=Lang_Plugin(21)%></span></a></li>
		<li><a href="http://www.56770.com/plugin/" target="_blank"><span><%=Lang_Menu(168)%></span></a></li>
      </ul>
</div>
<%
Response.Write("<div class=""tab-mainbody"">")
Response.Write("<div class=""tab-mainbody2"">")
If OutSubmit = 1 Then CheckOutSubmit()
Select Case action
	   Case "add" : add()
	   Case "add_ok" : add_ok()
	   Case "edit_ok" : edit_ok()
	   Case "del" : del()
	   Case "edit" : edit()
	   Case "up_b" : up_b()
	   Case "down_b" : down_b()
	   Case "ptype" : ptype()
	   Case "ptype_add_ok" : ptype_add_ok()
	   Case "ptype_edit" : ptype_edit()
	   Case "ptype_edit_ok" : ptype_edit_ok()
	   Case "ptype_del" : ptype_del()
	   Case "admin" : admin()
	   Case "flag" : flag()
	   Case "flag_ok" : flag_ok()
	   Case "flagall" : flagall()
	   Case "flagall_ok" : flagall_ok()
	   Case "install" : install()
	   Case Else
			list()
End Select
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

Sub add_ok()
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		p_name = safereplace(Trim(request("p_name")))
		p_content = safereplace(Trim(request("p_content")))
		p_type = safereplace(Trim(request("p_type")))
		p_url = safereplace(Trim(request("p_url")))
		p_order = CheckNum(request("p_order"),0)
		p_show = safereplace(Trim(request("p_show")))
		p_flag = safereplace(Trim(request("p_flag")))
        p_file = Split(p_url,".asp")(0)
		path_file = server.MapPath(Eshop_url & Adminpath &"/plugin/"&p_file&".asp")
		set fso = server.createobject("scripting.FileSystemObject")
		If fso.FileExists(path_file) then
				set rs = server.CreateObject("adodb.recordset")
				rs.open "select * from [Lebi_plugin]", conn, 1, 3
				rs.addnew
				rs("p_name") = p_name
				rs("p_type") = p_type
				rs("p_content") = p_content
				rs("p_url") = p_url
				rs("p_order") = p_order
				rs("p_show") = p_show
				rs("p_flag") = p_flag
				rs("p_date") = date()
				rs.update
				rs.close:Set rs=Nothing
				ManageLog Lang_Plugin(1) &" ["& p_name &"]"
				Call Up_mes(Lang_sys(45),"·"& Lang_sys(44),0,"?",0,0,2,1)
		Else
				Call Up_mes(Lang_sys(46),"·"& Lang_Plugin(2),0,"javascript:history.back();",0,0,5,0)
		End If
End Sub

Sub ptype_add_ok()
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",11.2,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		p_type=Safereplace(trim(request("p_type")))
		p_order = CheckNum(request("p_order"),0)
		p_no = CheckNum(request("p_no"),0)
		Set rs = conn.execute("select * from [Lebi_plugintype] where p_type='"&p_type&"'")
		If Not (rs.eof or rs.bof) Then
				response.write"<SCRIPT language=JavaScript>alert('"& Lang_Plugin(3) &"');javascript:history.go(-1)</SCRIPT>"
				response.End
		End If
		rs.close
		Set rs = conn.execute("select * from [Lebi_plugintype] where p_no="&p_no&"")
		If Not (rs.eof or rs.bof) Then
				response.write"<SCRIPT language=JavaScript>alert('"& Lang_Plugin(4) &"');javascript:history.go(-1)</SCRIPT>"
				response.End
		End If
		rs.close
		sql="select * from [Lebi_plugintype] where p_type='"&p_type&"'"
		set rs=server.createobject("ADODB.Recordset")
		rs.open sql, conn, 1, 3
		rs.addnew
		rs("p_type") = p_type
		rs("p_order") = p_order
		rs("p_no") = p_no
		rs("p_state") = 1
		rs.update
		rs.close:set rs=Nothing
		ManageLog Lang_Plugin(5) &" ["& p_type &"]"
		Call Up_mes(Lang_sys(45),"·"& Lang_sys(44),0,"?action=ptype",0,0,2,1)
End Sub

Sub ptype_edit_ok()
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",11.2,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		p_id = CheckNum(request("p_id"),0)
		p_type = Safereplace(trim(request("p_type")))
		p_order = CheckNum(request("p_order"),0)
		p_no = CheckNum(request("p_no"),0)
		p_state = CheckNum(request("p_state"),0)
		sql="select * from [Lebi_plugintype] where p_type='"& p_type &"' and p_id <> "& p_id &""
		set rs=conn.execute(sql)
		If Not (rs.eof Or rs.bof) Then
			   response.write"<SCRIPT language=JavaScript>alert('"& Lang_Plugin(3) &"');javascript:history.go(-1)</SCRIPT>"
			   response.End
		End If
		rs.close : set rs=Nothing
		sql="select * from [Lebi_plugintype] where p_no="& p_no &" and p_id <> "& p_id &""
		set rs=conn.execute(sql)
		If Not (rs.eof Or rs.bof) Then
			   response.write"<SCRIPT language=JavaScript>alert('"& Lang_Plugin(4) &"');javascript:history.go(-1)</SCRIPT>"
			   response.End
		End If
		rs.close : set rs=nothing
		conn.execute "update [Lebi_plugintype] set p_type='"& p_type &"',p_no="& p_no &",p_order="& p_order &",p_state="& p_state &" where p_id="& p_id &""
		conn.execute "update [Lebi_plugin] set p_state = "& p_state &" where p_type = "& p_no &""
		ManageLog Lang_Plugin(6) &" ["& p_type &"]"
		Call Up_mes(Lang_sys(48),"·"& Lang_sys(47),0,"?action=ptype",0,0,2,1)
End sub

Sub up_b()
        If OnlyRead = 1 Then OnlyReadMessage()
	    p_id = CheckNum(request("p_id"),0)
        conn.execute "update [Lebi_plugintype] set p_order=p_order+1 where p_id = "& p_id &""
		ManageLog Lang_Plugin(7)
        response.redirect "?action=ptype"
        response.end()
End Sub

Sub down_b()
        If OnlyRead = 1 Then OnlyReadMessage()
	    p_id = CheckNum(request("p_id"),0)
        conn.execute "update [Lebi_plugintype] set p_order=p_order-1 where p_id = "& p_id &""
		ManageLog Lang_Plugin(8)
        response.redirect "?action=ptype"
        response.end()
End Sub

Sub ptype_del()
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",11.2,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		p_id = CheckNum(request("p_id"),0)
		conn.execute "update [Lebi_plugintype] set p_state = 0 where p_id = "& p_id &""
		conn.execute "update [Lebi_plugin] set p_state = 0 where p_type = "& p_id &""
		ManageLog Lang_Plugin(9)
		Call Up_mes(Lang_Menu(167),"·"& Lang_Plugin(10),0,"?action=ptype",0,0,2,1)
End sub

Sub del()
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		id = CheckNum(request("id"),0)
		set rs = server.CreateObject("adodb.recordset")
		rs.open "select * from [Lebi_plugin] where p_id = "& id &"", conn, 1, 3
		If request("p_type") = "999" Then
				rs.delete
		Else
				rs("p_state") = 0
				rs("p_show") = 0
				rs.update
		End If
		p_name = rs("p_name")
		rs.close:Set rs=Nothing
		ManageLog Lang_Plugin(11) &" ["& p_name &"]"
		m_u="?p_type="&request("p_type")&"&keywords="&server.urlencode(request("keywords"))
		Call Up_mes(Lang_Menu(167),"·"& Lang_Plugin(12),0,m_u,0,0,2,1)
End Sub

Sub install()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		id = CheckNum(request("id"),0)
		set rs = server.CreateObject("adodb.recordset")
		rs.open "select p_state,p_show,p_url,p_name,p_type from [Lebi_plugin] where p_id = "& id &"", conn, 1, 3
		If rs(0) = 1 Then
				If InStr(rs(2),"?") > 0 Then
						response.redirect "plugin/"& rs(2) &"&p_no="& rs(4)
				Else
						response.redirect "plugin/"& rs(2) &"?p_no="& rs(4)
				End If
				response.End
		End If
        p_file = Split(rs(2),".asp")(0)
		path_file = server.MapPath(Eshop_url & Adminpath &"/plugin/"&p_file&".asp")
		set fso = server.createobject("scripting.FileSystemObject")
		If fso.FileExists(path_file) then
				rs("p_state") = 1
				rs("p_show") = 1
				p_name = rs("p_name")
				rs.update
				rs.close:Set rs=Nothing
				ManageLog Lang_Plugin(13) &" ["& p_name &"]"
				m_u="?p_type="&request("p_type")&"&keywords="&server.urlencode(request("keywords"))
				Call Up_mes(Lang_Menu(167),"·"& Lang_Plugin(14),0,m_u,0,0,2,1)
		Else
				rs.close:Set rs=Nothing
				ManageLog Lang_Plugin(13) &" ["& p_name &"]"
				m_u="?p_type="&request("p_type")&"&keywords="&server.urlencode(request("keywords"))
				Call Up_mes(Lang_Menu(167),"·"& Lang_Plugin(15),0,m_u,0,0,5,0)
		End If
End Sub

Sub edit_ok()
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
	    id = CheckNum(request("id"),0)
		p_name = safereplace(Trim(request("p_name")))
		p_content = safereplace(Trim(request("p_content")))
		p_typeid = CheckNum(request("p_typeid"),0)
		p_url = safereplace(Trim(request("p_url")))
		p_flag = safereplace(Trim(request("p_flag")))
		p_order = CheckNum(request("p_order"),0)
		p_show = CheckNum(request("p_show"),0)
		set rs = server.CreateObject("adodb.recordset")
		rs.open "select * from [Lebi_plugin] where p_id = "& id &"", conn, 1, 3
		rs("p_name") = p_name
		rs("p_type") = p_typeid
		rs("p_content") = p_content
		rs("p_url") = p_url
		rs("p_order") = p_order
		rs("p_show") = p_show
		rs("p_flag") = p_flag
		rs.update
		rs.close:Set rs=Nothing
		ManageLog Lang_Plugin(16) &" ["& p_name &"]"
		m_u="?p_type="&request("p_type")&"&keywords="&server.urlencode(request("keywords"))
		Call Up_mes(Lang_sys(48),"·"& Lang_sys(47),0,m_u,0,0,2,1)
End Sub

Sub flag_ok()
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
	    id = CheckNum(request("id"),0)
		Set admin = conn.execute("select id,pflag from [lebi_adminuser]")
		Do While Not admin.eof
				Sflag = safereplace(request("flag_"&admin(0)&""))
				If Not IsNumeric(Sflag) Or IsEmpty(Sflag) Then Sflag = 0
				If Sflag <> 0 Then
						pflag = admin(1) &","& Sflag
						conn.execute("update [lebi_adminuser] set pflag = '"& pflag &"' where id = "& admin(0) &"")
				End If
		admin.movenext
		Loop
		admin.close : Set admin = Nothing
		m_u="?p_type="&request("p_type")&"&keywords="&server.urlencode(request("keywords"))
		Call Up_mes(Lang_sys(69),"·"& Lang_sys(68),0,m_u,0,0,2,1)
End Sub

Sub flagall_ok()
        If OnlyRead = 1 Then OnlyReadMessage()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
	    id = CheckNum(request("id"),0)
		conn.execute("update [lebi_adminuser] set pflag = '"& replace(safereplace(Request("flag"))," ","") &"' where id = "& id &"")
		Call Up_mes(Lang_sys(69),"·"& Lang_sys(68),0,"?action=flagall",0,0,2,1)
End Sub

Sub add()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
%>
		<script language="JavaScript" type="text/JavaScript">
		function CheckForm(theform)
		{
			if (!isEmpty(theform.p_name,'<%=Lang_Plugin(17)%>')) return false;
			if (!isEmpty(theform.p_order,'<%=Lang_Plugin(18)%>')) return false;
			if (!isEmpty(theform.p_flag,'<%=Lang_Plugin(19)%>')) return false;
			if (!isEmpty(theform.p_url,'<%=Lang_Plugin(20)%>')) return false;
		}
		</script>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" id="add" class="classtable">
           <form method="post" action="?action=add_ok" name="add" onSubmit="return CheckForm(this);">
           <tr>
				<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
				<td align="right" class="classhead">
				<%=QuickMenu("","")%>
				</td>
           </tr>
           <tr>
              <td height="30" colspan="2" class="classtop"><%=Lang_Plugin(21)%></td>
           </tr>
           <tr class="classrow">
			   <td width="15%" height="30" class="classrow"><%=Lang_Plugin(22)%></td>
			   <td width="85%" class="classrow"><input type="text" name="p_name" value="" size="50" class="form">
			</td>
		   </tr>
           <tr class="classrow">
              <td height="30" class="classrow"><%=Lang_Plugin(23)%></td>
              <td class="classrow"><%
                  set rs=server.createobject("ADODB.Recordset")
                  sql = "select * from [Lebi_plugintype]"
                  rs.open sql,conn,1,1
		          if Not rs.eof then
			%>
			 <select name="p_type">
			  <%
			  do while not rs.eof
		  %>
			  <option value="<%=trim(rs("p_no"))%>">├ <%=trim(rs("p_type"))%></option>
			  <%
			   rs.movenext
					   loop
			   end if
					   rs.close
		  %>
			</select>
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(24)%></td>
			   <td class="classrow"><textarea name="p_content" cols="40" rows="3" class="text"></textarea>
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(25)%></td>
			   <td class="classrow"><input type="text" name="p_order" value="0" size="5" class="form">
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(26)%></td>
			   <td class="classrow"><input type="text" name="p_flag" value="1" size="5" class="form"> <img src="images/help.gif" align="absmiddle" title="<%=Lang_Plugin(29)%>">
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(27)%></td>
			   <td class="classrow"><select name="p_show"><option value="0"><%=Lang_Plugin(30)%></option><option value="1"><%=Lang_Plugin(31)%></option></select>
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(28)%></td>
			   <td class="classrow"><input type="text" name="p_url" value="" size="50" class="form">
			</td>
		   </tr>
        <tr>
           <td class="classfooter" colspan="2" align="left" height="30">
             <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
           </td>
        </tr>
        </form>
      </table>
	  <script>tdshow("add");</script>
<%
End Sub

Sub ptype()
		admin_flag=",11.2,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
%>
		<script language="JavaScript" type="text/JavaScript">
		function Checksort(theform)
		{
			if (!isEmpty(theform.p_type,'<%=Lang_Plugin(32)%>')) return false;
		}

		function ConfirmDel()
		{
			if(confirm("<%=Lang_Plugin(33)%>"))
				return true;
			else
				return false;
		}
		</script>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="class" class="classtable">
		<form method="post" action="?action=ptype_add_ok" name="addNEWS" onSubmit="return Checksort(this);">
		<tr>
		<td height="30" align="left" class="classhead" colspan="3"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
		<td colspan="2" align="right" class="classhead">
		<%=QuickMenu("admin_plugin.asp?action=flagall|"& Lang_Menu(129) &"","")%>
		</td>
		</tr>
		<tr>
		<td height="30" colspan="5" class="classtop"><%=Lang_Plugin(34)%></td>
		</tr>
		<tr class="classrow">
		<td width="30%" height="30" class="classrow" colspan="2"><%=Lang_Plugin(35)%><input name="p_type" type="text" size="20" maxlength="30" class="form">
		<%=Lang_Plugin(36)%><input name="p_no" type="text" size="5" value="0" maxlength="5" class="form">
		<%=Lang_Plugin(25)%><input name="p_order" type="text" size="5" value="0" maxlength="5" class="form">
		</td>
		<td align="right" class="classrow" colspan="3"></td>
		</tr>
		</form>
		<tr>
		<td width="10%" height="30" class="classtop"><%=Lang_Plugin(37)%></td>
		<td width="60%" class="classtop"><%=Lang_Plugin(38)%></td>
		<td width="10%" class="classtop"><%=Lang_Plugin(39)%></td>
		<td width="10%" class="classtop"><%=Lang_Plugin(40)%></td>
		<td width="10%" class="classtop"><%=Lang_Plugin(41)%></td>
		</tr>
		<%
		Set rs = conn.execute("Select * From [Lebi_plugintype] order by p_order desc")
		Do While Not rs.eof
		%>
						 <tr class="classrow">
							<td height="30" class="classrow"><b><%=rs("p_no")%></b></td>
							<td height="30" class="classrow"><%Set p_type = conn.execute("select p_type from [Lebi_plugintype] where p_id = "& rs("p_id") &"")
							If Not p_type.eof Then
							response.write p_type(0)
							End If
							p_type.close : Set p_type = Nothing
							%></td>
							<td class="classrow"><%=rs("p_order")%></td>
							<td class="classrow"><input type="image" name="up" title="↑" onClick="location.href='?action=up_b&p_id=<%=rs("p_id")%>';return false;" src="images/icon_up.gif" align="absmiddle">&nbsp;<input type="image" name="down" title="↓" onClick="location.href='?action=down_b&p_id=<%=rs("p_id")%>';return false;" src="images/icon_down.gif" align="absmiddle"></td>
							<td class="classrow"><a href="?p_id=<%=rs("p_id")%>&action=ptype_edit"><img src="images/icon_edit.gif" width="16" height="16" title=" <%=Lang_sys(51)%> " border="0"></a>&nbsp;&nbsp;<%If rs("p_state") = 1 Then%><a onClick="return ConfirmDel();" href="?p_id=<%=rs("p_id")%>&action=ptype_del"><img src="images/icon_del.gif" width="16" height="16" title=" <%=Lang_sys(15)%> " border="0"></a><%End If%></td>
						 </tr>
		<%
		rs.movenext
		loop
		rs.close : set rs=nothing
		%>
		</table>
		<script>tdshow("class");</script>
<%
End Sub

Sub ptype_edit()
		admin_flag=",11.2,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		p_id = CheckNum(request("p_id"),0)
		set rs= conn.execute("Select * From [Lebi_plugintype] where p_id="&p_id&"")
		p_type = rs("p_type")
		p_order = rs("p_order")
		p_no = rs("p_no")
		p_state = rs("p_state")
		rs.close
		set rs=nothing
%>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" id="edit" class="classtable">
          <form name="form1" method="post" action="?action=ptype_edit_ok">
            <tr>
              <td class="classhead" height="30" align="left">
                <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
			</td>
			<td align="right" class="classhead">
			<%=QuickMenu("","")%>
			</td>
           </tr>
            <tr>
              <td class="classtop" colspan="2" height="30" align="left"><%=Lang_Plugin(42)%></td>
           </tr>
                 <tr class="classrow">
                    <td width="15%" height="30" class="classrow"><%=Lang_Plugin(35)%></td>
                    <td width="85%" class="classrow"><input type="text" name="p_type" size="20" class="form" value="<%=p_type%>"></td>
                 </tr>
                 <tr class="classrow">
                    <td height="30" class="classrow"><%=Lang_Plugin(36)%></td>
                    <td class="classrow"><input type="text" name="p_no" size="5" value="<%=p_no%>" class="form"> <img src="images/help.gif" title="<%=Lang_Plugin(43)%>"></td>
                 </tr>
                 <tr class="classrow">
                    <td height="30" class="classrow"><%=Lang_Plugin(25)%></td>
                    <td class="classrow"><input type="text" name="p_order" size="5" value="<%=p_order%>" class="form"></td>
                 </tr>
                 <tr class="classrow">
                    <td height="30" class="classrow"><%=Lang_Plugin(44)%></td>
                    <td class="classrow"><select name="p_state"><option value="1"><%=Lang_Plugin(45)%></option><option value="0"<%=judge2(0,p_state)%>><%=Lang_Plugin(46)%></option></select></td>
                 </tr>
                <tr>
                    <td colspan="2" align="left" height="30" class="classfooter">
                    <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
					<input type="hidden" name="p_id" value="<%= p_id %>">
                    </td>
                </tr>
           </form>
        </table>
		<script>tdshow("edit");</script>
<%
End Sub

Sub list()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		keywords = safereplace(Trim(request("keywords")))
		p_type = CheckNum(request("p_type"),0)
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="list" class="classtable">
<tr>
<form name="form" method="post" action="Admin_plugin.asp">
<td height="30" align="left" colspan="4" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<select name="p_type">
<option value="0">┌ <%=Lang_Plugin(47)%></option>
<%
	 set rs=conn.execute("Select p_type,p_id From [Lebi_plugintype] order by p_order desc")
	 do while not rs.eof
	 response.write"<option value="""&rs(1)&""""
	 If CLng(p_type) = CLng(rs(1)) Then response.write" selected"
	 response.write">├ "&rs(0)&"</option>"
	 set rscsort=nothing
	 rs.movenext
		loop
	 rs.close : set rs=nothing
%>
</select>
</td>
<td style="padding-left:5px;"><input name="keywords" type="text" value="<%= keywords %>" class="form_query" size="15"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query">
</td>
</tr>
</table>
</td>
</form>
<td align="right" class="classhead">
<%=QuickMenu("","admin_plugin.asp?action=flagall|"& Lang_Menu(129) &"")%>
</td>
</tr>
<%
If p_type <> "999" Then
		sql = "Select p_type,p_id,p_no From [Lebi_plugintype] where 1=1"
		If p_type <> "0" Then sql = sql&" and p_id = "& p_type &""
		sql = sql&" order by p_order desc"
		set rs=conn.execute(sql)
	    do while not rs.eof
%>
              <tr>
               <td height="30" colspan="5" class="classtop"><%=rs(0)%></td>
              </tr>
<%
				i= 1
				sql="select * from [Lebi_plugin] where p_type = "& rs(2) &""
				If keywords <> "" Then sql = sql &" and p_name like '%"& keywords &"%'"
				sql = sql&" order by p_order desc "
				Set plugin = Server.CreateObject("ADODB.Recordset")
				plugin.open sql, conn, 1, 1
				If plugin.eof Then
						response.Write("<tr><td align=center colspan=5 height=20 class='classrow'></td></tr>")
				Else
						do while not plugin.eof
%>
						<tr class="classrow">
						  <td height="30" width="5%" class="classrow"><img src="images/<%=i%>.gif" width="16" height="16" border="0"></td>
						  <td height="30" width="15%" class="classrow"><%=plugin("p_name")%>(<%=plugin("p_flag")%>)</td>
						  <td height="30" width="55%" class="classrow"><%=plugin("p_content")%></td>
						  <td height="30" width="5%" class="classrow"><%If plugin("p_show") = 1 Then
						  response.write("<img src=""images/icon_yes.gif"" width=""16"" height=""16"" border=""0"" title="""& Lang_Plugin(48) &""">")
						  Else
						  response.write("&nbsp;")
						  End If
						  %></td>
						  <td height="30" width="15%" class="classrow"><%If plugin("p_state") = 0 Then%>
						  <a href="?action=install&id=<%=plugin("p_id")%>&keywords=<%=keywords%>&p_type=<%=p_type%>"><img src="images/icon_install.gif" width="16" height="16" border="0" title="<%=Lang_Plugin(49)%>"></a><%Else%><a href="?action=flag&id=<%=plugin("p_id")%>&keywords=<%=keywords%>&p_type=<%=p_type%>"><img src="images/icon_config.gif" width="16" height="16" border="0" title="<%=Lang_Plugin(54)%>"></a>&nbsp;<a href="?action=edit&id=<%=plugin("p_id")%>&keywords=<%=keywords%>&p_type=<%=p_type%>"><img src="images/icon_edit.gif" width="16" height="16" border="0" title="<%=Lang_sys(51)%>"></a>&nbsp;<a href="?action=del&id=<%=plugin("p_id")%>&keywords=<%=keywords%>&p_type=<%=p_type%>"><img src="images/icon_del.gif" width="16" height="16" border="0" title="<%=Lang_Plugin(50)%>"></a>&nbsp;<a href="plugin/<%=plugin("p_url")%>"><img src="images/icon_manage.gif" width="16" height="16" border="0" title="<%=Lang_Plugin(51)%>"></a><%End If%></td>
					    </tr>
<%
						plugin.movenext
						i = i + 1
						Loop
				 End If
				 plugin.close : Set plugin = Nothing
		rs.movenext
		Loop
		rs.close : Set rs = Nothing
Else
		i= 1
		sql="select * from [Lebi_plugin] where 1=1"
		If keywords <> "" Then sql = sql &" and p_name like '%"& keywords &"%'"
		sql = sql&" order by p_order desc "
		Set plugin = Server.CreateObject("ADODB.Recordset")
		plugin.open sql, conn, 1, 1
		If plugin.eof Then
				response.Write("<tr><td align=center colspan=5 height=20 class='classrow'></td></tr>")
		Else
				do while not plugin.eof
%>
				<tr class="classrow">
				  <td height="30" width="5%" class="classrow"><%=i%></td>
				  <td height="30" width="15%" class="classrow"><%=plugin("p_name")%>(<%=plugin("p_flag")%>)</td>
				  <td height="30" width="55%" class="classrow"><%=plugin("p_content")%></td>
				  <td height="30" width="5%" class="classrow"><%If plugin("p_show") = 1 Then
				  response.write("<img src=""images/icon_yes.gif"" width=""16"" height=""16"" border=""0"" title="""& Lang_Plugin(48) &""">")
				  Else
				  response.write("&nbsp;")
				  End If
				  %></td>
				  <td height="30" width="15%" class="classrow"><%If plugin("p_state") = 0 Then%><a href="?action=install&id=<%=plugin("p_id")%>&keywords=<%=keywords%>&p_type=<%=p_type%>"><img src="images/icon_install.gif" width="16" height="16" border="0" title="<%=Lang_Plugin(49)%>" align="absmiddle"></a>
				  <%Else%><a href="?action=flag&id=<%=plugin("p_id")%>&keywords=<%=keywords%>&p_type=<%=p_type%>"><img src="images/icon_config.gif" width="16" height="16" border="0" title="<%=Lang_Plugin(54)%>" align="absmiddle"></a><a href="?action=edit&id=<%=plugin("p_id")%>&keywords=<%=keywords%>&p_type=<%=p_type%>"><img src="images/icon_edit.gif" width="16" height="16" border="0" title="<%=Lang_sys(51)%>" align="absmiddle"></a><a href="?action=del&id=<%=plugin("p_id")%>&keywords=<%=keywords%>&p_type=<%=p_type%>"><img src="images/icon_del.gif" width="16" height="16" border="0" title="<%=Lang_Plugin(49)%>" align="absmiddle"></a><a href="plugin/<%=plugin("p_url")%>"><img src="images/icon_manage.gif" width="16" height="16" border="0" title="<%=Lang_Plugin(51)%>"></a><%End If%></td>
				</tr>

<%
				plugin.movenext
				i = i + 1
				Loop
		 End If
		 plugin.close : Set plugin = Nothing
End If
%>
<!--
<tr>
  <td class="classfaq" colspan="5">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>

  </div>
  </td>
</tr>
-->
</table>
<script>tdshow("list");</script>
<%
End Sub

Sub edit()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		id = CheckNum(request("id"),0)
		set rso=conn.execute("select * from [Lebi_plugin] where p_id=" & id )
%>
		<script language="JavaScript" type="text/JavaScript">
		function CheckForm(theform)
		{
			if (!isEmpty(theform.p_name,'<%=Lang_Plugin(17)%>')) return false;
			if (!isEmpty(theform.p_order,'<%=Lang_Plugin(18)%>')) return false;
			if (!isEmpty(theform.p_flag,'<%=Lang_Plugin(19)%>')) return false;
			if (!isEmpty(theform.p_url,'<%=Lang_Plugin(20)%>')) return false;
		}
		</script>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" id="edit" class="classtable">
           <form method="post" action="?action=edit_ok" name="modi" onSubmit="return CheckForm(this);">
           <tr>
				<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
				<td align="right" class="classhead">
				<%=QuickMenu("","")%>
				</td>
           </tr>
           <tr>
              <td class="classtop" height="30" colspan="2"><%=Lang_Plugin(52)%></td>
           </tr>
           <tr class="classrow">
			   <td width="15%" height="30" class="classrow"><%=Lang_Plugin(22)%></td>
			   <td width="85%" class="classrow"><input type="text" name="p_name" value="<%=rso("p_name")%>" size="50" class="form">
			</td>
		   </tr>
           <tr class="classrow">
              <td height="30" class="classrow"><%=Lang_Plugin(23)%></td>
              <td class="classrow"><%
                  set rs=server.createobject("ADODB.Recordset")
                  sql = "select * from [Lebi_plugintype]"
                  rs.open sql,conn,1,1
		          if Not rs.eof then
			%>
			 <select name="p_typeid">
			  <%
			  do while not rs.eof
		  %>
			  <option value="<%=trim(rs("p_no"))%>"<%=judge2(rs("p_no"),rso("p_type"))%>>├ <%=trim(rs("p_type"))%></option>
			  <%
			   rs.movenext
					   loop
			   end if
					   rs.close
		  %>
			</select>
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(24)%></td>
			   <td class="classrow"><textarea name="p_content" cols="40" rows="3" class="text"><%=rso("p_content")%></textarea>
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(25)%></td>
			   <td class="classrow"><input type="text" name="p_order" value="<%=rso("p_order")%>" size="5" class="form">
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(26)%></td>
			   <td class="classrow"><input type="text" name="p_flag" value="<%=rso("p_flag")%>" size="5" class="form">
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(27)%></td>
			   <td class="classrow"><select name="p_show"><option value="0"><%=Lang_Plugin(30)%></option><option value="1"<%=judge2(1,rso("p_show"))%>><%=Lang_Plugin(31)%></option></select>
			</td>
		   </tr>
           <tr class="classrow">
			   <td height="30" class="classrow"><%=Lang_Plugin(28)%></td>
			   <td class="classrow"><input type="text" name="p_url" value="<%=rso("p_url")%>" size="50" class="form">
			</td>
		   </tr>
		   <tr>
                  <td class="classfooter" height="30" colspan="2" align="left">
                     <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
                     <input type="hidden" name="id" value="<%=id%>">
					 <input type="hidden" name="keywords" value="<%= request("keywords") %>">
					 <input type="hidden" name="p_type" value="<%= request("p_type") %>">
                  </td>
               </tr>
            </form>
         </table>
		 <script>tdshow("edit");</script>
<%
        rso.close : set rso=nothing
End Sub

Sub flag()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		id = CheckNum(request("id"),0)
		set rso=conn.execute("select p_flag,p_type from [Lebi_plugin] where p_id=" & id )
%>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
           <form method="post" action="?action=flag_ok" name="add">
           <tr>
				<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
				<td align="right" class="classhead">
				<%=QuickMenu("","")%>
				</td>
           </tr>
           <tr>
              <td class="classtop" height="30" colspan="2"><%=Lang_Menu(129)%></td>
           </tr>
		   <%
		   Set plugintype = conn.execute("select p_no from [Lebi_PluginType] where p_id = "& rso("p_type") &"")
		   If Not plugintype.eof Then
				p_no = plugintype(0)
		   End If
		   plugintype.close : Set plugintype = Nothing
		   Set admin = conn.execute("select id,admin_name,pflag from [lebi_adminuser]")
		   Do While Not admin.eof
		   %>
           <tr class="classrow">
			   <td class="classrow" width="15%" height="30"><%=admin(1)%>：</td>
			   <td class="classrow"><input type="checkbox" name="flag_<%=admin(0)%>" value="<%=p_no%>.<%=rso(0)%>"<%=judge(admin(2),p_no&"."&rso(0))%>>
			</td>
		   </tr>
		   <%
		   admin.movenext
		   Loop
		   admin.close : Set admin = Nothing
		   %>
        <tr>
           <td class="classfooter" colspan="2" align="left" height="30">
             <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
			 <input type="hidden" name="id" value="<%=id%>">
			 <input type="hidden" name="keywords" value="<%= request("keywords") %>">
			 <input type="hidden" name="p_type" value="<%= request("p_type") %>">
           </td>
        </tr>
        </form>
		<tr>
		  <td class="classfaq" colspan="2">
		  <div class="faq_main">
		  <p class="faq_title"><%=Lang_sys(49)%></p>
		  <%=Lang_Plugin(53)%>
		  </div>
		  </td>
		</tr>
      </table>
<%
End Sub

sub flagall()
		admin_flag=",11.1,"
		If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
				adminflag()
		End If
		id = CheckNum(request("id"),0)
		set	rs=Conn.Execute("select pflag from [Lebi_adminuser] where id = "& id &"")
		If Not rs.eof Then
				pflag = rs(0)
		End If
		rs.close : Set rs = Nothing
%>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
		<tr>
		<td height="30" class="classhead">
		<select name="anclassid" onChange="var jmpURL=this.options[this.selectedIndex].value ;if(jmpURL!='') {window.location=jmpURL; }else{ this.selectedIndex=0; }">
		<option selected>┌ <%=Lang_Plugin(55)%></option>
		<%
			set	rs=Conn.Execute("select id,admin_name from [Lebi_adminuser] order by LastLogin desc")
			do while not rs.eof
		%>
		<option value="?action=flagall&id=<%=rs(0)%>" <%=judge2(rs(0),id)%>>├ <%=rs(1)%></option>
		<%
			rs.movenext
			loop
			rs.close
			set rs=nothing
		%>
		</select>
		</td>
		<td align="right" class="classhead">
		<%=QuickMenu("admin_plugin.asp|"& Lang_Menu(167) &"","admin_plugin.asp?action=ptype|"& Lang_Menu(123) &"")%>
		</td>
		</tr>
		<tr>
		  <td height="30" colspan="2" class="classtop"><%=Lang_Plugin(54)%></td>
		</tr>
		<form name="form2" method="post" action="?action=flagall_ok">
		<%
		dim	menu(50,50),trs,k
		Set rs = conn.execute("select p_id,p_no,p_type from [Lebi_PluginType] order by p_order desc")
		i = 0
		Do While Not rs.eof
		menu(i,0)=""& rs(2) &""
		Set rss = conn.execute("select p_flag,p_name from [Lebi_Plugin] where p_type = "& rs(1) &" order by p_order desc")
		ii = 1
		Do While Not rss.eof
		menu(i,ii)=""& rss(1) &"@@"& rs(1) &"."& rss(0) &""
		rss.movenext
		ii = ii + 1
		Loop
		rss.close : Set rss = Nothing
		rs.movenext
		i = i + 1
		Loop
		rs.close : Set rs = Nothing
		%>
		<%
		Dim n
		n = 0
		for i=0 to ubound(menu,1)
		if isempty(menu(i,1)) then exit	For
		Response.Write "<tr	class=""classrow""><td class=""classrow"" colspan=""2""><b>"&menu(i,0)&"</b><br>"
		on error resume	next
		for	j=1	to ubound(menu,2)
		if isempty(menu(i,j)) then exit	For
		tmpmenu=split(menu(i,j),"@@")
		menuname=tmpmenu(0)
		menurl=tmpmenu(1)
		%>
		<input type="checkbox" name="flag"	value="<%=menurl%>"	<% if instr(","&pflag&",",","&menurl&",")>0 then response.write "checked" %>><!--<%=menurl%>.--><%=menuname%>&nbsp;&nbsp;
		<%
		next%></td></tr>
		<%next%>
		<tr>
		<td height="30" colspan="2" align="left" class="classfooter">
		<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" border="0" title=" <%=Lang_sys(4)%> " onclick="location.href='javascript:selectall();';return false;" src="lang/<%=LangFilePath%>/images/bt_select.gif" align="absmiddle">
		<input type="hidden" name="id" value="<%=request("id")%>">
		</td>
		</tr>
		</form>
		 </table>
<%
end sub
%>