<!-- #Include File="../../Include/Config.asp" -->
<!-- #Include File="../../Include/Functions.asp" -->
<!-- #Include File="../../Include/Cls_PageCute.asp" -->
<!-- #Include File="../../Include/Cls_Search.asp" -->
<!-- #Include File="../../Include/Cls_FileSys.asp" -->
<!-- #Include File="../../Include/Inc_Post.asp" -->
<!-- #Include File="../../Editor/UBB/Editor.asp" -->
<!-- #Include File="AMH_Fir.asp" -->
<!-- #Include File="AdminCheck.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

'频道 ID
Dim iChannelIDs
	iChannelIDs = Cls.Code_ID("ChannelIDs")
Dim iChannelSetup
	iChannelSetup = Cls.Get_ChannelRes(iChannelIDs,18)
Dim tnum,nummer
tnum=10		'显示参数 1024*768建议设成：10，800*600建议设成：0
nummer=20	'列表每页显示数量

Dim s_d,s_tim,s_mark
s_d = "'d'"
s_tim = "now()"
s_mark = "#"
if SqlType = 1 then
   s_d = "d"
   s_tim = "getdate()"
   s_mark = "'"
end if
Dim Admins
	Admins = False
Dim del_user_true,del_upload_true,is_clear,istop_var,AsaiMHMod,id,mlevel,max_pop,cid,sid,ntit
dim sql_add,nums,rssum,page,viewpage,thepages,nsort,Data_Name
del_user_true=false
del_upload_true=false
is_clear=true
istop_var="istop"
AsaiMHMod=Cls.Code_Query("AsaiMHMod")
id=Cls.Code_ID("id")
nums=nummer
sql_add=""
pageurl="?AsaiMHMod="&AsaiMHMod&"&"
nsort=""
Data_Name=""
mlevel=0
Max_Pop=50

'//* 检验超级管理员身份 *//
Function ChkAdmins()
	ChkAdmins = False
	If Login_UserName = "" Then Exit Function
	If Login_Level = 10 Then ChkAdmins = True
	'If Instr("|"&Cls.SuperAdmins&"|","|"&Login_UserName&"|")<>0 Then ChkAdmins = True
	'If  Login_Level = 10 And Instr("|"&Cls.SuperAdmins&"|","|"&Login_UserName&"|")<>0 Then ChkAdmins = True
End Function

'//* 读取后台菜单参数 *//
Private Sub AMH_Master(mType,mTips)
	Dim mErr
		mErr = True
	Dim aMenus, Aii, Sii
		aMenus = Cls.Cache_Get("amh_menu")
	For Aii = 0 To Ubound(aMenus,2)
		If LCase(Cstr(aMenus(4,Aii))) = LCase(Cstr(Index_Url)) Then
		  Sii = Int(aMenus(1,Aii))
			Data_Name = aMenus(8,Aii)
			mlevel = aMenus(7,Aii)
			tit = aMenus(2,Aii)
			tit_fir = aMenus(3,Aii)
			MenuHelp = aMenus(10,Aii)
			mErr = False
			Exit For
		End If
	Next
	If iChannelIDs>0 And Sii<>0 Then
		if int(Cls.Get_ChannelRes(iChannelIDs,8))=1 Then
			tit = Cls.Get_ChannelRes(iChannelIDs,1)
			tit_fir = Cls.Get_ChannelRes(iChannelIDs,13)
		End If
	End If
	If mType = 1 And ( Data_Name="" Or tit="" Or tit_fir="" Or Not(IsNumeric(mlevel)) ) Then mErr = True
	If mErr Then
		Call AMH_Msg("本栏目（"&Index_Url&"）的栏目管理参数还未初始化！\n\n请点击进入管理菜单设置该栏目管理参数。","amh_menu.asp",1)
		Call web_Clear(1)
	End If
	If mTips > 1 And iChannelIDs = 0 Then
		Call AMH_Msg("您没有选择频道类型！！","AMH_Index.Asp?Action=main",1)
		Call web_clear(1)
	End If
	If mTips = 2 Then
		Call Cls.Channel_Initialize(iChannelIDs)
		If Not Cls.ChannelTrue Then
			Call AMH_Msg("您选择频道不存在！！","AMH_Index.Asp?Action=main",1)
			Call web_clear(1)
		End If
	End If
End Sub

Function Object_Install(Strclassstring)
  On Error Resume Next
  Object_Install=True
  Dim Xtestobj
  Err=0
  Set Xtestobj=Server.Createobject(Strclassstring)
  If -2147221005=Err Then
    Err.Clear
    Object_Install=False
  End If
  Set Xtestobj=Nothing
End Function

Sub AsaiMHIs_Nsort_Review()
	If iChannelIDs = 0 Then Exit Sub
	Dim iChannelRes
	iChannelRes = Cls.Get_ChannelRes(iChannelIDs,18)
	If Cls.Get_ChannelSetup(iChannelRes,1) = 1 then
%>
  <td width=10></td>
  <td><a href='AMH_Class.asp?ChannelIDs=<%Response.Write iChannelIDs%>'>分类管理</a></td>
<%
	End If
	If Cls.Get_ChannelSetup(iChannelRes,2) = 1 then
%>
  <td width=10></td>
  <td><a href='AMH_Review.asp?ChannelIDs=<%Response.Write iChannelIDs%>'>评论管理</a></td>
<%
	End If
	If Cls.Get_ChannelSetup(iChannelRes,3) = 1 then
%>
  <td width=10></td>
  <td><a href='AMH_Special.asp?ChannelIDs=<%Response.Write iChannelIDs%>'>专题管理</a></td>
<%
	End If
	If Cls.Get_ChannelSetup(iChannelRes,4) = 1 then
%>
  <td width=10></td>
  <td><a href='AMH_KeyWord.asp?ChannelIDs=<%Response.Write iChannelIDs%>'>关键字管理</a></td>
<%
	End If
	If Cls.Get_ChannelSetup(iChannelRes,5) = 1 then
%>
  <td width=10></td>
  <td><a href='AMH_Err.asp?ChannelIDs=<%Response.Write iChannelIDs%>'>报错管理</a></td>
<%
	End If
	If Cls.Get_ChannelRes(iChannelIDs,8) <> 2 Then
%>
  <td width=10></td>
  <td><a href='AMH_Template.asp?ChannelIDs=<%Response.Write iChannelIDs%>'>模板管理</a></td>
<%
	End If
	If is_clear Then
%>
  <td width=10></td>
  <td><a href='?ChannelIDs=<%Response.Write iChannelIDs%>&action=clear' onclick="javascript:return click_return('清空所有<%Response.Write tit_fir%>',0);">清空所有<%Response.Write tit_fir%></a></td>
<%
	End If
End Sub

Sub AsaiMHIs_Js(var1,var2)
%>
  <td width=10></td>
  <td><a href='?action=js<%Response.Write var1%>' title='当您进行了本类的修改操作后请点击更新一下前台的数据' onclick="javascript:return click_return('更新本类前台数据',0);">更新<%Response.Write var2%>数据</a></td>
<%
End Sub

Sub AsaiMHGo_Handle()
  dim sel_type,seltype,sel_id,hdim,hnum,hid,hi,htype,hintegral
  htype=1
  sel_type=trim(request.form("sel_type"))
  select case sel_type
  case "推荐","取消推荐"
    seltype="Isgood"
    if sel_type="取消推荐" then htype=0
  case "固顶","取消固顶"
    seltype=istop_var
    if sel_type="取消固顶" then htype=0
  case "焦点","取消焦点"
    seltype="Isfocus"
    if sel_type="取消焦点" then htype=0
  case "审核","待审核","显示","隐藏"
    seltype="hidden"
    if sel_type="待审核" or sel_type="隐藏" then htype=0
  case "删除"
    seltype="delete"
  case else
    sel_type=""
    seltype=""
  end select
  if Cls.post_chk()=false or seltype="" then exit sub
  hintegral=mp_integral()
  sel_id=Cls.Code_Sel("sel_id",1)
  hdim=split(sel_id,",")
  hnum=ubound(hdim)
  select case seltype
  case istop_var,"hidden","Isgood","Isfocus"
    for hi=0 to hnum
      hid=hdim(hi)
      if isnumeric(hid) then
        sql="update "&Data_Name&" set "&seltype&"="&htype&" where id="&hid
        call Cls.exec(sql,0)
      End If
    next
  case "delete"
    for hi=0 to hnum
      hid=hdim(hi)
      if isnumeric(hid) then
        if del_user_true then
          sql="update AsaiMHUserData set integral=integral-"&hintegral&" where username=(select top 1 username from "&Data_Name&" where id="&hid&") and username<>'"&login_username&"'"
          call Cls.exec(sql,0)
        End If
        'if del_upload_true then call upload_del(Index_Url,hid)
        If Data_Name="AsaiMHMusicSinger" Then 
          call Cls.exec("delete from AsaiMHMusicDisk where n_id="&hid,0)
          call Cls.exec("delete from AsaiMHMusicSong where n_id="&hid,0)
          call Cls.exec("delete from "&Data_Name&" where id="&hid,0)
        ElseIf Data_Name="AsaiMHMusicDisk" Then 
          call Cls.exec("delete from AsaiMHMusicSong where n_id="&hid,0)
          call Cls.exec("delete from "&Data_Name&" where id="&hid,0) 
        Else
          call Cls.exec("delete from "&Data_Name&" where id="&hid,0) 
        End If
        if Data_Name="video" then call Cls.exec("delete from AsaiMHVideoUrl where nameid="&hid,0)
      End If
    next
  end select
  erase hdim
  action=""
  call AMH_event(sel_type&" "&(hnum+1)&"条（"&tit_fir&"）记录")
  Response.Write vbcrlf&"<script language=javascript>alert(""已成功（"&sel_type&"）操作了"&(hnum+1)&"条记录！"");</script>"
End Sub

Sub AsaiMHGo_Clear()
  dim tdim,tnum,ti
  sql="select count(id) from "&Data_Name
  set rs=Cls.exec(sql,1)
  if rs(0)=0 then
    rs.close
    call AMH_msg("暂时没有（"&tit_fir&"）数据！","?ChannelIDs="&iChannelIDs,1)
    exit sub
  End If
  rs.close
  sql="select id from "&Data_Name&" order by id"
  call Cls.exec("",-1)
  rs.open sql,conn,1,1
  tdim=rs.getrows()
  rs.close
  if Data_Name="AsaiMHMusicSinger" Then
  call Cls.exec("delete from "&Data_Name,0)
  call Cls.exec("delete from AsaiMHMusicDisk",0)
  call Cls.exec("delete from AsaiMHMusicSong",0)
  Else
  call Cls.exec("delete from "&Data_Name,0)
  End If
  call AMH_event("清空所有 "&tit_fir&" 数据！")
  call AMH_msg("已成功清空所有 "&tit_fir&" 数据！","?ChannelIDs="&iChannelIDs,1)
End Sub

'//* 后台首部显示 *//
Sub AMH_Header(tt)
	Dim ComeUrl, cUrl
	ComeUrl = Trim(request.ServerVariables("HTTP_REFERER"))
	If tt = 1 Then
	  If Cls.Is_Null(ComeUrl) = "" Then
		  Call AMH_Msg("为安全起见，不允许直接输入地址访问本系统的后台管理页面！！","AMH_Index.Asp?Action=main",1)
		  Call web_clear(1)
		  Exit Sub
	  End If
	  If Not Cls.Post_Chk() Then
		  Call AMH_Msg("为安全起见，不允许从外部链接地址访问本系统的后台管理页面！！","AMH_Index.Asp?Action=main",1)
		  Call web_clear(1)
		  Exit Sub
	  End If
	End If
	If Not ChkAdmins Then
		If login_level < mlevel Or Admins=True Then
			Call Format_Redirect("AMH_Main.Asp?ErrorLevel="&mlevel)
		End If
	End If
	Call AMH_Title(1)
	Call AMH_Td(tit_fir&"管理导航")
End Sub

Sub AMH_Title(tt)
	Response.Write vbcrlf&"<html>" & _
		 vbcrlf&"<head>" & _
		 vbcrlf&"<title>"&Cls.Web_Name&" - 管理后台</title>" & _
		 vbcrlf&"<meta http-equiv=Content-Type content=text/html; charset=gb2312>" & _
		 vbcrlf&"<link type=text/css href='Images/admin.Css' rel=stylesheet>" & _
		 vbcrlf&"<script language=javascript src='Images/Tree/Tree.JS'></script>"
	If tt=1 Then
		Response.Write vbcrlf&"<script language=javascript src='Images/Admin.js'></script>" & _
		   vbcrlf&"<script language=javascript src='"&Cls.Web_Dir&"Style/Select.js'></script>" & _
		   vbcrlf&"<script language=javascript src='Images/AMH_Help.js'></script>" & _
       vbcrlf&"<base target='_self'>" & _
		   vbcrlf&"</head>" & _
		   vbcrlf&"<body leftMargin=0 topMargin=0 marginheight=0 marginwidth=0>" & _
		   vbcrlf&"<center>"
		Call AMH_table(1)
	End If
End Sub

Function mp_integral()
	mp_integral=3'dim_num(24)
End Function

Function Img_Admin(apic,atit)
	Dim tmp1
	tmp1=apic
	If Cls.Is_Null(tmp1)="" Then tmp1="s_"
	Img_Admin="<img border=0 src='Images/"&tmp1&".gif' title='"&atit&"' align=absmiddle>"
End Function

Function Pro_Edit(pt,ptit)
	pro_edit="<a href='"&pt&"'>"&Img_Admin("edit",ptit)&"</a>"
End Function

function pro_istop(pt)
  if pt=1 or pt=true then pro_istop=img_admin("istop","固顶")
end function

function pro_IncludeInfo(pt)
  if pt=3 then pro_IncludeInfo=img_admin("IncludeInfo2","组图")
end function

function pro_isfocus(pt)
  if pt=1 or pt=true then pro_isfocus=img_admin("isfocus","焦点")
end function

Function pro_isgood(pt)
	If pt=1 Or pt=true Then pro_isgood=Img_Admin("isgood","推荐")
End Function

Function Pro_ispic(pt)
	If pt=True Then pro_ispic=Img_Admin("ispic","图片")
End Function

Function Pro_istitpic(pt)
	If pt=True Then pro_istitpic=Img_Admin("istitpic","图片标题")
End Function

Function Pro_Cod(pt)
	If int(pt)=1 Then
		Pro_Cod=Img_Admin("cod2","HTML 编码")
	Else
		Pro_Cod=Img_Admin("cod1","UBB 编码")
	End If
End Function

Function Pro_Hidden(pt,ptt)
	If pt=True Or pt=1 Then
		Pro_Hidden="<font class=Gys title='当前状态为：显示'>显示</font>"
	Else
		Pro_Hidden="<font class=red2 title='当前状态为：待审核/隐藏'>审核</font>"
	End If
End Function

Function Pro_Star(pt)
	If pt=5 Then pro_Star=Img_Admin("VIstop","五星")
End Function

Sub AMH_Resize(tname,tc,tr,tstr,ti)
	Dim tmp1
	tmp1=tname
	If ti<>"" Then tmp1="tp"&ti
%>
<table border=0 cellspacing=0 cellpadding=0>
  <tr>
  <td>
  <textarea name="<%=tname%>" id="<%=tmp1%>" cols=<%=tc%> rows=<%=tr%>><%=tstr%></textarea>
  </td>
  <td width=5></td>
  <td valign=bottom>
  <p>
  <a href='javascript:;' onclick="javascript:AMH_resize(-5,'<%=tmp1%>');"><img src='images/minus.gif' border=0></a>&nbsp;&nbsp<a href='javascript:;' onclick="javascript:AMH_resize(5,'<%=tmp1%>');"><img src='images/plus.gif' border=0></a>
  <br />
  <a href='javascript:;' onclick="javascript:AsaiMHCopy('<%=tmp1%>',0);"><img src='images/copy_cut.gif' border=0 title='复制到剪贴板'></a>&nbsp;&nbsp;<img src='images/viewpic.gif' onclick=runscript(<%=tmp1%>)>
  </p>
  </td>
  </tr>
</table>
<%
End Sub

Sub ReloadMenu(tt)
	Call Cls.Cache_Del("web_menu")
	If tt=1 Then Response.Write Cls.Js_Put("parent.frame_left.re_load();",1)
End Sub
%>
