<%
dim showmsg
Class sdcms_create
	Public Sub Create_index
	    filename="index"&sdcms_filetxt
		set sdcms_f=new Sdcms_Function
		show=sdcms_f.LoadFile(""&Load_temp_dir&"sdcms_index.htm")
		set power=new sdcms_power
		power.sdcms_power(id)
		sdcms_f.savefile "../",filename,show 
		echo "首页生成成功：<a href=../"&filename&" target=_blank>"&filename&"</a><br>"
		set power=nothing
		set sdcms_f=nothing
	End sub
	'-----------------------------------------------------------
	Public Sub Create_map
	    filename="sitemap"&sdcms_filetxt
		set sdcms_f=new Sdcms_Function
		show=sdcms_f.LoadFile(""&Load_temp_dir&"sdcms_map.htm")
		set power=new sdcms_power
		power.sdcms_power(id)
		sdcms_f.savefile "../",filename,show
		echo "地图生成成功：<a href=../"&filename&" target=_blank>"&filename&"</a><br>"
		sdcms_f.savefile "../","sitemap.xml",sitemap_google
		echo "Google地图生成成功：<a href=../sitemap.xml target=_blank>sitemap.xml</a><br>"
		set power=nothing
		set sdcms_f=nothing
	End sub
	
	Public Function sitemap_google
		set sdcms_f=new sdcms_function
		t0="<?xml version=""1.0"" encoding=""UTF-8""?>"
		t0=t0&"<urlset xmlns=""http://www.google.com/schemas/sitemap/0.84"">"
		t0=t0&"<url>"
		t0=t0&"<loc>"&sdcms_weburl&"</loc>"
		t0=t0&"<lastmod>"&sdcms_f.sdcms_date(date(),1)&"</lastmod>"
		t0=t0&"<changefreq>daily</changefreq>"
		t0=t0&"<priority>0.8</priority>"
		t0=t0&"</url>"
		set rs=conn.execute("select top 50 id,classid,htmlname,lastupdate from sd_info where ispass=1 and iscreate=1 order by lastupdate desc,id desc")
		while not rs.eof
		t0=t0&"<url>"
		t0=t0&"<loc>"&sdcms_weburl&sdcms_root&sdcms_htmdir&sdcms_f.loadrecord("classdir","sd_class",rs(1))&rs(2)&sdcms_filetxt&"</loc>"
		t1=year(rs(3))&"-"&right("0"&month(rs(3)),2)&"-"&right("0"&day(rs(3)),2)&"T"&right("0"&hour(rs(3)),2)&":"&right("0"&minute(rs(3)),2)&":"&right("0"&second(rs(3)),2)&"+08:00"
		t0=t0&"<lastmod>"&t1&"</lastmod>"
		t0=t0&"</url>"
		rs.movenext
		wend
		t0=t0&"</urlset>"
		sitemap_google=t0
		set sdcms_f=nothing
	End Function
	'-----------------------------------------------------------
	Public Sub Create_n_list
		set sdcms_f=new Sdcms_Function
		show=sdcms_f.LoadFile(""&Load_temp_dir&"sdcms_notice.htm")
	    upath =sdcms_f.Create_upfile("../notice")
		set power=new sdcms_power
		set rs=server.CreateObject("adodb.recordset")
		sql="select id,title,adddate from sd_notice order by id desc"
		rs.open sql,conn,1,1
		rs.PageSize =20
		if  rs.eof and rs.bof then
			power.sdcms_power(id)
			indexname="index"&sdcms_filetxt
			sdcms_f.savefile "../notice/",indexname,show
		else
			for k=1 to rs.PageCount
				page=k
				if k=1 then
					power.sdcms_power(id)
					indexname="index"&sdcms_filetxt
					sdcms_f.savefile "../notice/",indexname,show 
					show=sdcms_f.LoadFile(""&Load_temp_dir&"sdcms_notice.htm")
				else
					power.sdcms_power(id)
					indexname="index_"&k-1&sdcms_filetxt
					sdcms_f.savefile "../notice/",indexname,show 
					show=sdcms_f.LoadFile(""&Load_temp_dir&"sdcms_notice.htm")
				end if
			next
		end if
		echo "列表生成成功：<a href=../notice/ target=_blank>../notice/</a><br>"
		set power=nothing
		set sdcms_f=nothing
	End Sub
	
	Public Sub Create_notice_show(t0)
	    set sdcms_f=new sdcms_function
	    upath =sdcms_f.Create_upfile("../notice")
		sql="select id,title,author,adddate,hits,content,url,isurl from sd_notice where id="&t0&""
		set rs_n=conn.execute(sql)
		if rs_n.eof then
			exit Sub
		else
		    show_n_id=rs_n(0)
			show_n_title=rs_n(1)
			show_n_author=rs_n(2)
			show_n_date=rs_n(3)
			show_n_hits="<span id=""show_n_hits_hits""><script>get_hits("&rs_n(0)&",0,0,""show_n_hits_hits"");</script></span>"
			if rs_n(7)=0 then
			show_n_content=sitelinks(rs_n(5))
			else
			show_n_content="<script>window.location.href='"&rs_n(6)&"';</script>"
			end if
			rs_n.close
		end if
		
		'======================================
		'增加的分页标签内容
		set power=new sdcms_power
		show=sdcms_f.LoadFile(""&Load_temp_dir&"sdcms_notice_info.htm")
		getcontent=split(show_n_content,"$show_page$")
		pagenums=ubound(getcontent)
		for i=0 to pagenums  
			if i=0 then
			filename=show_n_id&sdcms_filetxt
			else
			filename=show_n_id&"_"&i&sdcms_filetxt
			end if   
			show_n_content=getcontent(i)
			content_page=""
			if i=0 then
			content_page=content_page&"<a>首页</a>"
			else
			content_page=content_page&"<a href="&show_n_id&""&sdcms_filetxt&">首页</a>"
			end if
			if i=0 then
			content_page=content_page&"<a>上一页</a>"
			elseif i=1 then
			content_page=content_page&"<a href="&show_n_id&""&sdcms_filetxt&">上一页</a>"
			else
			content_page=content_page&"<a href="&show_n_id&"_"&i-1&""&sdcms_filetxt&">上一页</a>"
			end if
			if i=0 then
			content_page=content_page&"<span>1</span>"
			else
			content_page=content_page&"<a href="&show_n_id&""&sdcms_filetxt&">1</a>"
			end if
			for k=1 to pagenums-1
			if pagenums<>1  and pagenums>i then
			if i=k then
			content_page=content_page&"<span>"&k+1&"</span>"
			else
			content_page=content_page&"<a href='"&show_n_id&"_"&k&sdcms_filetxt&"'>"&k+1&"</a>"
			end if
			end if
			if i=pagenums then
			if i=k then
			content_page=content_page&"<span>"&k&"</span>"
			else
			content_page=content_page&"<a href='"&show_n_id&"_"&k&sdcms_filetxt&"'>"&k+1&"</a>"
			end if
			end if
			next
			if i<pagenums or i>k then
			content_page=content_page&"<a href='"&show_n_id&"_"&pagenums&sdcms_filetxt&"'>"&pagenums+1&"</a>"
			else
			content_page=content_page&"<span>"&pagenums+1&"</span>"
			end if
			if i<pagenums or i>k then
			content_page=content_page&"<a href="&show_n_id&"_"&i+1&""&sdcms_filetxt&">下一页</a>"
			else
			content_page=content_page&"<a>下一页</a>"
			end if
			if i>=pagenums then
			content_page=content_page&"<a>末页</a>"
			else
			content_page=content_page&"<a href="&show_n_id&"_"&k&sdcms_filetxt&">末页</a>"
			end if
			if pagenums<=0 then 
			content_page=""
			end if
			power.sdcms_power(show_n_id)
			sdcms_f.savefile "../notice/",filename,show 
			echo "生成成功：<a href=../notice/"&filename&" target=_blank>"&filename&"</a><br>"
			show=sdcms_f.LoadFile(""&Load_temp_dir&"sdcms_notice_info.htm")
		next
        '增加内分页标签$show_page$结束
		'======================================
		set power=nothing
		set sdcms_f=nothing
	End Sub
	
	'-----------------------------------------------------------
	Public Sub Create_i_list(classids)
	    show_i_classid=classids
	    set sdcms_f=new Sdcms_Function
		show=sdcms_f.Loadlisttemp(classids)
		set power=new sdcms_power
		classid_s01=classids
		classid_s=conn.execute("select allclassid from sd_class where id="&classids&"")(0)
		if isempty(application(sdcms_cookies&classids)) then
		pagenums=create_app(classids,sdcms_f.LoadRecord("pagenum","sd_class",classids))
		else
		pagenums=application(sdcms_cookies&classids)
		end if
		set rs=server.CreateObject("adodb.recordset")
		sql="select id,title,adddate from sd_info where classid in("&classid_s&") order by id desc"
		rs.open sql,conn,1,1
		rs.PageSize =pagenums
		if  rs.eof and rs.bof then
			power.sdcms_power(id)
			indexname="index"&sdcms_filetxt
			sdcms_f.savefile sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",classids),indexname,show
		else
			for k=1 to rs.PageCount
				page=k
				if k=1 then    
					power.sdcms_power(id)
					indexname="index"&sdcms_filetxt
					sdcms_f.savefile sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",classids),indexname,show 
					show=sdcms_f.Loadlisttemp(classids)
				else
					power.sdcms_power(id)
					indexname="index_"&k-1&sdcms_filetxt
					sdcms_f.savefile sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",classids),indexname,show 
					show=sdcms_f.Loadlisttemp(classids)
				end if
			next
		end if
		echo "列表生成成功：<a href="&sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",classids)&" target=_blank>"&sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",classids)&"</a><br>"
		set power=nothing
		set sdcms_f=nothing
	End Sub
	
	Public Sub Create_info_show(t0)
	
		sql="select id,classid from sd_info where id="&t0&" and iscreate=1"
		set rs_s=conn.execute(sql)
		if not rs_s.eof then
			show_picid=rs_s(0)
			show_picclassid=rs_s(1)
		end if
		rs_s.close:set rs_s=nothing
	

		sql="select infoshow from sd_class where id="&show_picclassid&""
		set rs_t=conn.execute(sql)
		if not rs_t.eof then
		  show_temp=rs_t(0)
		end if
		rs_t.close:set rs_t=nothing

		if show_temp = 21 then

			showmsg=false
			sql="select id,title,content,classid,htmlname from sd_info where id="&t0&" and iscreate=1 "
			set rs_n=conn.execute(sql)
			if rs_n.eof then
				exit Sub
			else
				show_i_id=rs_n(0)
				show_i_title=rs_n(1)
				show_i_content=rs_n(2)
				show_i_classid=rs_n(3)
				show_i_htmlname=rs_n(4)
				rs_n.close
			end if

			imgshow=texted("<img.+?>",show_i_content)

			strd=split(imgshow,"""")
			for i=0 to ubound(strd)
			   if mid(right(strd(i),4),1,1)="." then
				 show_i_contents=show_i_contents&"<li><a rel='lightbox[roadtrip]' href="""&strd(i)&""" title="""&show_i_title&"""><img border ='0' src="""&strd(i)&""" /></a></li>"&vbCrLf
			   end if 
			next
	
			filename=show_i_id&sdcms_filetxt
			set sdcms_f=new Sdcms_Function
			class_dir=sdcms_f.LoadRecord("classdir","sd_class",show_i_classid)'查询语句
	
	
			show=sdcms_f.Loadlistshowtemp(show_i_classid)'加载文件信息模板内容		
			infoname=show_i_htmlname&sdcms_filetxt
			
			set power=new sdcms_power
			power.sdcms_power(show_i_id)
			
			if instr(show,"{sdcms:infopic_content}")>0 then
			   show=replace(show,"{sdcms:infopic_content}",show_i_contents)
			end if	
	
			show_i_contents=""
			'response.write show
			sdcms_f.savefile sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",show_i_classid),infoname,show 
			'echo "生成成功：<a href="&sdcms_root&class_dir&infoname&" target=_blank>"&infoname&"</a>　"
			showmsg=true
			show=sdcms_f.Loadlistshowtemp(show_i_classid)'加载文件信息模板内容
			
			set power=nothing
			set sdcms_f=nothing
		
			exit sub
		end if

		showmsg=false
		sql="select id,title,author,adddate,hits,content,url,isurl,classid,keyword,jj,htmlname,tags from sd_info where id="&t0&" and iscreate=1 "
		set rs_n=conn.execute(sql)
		if rs_n.eof then
			exit Sub
		else
		    show_i_id=rs_n(0)
			show_i_title=rs_n(1)
			show_i_author=rs_n(2)
			show_i_date=rs_n(3)
			show_i_hits_hits="<span id=""show_i_hits_hits""><script>get_hits("&rs_n(0)&",1,0,""show_i_hits_hits"");</script></span>"
			show_i_hits_day="<span id=""show_i_hits_day""><script>get_hits("&rs_n(0)&",1,1,""show_i_hits_day"");</script></span>"
			show_i_hits_week="<span id=""show_i_hits_week""><script>get_hits("&rs_n(0)&",1,2,""show_i_hits_week"");</script></span>"
			show_i_hits_month="<span id=""show_i_hits_month""><script>get_hits("&rs_n(0)&",1,3,""show_i_hits_month"");</script></span>"
			show_i_commentnum="<span id=""show_i_commentnum""><script>get_comment("&rs_n(0)&");</script></span>"
			if rs_n(7)=0 then
			show_i_content=sitelinks(rs_n(5))
			else
			show_i_content="<script>window.location.href='"&rs_n(6)&"';</script>"
			end if
			show_i_classid=rs_n(8)
			if rs_n(9)="" or isnull(rs_n(9)) then
			show_i_keyword=""
			else
			show_i_keyword=rs_n(9)
			end if
			show_i_jj=rs_n(10)
			show_i_htmlname=rs_n(11)
			show_infotags=get_tags(rs_n(12))
			rs_n.close
		end if
		 
		filename=show_i_id&sdcms_filetxt
		set sdcms_f=new Sdcms_Function
		class_dir=sdcms_f.LoadRecord("classdir","sd_class",show_i_classid)
		set rs_p=conn.execute("select top 1 id,title,classid,htmlname from sd_info where id<"&t0&" and classid="&show_i_classid&"  order by id desc")
		if rs_p.eof then
			show_i_pre="没有了"
		else
			show_i_pre="<a href="""&sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",rs_p(2))&rs_p(3)&sdcms_filetxt&""">"&rs_p(1)&"</a>"
		end if
		rs_p.close
		set rs_nt=conn.execute("select top 1 id,title,classid,htmlname from sd_info where id>"&t0&" and classid="&show_i_classid&" ")
		if  rs_nt.eof then
			show_i_next="没有了"
		else
			show_i_next="<a href="""&sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",rs_nt(2))&rs_nt(3)&sdcms_filetxt&""">"&rs_nt(1)&"</a>"
		end if
		rs_nt.close
		'======================================
		'增加的分页标签内容
		set power=new sdcms_power
		show=sdcms_f.Loadlistshowtemp(show_i_classid)
		getcontent=split(show_i_content,"$show_page$")
		pagenums=ubound(getcontent)
		for i=0 to pagenums  
			if i=0 then
			infoname=show_i_htmlname&sdcms_filetxt
			else
			infoname=show_i_htmlname&"_"&i&sdcms_filetxt
			end if   
			show_i_content=getcontent(i)
			content_page=""
			if i=0 then
			content_page=content_page&"<a>首页</a>"
			else
			content_page=content_page&"<a href="&show_i_htmlname&""&sdcms_filetxt&">首页</a>"
			end if
			if i=0 then
			content_page=content_page&"<a>上一页</a>"
			elseif i=1 then
			content_page=content_page&"<a href="&show_i_htmlname&""&sdcms_filetxt&">上一页</a>"
			else
			content_page=content_page&"<a href="&show_i_htmlname&"_"&i-1&""&sdcms_filetxt&">上一页</a>"
			end if
			if i=0 then
			content_page=content_page&"<span>1</span>"
			else
			content_page=content_page&"<a href="&show_i_htmlname&""&sdcms_filetxt&">1</a>"
			end if
			for k=1 to pagenums-1
			if pagenums<>1  and pagenums>i then
			if i=k then
			content_page=content_page&"<span>"&k+1&"</span>"
			else
			content_page=content_page&"<a href='"&show_i_htmlname&"_"&k&sdcms_filetxt&"'>"&k+1&"</a>"
			end if
			end if
			if i=pagenums then
			if i=k then
			content_page=content_page&"<span>"&k&"</span>"
			else
			content_page=content_page&"<a href='"&show_i_htmlname&"_"&k&sdcms_filetxt&"'>"&k+1&"</a>"
			end if
			end if
			next
			if i<pagenums or i>k then
			content_page=content_page&"<a href='"&show_i_htmlname&"_"&pagenums&sdcms_filetxt&"'>"&pagenums+1&"</a>"
			else
			content_page=content_page&"<span>"&pagenums+1&"</span>"
			end if
			if i<pagenums or i>k then
			content_page=content_page&"<a href="&show_i_htmlname&"_"&i+1&""&sdcms_filetxt&">下一页</a>"
			else
			content_page=content_page&"<a>下一页</a>"
			end if
			if i>=pagenums then
			content_page=content_page&"<a>末页</a>"
			else
			content_page=content_page&"<a href="&show_i_htmlname&"_"&k&sdcms_filetxt&">末页</a>"
			end if
			if pagenums<=0 then 
			content_page=""
			end if
			power.sdcms_power(show_i_id)
			sdcms_f.savefile sdcms_root&sdcms_htmdir&sdcms_f.LoadRecord("classdir","sd_class",show_i_classid),infoname,show 
			'echo "生成成功：<a href="&sdcms_root&class_dir&infoname&" target=_blank>"&infoname&"</a>　"
			showmsg=true
			show=sdcms_f.Loadlistshowtemp(show_i_classid)
		next
        '增加内分页标签$show_page$结束
		'======================================
		set power=nothing
		set sdcms_f=nothing
		

	End Sub
	
	Public Sub Create_class_list(id)
	set rs=conn.execute("select id,classdir,indexshow,listshow from sd_class where id="&id&"")
	if rs.eof then
		exit sub
	else
	    set sdcms_f=new sdcms_function
	    upath =sdcms_f.Create_upfile(sdcms_root&sdcms_htmdir&rs(1))
		select case rs(2)
			case "0":Create_i_list rs(0)
			case else:Create_channel rs(0)
		end select
		set sdcms_f=nothing
	end if
	End Sub
	
	Public Sub Create_channel(t0)
		set rs=conn.execute("select indexshow,classdir from sd_class where id="&t0&"")
		if not rs.eof then
	 
			if rs(0)<>0 then
				filename="index"&sdcms_filetxt
				set sdcms_f=new Sdcms_Function
				show=sdcms_f.LoadRecord("content","sd_temp",rs(0))
				set power=new sdcms_power
				power.sdcms_power(id)
				sdcms_f.savefile sdcms_root&sdcms_htmdir&rs(1),filename,show 
				echo "频道首页生成成功：<a href="&sdcms_root&sdcms_htmdir&rs(1)&filename&" target=_blank>"&filename&"</a><br>"
				set power=nothing
				set sdcms_f=nothing
			End If
			
		End if
	End Sub
	
	Public Sub Create_other(t0)
	    set sdcms_f=new sdcms_function
		sql="select title,tempid,content,id,htmlname,pagedir from sd_other where id="&t0&""
		set rs_o=conn.execute(sql)
		if rs_o.eof then
			exit Sub
		else
		    other_id=rs_o(3)
		    other_title=rs_o(0)
			other_temp=rs_o(1)
			other_content=sitelinks(rs_o(2))
			other_htmlname=rs_o(4)
			sdcms_pagedir=rs_o(5)
			other_link = sdcms_pagedir & other_htmlname & sdcms_filetxt
			rs_o.close
		end if
		if sdcms_pagedir<>"/" then
			sdcms_f.Create_upfile(sdcms_pagedir)
		end if
		'======================================
		'增加的分页标签内容
		set power=new sdcms_power
		if other_temp=0 then
			show=sdcms_f.LoadFile(""&Load_temp_dir&"sdcms_page.htm")
		else
			show=sdcms_f.Loadrecord("content","sd_temp",other_temp)
		end if
		getcontent=split(other_content,"$show_page$")
		pagenums=ubound(getcontent)
		for i=0 to pagenums  
			if i=0 then
			filename=other_htmlname&sdcms_filetxt
			else
			filename=other_htmlname&"_"&i&sdcms_filetxt
			end if   
			other_content=getcontent(i)
			content_page=""
			if i=0 then
			content_page=content_page&"<a>首页</a>"
			else
			content_page=content_page&"<a href="&other_htmlname&""&sdcms_filetxt&">首页</a>"
			end if
			if i=0 then
			content_page=content_page&"<a>上一页</a>"
			elseif i=1 then
			content_page=content_page&"<a href="&other_htmlname&""&sdcms_filetxt&">上一页</a>"
			else
			content_page=content_page&"<a href="&other_htmlname&"_"&i-1&""&sdcms_filetxt&">上一页</a>"
			end if
			if i=0 then
			content_page=content_page&"<span>1</span>"
			else
			content_page=content_page&"<a href="&other_htmlname&""&sdcms_filetxt&">1</a>"
			end if
			for k=1 to pagenums-1
			if pagenums<>1  and pagenums>i then
			if i=k then
			content_page=content_page&"<span>"&k+1&"</span>"
			else
			content_page=content_page&"<a href='"&other_htmlname&"_"&k&sdcms_filetxt&"'>"&k+1&"</a>"
			end if
			end if
			if i=pagenums then
			if i=k then
			content_page=content_page&"<span>"&k&"</span>"
			else
			content_page=content_page&"<a href='"&other_htmlname&"_"&k&sdcms_filetxt&"'>"&k+1&"</a>"
			end if
			end if
			next
			if i<pagenums or i>k then
			content_page=content_page&"<a href='"&other_htmlname&"_"&pagenums&sdcms_filetxt&"'>"&pagenums+1&"</a>"
			else
			content_page=content_page&"<span>"&pagenums+1&"</span>"
			end if
			if i<pagenums or i>k then
			content_page=content_page&"<a href="&other_htmlname&"_"&i+1&""&sdcms_filetxt&">下一页</a>"
			else
			content_page=content_page&"<a>下一页</a>"
			end if
			if i>=pagenums then
			content_page=content_page&"<a>末页</a>"
			else
			content_page=content_page&"<a href="&other_htmlname&"_"&k&sdcms_filetxt&">末页</a>"
			end if
			if pagenums<=0 then 
			content_page=""
			end if
			power.sdcms_power(other_id)
			sdcms_f.savefile sdcms_pagedir,filename,show 
			echo "生成成功：<a href="&sdcms_pagedir&filename&" target=_blank>"&filename&"</a><br>"
			if other_temp=0 then
			show=sdcms_f.LoadFile(""&Load_temp_dir&"sdcms_page.htm")
			else
			show=sdcms_f.Loadrecord("content","sd_temp",other_temp)
		end if
		next
        '增加内分页标签$show_page$结束
		'======================================
		set power=nothing
		set sdcms_f=nothing
	End Sub
End Class
%>