<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="version.asp"-->
<%
dim menulist : menulist= "系统管理||2|||扩展功能||3|||视频管理||4|||文章管理||5|||用户管理||6|||模板及生成||7|||采集管理||8"


sub headAdmin(title)
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=title%> - 苹果CMS</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link rel="stylesheet" type="text/css" href="../images/admin.css" />
<link rel="stylesheet" type="text/css" href="../images/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../images/icon.css" />
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="../js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../js/adm/admin.js"></script>
<script type="text/javascript" src="../js/function.js"></script>
</head>
<body>
<%
end sub

Sub footAdmin
	writeA "<div align=center>" & getRunTime() &  "</div><div align=center >Copyright 2008-2013 All rights reserved. <a target=""_blank"" href=""http://www.maccms.com"">Maccms</a></div>" & chr(10) & "</body>" & chr(10) & "</html>"
	dispseObj()
End Sub

sub chkLogin
	dim sql,rs
	dim m_id,m_name,loginValidate
	m_id = getCookie("adminid") : m_id = chkSql(m_id,true)
	m_name = getCookie("adminname") : m_name = chkSql(m_name,true)
	if not isN(m_name) and not isN(m_id) then
		on error resume next
		set rs = objdb.db("SELECT * FROM {pre}manager WHERE m_name='" & m_name &"' AND m_id= "&m_id,"rs1")
		loginValidate = md5(rs("m_random") & rs("m_name") & rs("m_id"),2)
		objdb.c(rs)
		if err then 
			setCookie "admincheck",""
		    writeE "<script>top.location.href='index.asp?action=login';</script>"
		end if
		if getCookie("admincheck") <> loginValidate then 
		   setCookie "admincheck",""
		   writeE "<script>top.location.href='index.asp?action=login';</script>"
		end if
	else
		writeE "<script>top.location.href='index.asp?action=login';</script>"
	end if
end sub


sub chkPopedom(str)
	
end sub


Function checkField(fieldName,tableName)
	dim flag,sql,rsObj,i,ExeResultNum : flag=False : sql="select * from "&tableName 
	set rsObj = objdb.dbConn.ExeCute(sql,ExeResultNum)
	for i = 0 to rsObj.Fields.Count - 1 
		if rsObj.Fields(i).Name=fieldName then 
			flag=True : Exit For 
		else 
			flag=False 
		end if 
	next 
	checkField=flag 
End Function

Function checkTable(tableName)
	dim flag,sql,rs,i,sysTables : flag=False
	set rs = objdb.dbConn.openSchema(20)
	rs.filter="table_type='table'"
	rs.movefirst
	do while not rs.eof
	sysTables = sysTables & "[" & rs("TABLE_NAME") & "],"
	rs.movenext:loop
	rs.close
	set rs=nothing
	if instr(sysTables,"[" &tableName &"]")=0 then
		flag = false
	else
		flag =true
	end if
	checkTable =flag
end Function
dim macUrl : macUrl = "h"&"t"&"tp"&"://w"&"w"&"w"&".ma"&"ccm"&"s.co"&"m/"
function cBreakpoint(fname)
	if objFile.IsFileExists(fname&".html") then cBreakpoint =true else cBreakpoint=false
end function

function dBreakpoint(fname)
	if objFile.IsFileExists(fname&".html") then objFile.delfile fname&".html"
end function

function wBreakpoint(fname,url)
	dim fdes
	fdes = "<meta http-equiv=""refresh"" content=""0;url="&url&""">"
	objFile.createFile fname&".html",fdes
end function

function gBreakpoint(fname)
	gBreakpoint = objFile.getfile(fname&".html")
end function

Sub ImgWriter(Path)
	Dim Jpeg
	on error resume next
	Set Jpeg = Server.CreateObject("Persits.Jpeg")
	if err.number=0 then
		Jpeg.Open Server.MapPath(Path)
		Jpeg.Canvas.Font.Color = &HFF0000
		Jpeg.Canvas.Font.Family = "黑体"
		Jpeg.Canvas.Font.Bold = True
		Jpeg.Canvas.Font.Size = 18
		Jpeg.Canvas.Font.Quality = 10
		Jpeg.Canvas.Font.ShadowXOffset = 1
		Jpeg.Canvas.Font.ShadowYOffset = 3
		Jpeg.Canvas.Pen.Color = &HFFFFFF
		Jpeg.Canvas.Pen.Width = 3 
		Jpeg.Canvas.Brush.Solid = False 
		IF app_waterlocation =0 Then
		Jpeg.Canvas.Print (Jpeg.width-60)/2, (Jpeg.height-10)/2, app_waterfont       '居中
		ElseIf app_waterlocation=1 Then
		Jpeg.Canvas.Print Jpeg.width-120, 20, app_waterfont       '右上
		ElseIF app_waterlocation=2 Then
		Jpeg.Canvas.Print Jpeg.width-120, Jpeg.height-20, app_waterfont       '右下
		ElseIF app_waterlocation=3 Then
		Jpeg.Canvas.Print 20, 20, app_waterfont       '左上
		Else
		Jpeg.Canvas.Print 20, Jpeg.height-20, app_waterfont       '左下
		End IF
		Jpeg.Save Server.MapPath(Path)
	else
		writeA "不支持Persits.Jpeg水印组件，请关闭自动添加水印"
	end if
	Set Jpeg = Nothing
	err.clear
End Sub

function getSavePicPath()
	dim datetime,path,path1,i,syear,smonth,sday,filecount
	datetime = now() : syear= year(datetime) : smonth = month(datetime) : sday=day(datetime)
	if len(smonth) =1 then smonth= "0"&smonth
	if app_picpath = 1 then
		getSavePicPath = syear&"-"& smonth
	elseif app_picpath = 2 then
		getSavePicPath = syear&"-"& smonth &"-"&sday
	elseif app_picpath = 3 then
		for i=0 to 50
			path = syear&"-"&smonth &"-"& sday &"-"&i
			path1 = "../upload/vod" & "/" & path & "/"
			if objfile.isFolderExists(path1) then
				filecount = objfile.folderFileCount(path1)
				
				if filecount > 500 then
					getSavePicPath = syear&"-"&smonth&"-"& sday &"-"& (i+1)
				else
					getSavePicPath = path
					exit for
				end if
			else
				getSavePicPath = path
				exit for
			end if
		next
	else
		getSavePicPath = ""
	end if
end Function
%>