 <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!--#include file="Ex_Cls/Ex_SkinCls.asp"-->
<!--#include file="Ex_Cls/Ex_SplitPageCls.asp"-->
<%
Dim ExComm
Set ExComm=new Ex_CommonCls
ExComm.GetConfigCache("runmode,ShowName,CmtPageSize,IsCheckCode,cmtmsgcheckre,iscmtmsgcheck,LogNum,blogname,BlogDescription,BlogKeyWord,IndexAddWord,blogurl,logourl,DefaultSkin,MusicType,ViewType,Domain,ListOrderType")
ExComm.IsIpAllow
ExComm.GoIndex
ExComm.CheckInstall
Dim c_year,c_month,C_day,Show_LogIds
'**********************************
'作  用：显示日志列表
'**********************************
function show_log(ByVal ExSkin)
    Dim temp,show_logcyc,rs,show_topic,show_more,show_loginfo,show_logtext,show_author,show_topictxt
	Dim show_emot,show_addtime,show_logcls,show_topicurl
	Dim action,classid
	Dim Skin2
	Dim ExNow,ViewType,OrderType,ContentType
	OrderType=Request.QueryString("ordertype")
	ViewType=Request.QueryString("viewtype")
	ContentType=Request.QueryString("contenttype")
	If ViewType="" Then 
		ViewType=Request.Cookies(Md5(Sn))("viewtype")
	End If 
	If ViewType="" Then 
		ViewType=Application(Sn&"viewtype")
	End If
	If ViewType="list" Then 
		Response.Cookies(Md5(Sn))("viewtype")="list"
	Else 
		Response.Cookies(Md5(Sn))("viewtype")="abstract"
	End If 
	If InStr(OrderType,"recommend")<>0 Then 
		OrderType="Recommend desc,"
	ElseIf InStr(OrderType,"bits")<>0 Then 
		OrderType="bits desc,"
	ElseIf InStr(OrderType,"cmt")<>0 Then 	
		OrderType="cmt desc,"
	ElseIf InStr(OrderType,"submittime")<>0 Then 
		OrderType="submittime desc,"
	End If 
	ExNow=ExComm.ExNow()
	c_year=ExComm.G(request.querystring("c_year"))
	c_month=ExComm.G(request.querystring("c_month"))
	c_day=ExComm.G(request("c_day"))
	classid=cint(request.querystring("classid"))
	action=ExComm.G(request.querystring("action"))
	'构造Sql语句开始
	Dim ExPages,page
	Set ExPages=new Ex_SplitPageCls
	Expages.letConn=Conn
	Expages.letColumns="select log_postyear,log_postmonth,log_postday, title,bits,id,iscmt,classid,emotion,tb,ishide,cmt,logpass,submittime,abstract,textnum"
	ExPages.letDataFrom="from Ex_Log"
	ExPages.letOrder="order by istop asc,"&OrderType&Application(Sn&"ListOrderType")
	If action<>"search" Then'当非搜索
		If classid=0 Then
			If c_year<>"" And c_month<>"" And c_day<>"" Then
				ExPages.letWhere="where log_postyear="&c_year&" and log_postmonth="&c_month&" and log_postday="&c_day&" and textnum<>0 and datediff('d','"&ExNow&"',submittime)<=0"
				ExPages.letStrPage="&c_year="&c_year&"&c_month="&c_month&"&c_day="&c_day&"&"
			ElseIf c_year<>"" And c_month<>"" Then 
				ExPages.letWhere="where log_postyear="&c_year&" and log_postmonth="&c_month&" and textnum<>0 and datediff('d','"&ExNow&"',submittime)<=0"
				ExPages.letStrPage="&c_year="&c_year&"&c_month="&c_month&"&c_day="&c_day&"&"
			ElseIf c_year<>"" Then 
				ExPages.letWhere="where log_postyear="&c_year&" and textnum<>0 and datediff('d','"&ExNow&"',submittime)<=0"
				ExPages.letStrPage="&c_year="&c_year&"&c_month="&c_month&"&c_day="&c_day&"&"
			ElseIf ContentType<>"" Then 
				ExPages.letWhere="where textnum<>0 and datediff('d','"&ExNow&"',submittime)<=0 and recommend<>0"
				ExPages.letStrPage="&contenttype=recommend"
			Else 
				ExPages.letWhere="where textnum<>0 and datediff('d','"&ExNow&"',submittime)<=0"
				ExPages.letStrPage=""
			End If 
		Else'具体到某类
			ExPages.letWhere="where classid="&classid&" and textnum<>0 and datediff('d','"&ExNow&"',submittime)<=0"
			ExPages.letStrPage="&classid="&classid
		End If 
	Else'为搜索
		Dim selecttype,keyword
		selecttype=ExComm.G(request("selecttype"))
		keyword=ExComm.G(request("keyword"))
		ExPages.letWhere="where "&selecttype&" like '%"&keyword&"%' and textnum<>0"
		ExPages.letStrPage="&action=search&selecttype="&selecttype&"&keyword="&keyword&"&"
		'点击tags进行处理
		classid2=ExComm.G(request.querystring("classid"))
		If request.querystring.count<>0 And classid2<>"" And selecttype="tags"then
			dim tagsrs,classid2
			classid2=ExComm.G(request.querystring("classid"))
			Conn.execute("update Ex_tags set times=times+1 where tagname='"&keyword&"' and classid="&classid2)
		End if
	End If
	'构造sql语句结束
	Set Rs=server.CreateObject("adodb.recordset")
	If ViewType="list" Then 
		Expages.letPageSize=CInt(Application(sn&"LogNum"))*5
	Else 
		Expages.letPageSize=CInt(Application(sn&"LogNum"))
	End If 
	If ExComm.G(request("page"))="" Then
		page=1
	Else
		page=ExComm.G(request("page"))
	End if
	ExPages.letPage=CInt(page)
	ExPages.Execute()
	'显示tags和日志列表内容开始
	Set Rs=ExPages.GetRs
	If ExPages.GetRsCount<>0 then
	'===============以下为显示代码===============
	'显示热门tags
		
	'tags显示结束
		Do While Not rs.eof
			'构造$show_topic$
			If Application(sn&"runmode")="静态" Then 
				Dim BlogViewUrl
				BlogViewUrl=ExComm.CreateUrl(ExComm.GetClassFolder(Rs("classid")),ExComm.GetLogName(Rs("id")),"")
				show_topic="<a href=index.asp?classid="&rs("classid")&">["&ExComm.GetClassName(rs("classid"))&"]</a>"
				show_logcls=Replace(show_topic,"[","")
				show_logcls=Replace(show_logcls,"]","")
				If Rs("ishide")="游客" And Rs("textnum")<>0  And (Trim(Rs("logpass"))="" Or IsNull(Rs("logpass"))) Then 
					show_topic=show_topic&"<a href="&BlogViewUrl&">"&rs("title")&"</a>"
					show_topicurl=BlogViewUrl
				Else
					show_topic=show_topic&"<a href=blogview.asp?id="&rs("id")&">"&rs("title")&"</a>"
					show_topicurl="blogview.asp?id="&rs("id")
				End if
			Else 
				show_topic="<a href=index.asp?classid="&rs("classid")&">["&ExComm.GetClassName(rs("classid"))&"]</a>"
				show_logcls=Replace(show_topic,"[","")
				show_logcls=Replace(show_logcls,"]","")
				show_topic=show_topic&"<a href=blogview.asp?id="&rs("id")&">"&rs("title")&"</a>"
				show_topicurl="blogview.asp?id="&rs("id")
			End if
			'构造$show_loginfo$
			show_loginfo=""&Application(sn&"ShowName")&" 发表于 "&rs("log_postyear")&"-"&rs("log_postmonth")&"-"&rs("log_postday")&" "&Hour(Rs("submittime"))&":"&Minute(Rs("submittime"))&":"&Second(Rs("submittime"))
			'构造$show_logtext$
			If ExComm.IsLogin("admin")=False  And rs("ishide")="隐藏" then
				show_logtext="<div align=center>此处隐藏一篇日志。</div>"
			elseif rs("logpass")<>"" And  ExComm.IsLogin("admin")=False  then
				show_logtext="<div align=center><a href=blogview.asp?id="&rs("id")&">此日志需要密码访问。</a></div>"
			ElseIf ExComm.IsLogin("user")=False  And rs("ishide")="会员" And ExComm.IsLogin("admin")=False  Then
				show_logtext="<div align=center><br>本日志只有会员才可以查看,如果您是会员请登陆</div>"
			Else
				show_logtext=Rs("abstract")
			end If
			'构造$show_more$ 此标记为js调用显示
			show_more=ExSkin.More(Rs("Id"))
			'构造$show_emot$
			show_emot="<img src=images/emotion/em0"&rs("emotion")&".gif >"
			'构造$show_author$
			show_author=Application(sn&"showname")
			'构造$show_addtime$
			show_addtime=rs("log_postyear")&"-"&rs("log_postmonth")&"-"&rs("log_postday")&" "&Hour(Rs("submittime"))&":"&Minute(Rs("submittime"))&":"&Second(Rs("submittime"))
			'构造$show_topictxt$
			show_topictxt=rs("title")
	
			Show_LogIds=Show_LogIds&Rs("id")&","
			'辅模板替换开始
			If viewtype="list" Then 
				Show_Logcyc="<div class=""viewtype opt"" style=""text-align:left""><span>"&show_more&"</span>★&nbsp;"&show_topic&"</div>"
			Else 
				Skin2=ExSkin.GetTxtSkin("show_log.html")
				show_logcyc=replace(Skin2,"$show_topic$",show_topic)
				Show_logcyc=Replace(show_logcyc,"$show_copyright$","")
				Show_logcyc=Replace(show_logcyc,"$show_adscnthead$","")
				Show_logcyc=Replace(show_logcyc,"$show_adscntbottom$","")
				show_logcyc=replace(show_logcyc,"$show_loginfo$",show_loginfo)
				show_logcyc=replace(show_logcyc,"$show_more$",show_more)
				show_logcyc=replace(show_logcyc,"$show_emot$",show_emot)
				show_logcyc=replace(show_logcyc,"$show_author$",show_author)
				show_logcyc=replace(show_logcyc,"$show_addtime$",show_addtime)
				show_logcyc=replace(show_logcyc,"$show_topictxt$",show_topictxt)
				show_logcyc=replace(show_logcyc,"$show_logtext$",show_logtext)
				show_logcyc=replace(show_logcyc,"$show_logcls$",show_logcls)
				show_logcyc=replace(show_logcyc,"$show_topicurl$",show_topicurl)
			End If 
			rs.movenext
			show_log=show_log&show_logcyc
		Loop 		
	'内容部分循环结束
	'===================分页尾部=======================
		dim showpage
		showpage="<br><center>"&ExPages.Show&"</center>"
		show_log=show_log&showpage
		set rs=nothing
	else
		show_log="暂时未有任何日志！"
	end If
	'显示tags和日志列表内容结束
End Function

'音乐模式转向
Function MusicJS
	Dim Temp
	If Application(Sn&"MusicType")="框架" Then 
		Temp="<script>"
		Temp=Temp&"if (top.location==location)"
		Temp=Temp&"{"
		Temp=Temp&"top.location=""musicframe.asp?f=index"""
		Temp=Temp&"}"
		Temp=Temp&"</script>"
	End If 
	MusicJs=Temp
End Function 
'主模板标记替换开始
Dim ExSkin,Head,Body,Bottom,Title,Skin1
Set ExSkin=new Ex_SkinCls
Skin1=ExSkin.GetTxtSkin("default.html")
Body=Replace(Skin1,"$show_log$",show_log(ExSkin))'替换内容标签
Body=Replace(Body,"$show_info$",ExSkin.Info)
Body=Replace(Body,"$show_login$",ExSkin.Login)
Body=Replace(Body,"$show_calendar$",ExSkin.calendar(C_year,C_Month,C_Day))
Set ExSkin=Nothing 
Body=Replace(Body,"$show_logids$",show_logids)
Body=Replace(Body,"$show_year$",c_year)
Body=Replace(Body,"$show_month$",c_month)
Body=Replace(Body,"$show_day$",c_day)
Body=Body&MusicJs
Bottom=ExComm.BottomInfo
If Request.QueryString("classid")<>"" And Request.QueryString("selecttype")<>"" Then 
	Title=ExComm.G(request.QueryString("keyword"))
ElseIf Request.QueryString("classid")<>"" Then 
	Title=ExComm.GetClassName(CInt(Request.QueryString("classid")))
Else 
	Title=Application(sn&"blogname")
End If 
'输出内容
Head=Head&"<html xmlns=""http://www.w3.org/1999/xhtml"">"&vbcrlf
Head=Head&"<head>"&vbcrlf
Head=Head&"<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"">"&vbcrlf
Head=Head&"<meta name=""Description"" content="""&Application(sn&"BlogDescription")&""">"&vbcrlf
Head=Head&"<meta name=""Keywords"" content="""&Application(sn&"BlogKeyWord")&""">"&vbcrlf
Head=Head&"<title>"&Title&Application(sn&"IndexAddWord")&"</title>"&vbcrlf
Head=Head&"<script src=""inc/Main.js""></script>"
Head=Head&"<script src=""inc/UserInfo.js""></script>"
Head=Head&"<script src=""inc/jquery.js""></script>"
Head=Head&"<link href=""inc/OblogSkin.Css"" rel=""stylesheet"" type=""text/css"" />"&vbcrlf
Head=Head&"</head>"&vbcrlf
Head=Head&"<body>"&vbcrlf
If ExComm.IsOblogSkin Then 
	Response.Write Head
	Response.Write Body
	Response.Write "</body></html>"
Else
	Body=Replace(Body,"$show_blogtitle$",Title&Application(sn&"IndexAddWord"))
	Body=Replace(Body,"$show_blogkeyword$",Application(sn&"blogkeyword"))
	Body=Replace(Body,"$show_blogdescription$",Application(sn&"blogdescription"))
	Response.Write Body
End If 
If Application(Sn&"Runmode")<>"静态" Then 
	ExComm.visitorCount
End If 
Set ExComm=Nothing 
%>