<%
'*******************************************************
'易达CMS中小企业快速建站系统
'软件开发 黑龙江省世纪伟成网络科技有限公司
'网址：http://yidacms.com
'软件享有著作权，未经公司或开发者同意禁止更改以下代码。
'*******************************************************
function Photo(str)
	set reg=new regexp
	reg.IgnoreCase = False 
	reg.Global = True 
	reg.Pattern = "<Photo:\{(.+?)\}>([\s\S]*?)<Photo>"
	set aa=reg.execute(str)
	for each match in aa
	bq=match.submatches(0)
	nr=match.submatches(1)
        Language=nbq(bq,"Language")
	Row=nbq(bq,"Row")
	leixing=nbq(bq,"leixing")
	Tlen=nbq(bq,"Tlen")
	str=replace(str,match,GetPhoto(Language,Row,nr,leixing,Tlen))
	next
	Photo=str
end function

Function GetPhoto(Language,Row,yida_cms,leixing,Tlen)
set rs = server.createobject("adodb.recordset")
sql="select top "&Row&" * from shuaiweb_photo where shuaiweb_photosort = "&leixing&" or shuaiweb_photosort2 = "&leixing&" and yida_language = '" & Language & "' ORDER BY id DESC"
rs.open sql,dbok,1,1
Do While Not rs.EOF

if Language = "ch" then
 if yida_url = "asp" then
  GetPhotourl = webpath & "zh_photo_view.asp?id=" & rs("id")
   elseif yida_url = "html" or yida_url = "asphtml" then
  GetPhotourl = webpath & "html/photo/photo_"&rs("id")&".html"
 end if
elseif Language = "en" then
 if yida_url = "asp" then
  GetPhotourl = webpath & "en_photo_view.asp?id=" & rs("id")
   elseif yida_url = "html" or yida_url = "asphtml" then
  GetPhotourl = webpath & "html/en_photo/photo_"&rs("id")&".html"
 end if
end if

yida_cms1=replace(yida_cms,"{Photo:id}",rs("id"))
yida_cms2=replace(yida_cms1,"{Photo:name}",left(rs("shuaiweb_photoname"),Tlen))
yida_cms3=replace(yida_cms2,"{Photo:img1}",rs("shuaiweb_photoimg1"))
yida_cms4=replace(yida_cms3,"{Photo:img2}",rs("shuaiweb_photoimg2"))
yida_cms5=replace(yida_cms4,"{Photo:img3}",rs("shuaiweb_photoimg3"))
yida_cms6=replace(yida_cms5,"{Photo:img4}",rs("shuaiweb_photoimg4"))
yida_cms7=replace(yida_cms6,"{Photo:img5}",rs("shuaiweb_photoimg5"))

if Language = "ch" then
 yida_cms8=replace(yida_cms7,"{Photo:tuwenshijian}",FormatDate(rs("time"),4))
  elseif Language = "en" then
 yida_cms8=replace(yida_cms7,"{Photo:tuwenshijian}",FormatDate(rs("time"),12))
end if

yida_cms9=replace(yida_cms8,"{Photo:url}",GetPhotourl)
yida_cms10=replace(yida_cms9,"{Photo:tuwenneirong}",left(RemoveHTML(rs("shuaiweb_photocontent")),100))

tt=tt+yida_cms10
rs.movenext						
Loop
GetPhoto = tt
rs.Close
set rs=nothing	
End Function

function Photoclass(str)
	set reg=new regexp
	reg.IgnoreCase = False 
	reg.Global = True 
	reg.Pattern = "<Photoclass:\{(.+?)\}>([\s\S]*?)<Photoclass>"
	set aa=reg.execute(str)
	for each match in aa
	bq=match.submatches(0)
	nr=match.submatches(1)
	Language=nbq(bq,"Language")
        Quanbu=nbq(bq,"Quanbu")
	Row=nbq(bq,"Row")
        Lanmu=nbq(bq,"Lanmu")
        Leixing=nbq(bq,"Leixing")
	str=replace(str,match,tuwenfenlei(Language,Quanbu,Row,Lanmu,Leixing,nr))
	next
	Photoclass=str
end function

Function tuwenfenlei(Language,Quanbu,Row,Lanmu,Leixing,yida_cms)
	set rs = server.createobject("adodb.recordset")
   if Quanbu = 0 then
	sql="select top "&Row&" * from shuaiweb_Photoclass where wait_tcsi = 1 and wait_tcyi = '0' and yida_language='" & Language & "' ORDER BY shuaiweb_classsort ASC"
          elseif Quanbu = 1 then
	sql="select * from shuaiweb_Photoclass where wait_tcsi = 1 and id = " & Leixing & " and yida_language='" & Language & "' ORDER BY shuaiweb_classsort ASC"
   end if
	rs.open sql,dbok,1,1
	Do While Not rs.EOF

        if Language = "ch" then
         if yida_url = "asp" then
          Photoclassurl = webpath & "zh_photo.asp?id=" & rs("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          Photoclassurl = webpath & "html/photo/photolist_"&rs("id")&".html"
         end if
        elseif Language = "en" then
         if yida_url = "asp" then
          Photoclassurl = webpath & "en_photo.asp?id=" & rs("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          Photoclassurl = webpath & "html/en_photo/photolist_"&rs("id")&".html"
         end if
        end if

if Lanmu = 1 then
        yida_cms1=replace(yida_cms,"{Photo:name}",rs("shuaiweb_classname"))
        yida_cms2=replace(yida_cms1,"{Photo:id}",rs("id"))
        yida_cms3=replace(yida_cms2,"{Photoclass:url}",Photoclassurl)
        tt=tt+yida_cms3
end if

	set rss = server.createobject("adodb.recordset")
         if Quanbu = 0 then
	sql="select * from shuaiweb_Photoclass where wait_tcsi = 1 and wait_tcyi = '"&rs("id")&"' ORDER BY shuaiweb_classsort ASC"
         elseif Quanbu = 1 then
	sql="select * from shuaiweb_Photoclass where wait_tcsi = 1 and wait_tcyi = '" & Leixing & "' ORDER BY shuaiweb_classsort ASC"
         end if
	rss.open sql,dbok,1,1
	Do While Not rss.EOF

        if Language = "ch" then
         if yida_url = "asp" then
          Photoclassurl1 = webpath & "zh_photo.asp?id=" & rss("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          Photoclassurl1 = webpath & "html/photo/photolist_"&rss("id")&".html"
         end if
        elseif Language = "en" then
         if yida_url = "asp" then
          Photoclassurl1 = webpath & "en_photo.asp?id=" & rss("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          Photoclassurl1 = webpath & "html/en_photo/photolist_"&rss("id")&".html"
         end if
        end if

 if Lanmu = 1 then
  yida_cms1=replace(yida_cms,"{Photo:name}","┝ " & rss("shuaiweb_classname"))
   else
  yida_cms1=replace(yida_cms,"{Photo:name}",rss("shuaiweb_classname"))
 end if

        yida_cms2=replace(yida_cms1,"{Photo:id}",rss("id"))
        yida_cms3=replace(yida_cms2,"{Photoclass:url}",Photoclassurl1)
        tt=tt+yida_cms3
    rss.movenext
    Loop
    rss.close
    set rss = nothing

	rs.movenext						
	Loop
	rs.Close
	set rs=nothing
        tuwenfenlei = tt
End Function

function Photolist(str)
	set reg=new regexp
	reg.IgnoreCase = False 
	reg.Global = True 
	reg.Pattern = "<Photolist:\{(.+?)\}>([\s\S]*?)<Photolist>"
	set aa=reg.execute(str)
	for each match in aa
	bq=match.submatches(0)
	nr=match.submatches(1)
	Language=nbq(bq,"Language")
	Tlen=nbq(bq,"Tlen")
	str=replace(str,match,Photoliebiao(nr,Language,Tlen))
	next
	Photolist=str
end function

Function Photoliebiao(yida_cms,Language,Tlen)  
set rs = server.createobject("adodb.recordset")
if request("id") = "" then
 sql="select * from shuaiweb_photo where yida_language ='" & Language & "' ORDER BY id DESC"
  else
 yidacms_Photolist = cint(request("id"))
 sql="select * from shuaiweb_photo where shuaiweb_photosort = "&yidacms_Photolist&" or shuaiweb_photosort2 = "&yidacms_Photolist&" and yida_language ='" & Language & "' ORDER BY id DESC"
end if 
rs.open sql,dbok,1,1
if rs.eof then
	zanwu = zanwuxinwen
		else
			rs.PageSize = vipzhphotolist
				iCount=rs.RecordCount 
					iPageSize=rs.PageSize
						maxpage=rs.PageCount 
							page=request("page")
if Not IsNumeric(page) or page="" then
	page=1
		else
			page=cint(page)
				end if
					if page<1 then
						page=1
							elseif  page>maxpage then
								page=maxpage
									end if
	 									rs.AbsolutePage=Page
if page=maxpage then
	x=iCount-(maxpage-1)*iPageSize
		else
			x=iPageSize
				end if
For i=1 To x

        if Language = "ch" then
         if yida_url = "asp" then
          photolisturl = webpath & "zh_photo_view.asp?id=" & rs("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          photolisturl = webpath & "html/photo/photo_"&rs("id")&".html"
         end if
        elseif Language = "en" then
         if yida_url = "asp" then
          photolisturl = webpath & "en_photo_view.asp?id=" & rs("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          photolisturl = webpath & "html/en_photo/photo_"&rs("id")&".html"
         end if
        end if

yida_cms1=replace(yida_cms,"{Photo:id}",rs("id"))
yida_cms2=replace(yida_cms1,"{Photo:name}",left(rs("shuaiweb_photoname"),Tlen))
yida_cms3=replace(yida_cms2,"{Photo:img1}",rs("shuaiweb_photoimg1"))
yida_cms4=replace(yida_cms3,"{Photo:img2}",rs("shuaiweb_photoimg2"))
yida_cms5=replace(yida_cms4,"{Photo:img3}",rs("shuaiweb_photoimg3"))
yida_cms6=replace(yida_cms5,"{Photo:img4}",rs("shuaiweb_photoimg4"))
yida_cms7=replace(yida_cms6,"{Photo:img5}",rs("shuaiweb_photoimg5"))

if Language = "ch" then
 yida_cms8=replace(yida_cms7,"{Photo:tuwenshijian}",FormatDate(rs("time"),4))
  elseif Language = "en" then
 yida_cms8=replace(yida_cms7,"{Photo:tuwenshijian}",FormatDate(rs("time"),12))
end if

yida_cms9=replace(yida_cms8,"{Photo:url}",photolisturl)
yida_cms10=replace(yida_cms9,"{Photo:tuwenneirong}",left(RemoveHTML(rs("shuaiweb_photocontent")),100))

tt=tt+yida_cms10

	rs.movenext						
	next
end if
rs.Close
set rs=nothing
if Language = "ch" then
	Photoliebiao = tt & zanwu & PageControl(iCount,maxpage,page,"<p align=center>",3)
		else
	Photoliebiao = tt & zanwu & PageControl1(iCount,maxpage,page,"<p align=center>",3)
end if
End Function

Function Photoview(a)
        Photo_id = cint(request("id"))
	set rs = server.createobject("adodb.recordset")
	sql="select * from shuaiweb_photo WHERE id = "&Photo_id&""
	rs.open sql,dbok,1,3

	yidacms_tag_Photo = yidacms_tag_Photo &_ 

	(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(rs("shuaiweb_photocontent"),"{sys:weburl}",sw_dizhi),"{sys:title}",sw_webtitle),"{sys:gongsibiaoti}",co_name),"{sys:gongsidizhi}",sw_gongsidizhi),"{sys:dianhua}",sw_dianhua),"{sys:yidongdianhua}",sw_yidongdianhua),"{sys:chuanzhen}",sw_chuanzhen),"{sys:qq}",sw_qq),"{sys:lianxiren}",sw_lianxiren),"{sys:beian}",sw_beian),"{sys:youxiang}",sw_youxiang),"{sys:youbian}",sw_youbian))

        a = replace(a,"{Photo:name}",rs("shuaiweb_photoname"))
        a = replace(a,"{Photo:img}",yidacms_photoimg)
        a = replace(a,"{Photo:img1}",rs("shuaiweb_photoimg1"))
        a = replace(a,"{Photo:img2}",rs("shuaiweb_photoimg2"))
        a = replace(a,"{Photo:img3}",rs("shuaiweb_photoimg3"))
        a = replace(a,"{Photo:img4}",rs("shuaiweb_photoimg4"))
        a = replace(a,"{Photo:img5}",rs("shuaiweb_photoimg5"))
        a = replace(a,"{Photo:tuwenneirong}",yidacms_tag_Photo)

        if rs("yida_language") = "ch" then
         a = replace(a,"{Photo:tuwenshijian}",FormatDate(rs("time"),4))
          elseif rs("yida_language") = "en" then
         a = replace(a,"{Photo:tuwenshijian}",FormatDate(rs("time"),12))
        end if

        If Not(rs.bof and rs.eof) Then
        a = replace(a,"{Photo:liulan}",rs("shuaiweb_photonumber"))
        rs("shuaiweb_photonumber") = rs("shuaiweb_photonumber") +1
        Rs.UPDATE
        end if
	rs.Close
	set rs=nothing
Photoview = a
End Function

	Function Photo_classhtml(a)
        Photoclass_id = cint(request("id"))
	if request("id") = "" then
		a = replace(a,"{Photo:classhtml}"," ")
			else
		set rs = server.createobject("adodb.recordset")
		sql="select * from shuaiweb_photoclass WHERE id = "&Photoclass_id&""
		rs.open sql,dbok,1,1
			if rs("shuaiweb_photohtml") = "" then
        			a = replace(a,"{Photo:classhtml}","无栏目自定义html")
					else
        			a = replace(a,"{Photo:classhtml}",rs("shuaiweb_photohtml"))
			end if
		rs.Close
		set rs=nothing
	end if
        Photo_classhtml = a
	End Function
%>