<!--#include file="../../conn.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/const.asp"-->
<!--#include file="../inc/check.asp"-->
<!--#include file="../../inc/chkinput.asp"-->
<!--#include file="../../inc/md5.asp"-->
<!--#include file="../../api/cls_api.asp"-->
<%
Admin_header
'=====================================================================
' 软件名称：新云网站管理系统
' 当前版本：NewAsp Content Management System Version 4.0
' 文件名称：admin_conform.asp
' 更新日期：2008-09-16
' 官方网站：新云网络(www.NewAsp.net www.NewAsp.cn) QQ：94022511
'=====================================================================
' Copyright 2003-2008 NewAsp.net - All Rights Reserved.
' newasp is a trademark of NewAsp.net
'=====================================================================
%>
<table class="table1" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<td class="tableline linetitle" width="120" align="left">系统整合接口设置</td>
		<td class="tableline" width="*" align="right"><a href="admin_index.asp">管理首页</a>
			 - <a href="admin_list.asp">用户列表</a>
			 - <a href="admin_user.asp?action=add">添加会员</a>
			 - <a href="admin_list.asp?showmode=1">等待验证的会员</a>
			 - <a href="admin_list.asp?UserGrade=999">管理员</a>
			 - <a href="admin_list.asp?UserGrade=1">普通会员</a>
			 - <a href="admin_list.asp?UserGrade=2">高级会员</a>
			 - <a href="admin_list.asp?UserGrade=3">VIP会员</a>
			 - <a href="admin_password.asp">修改密码</a>
		</td>
	</tr>
</table>
<%
Dim Action
If Not ChkAdmin("Conform") Then
	Call Transfer_error()
End If
Action = LCase(Request("action"))
Select Case Trim(Action)
Case "save"
	Call SaveConformify()
Case Else
	Call showmain()
End Select
If FoundErr=True Then
	ReturnError(ErrMsg)
End If
Admin_footer
SaveLogInfo(AdminName)
NewAsp.PageEnd

Sub showmain()
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<form name="myform" method="post" action="?action=save">
<tr>
	<th colspan="2">多系统整合接口设置</th>
</tr>
<tr>
	<td class="tablerow1" width="20%" align="right"><u>是否开启多系统整合程序</u>：</td>
	<td class="tablerow1" width="80%">
	<input type="radio" name="API_Enable" value="false"<%
	If Not API_Enable Then Response.Write " checked"
	%>> 关闭&nbsp;&nbsp;
	<input type="radio" name="API_Enable" value="true"<%
	If API_Enable Then Response.Write " checked"
	%>> 开启
	</td>
</tr>
<tr>
	<td class="tablerow2" align="right"><u>设置系统密钥</u>：</td>
	<td class="tablerow2"><input type="text" name="API_ConformKey" size="35" value="<%=API_ConformKey%>"> 
		<font color="red">系统整合，必须保证与其它系统设置的密钥一致。</font>
	</td>
</tr>
<tr>
	<td class="tablerow1" align="right"><u>是否除错</u>：</td>
	<td class="tablerow1">
	<input type="radio" name="API_Debug" value="false"<%
	If Not API_Debug Then Response.Write " checked"
	%>> 否&nbsp;&nbsp;
	<input type="radio" name="API_Debug" value="true"<%
	If API_Debug Then Response.Write " checked"
	%>> 是&nbsp;&nbsp;<font color="red">如果整合的论坛程序和新云程序的用户数据不同步，你可以选择“是”</font>
	</td>
</tr>
<tr>
	<td class="tablerow2" align="right"><u>整合程序的接口文件路径</u>：</td>
	<td class="tablerow2"><textarea name="API_Urls" rows="6" cols="70"><%=API_Urls%></textarea></td>
</tr>
<tr>
	<td class="tablerow1" align="right"><u>整合用户登录后转向URL</u>：</td>
	<td class="tablerow1"><input type="text" name="API_LoginUrl" size="45" value="<%=API_LoginUrl%>"> 
		<font color="red">不设置请输入“0”。</font>
	</td>
</tr>
<tr>
	<td class="tablerow2" align="right"><u>整合用户注册后转向URL</u>：</td>
	<td class="tablerow2"><input type="text" name="API_ReguserUrl" size="45" value="<%=API_ReguserUrl%>"> 
		<font color="red">不设置请输入“0”。</font>
	</td>
</tr>
<tr>
	<td class="tablerow1" align="right"><u>整合用户注销后转向URL</u>：</td>
	<td class="tablerow1"><input type="text" name="API_LogoutUrl" size="45" value="<%=API_LogoutUrl%>"> 
		<font color="red">不设置请输入“0”。</font>
	</td>
</tr>
<tr>
	<td class="tablerow2" align="right">&nbsp;</td>
	<td class="tablerow2"><input type="submit" value="保存设置" name="submit_button" class="button"></td>
</tr>
</form>
<tr>
	<td class="tablerow1" colspan="2"><b>说明：</b>
	<ol>
		<li>如果有多个程序整合，接口之间用半角"|"分隔</li>
		<li>例如：<font color="blue">http://你的论坛网址/dv_dpo.asp|http://你的网站地址/博客安装目录/oblogresponse.asp</font></li>
		<li>本系统的接口路径：<font color="red"><%=NewAsp.MainDomain%>/api/api_reponse.asp</font></li>
	</ol></td>
</tr>
</table>
<%
End Sub

Sub SaveConformify()
	Dim strTempCode
	strTempCode = Chr(60) & "%"& vbCrLf
	strTempCode = strTempCode & Chr(39) & "--API_Enable 是否打开系统整合(默认闭关: False,打开: True)" & vbCrLf
	strTempCode = strTempCode & "Const API_Enable		= "& NewAsp.ChkBoolean(Request.Form("API_Enable")) & vbCrLf
	strTempCode = strTempCode & Chr(39) & "--API_ConformKey 设置系统密钥 (系统整合,必须保证与其它系统设置的密钥一致)" & vbCrLf
	strTempCode = strTempCode & "Const API_ConformKey	= """& ChkRequestForm("API_ConformKey") & """" & vbCrLf
	strTempCode = strTempCode & Chr(39) & "--API_Urls :整合的其它程序的接口文件路径;多个程序接口之间用半角""|""分隔" & vbCrLf
	strTempCode = strTempCode & "Const API_Urls			= """& ChkRequestForm("API_Urls") & """" & vbCrLf
	strTempCode = strTempCode & Chr(39) & "--如果整合的论坛程序和新云程序的用户数据不同步,你可以设置为: True" & vbCrLf
	strTempCode = strTempCode & "Const API_Debug			= "& NewAsp.ChkBoolean(Request.Form("API_Debug")) & vbCrLf
	strTempCode = strTempCode & Chr(39) & "--API_LoginUrl 整合用户登录后转向的URL,不设置为""0""" & vbCrLf
	strTempCode = strTempCode & "Const API_LoginUrl		= """& ChkRequestForm("API_LoginUrl") &"""" & vbCrLf
	strTempCode = strTempCode & Chr(39) & "--API_ReguserUrl 整合用户注册后转向的URL,不设置为""0""" & vbCrLf
	strTempCode = strTempCode & "Const API_ReguserUrl	= """& ChkRequestForm("API_ReguserUrl") &"""" & vbCrLf
	strTempCode = strTempCode & Chr(39) & "--API_LogoutUrl 整合用户注销后转向的URL,不设置为""0""" & vbCrLf
	strTempCode = strTempCode & "Const API_LogoutUrl		= """& ChkRequestForm("API_LogoutUrl") &"""" & vbCrLf
	strTempCode = strTempCode & "%"& Chr(62)

	writeTextFile "../../api/config.asp",strTempCode
	Succeed("<li>恭喜您！保存系统整合设置成功。</li>")
End Sub
Function ChkRequestForm(reform)
	Dim strForm
	strForm = Trim(Request.Form(reform))
	If IsNull(strForm) Then
		strForm = "0"
	Else
		strForm = Replace(strForm, Chr(0), vbNullString)
		strForm = Replace(strForm, Chr(34), vbNullString)
		strForm = Replace(strForm, "'", vbNullString)
		strForm = Replace(strForm, """", vbNullString)
	End If
	If strForm = "" Then strForm = "0"
	ChkRequestForm = strForm
End Function

Function writeTextFile(fileName,Text)
	NewAspStream.charset="GB2312"
	NewAspStream.Type = 2
	NewAspStream.Mode = 3
	NewAspStream.open()
	NewAspStream.WriteText(Text)
	NewAspStream.SaveToFile ChkMapPath(fileName),2
	NewAspStream.close()
End Function
%>