<!--#include file="Conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_upfile.asp
'* 最后更新 2013-01-08 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",10.5,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_upfile.inc"
include "lang/"& LangFilePath &"/lang_data.inc"
CurrentId = 0
CurrentUrl = "admin_upfile.asp"
LB_Head()
LB_Menu()
Response.Write("<div class=""mainbody"">")
Response.Write("<div class=""mainbody2"">")
if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 then
        adminflag()
Else
		If OutSubmit = 1 Then CheckOutSubmit()
        Select Case request("action")
		       Case "del" : del()
			   Case Else
			        main()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

Sub GetFolder(folder,path,fleft)
		Set fso=server.createobject("scripting.filesystemobject")
		Set objfolder=fso.getfolder(folder)
		Set objsubfolders=objfolder.subfolders
		for each objsubfolder in objsubfolders
				nowpath = folder &"\"& objsubfolder.name
				If InStr("brand,gg,sort_pic,score,packing,other,links,news,gg_s1,grade,huangou,logo,pay,userfiles,uploadfile,upload,uppic",LCase(objsubfolder.name)) = 0 Then
						response.write"<option value='?SaveUpFilesPath="& path &"/"& objsubfolder.name &"' "& judge2(request("SaveUpFilesPath"),path &"/"& objsubfolder.name)&">"& fLeft & objsubfolder.name &"</option>"
				End If
				'Call GetFolder(nowpath)
		next
		Set fso = Nothing
End Sub

Sub del()
        If OnlyRead = 1 Then OnlyReadMessage()
        id = Split(request("id"),",")
        set fso=CreateObject("Scripting.FileSystemObject")
		For i = 0 To UBound(id)
                rem 增加删除检测 防止删除系统文件 2006-3-6 56770.kingdge
                If InStr(LCase(server.mappath(id(i))),"\"& LCase(picpath) &"\")>0 Or InStr(LCase(server.mappath(id(i))),"\pic\")>0 Then
                        whichfile=server.mappath(id(i))
                        Set thisfile = fso.GetFile(whichfile)
		        Else
                        response.write "<script language='javascript'>alert('ERROR!');window.document.location.href='quit.asp';</script>"
                        Response.End
		        End If
                thisfile.Delete True
		Next
		ManageLog Lang_Upfile(1) &" ["&request("id")&"]"
		m_u="?SaveUpFilesPath="& request("SaveUpFilesPath") &"&page="& request("page")
		Call Up_mes(Lang_sys(43),"·"& Lang_sys(42),0,m_u,0,0,2,1)
End Sub

Sub main()
		On Error Resume Next
        If not IsObjInstalled("Scripting.FileSystemObject")Then
                Response.Write Lang_Data(5)
                response.End
        End If
		Set fso=server.createobject("scripting.filesystemobject")
		page = CheckNum(request("page"),1)
        SaveUpFilesPath = Replace(Replace(safereplace(request("SaveUpFilesPath")),".",""),"\","")
        If SaveUpFilesPath="" Then
                SaveUpFilesPath="pic/"
        End If
        if right(SaveUpFilesPath, 1)<>"/" then
                UploadDir="../" & SaveUpFilesPath & "/"
        else
                UploadDir="../" & SaveUpFilesPath
        end If
%>
<script language="javascript" type="text/javascript" src="inc/js/js_link.js"></script>
<script language="javascript" type="text/javascript" src="inc/js/lightbox/jquery.colorbox-min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){$("a[rel^='colorbox']").colorbox({title:"<%=Lang_Upfile(21)%>",slideshow:true,slideshowAuto:false,previous:"<%=Lang_Upfile(22)%>",next:"<%=Lang_Upfile(23)%>",close:"<%=Lang_Upfile(24)%>",slideshowStart:"<%=Lang_Upfile(25)%>",slideshowStop:"<%=Lang_Upfile(26)%>",current:"({total}/{current})"});});
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="list" class="classtable">
<form action="?" method="post">
<tr>
<td height="30" align="left" colspan="3" class="classhead">
<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_delete.gif" value=" <%=Lang_sys(15)%> " align="absmiddle">
</td>
<input type="hidden" name="page" value="<%= page %>">
<input type="hidden" name="SaveUpFilesPath" value="<%=SaveUpFilesPath%>">
<input type="hidden" name="action" value="del">
<td align="right" colspan="3" class="classhead">
<%=QuickMenu("admin_lockip.asp|"& Lang_Menu(152) &"","Admin_space.asp|"& Lang_Menu(155) &"")%>
</td>
</tr>
<%
Const MaxPerPage=20
TruePath=Server.MapPath(UploadDir)
if fso.FolderExists(TruePath)then
        FileCount=0
        TotleSize=0
        Set theFolder=fso.GetFolder(TruePath)
        For Each theFile In theFolder.Files
                FileCount=FileCount+1
                TotleSize=TotleSize+theFile.Size
        next
        totalPut=FileCount
        if page<1 then
                page=1
        end if
        if(page-1)*MaxPerPage>totalput then
                if(totalPut mod MaxPerPage)=0 then
                        page= totalPut \ MaxPerPage
                else
                        page= totalPut \ MaxPerPage + 1
                end If
         End If
end if
dim c
FileCount=0
TotleSize=0
%>
<tr>
<td class="classtop" width="5%" height="30" title="<%=Lang_sys(4)%>" style="cursor:pointer;" onclick="location.href='javascript:selectall();';return false;"><%=Lang_sys(50)%></td>
<td class="classtop" width="20%"><%=Lang_Upfile(2)%></td>
<td class="classtop" width="25%"><%=Lang_Upfile(3)%></td>
<td class="classtop" width="15%"><%=Lang_Upfile(4)%></td>
<td class="classtop" width="15%"><%=Lang_Upfile(5)%></td>
<td class="classtop" width="20%"><%=Lang_Upfile(6)%></td>
</tr>
<%
For Each theFile In theFolder.Files
c=c+1
if FileCount >= MaxPerPage then
exit for
elseif c>MaxPerPage*(page-1) Then
%>
<tr class="classrow">
<td height="45" class="classrow"><input name="id" type="checkbox" value="<%=UploadDir&theFile.Name%>">
<%
If LCase(SaveUpFilesPath) = LCase(picpath) &"/csv" Or IsNumeric(Replace(LCase(SaveUpFilesPath),LCase(picpath) &"/","")) Or InStr(Lcase(SaveUpFilesPath),"product") > 0 Or InStr(Lcase(SaveUpFilesPath),"_b") > 0 Then 
		sql = "select count(id) from Lebi_Product where 1=1"
		If IsSqlDataBase = 1 Then
				sql = sql &" and (charindex('"& theFile.Name &"',pic)>0 or charindex('"& theFile.Name &"',cpic)>0)"
		Else
				sql = sql &" and (instr(pic,'"& theFile.Name &"')>0 or instr(cpic,'"& theFile.Name &"')>0)"
		End If
		PD = checknum(conn.execute(sql)(0),0)
		If IsNull(PD) Then PD = 0
ElseIf LCase(SaveUpFilesPath) = "pic/brand" Then 
		sql = "select count(id) from Lebi_brand where 1=1"
		If IsSqlDataBase = 1 Then
				sql = sql &" and (charindex('"& theFile.Name &"',brand_pic)>0)"
		Else
				sql = sql &" and (instr(brand_pic,'"& theFile.Name &"')>0)"
		End If
		PD = checknum(conn.execute(sql)(0),0)
		If IsNull(PD) Then PD = 0
ElseIf LCase(SaveUpFilesPath) = "pic/sort_pic" Then 
		sql = "select count(c_id) from Lebi_category where 1=1"
		If IsSqlDataBase = 1 Then
				sql = sql &" and (charindex('"& theFile.Name &"',c_pic)>0)"
		Else
				sql = sql &" and (instr(c_pic,'"& theFile.Name &"')>0"
		End If
		PD = checknum(conn.execute(sql)(0),0)
		If IsNull(PD) Then PD = 0
ElseIf LCase(SaveUpFilesPath) = "pic/news" Then 
		sql = "select count(c_id) from Lebi_news where 1=1"
		If IsSqlDataBase = 1 Then
				sql = sql &" and (charindex('"& theFile.Name &"',pic_src)>0)"
		Else
				sql = sql &" and (instr(pic_src,'"& theFile.Name &"')>0)"
		End If
		PD = checknum(conn.execute(sql)(0),0)
		If IsNull(PD) Then PD = 0
ElseIf LCase(SaveUpFilesPath) = "pic/packing" Then 
		sql = "select count(id) from Lebi_packing where 1=1"
		If IsSqlDataBase = 1 Then
				sql = sql &" and (charindex('"& theFile.Name &"',pic)>0)"
		Else
				sql = sql &" and (instr(pic,'"& theFile.Name &"')>0)"
		End If
		PD = checknum(conn.execute(sql)(0),0)
		If IsNull(PD) Then PD = 0
ElseIf LCase(SaveUpFilesPath) = "pic/grade" Then 
		sql = "select count(id) from Lebi_user_grade where 1=1"
		If IsSqlDataBase = 1 Then
				sql = sql &" and (charindex('"& theFile.Name &"',grade_ico)>0)"
		Else
				sql = sql &" and (instr(grade_ico,'"& theFile.Name &"')>0)"
		End If
		PD = checknum(conn.execute(sql)(0),0)
		If IsNull(PD) Then PD = 0
ElseIf LCase(SaveUpFilesPath) = "pic/gg" Then 
		sql = "select count(a_id) from Lebi_ad where 1=1"
		If IsSqlDataBase = 1 Then
				sql = sql &" and (charindex('"& theFile.Name &"',a_pic)>0)"
		Else
				sql = sql &" and (instr(a_pic,'"& theFile.Name &"')>0)"
		End If
		PD = checknum(conn.execute(sql)(0),0)
		If PD = 0 Then 
				sql = "select count(id) from Lebi_gg where 1=1"
				If IsSqlDataBase = 1 Then
						sql = sql &" and (charindex('"& theFile.Name &"',gg_s1)>0 or charindex('"& theFile.Name &"',gg_s2)>0 or charindex('"& theFile.Name &"',gg_s3)>0 or charindex('"& theFile.Name &"',gg_s4)>0 or charindex('"& theFile.Name &"',gg_tj)>0 or charindex('"& theFile.Name &"',ggtop)>0)"
				Else
						sql = sql &" and (instr(gg_s1,'"& theFile.Name &"')>0 or instr(gg_s2,'"& theFile.Name &"')>0 or instr(gg_s3,'"& theFile.Name &"')>0 or instr(gg_s4,'"& theFile.Name &"')>0 or instr(gg_tj,'"& theFile.Name &"')>0 or instr(ggtop,'"& theFile.Name &"')>0)"
				End If
				PD = checknum(conn.execute(sql)(0),0)
				If IsNull(PD) Then PD = 0
		End If 
ElseIf LCase(SaveUpFilesPath) = "pic/score" Then 
		sql = "select count(id) from Lebi_vipproduct where 1=1"
		If IsSqlDataBase = 1 Then
				sql = sql &" and (charindex('"& theFile.Name &"',pic)>0 or charindex('"& theFile.Name &"',cpic)>0)"
		Else
				sql = sql &" and (instr(pic,'"& theFile.Name &"')>0 or instr(cpic,'"& theFile.Name &"')>0)"
		End If
		PD = checknum(conn.execute(sql)(0),0)
		If IsNull(PD) Then PD = 0
ElseIf LCase(SaveUpFilesPath) = "pic/links" Then 
		sql = "select count(c_id) from Lebi_linkconfig where 1=1"
		For LangT = 1 To TotalLang
				If IsSqlDataBase = 1 Then
						sql = sql &" and (charindex('"& theFile.Name &"',c_logo"& LanguageTxt(LangT) &")>0)"
				Else
						sql = sql &" and (instr(c_logo"& LanguageTxt(LangT) &",'"& theFile.Name &"')>0)"
				End If
		Next 
		PD = checknum(conn.execute(sql)(0),0)
		If IsNull(PD) Then PD = 0
		If PD = 0 Then 
				sql = "select count(id) from Lebi_huoban where 1=1"
				If IsSqlDataBase = 1 Then
						sql = sql &" and (charindex('"& theFile.Name &"',logo)>0)"
				Else
						sql = sql &" and (instr(logo,'"& theFile.Name &"')>0)"
				End If
				PD = checknum(conn.execute(sql)(0),0)
				If IsNull(PD) Then PD = 0
		End If 
ElseIf LCase(SaveUpFilesPath) = "pic/pay" Then
		sql = "select count(id) from Lebi_pay where 1=1"
		If IsSqlDataBase = 1 Then
				sql = sql &" and (charindex('"& theFile.Name &"',p_chinabank)>0 or charindex('"& theFile.Name &"',p_alipay)>0 or charindex('"& theFile.Name &"',p_paypal)>0 or charindex('"& theFile.Name &"',p_paypal_cn)>0 or charindex('"& theFile.Name &"',p_99bill)>0 or charindex('"& theFile.Name &"',p_tenpay)>0 or charindex('"& theFile.Name &"',p_tenpay2)>0 or charindex('"& theFile.Name &"',p_ips)>0)"
		Else
				sql = sql &" and (instr(p_chinabank,'"& theFile.Name &"')>0 or instr(p_alipay,'"& theFile.Name &"')>0 or instr(p_paypal,'"& theFile.Name &"')>0 or instr(p_paypal_cn,'"& theFile.Name &"')>0 or instr(p_99bill,'"& theFile.Name &"')>0 or instr(p_tenpay,'"& theFile.Name &"')>0 or instr(p_tenpay2,'"& theFile.Name &"')>0 or instr(p_ips,'"& theFile.Name &"')>0)"
		End If
		PD = checknum(conn.execute(sql)(0),0)
		If IsNull(PD) Then PD = 0
Else
		PD = 1
End If 
If PD = 0 Then response.write("<br/><font color=red>"& Lang_Upfile(7) &"</font>")
%></td>
<td class="classrow"><%If theFile.Name<>"Thumbs.db" Then%><div class="picture"><a href="<%=(UploadDir & theFile.Name)%>" rel=colorbox1 target="_blank"><img src="<%=(UploadDir & theFile.Name)%>" border="0" onMouseover="javascript:ddrivetip('<div class=pictureview><img src=<%=(UploadDir & theFile.Name)%>></div>', '#ffffff', '150')" onMouseout="hideddrivetip()"></a></div><%else%>--<%End if%></td>
<td class="classrow"><a href="<%=(UploadDir & theFile.Name)%>" rel=colorbox2 target="_blank"><%=theFile.Name%></a></td>
<td class="classrow"><%=theFile.size%><%=Lang_Upfile(8)%></td>
<td class="classrow"><%=theFile.type%></td>
<td class="classrow"><%=theFile.DateLastModified%></td>
</tr>
<%
FileCount=FileCount+1
TotleSize=TotleSize+theFile.Size
if totalput mod maxperpage=0 then
        n= totalput \ maxperpage
else
        n= totalput \ maxperpage+1
end If
End If
Next
%>
</form>
<form name="form" method="Post" action="?SaveUpFilesPath=<%=SaveUpFilesPath%>">
<tr>
<td height="30" align="left" colspan="2" class="classfooter">
<select name="SaveUpFilesPath" onChange="var jmpURL=this.options[this.selectedIndex].value ;if(jmpURL!='') {window.location=jmpURL; }else{ this.selectedIndex=0;}" style="font-size:11px;">
<optgroup label="商品图片">
<option value="?SaveUpFilesPath=<%= picpath %>" <%=judge2(request("SaveUpFilesPath"),picpath)%>>├ <%=Lang_Upfile(9)%></option>
<%GetFolder Server.mappath("../"& picpath),picpath,"├ "%>
</optgroup>
<optgroup label="<%=Lang_Upfile(19)%>">
<option value="?SaveUpFilesPath=pic" <%=judge2(request("SaveUpFilesPath"),"pic")%>>├ <%=Lang_Upfile(9)%></option>
<option value="?SaveUpFilesPath=pic/brand" <%=judge2(request("SaveUpFilesPath"),"pic/brand")%>>├ <%=Lang_Upfile(10)%></option>
<option value="?SaveUpFilesPath=pic/sort_pic" <%=judge2(request("SaveUpFilesPath"),"pic/sort_pic")%>>├ <%=Lang_Upfile(11)%></option>
<option value="?SaveUpFilesPath=pic/news" <%=judge2(request("SaveUpFilesPath"),"pic/news")%>>├ <%=Lang_Upfile(12)%></option>
<option value="?SaveUpFilesPath=pic/packing" <%=judge2(request("SaveUpFilesPath"),"pic/packing")%>>├ <%=Lang_Upfile(13)%></option>
<option value="?SaveUpFilesPath=pic/grade" <%=judge2(request("SaveUpFilesPath"),"pic/grade")%>>├ <%=Lang_Upfile(14)%></option>
<option value="?SaveUpFilesPath=pic/gg" <%=judge2(request("SaveUpFilesPath"),"pic/gg")%>>├ <%=Lang_Upfile(15)%></option>
<option value="?SaveUpFilesPath=pic/score" <%=judge2(request("SaveUpFilesPath"),"pic/score")%>>├ <%=Lang_Upfile(16)%></option>
<option value="?SaveUpFilesPath=pic/links" <%=judge2(request("SaveUpFilesPath"),"pic/links")%>>├ <%=Lang_Upfile(17)%></option>
<option value="?SaveUpFilesPath=pic/pay" <%=judge2(request("SaveUpFilesPath"),"pic/pay")%>>├ <%=Lang_Upfile(18)%></option>
<option value="?SaveUpFilesPath=pic/other" <%=judge2(request("SaveUpFilesPath"),"pic/other")%>>├ <%=Lang_Upfile(19)%></option>
<option value="?SaveUpFilesPath=pic/userfiles" <%=judge2(request("SaveUpFilesPath"),"pic/userfiles")%>>├ <%=Lang_Upfile(20)%></option>
<%GetFolder Server.mappath("../pic/userfiles"),"pic/userfiles","  ├ FCKeditor - "%>
</optgroup>
</select>
<!--当前文件夹：-->
<% 'If isempty(SaveUpFilesPath) Then response.write"pic" Else response.write SaveUpFilesPath End If%>
</td>
<td colspan="4" height="30" class="classfooter" align="right">
<%
pagenmin=page-3'计算页码开始值
If page = 1 Then
   pagenmax=page+5
Else
   pagenmax=page+3
End If
If (pagenmin<1) then
	pagenmin=1
end If
pagec = FormatNumber2(totalput/maxperpage)
If pagec = ".00" Then pagec = 1
If InStr(pagec,".") > 0 Then
		If CLng(Split(pagec,".")(1))>0 Then
		pagec = Split(pagec,".")(0) + 1
		Else
		pagec = CLng(Split(pagec,".")(0))
		End If
End If
If CLng(page) > CLng(pagec) Then page = pagec
%>
<form action='?SaveUpFilesPath=<%=SaveUpFilesPath%>' name='pagefoot' method='post'>
<div class="pagination">
<%
If (page>1) Then
		Response.Write"<a href='?SaveUpFilesPath="& SaveUpFilesPath &"&page=1' class=""page-prev"">"& Lang_Page(1) &"</a>"
End If
if n>1 and n=page then
		Response.Write"<a href='?SaveUpFilesPath="& SaveUpFilesPath &"&page="& page-1 &"' class=""page-prev"">"& Lang_Page(2) &"</a>"
End If
if(pagenmax>pagec) then
		pagenmax=pagec
end if
for page_i = pagenmin to pagenmax
		if(CLng(page_i)=CLng(page)) then
				Response.Write"<span class=""page-cur"">"& page_i &"</span>"
		else
				Response.Write"<a href=?SaveUpFilesPath="& SaveUpFilesPath &"&page="& page_i &">"& page_i &"</a>"
		end if
next
if page=1 and n<>page and n <> 0 then
		Response.Write"<a href='?SaveUpFilesPath="& SaveUpFilesPath &"&page="& page+1 &"' class=""page-next"">"& Lang_Page(3) &"</a>"
		Response.Write"<a href='?SaveUpFilesPath="& SaveUpFilesPath &"&page="& pagec &"' class=""page-next"">"& Lang_Page(4) &"</a>"
end if
Response.Write"<span class=""page-skip"">"& Lang_Page(6) &" "& page &"/"& pagec &" <input type='text' name='Page' value='"& page+1 &"' class='text'><input type='submit' name='go' value='"& Lang_Page(5) &"' class='button'></span>"
%>
</div>
</form>
</td>
</tr>
</table>
<script>tdshow("list");</script>
<%End Sub%>