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

Function Getnews(Language,Row,yida_cms,leixing,Tlen)
set rs = server.createobject("adodb.recordset")
sql="select top "&Row&" * from shuaiweb_news where shuaiweb_newssort = "&leixing&" or shuaiweb_newssort2 = "&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
  Getnewsurl = webpath & "zh_news_view.asp?id=" & rs("id")
   elseif yida_url = "html" or yida_url = "asphtml" then
  Getnewsurl = webpath & "html/news/news_"&rs("id")&".html"
 end if
elseif Language = "en" then
 if yida_url = "asp" then
  Getnewsurl = webpath & "en_news_view.asp?id=" & rs("id")
   elseif yida_url = "html" or yida_url = "asphtml" then
  Getnewsurl = webpath & "html/en_news/news_"&rs("id")&".html"
 end if
end if

yida_cms1=replace(yida_cms,"{News:name}",left(rs("shuaiweb_newstitle"),Tlen))
yida_cms2=replace(yida_cms1,"{News:name_color}","<font color='"&rs("wait_neyi")&"'>" & left(rs("shuaiweb_newstitle"),Tlen) & "</font>")
yida_cms3=replace(yida_cms2,"{News:id}",rs("id"))
yida_cms4=replace(yida_cms3,"{News:xinwenzuozhe}",rs("shuaiweb_newsAuthor"))
yida_cms5=replace(yida_cms4,"{News:xinwenlaiyuan}",rs("shuaiweb_newsSource"))

if Language = "ch" then
 yida_cms6=replace(yida_cms5,"{News:xinwenshijian}",FormatDate(rs("time"),4))
  elseif Language = "en" then
 yida_cms6=replace(yida_cms5,"{News:xinwenshijian}",FormatDate(rs("time"),12))
end if
yida_cms7=replace(yida_cms6,"{News:url}",Getnewsurl)
yida_cms8=replace(yida_cms7,"{News:tupian}",newstupian)
yida_cms9=replace(yida_cms8,"{News:xinwenneirong}",left(RemoveHTML(rs("shuaiweb_newsContent")),100))

tt=tt+yida_cms9
rs.movenext						
Loop
Getnews = tt
rs.Close
set rs=nothing	
End Function

function Newsclass(str)
	set reg=new regexp
	reg.IgnoreCase = False 
	reg.Global = True 
	reg.Pattern = "<Newsclass:\{(.+?)\}>([\s\S]*?)<Newsclass>"
	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,xinwenfenlei(Language,Quanbu,Row,Lanmu,Leixing,nr))
	next
	Newsclass=str
end function

Function xinwenfenlei(Language,Quanbu,Row,Lanmu,Leixing,yida_cms)
	set rs = server.createobject("adodb.recordset")
   if Quanbu = 0 then
	sql="select top "&Row&" * from shuaiweb_newsclass where wait_ncsi = 1 and wait_ncyi = '0' and yida_language='" & Language & "' ORDER BY shuaiweb_classsort ASC"
          elseif Quanbu = 1 then
	sql="select * from shuaiweb_newsclass where wait_ncsi = 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
          newsclassurl = webpath & "zh_news.asp?id=" & rs("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          newsclassurl = webpath & "html/news/newslist_"&rs("id")&".html"
         end if
        elseif Language = "en" then
         if yida_url = "asp" then
          newsclassurl = webpath & "en_news.asp?id=" & rs("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          newsclassurl = webpath & "html/en_news/newslist_"&rs("id")&".html"
         end if
        end if

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

	set rss = server.createobject("adodb.recordset")
         if Quanbu = 0 then
	sql="select * from shuaiweb_newsclass where wait_ncsi = 1 and wait_ncyi = '"&rs("id")&"' ORDER BY shuaiweb_classsort ASC"
         elseif Quanbu = 1 then
	sql="select * from shuaiweb_newsclass where wait_ncsi = 1 and wait_ncyi = '" & 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
          newsclassurl1 = webpath & "zh_news.asp?id=" & rss("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          newsclassurl1 = webpath & "html/news/newslist_"&rss("id")&".html"
         end if
        elseif Language = "en" then
         if yida_url = "asp" then
          newsclassurl1 = webpath & "en_news.asp?id=" & rss("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          newsclassurl1 = webpath & "html/en_news/newslist_"&rss("id")&".html"
         end if
        end if

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

        yida_cms2=replace(yida_cms1,"{News:id}",rss("id"))
        yida_cms3=replace(yida_cms2,"{Newsclass:url}",newsclassurl1)
        tt=tt+yida_cms3
    rss.movenext
    Loop
    rss.close
    set rss = nothing

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

function Newslist(str)
	set reg=new regexp
	reg.IgnoreCase = False 
	reg.Global = True 
	reg.Pattern = "<Newslist:\{(.+?)\}>([\s\S]*?)<Newslist>"
	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,xinwenliebiao(nr,Language,Tlen))
	next
	Newslist=str
end function

Function xinwenliebiao(yida_cms,Language,Tlen)  
set rs = server.createobject("adodb.recordset")
if request("id") = "" then
 sql="select * from shuaiweb_news where yida_language ='" & Language & "' ORDER BY id DESC"
  else
 yidacms_newslist = cint(request("id"))
 sql="select * from shuaiweb_news where shuaiweb_newssort = "&yidacms_newslist&" or shuaiweb_newssort2 = "&yidacms_newslist&" 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 = vipnewslist
				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
          Newslisturl = webpath & "zh_news_view.asp?id=" & rs("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          Newslisturl = webpath & "html/news/news_"&rs("id")&".html"
         end if
        elseif Language = "en" then
         if yida_url = "asp" then
          Newslisturl = webpath & "en_news_view.asp?id=" & rs("id")
           elseif yida_url = "html" or yida_url = "asphtml" then
          Newslisturl = webpath & "html/en_news/news_"&rs("id")&".html"
         end if
        end if

yida_cms1=replace(yida_cms,"{News:name}","<font color='"&rs("wait_neyi")&"'>" & left(rs("shuaiweb_newstitle"),Tlen) & "</font>")
yida_cms2=replace(yida_cms1,"{News:id}",rs("id"))
yida_cms3=replace(yida_cms2,"{News:xinwenzuozhe}",rs("shuaiweb_newsAuthor"))
yida_cms4=replace(yida_cms3,"{News:xinwenlaiyuan}",rs("shuaiweb_newsSource"))
if Language = "ch" then
 yida_cms5=replace(yida_cms4,"{News:xinwenshijian}",FormatDate(rs("time"),4))
  elseif Language = "en" then
 yida_cms5=replace(yida_cms4,"{News:xinwenshijian}",FormatDate(rs("time"),12))
end if
yida_cms6=replace(yida_cms5,"{News:url}",Newslisturl)
yida_cms7=replace(yida_cms6,"{News:xinwenneirong}",left(RemoveHTML(rs("shuaiweb_newsContent")),100))
tt=tt+yida_cms7

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

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

	yidacms_tag_news = yidacms_tag_news &_ 

	(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(rs("shuaiweb_newsContent"),"{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,"{News:name}",rs("shuaiweb_newstitle"))
        a = replace(a,"{News:xinwenzaiyao}",rs("shuaiweb_newsAbstract"))
        a = replace(a,"{News:xinwenlaiyuan}",rs("shuaiweb_newsSource"))
        a = replace(a,"{News:xinwenzuozhe}",rs("shuaiweb_newsAuthor"))
        a = replace(a,"{News:xinwenneirong}",yidacms_tag_news)
        if rs("yida_language") = "ch" then
         a = replace(a,"{News:xinwenshijian}",FormatDate(rs("time"),4))
          elseif rs("yida_language") = "en" then
         a = replace(a,"{News:xinwenshijian}",FormatDate(rs("time"),12))
        end if
        If Not(rs.bof and rs.eof) Then
        a = replace(a,"{News:liulan}",rs("wait_nesan"))
        rs("wait_nesan") = rs("wait_nesan") +1
        Rs.UPDATE
        end if
	rs.Close
	set rs=nothing
Newsview = a
End Function

function WapNews(str)
	set reg=new regexp
	reg.IgnoreCase = False 
	reg.Global = True 
	reg.Pattern = "<WapNews:\{(.+?)\}>([\s\S]*?)<WapNews>"
	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,WapGetnews(Language,Row,nr,leixing,Tlen))
	next
	WapNews=str
end function

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

if Language = "ch" then
  Getnewsurl = webpath & "wap/zh_news_view.asp?id=" & rs("id")
elseif Language = "en" then
  Getnewsurl = webpath & "wap/en_news_view.asp?id=" & rs("id")
end if

yida_cms1=replace(yida_cms,"{News:name}",left(rs("shuaiweb_newstitle"),Tlen))
yida_cms2=replace(yida_cms1,"{News:name_color}","<font color='"&rs("wait_neyi")&"'>" & left(rs("shuaiweb_newstitle"),Tlen) & "</font>")
yida_cms3=replace(yida_cms2,"{News:id}",rs("id"))
yida_cms4=replace(yida_cms3,"{News:xinwenzuozhe}",rs("shuaiweb_newsAuthor"))
yida_cms5=replace(yida_cms4,"{News:xinwenlaiyuan}",rs("shuaiweb_newsSource"))

if Language = "ch" then
 yida_cms6=replace(yida_cms5,"{News:xinwenshijian}",FormatDate(rs("time"),4))
  elseif Language = "en" then
 yida_cms6=replace(yida_cms5,"{News:xinwenshijian}",FormatDate(rs("time"),12))
end if
yida_cms7=replace(yida_cms6,"{News:url}",Getnewsurl)
yida_cms8=replace(yida_cms7,"{News:tupian}",newstupian)
tt=tt+yida_cms8
rs.movenext						
Loop
WapGetnews = tt
rs.Close
set rs=nothing
End Function


	Function News_classhtml(a)
        newsclass_id = cint(request("id"))
	if request("id") = "" then
		a = replace(a,"{News:classhtml}"," ")
			else
		set rs = server.createobject("adodb.recordset")
		sql="select * from shuaiweb_newsclass WHERE id = "&newsclass_id&""
		rs.open sql,dbok,1,1
			if rs("shuaiweb_newshtml") = "" then
        			a = replace(a,"{News:classhtml}","无栏目自定义html")
					else
        			a = replace(a,"{News:classhtml}",rs("shuaiweb_newshtml"))
			end if
		rs.Close
		set rs=nothing
	end if
        News_classhtml = a
	End Function

%>