<!--#include file="../../fy.Function.asp"-->
<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>fycms后台管理系统</title>
<link rel="stylesheet" type="text/css" href="../../css/base.css">
<link rel="stylesheet" type="text/css" href="../../css/content.css">
<script type='text/javascript' src='../../js/main.js'></script>
</head>
<body>
<div class="content"> 
	<div class="breadnav">当前位置：<a href="#">后台首页</a> >> 伪静态生成</div>
    
   <% 
	If Not fycms.fycms_QXYZ(0,"makerewrite","") Then   Call fycms.Alert("对不起，你没有操作权限！","") 
Dim MXarr,i
 dim Action,ID,ShowErr,content,strtemp,classrewrite,rs2,sql
	Action = Request("Action")
 		If request("action")="save" Then 
		Dim Connfile
		Connfile = Connfile &  "<" & "%" & vbCrLf
		Connfile = Connfile &  "Dim Content_list_url" & vbCrLf
 	    MXarr=fycms.Act_MX_Sys_Arr()
		classrewrite=delAsp(request("classrewrite"))
		Connfile = Connfile &"Content_list_url="""&classrewrite&""""& vbCrLf
 		Dim classrewriteurl,content_all_rewriteurl
		classrewriteurl=classrewrite
		If Instr(classrewriteurl,"{id}") > 0 Then classrewriteurl = Replace(classrewriteurl,"{id}","([0-9]+)")
		If Instr(classrewriteurl,"{classid}") > 0 Then classrewriteurl = Replace(classrewriteurl,"{classid}","([0-9]+)")
		If Instr(classrewriteurl,"{modeid}") > 0 Then classrewriteurl = Replace(classrewriteurl,"{modeid}","([0-9]+)")
		If Instr(classrewriteurl,"{pinyinnum}") > 0 Then classrewriteurl = Replace(classrewriteurl,"{pinyinnum}","(.*)")
		Dim classrewriteurls
		classrewriteurls=classrewriteurl
 		classrewriteurl="RewriteRule ^(.*)"&fycms.actsys&classrewriteurls&"/([0-9]+)$ $1"&fycms.actsys&"list\.asp\?cid=$2&page=$3 [I,O]"& vbCrLf
		classrewriteurl=classrewriteurl&"RewriteRule ^(.*)"&fycms.actsys&classrewriteurls&"$ $1"&fycms.actsys&"list\.asp\?cid=$2 [I,O]"& vbCrLf
		If IsArray(MXarr) Then
			For I=0 To Ubound(MXarr,2)
				strtemp = delAsp(request("contentrewrite"&MXarr(0,I)))

		Connfile = Connfile &  "Dim Content"&MXarr(0,I)&"_rewrite_url" & vbCrLf
 		Connfile = Connfile &"Content"&MXarr(0,I)&"_rewrite_url="""&strtemp&""""& vbCrLf

					Dim contentrewriteurl
					contentrewriteurl=delAsp(request("contentrewrite"&MXarr(0,I)))
					If Instr(contentrewriteurl,"{id}") > 0 Then contentrewriteurl = Replace(contentrewriteurl,"{id}","([0-9]+)")
					If Instr(contentrewriteurl,"{classid}") > 0 Then contentrewriteurl = Replace(contentrewriteurl,"{classid}","([0-9]+)")
					If Instr(contentrewriteurl,"{modeid}") > 0 Then contentrewriteurl = Replace(contentrewriteurl,"{modeid}","([0-9]+)")
					If Instr(contentrewriteurl,"{pinyinnum}") > 0 Then contentrewriteurl = Replace(contentrewriteurl,"{pinyinnum}","(.*)")
  					content_all_rewriteurl=content_all_rewriteurl&"RewriteRule ^(.*)"&fycms.actsys&contentrewriteurl&"/([0-9]+)$ $1"&fycms.actsys&rep(MXarr(6,I),"/index.asp","")&"/index\.asp\?id=$2&page=$3 [I,O]"& vbCrLf
					content_all_rewriteurl=content_all_rewriteurl&"RewriteRule ^(.*)"&fycms.actsys&contentrewriteurl&"$ $1"&fycms.actsys&rep(MXarr(6,I),"/index.asp","")&"/index\.asp\?id=$2 [I,O]"& vbCrLf
 			Next
		End If
		
		Connfile = Connfile &  "%" & ">" & vbCrLf
  		Call noSaveFile(Connfile,fycms.actsys&"fy_inc/rewrite.asp")
 		Dim rewriteurl
		Set rs2=fycms.actexe("Select id,title,filepath From diyplus_fy")
 		If Not  rs2.eof Then 
			  sql=rs2.getrows(-1)
			  For  i=0 to ubound(sql,2)
					rewriteurl=rewriteurl&testsource(request("plus"&sql(0,i)),sql(0,i),sql(2,i))
 			  Next
		  End If 
		rewriteurl=rep(rewriteurl,"//","/")
 		Application.Contents.RemoveAll
  	End If
%> <form name="form13" method="post" action="?">  

    <div class="divtable"> 
        <dl>
            <dt>httpd.ini参考</dt>
            <dd>
                 <textarea name="textarea" id="textarea" cols="120" rows="10"><%=server.HTMLEncode(classrewriteurl &content_all_rewriteurl&rewriteurl)%></textarea>
             </dd>
         </dl>
     </div>
    </form>


  	<%
 	  Function  testsource(rewriteurl,cID,filepath)
	  	  Dim rs2,strs,strurl,i,sql,strs3
			Set rs2=fycms.actexe("Select id,entitle From plusget_fy Where cID="&cID)
 		  If Not  rs2.eof Then 
		  sql=rs2.getrows(-1)
		  for i=0 to ubound(sql,2)
					rewriteurl=rep(rewriteurl,"{"&sql(1,i)&"}","(.+)")
					If ubound(sql,2)=i Then 
						strurl=strurl&sql(1,i)&"=$"&i+2
					Else 
						strurl=strurl&sql(1,i)&"=$"&i+2&"&"
					End If 
		  Next
 		End If 
 		testsource=testsource&"RewriteRule ^(.*)"&fycms.actsys&rewriteurl&"$  $1"&fycms.actsys&rep(filepath,".","\.")&"\?"&strurl&" [I,O]"& vbCrLf
		testsource=testsource&"RewriteRule ^(.*)"&fycms.actsys&rewriteurl&"([0-9]+)/$  $1"&fycms.actsys&rep(filepath,".","\.")&"\?"&strurl&"&page=$"&i+2&" [I,O]"& vbCrLf
	 
	  End  Function 
  %>


  <form name="form1" method="post" action="Index.asp?action=save">
    <div class="divtable"> 
        <dl>
            <dt>支持的标签</dt>
            <dd>
                 {id} 文章ID或栏目ID<br />
	  {classid} 文章栏目ID或栏目classid<br />
	  {modeid} 模型ID<br />
	  {pinyinnum} 拼音和数字<br />
             </dd>
         </dl>
        
        <dl>
            <dt>栏目伪静态</dt>
            <dd>
               <input  class="Ainput" name="classrewrite" type="text" size="50" value="<%=Content_list_url%>">只能有一个参数,最后不能带 / 符号
             </dd>
         </dl>
        <%
   
   MXarr=fycms.Act_MX_Sys_Arr()

  	If IsArray(MXarr) Then
		For I=0 To Ubound(MXarr,2)%>
 	 <dl>
            <dt><%=MXarr(1,I)%>内容页伪静态</dt>
       <dd><input  class="Ainput" name="contentrewrite<%=MXarr(0,I)%>" type="text" size="50" value="<%=rep(MXarr(6,I),"/index.asp","")%>/{id}">只能有一个参数</dd>
    </dl>
	
	<%	Next
	End If%>
        <dl>
            <dt>自定义插件规则</dt>
         </dl>
        



	<%Dim rs
	Set rs=fycms.actexe("select * from diyplus_fy")
	If Not rs.eof Then 
		Do While Not rs.eof 
 

   	  Dim  strs 
	  strs=rs("rewriteurl")
 	  If strs="" Then strs=fycms.actsys&fycms.GetEn(fycms.PinYin(delhtml(rs("title"))))

%>
 	 <dl>
            <dt><%=rs("title")%>规则</dt>
       <dd><input  class="Ainput" name="plus<%=rs("id")%>" type="text" size="50" value="<%=strs%>"></dd>
   </dl>

<%		rs.movenext
		loop
 
	End If 
	%>


 
 
            <dl>
            <dt class="vhid">提交：</dt>
            <dd>
                <a class="btn btn_primary" href="javascript:void(0);" onclick="CheckForm()">提交</a>
 				<input class="btn" type="reset" name="Submit2" value="重置">
            </dd>
         </dl>
        
    </div>
    </form>




<script language="javascript">
 
function CheckForm()
{ var form=document.form1;
	 if (form.classrewrite.value=='')
		{ alert("请输入栏目伪静态!");   
		  form.classrewrite.focus();    
		   return false;
		} 
	
	    form.submit();
        return true;
	}</script>  








</div>

</body>
</html>
