<!--#include file =../conn.asp-->
<!-- #include file="inc/const.asp" -->
<!--#include file="../inc/dv_loadcache.asp"-->
<%
' 活跃度插件V2.0 Beta1 For DVBBS 7.0~Dvbbs 7.1
' 插件作者：若阑
' 网址：QQ电子宠物社区 http://www.qqpet.com/
' 发布方式：免费
' 编写时间: 2005-03-20
' 功能描述：插件用于添加两个论坛参数，活跃度和在线时间，参数有后台设置
' Copyright (C) 2005
	Head()
	dim admin_flag
	admin_flag=",1,"
	If Not Dvbbs.master or instr(","&session("flag")&",",admin_flag)=0 Then 
		Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=admin_index.asp target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
		Call dvbbs_error()
	Else
		if request("action")="save" then
			call saveconst()
		elseif request("action")="savelim" then
			call SaveLimit()
		else
			call List()
		end if
		Footer()
	end if

Sub List()
%>

<table border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
<tr> 
<th width="100%" colspan=3 class="tableHeaderText" height=25>论坛活跃度设置
</th></tr>
<tr> 
</table><BR>
<BR>
<% 
Dim ActiveSetting,AwardCount,AwardPer
ActiveSetting=split(Dvbbs.forum_setting(88),"@@")
if CLng(Ubound(ActiveSetting))<>16 then
	ActiveSetting="1@@3@@5@@100*500*1000*5000@@①年迈乌龟*②懒惰白猪*③活泼小兔*④生猛海鲜@@1@@skins/default/bar/bar1.gif@@skins/default/bar/bar5.gif@@1@@3@@0@@0@@恭喜!你的在线等级已经升了一级@@0*0*0*0*0*0*0*0@@0*0*0*0*0*0*0*0@@15@@5"
	ActiveSetting=split(ActiveSetting,"@@")
end if
AwardCount=split(ActiveSetting(13),"*")
AwardPer=split(ActiveSetting(14),"*")
%>
<script>
function ListGongShi()
{
var str,bb,i;
	if (document.getElementById("yanshi"))
	{
str='<font color=red>公式演示:</font>';
		for(i=1;i<10;i++)
		{
			bb=parseInt(document.getElementById("forum_setting(88)15").value)*i+parseInt(document.getElementById("forum_setting(88)16").value)*i*i;
			str=str+numberToString(i)+"级:"+  numberToString(bb)+"小时    ";
		}
	}
document.getElementById("yanshi").innerHTML=str;
}

function ListJiang(AwardId)
{
var str,bb,i;
	if (document.getElementById("yanshi"))
	{
str='<font color=red>公式演示:</font>';
		for(i=1;i<10;i++)
		{
			bb=parseInt(document.getElementById("AwardCount("+AwardId+")").value)+parseInt(document.getElementById("AwardPer("+AwardId+")").value)*i;
			str=str+numberToString(i)+"级:" + "奖励" +  numberToString(bb)+"&nbsp;&nbsp;";
		}
	}
document.getElementById("yanshi").innerHTML=str;
}

function numberToString(inputNumber,base)
{
  return (inputNumber.toString(10));
}

function Changeoption(boardselect)
{
document.getElementById("ActiveLimit0").value = document.getElementById("BoardLimit0"+boardselect).value;
document.getElementById("ActiveLimit1").value = document.getElementById("BoardLimit1"+boardselect).value;
}
</script>
<form method="POST" action="?action=save" name="theform">
<table border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
<tr> 
<th height=25 colspan=2 align=left id=tabletitlelink><b>活跃度参数</b>[<a href="#top">顶部</a>]</th>
</tr>
<tr> 
<td class=Forumrow  width="50%">是否要活跃度功能</td>
<td class=Forumrow>
<input type=radio name="forum_setting(88)8" value=0 <%if cint(ActiveSetting(8))=0 then%>checked<%end if%>>否&nbsp;
<input type=radio name="forum_setting(88)8" value=1 <%if cint(ActiveSetting(8))=1 then%>checked<%end if%>>是&nbsp;
</td>
</tr>
<tr> 
<tr> 
<td class=Forumrow  width="50%">在线时间1分钟增加活跃度多少</td>
<td class=Forumrow><input type="text" name="forum_setting(88)0" size="10" value="<%=ActiveSetting(0)%>">
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">发1贴增加活跃度多少</td>
<td class=Forumrow><input type="text" name="forum_setting(88)1" size="10" value="<%=ActiveSetting(1)%>">
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">计算时长(每隔几天重新计算) </td>
<td class=Forumrow><input type="text" name="forum_setting(88)2" size="10" value="<%=ActiveSetting(2)%>">
(单位:天) (把活跃度<font color="#FF0000">清0</font>)
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">活跃等级数字分级(使用*分隔) </td>
<td class=Forumrow><input type="text" name="forum_setting(88)3" size="40" value="<%=ActiveSetting(3)%>">
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">活跃等级文字表达(使用*分隔) </td>
<td class=Forumrow><input type="text" name="forum_setting(88)4" size="40" value="<%=ActiveSetting(4)%>">
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">活跃度条条图片(前面) </td>
<td class=Forumrow><input type="text" name="forum_setting(88)6" size="40" value="<%=ActiveSetting(6)%>">
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">活跃度条条图片(后面) </td>
<td class=Forumrow><input type="text" name="forum_setting(88)7" size="40" value="<%=ActiveSetting(7)%>">
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">是否显示在线等级 </td>
<td class=Forumrow>
<input type=radio name="forum_setting(88)5" value=0 <%if cint(ActiveSetting(5))=0 then%>checked<%end if%>>否&nbsp;
<input type=radio name="forum_setting(88)5" value=1 <%if cint(ActiveSetting(5))=1 then%>checked<%end if%>>是&nbsp;
</td>
</tr>

<tr> 
<td class=Forumrow  width="50%">在线时间多久更新一次 </td>
<td class=Forumrow>
<input type="text" name="forum_setting(88)9" size="10" value="<%=ActiveSetting(9)%>">
(单位:分钟)
<br>
<br>
设置1以上,越小进库越频繁,精度越高,越耗资源</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">在线时间公式参数设置 </td>
<td class=Forumrow>参数1：<input type="text" name="forum_setting(88)15" size="10" value="<%=ActiveSetting(15)%>">参数2：<input type="text" name="forum_setting(88)16" size="10" value="<%=ActiveSetting(16)%>"><a href=# onclick="javascript:ListGongShi();">公式演示</a>
</td>
</tr>
<tr> 
<td class=Forumrow colspan="2" width="50%" id=yanshi></td>
</tr>
<tr> 
<th height=25 colspan=2 align=left id=tabletitlelink>在线等级升级奖励参数设置</th>
</tr>
<tr> 
<td class=Forumrow  width="50%">是否开启在线升级短信通知</td>
<td class=Forumrow>
<input type=radio name="forum_setting(88)11" value=0 <%if cint(ActiveSetting(11))=0 then%>checked<%end if%>>否&nbsp;
<input type=radio name="forum_setting(88)11" value=1 <%if cint(ActiveSetting(11))=1 then%>checked<%end if%>>是&nbsp;
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">短信通知内容</td>
<td class=Forumrow><input type="text" name="forum_setting(88)12" size="40" value="<%=ActiveSetting(12)%>">
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">是否开启在线升级奖励功能</td>
<td class=Forumrow>
<input type=radio name="forum_setting(88)10" value=0 <%if cint(ActiveSetting(10))=0 then%>checked<%end if%>>否&nbsp;
<input type=radio name="forum_setting(88)10" value=1 <%if cint(ActiveSetting(10))=1 then%>checked<%end if%>>是&nbsp;
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%"><B>升一级所奖励的数值设置</B></td>
<td class=Forumrow>&nbsp;</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">文章数</td>
<td class=Forumrow><input type="text" name="AwardCount(0)" size="10" value="<%=AwardCount(0)%>">
<font color=blue><B>+</B></font>
  <input type="text" name="AwardPer(0)" size="10" value="<%=AwardPer(0)%>">
  <font color=blue>X</font> 新在线等级 <a href=# onclick="javascript:ListJiang(0);"><font color=blue>公式演示</font></a></td>
</tr>

<tr> 
<td class=Forumrow  width="50%">主题数</td>
<td class=Forumrow><input type="text" name="AwardCount(1)" size="10" value="<%=AwardCount(1)%>">
<font color=blue><B>+</B></font>
  <input type="text" name="AwardPer(1)" size="10" value="<%=AwardPer(1)%>">
  <font color=blue>X</font> 新在线等级 <a href=# onclick="javascript:ListJiang(1);"><font color=blue>公式演示</font></a></td>
</tr>
<tr> 
<td class=Forumrow  width="50%">金钱数</td>
<td class=Forumrow><input type="text" name="AwardCount(2)" size="10" value="<%=AwardCount(2)%>">
<font color=blue><B>+</B></font>
  <input type="text" name="AwardPer(2)" size="10" value="<%=AwardPer(2)%>">
  <font color=blue>X</font> 新在线等级 <a href=# onclick="javascript:ListJiang(2);"><font color=blue>公式演示</font></a></td>
</tr>
<tr> 
<td class=Forumrow  width="50%">积分数</td>
<td class=Forumrow><input type="text" name="AwardCount(3)" size="10" value="<%=AwardCount(3)%>">
<font color=blue><B>+</B></font>
  <input type="text" name="AwardPer(3)" size="10" value="<%=AwardPer(3)%>">
  <font color=blue>X</font> 新在线等级 <a href=# onclick="javascript:ListJiang(3);"><font color=blue>公式演示</font></a></td>
</tr>
<tr> 
<td class=Forumrow  width="50%">魅力数</td>
<td class=Forumrow><input type="text" name="AwardCount(4)" size="10" value="<%=AwardCount(4)%>">
<font color=blue><B>+</B></font>
  <input type="text" name="AwardPer(4)" size="10" value="<%=AwardPer(4)%>">
  <font color=blue>X</font> 新在线等级 <a href=# onclick="javascript:ListJiang(4);"><font color=blue>公式演示</font></a></td>
</tr>
<tr> 
<td class=Forumrow  width="50%">威望数</td>
<td class=Forumrow><input type="text" name="AwardCount(5)" size="10" value="<%=AwardCount(5)%>">
<font color=blue><B>+</B></font>
  <input type="text" name="AwardPer(5)" size="10" value="<%=AwardPer(5)%>">
  <font color=blue>X</font> 新在线等级 <a href=# onclick="javascript:ListJiang(5);"><font color=blue>公式演示</font></a></td>
</tr>

<tr> 
<td class=Forumrow  width="50%">金币数(DV7.1)</td>
<td class=Forumrow><input type="text" name="AwardCount(6)" size="10" value="<%=AwardCount(6)%>">
<font color=blue><B>+</B></font>
  <input type="text" name="AwardPer(6)" size="10" value="<%=AwardPer(6)%>">
  <font color=blue>X</font> 新在线等级 <a href=# onclick="javascript:ListJiang(6);"><font color=blue>公式演示</font></a></td>
</tr>

<tr> 
<td class=Forumrow  width="50%">点券数(DV7.1)</td>
<td class=Forumrow><input type="text" name="AwardCount(7)" size="10" value="<%=AwardCount(7)%>">
<font color=blue><B>+</B></font>
  <input type="text" name="AwardPer(7)" size="10" value="<%=AwardPer(7)%>">
  <font color=blue>X</font> 新在线等级 <a href=# onclick="javascript:ListJiang(7);"><font color=blue>公式演示</font></a></td>
</tr>
<tr> 
<td width="50%" class=Forumrow>&nbsp; </td>
<td width="50%" class=Forumrow>  
<div align="center"> 
<input type="submit" name="Submit" value="提 交">
</div>
</td>
</tr>
</table>
</form>
<form method="POST" action="RL_admin_Active.asp?action=savelim" name="theboardform">
<table border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
<tr> 
<th height=25 colspan=2 align=left id=tabletitlelink><b>设置版面在线时间限制</b>[<a href="#top">顶部</a>]</th>
</tr>
<tr> 
<td class=Forumrow  width="50%">选择要设置的版面</td>
<td class=Forumrow>
<select name="eboardid" id="eboardid" onChange="Changeoption(this.value)">
<%
Dim RLAdmin_Sql,RLAdmin_Rs,MyBoardSetting,ActiveLimit
RLAdmin_Sql = "select BoardId,BoardType,board_setting,depth from dv_board order by rootid,orders"
Set RLAdmin_Rs = Dvbbs.Execute(RLAdmin_Sql)
if RLAdmin_Rs.Eof then
%>
<option value="0">没有版面</option>
<%
else
	ActiveLimit = ""
	Do While not RLAdmin_Rs.Eof
	MyBoardSetting = RLAdmin_Rs("board_setting")
	MyBoardSetting = split(MyBoardSetting,",")
	MyBoardSetting(68)= split(MyBoardSetting(68),"*")
	if Ubound(MyBoardSetting(68))<1 then
		MyBoardSetting(68) = "0*0"
		MyBoardSetting(68)= split(MyBoardSetting(68),"*")
	end if
	if ActiveLimit = "" then
		ActiveLimit = RLAdmin_Rs("BoardId") & "*" & MyBoardSetting(68)(0) & "*"& MyBoardSetting(68)(1)
	else
		ActiveLimit = ActiveLimit & "||" & RLAdmin_Rs("BoardId") & "*" & MyBoardSetting(68)(0) & "*"& MyBoardSetting(68)(1)
	end if
	%>
	  <option value="<%=RLAdmin_Rs("BoardId")  %>" >
	<%for i=1 to RLAdmin_Rs("depth")%>
	&nbsp; &nbsp; 
	<%next%>
	<%=RLAdmin_Rs("BoardType")  %></option>
	<%
	RLAdmin_Rs.MoveNext
	Loop
	RLAdmin_Rs.Close
end if	  
	%>
</select>
<%
Dim InputTemp
ActiveLimit = Split(ActiveLimit,"||")
for i=0 to Ubound(ActiveLimit)
InputTemp = Split(ActiveLimit(i),"*")

%>
<input name="BoardLimit0<%= InputTemp(0) %>" type="hidden" value="<%= InputTemp(1) %>">
<input name="BoardLimit1<%= InputTemp(0) %>" type="hidden" value="<%= InputTemp(2) %>">
<%
next
%>
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">在线时间多少才可以进入</td>
<td class=Forumrow>
<input type="text" name="ActiveLimit0" size="10" value="0">
</td>
</tr>
<tr> 
<td class=Forumrow  width="50%">活跃度多少才可以进入</td>
<td class=Forumrow>
<input type="text" name="ActiveLimit1" size="10" value="0">
</td>
</tr>

<tr> 
<td width="50%" class=Forumrow>&nbsp; </td>
<td width="50%" class=Forumrow>  
<div align="center"> 
<input type="submit" name="Submit1" value="提 交">
</div>
</td>
</tr>
</table>
</form>
<%
end sub

sub saveconst()
Dim AwardCount,AwardPer,j,ActiveSetting,ForumInfo,ForumSetting,NewSetting
For j=0 to  7
	if j=0 then
		AwardCount=Replace(Trim(Request.form("AwardCount("&j&")")),"*","")
	else
		AwardCount=AwardCount&"*"&Replace(Trim(Request.form("AwardCount("&j&")")),"*","")
	end if
Next

For j=0 to  7
	if j=0 then
		AwardPer=Replace(Trim(Request.form("AwardPer("&j&")")),"*","")
	else
		AwardPer=AwardPer&"*"&Replace(Trim(Request.form("AwardPer("&j&")")),"*","")
	end if
Next
			
ActiveSetting=""
For j=0 to  16
	if j=0 then
		ActiveSetting=Replace(Trim(Request.form("Forum_Setting(88)"&j)),"@@","")
	elseif j=13 then
		ActiveSetting=ActiveSetting&"@@"&AwardCount
	elseif j=14 then
		ActiveSetting=ActiveSetting&"@@"&AwardPer
	else
		ActiveSetting=ActiveSetting&"@@"&Replace(Trim(Request.form("Forum_Setting(88)"&j)),"@@","")
	end if
Next

'forum_info|||forum_setting|||forum_user|||copyright|||splitword|||stopreadme
Set rs=Dvbbs.execute("select forum_setting from dv_setup")
	ForumInfo = split(rs(0),"|||")
rs.close

ForumSetting = split(ForumInfo(1),",")
ForumSetting(88) = ActiveSetting
NewSetting = ""
For i = 0 to Ubound(ForumSetting)
	If i = 0 Then
		NewSetting = ForumSetting(0)
	Else
		NewSetting = NewSetting & "," & Replace(ForumSetting(i),",","，")
	End If
Next

ForumInfo(1) = NewSetting

NewSetting = ""
For i = 0 to Ubound(ForumInfo)
	If i = 0 Then
		NewSetting = ForumInfo(0)
	Else
		NewSetting = NewSetting & "|||" & ForumInfo(i)
	End If
Next

sql="update Dv_setup set Forum_Setting='"&checkStr(NewSetting)&"'"
dvbbs.execute(sql)
ReloadSetup()
LoadStyleList_All()
Dv_suc("设置论坛活跃度成功.<a href=RL_admin_Active.asp>返回活跃度设置</a>")
end sub

sub SaveLimit()
Dim RL_AdminSql,RL_AdminRS,BoardId,MyBoardSetting,ActiveLimit,NewSetting
If IsNumeric(Request("eboardid")) and Request("eboardid")<>"" then
	BoardId = CLng(Request("eboardid"))
else
	BoardId = 0
	Response.Write("参数错误")
	Exit Sub
end if
For i=0 to 1
	if IsNumeric(Request("ActiveLimit"&i)) and Request("ActiveLimit"&i)<>"" then
		if i = 0 then
			ActiveLimit = Clng(Request("ActiveLimit0"))
		else
			ActiveLimit = ActiveLimit & "*" & CLng(Request("ActiveLimit"&i))
		end if
	else
		Response.Write("参数错误")
		Exit Sub
	end if
Next

RL_AdminSql = "Select board_setting from DV_Board where boardid="&BoardId
Set RL_AdminRS = Dvbbs.Execute(RL_AdminSql)
if not RL_AdminRS.Eof then
	MyBoardSetting = RL_AdminRS("board_setting")
else
	MyBoardSetting = ""
end if
RL_AdminRS.CLose
if MyBoardSetting = "" then Exit Sub

MyBoardSetting = Split(MyBoardSetting,",")
MyBoardSetting(68) = ActiveLimit

For i = 0 to Ubound(MyBoardSetting)
	if i=0 then
		NewSetting = MyBoardSetting(0)
	else
		NewSetting = NewSetting & "," & MyBoardSetting(i)
	end if
Next

if NewSetting<>"" then
	RL_AdminSql = "Update Dv_Board set board_setting='"&checkStr(NewSetting)&"' where boardid="&BoardId
	Dvbbs.Execute(RL_AdminSql)
	dv_suc("设置成功。<a href=RL_admin_Active.asp>返回活跃度设置</a>")
	ReloadSetup()
end if
end sub

Function Checkstr(Str)
	If Isnull(Str) Then
		CheckStr = ""
		Exit Function 
	End If
	CheckStr = Replace(Str,"'","''")
End Function

%>