<!--#include file="base.asp"-->
<%
''' EYCMS 回收站
''' ==================================================================
	dim user_islock:user_islock=eycms.db.dbloadone("islock","ey_admin_menu","title='会员'")
	sub deldb()
		dim id:id=eycms.enhtml(eycms.fget("id",0))
		dim data
		data=eycms.db.dbload(1,"id,(select tablename from view_category where cateid=ey_content.classid) as tablename,tags,classid,isurl,url","ey_content","id="&id&" and islock=-3","")
		if ubound(data)>=0 then
			if webmode=3 then
				dim fileurl:fileurl=eycms.geturl(data(0,0),data(3,0),data(4,0),data(5,0))
				eycms.delfile fileurl
			end if
			eycms.db.dbdel data(1,0),"cid="&id&""
			deal_del_file id,1
			deal_tags data(2,0),""
			eycms.db.dbdel "ey_expand_mood","contentid="&id&""
			eycms.db.dbdel "ey_expand_comment","contentid="&id&""
			If user_islock=1 Then eycms.db.dbdel "ey_user_favorite","contentid="&id&""
			eycms.db.dbdel "ey_content","id="&id&" and islock=-3"
		end if
		eycms.echo "1"
	end sub
	
	sub pass()
		dim id:id=eycms.enhtml(eycms.fget("id",0))
		eycms.db.dbupdate "ey_content","id="&id&" and islock=-3",array(array("islock",1,0,0))
		eycms.echo "1"
	end sub
	
	sub recoverysome()
		dim id:id=eycms.enhtml(eycms.fget("id",0))
		dim idarr:idarr=split(id,",")
		dim data
		if ubound(idarr)<0 then
			eycms.echo "0&#33267;&#23569;&#36873;&#25321;&#19968;&#26465;&#20449;&#24687;"
		else
			dim i
			for i=0 to ubound(idarr)
				if not isnumeric(idarr(i)) then
					eycms.echo "0&#21442;&#25968;&#65306;"&idarr(i)&"&#19981;&#27491;&#30830;&#65292;&#35831;&#30830;&#35748;&#21518;&#20877;&#25805;&#20316;"
					exit sub
				end if
			next
			eycms.db.dbupdate "ey_content","id in("&id&") and islock=-3",array(array("islock",1,0,0))
			eycms.echo "1"
		end if
	end sub
	
	sub delsome()
		dim id:id=eycms.enhtml(eycms.fget("id",0))
		dim idarr:idarr=split(id,",")
		dim data
		if ubound(idarr)<0 then
			eycms.echo "0&#33267;&#23569;&#36873;&#25321;&#19968;&#26465;&#20449;&#24687;"
		else
			dim i
			for i=0 to ubound(idarr)
				if not isnumeric(idarr(i)) then
					eycms.echo "0&#21442;&#25968;&#65306;"&idarr(i)&"&#19981;&#27491;&#30830;&#65292;&#35831;&#30830;&#35748;&#21518;&#20877;&#25805;&#20316;"
					exit sub
				else
					data=eycms.db.dbload(1,"id,(select tablename from view_category where cateid=ey_content.classid) as tablename,tags,classid,isurl,url","ey_content","id="&idarr(i)&" and islock=-3","")
					if ubound(data)>=0 then
						if webmode=3 then
							dim fileurl:fileurl=eycms.geturl(data(0,0),data(3,0),data(4,0),data(5,0))
							eycms.delfile fileurl
						end if
						deal_del_file idarr(i),1
						eycms.db.dbdel data(1,0),"cid="&idarr(i)&""
						deal_tags data(2,0),""
						eycms.db.dbdel "ey_expand_mood","contentid="&idarr(i)&""
						eycms.db.dbdel "ey_expand_comment","contentid="&idarr(i)&""
						If user_islock=1 Then eycms.db.dbdel "ey_user_favorite","contentid="&idarr(i)&""
						eycms.db.dbdel "ey_content","id="&idarr(i)&" and islock=-3"
					end if
				end if
			next
			eycms.echo "1"
		end if
	end sub
	
	sub recovery()
		eycms.db.dbupdate "ey_content","islock=-3",array(array("islock",1,0,0))
		eycms.echo "1"
	end sub
	
	sub clearall()
		dim data,i
		data=eycms.db.dbload("","id,(select tablename from view_category where cateid=ey_content.classid) as tablename,tags,classid,isurl,url","ey_content","islock=-3","")
		if ubound(data)>=0 then
			for i=0 to ubound(data,2)
				if webmode=3 then
					dim fileurl:fileurl=eycms.geturl(data(0,i),data(3,i),data(4,i),data(5,i))
					eycms.delfile fileurl
				end if
				eycms.db.dbdel data(1,i),"cid="&data(0,i)&""
				deal_del_file data(0,i),1
				deal_tags data(2,i),""
				eycms.db.dbdel "ey_expand_mood","contentid="&data(0,i)&""
				eycms.db.dbdel "ey_expand_comment","contentid="&data(0,i)&""
				If user_islock=1 Then eycms.db.dbdel "ey_user_favorite","contentid="&data(0,i)&""
				eycms.db.dbdel "ey_content","islock=-3 and id="&data(0,i)&""
			next
		end if
		eycms.echo "1"
	end sub
	
	islogin
	checkpagelever 21
	dim act:act=lcase(eycms.fget("act",0))
	dim keyword:keyword=eycms.enhtml(eycms.fget("keyword",1))
	select case act
		case "del":deldb
		case "recoverysome":recoverysome
		case "delsome":delsome
		case "pass":pass
		case "recovery":recovery
		case "clearall":clearall
		case else
			dim orderby,wherekey
			if eycms.strlen(keyword)>0 then
				if datatype then
					wherekey=" and instr(lcase(title),lcase('"&keyword&"'))>0 "
				else
					wherekey=" and title like '%"&keyword&"%'"
				end if
			end if
			load theme_contentrecycle
	end select
	eycms.db.dbclose
%>
