<%
Dim XiaoLu,LC,PlusEdition
LC="V1.0.2"

'========PlusEdition： Sp1设为1，7.1设为2 ==========
PlusEdition = 1
'========PlusEdition： Sp1设为1，7.1设为2 ==========

Set XiaoLu=New Plus_XiaoLu
Class Plus_XiaoLu
Rem Const

Public Setting
Public str2,doublespace,sp
Public UserEg,UserPg,ID,SignInTitle,SignInTime,UserFettle,SignInAction
Public UserPay,UserAppeal,UserSignIn,UserOnLeave,UserSignInId,UserId,UserResume,UserIp
Public RegTime,UserName,UserClass,UserSex,UserLogins,UserEp,UserWealth,UserMoney

Rem Sub
'//特殊字符//
Public function HTMLCode(str)
	  str2=server.HTMLEncode(str)
	  str2=replace(str2,chr(13),"<br>")
	  doublespace="&nbsp;"
	  for sp=2 to 20
	   doublespace=doublespace & "&nbsp;"
	   str2=replace(str2,space(sp),doublespace)
	  next
	  htmlcode=str2
End function

Public Function PageConst(N)

	Endpage = 0
	MaxRows = ""&Cint(N)&""
	Page = Request("Page")
	If IsNumeric(Page) = 0 or Page="" Then Page=1
	Page = Clng(Page)
	Set Rs=Server.CreateObject("ADODB.RECORDSET")
	Response.Write "<script language=""JavaScript"" src=""inc/Pagination.js""></script>"

End Function

Public Function APageConst(N)

	Endpage = 0
	MaxRows = ""&Cint(N)&""
	Page = Request("Page")
	If IsNumeric(Page) = 0 or Page="" Then Page=1
	Page = Clng(Page)
	Set Rs=Server.CreateObject("ADODB.RECORDSET")
	Response.Write "<script language=""JavaScript"" src=""../inc/Pagination.js""></script>"

End Function

Public Sub Footer()
	Response.Write"<table align=center >"
	Response.Write "<tr align=center><td width=""100%"" class=copyright>"
	Response.Write"XiaoLu Plus ForumOffice "&LC&" , Copyright (c) 2001-2005 . All Rights Reserved ."
	Response.Write"</td></tr></table>"
End Sub

Public Function Checkstr(Str)
	If Isnull(Str) Then
		CheckStr = ""
		Exit Function 
	End If
		Str = Replace(Str,"'","''")
		Str = Replace(Str,"--","－－")
		Str = Replace(Str,";","；")
		Str = Replace(Str,",","，")
		Str = Replace(Str,"(","（")
		Str = Replace(Str,")","）")
		Str = Replace(Str,"0x","Ox")
		Str = Replace(Str,"@","＠")
		Str = Replace(Str,"%","％")
		Str = Replace(Str,"<","＜")
		Str = Replace(Str,">","＞")
	Checkstr = Str
End Function

'//数组//
Public Sub Class_Setting()

UserIp=Dvbbs.UserTrueIP

Dim Rs
Set Rs=Dvbbs.Plus_Execute("Select Office_Setting from [Dv_LuZiPlus_Const]")
	Setting=Split(Rs("Office_Setting"),"||@@||") '基本设置数组
rs.close 
set rs=nothing

End Sub

Public Sub PlusInfo()
	Dim Rs
	If Dvbbs.UserID <> 0 Then
	
		If Cint(PlusEdition) = 2 Then

			'//Sp1以下版本，如：7.1，没测试过7.0可以不可以用。
			UserName=Dvbbs.MyUserInfo(5)
			UserClass=Dvbbs.MyUserInfo(18)
			RegTime=Dvbbs.MyUserInfo(14)
			UserSex = Dvbbs.MyUserInfo(10)
			UserLogins = Dvbbs.MyUserInfo(16)
			UserEp = Dvbbs.MyUserInfo(22)
			UserWealth = Dvbbs.MyUserInfo(21)
			UserMoney = Dvbbs.MyUserInfo(37)

		ElseIf Cint(PlusEdition) = 1 Then

			'//Sp1设置
			UserName=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@username").text
			UserClass=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text
			RegTime=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@joindate").text
			UserSex = Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usersex").text
			UserLogins = Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userlogins").text
			UserEp = Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text
			UserWealth = Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text
			UserMoney = Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usermoney").text

		End If
		
	Else
		Dvbbs.AddErrCode(6)
		Dvbbs.Showerr()
	End If

	'//最新记录ID号

	Set Rs=Dvbbs.Plus_Execute("Select top 1 * from [Dv_LuZiOffice_SignIn] order by SignInTime desc")
	
	If rs.eof then

	Else
		ID = ""&Trim(Rs("ID"))&""
		SignInAction= ""&Trim(Rs("SignInAction"))&""
		SignInTitle = ""&Trim(Rs("SignInTitle"))&""
		SignInTime= ""&Trim(Rs("SignInTime"))&""
		
	End If
	rs.close 
	set rs=nothing

	'//最新签到记录ID号
	Set Rs=Dvbbs.Plus_Execute("Select top 1 * from [Dv_LuZiPlus_Log] Where ClassId=1 and UserName='"&UserName&"' order by NewTime desc")

	If rs.eof then

	Else
		UserSignInId = ""&Trim(Rs("SignInId"))&""
	End If

	rs.close 
	set rs=nothing

		If Dvbbs.UserID=0 Then

			Dvbbs.AddErrCode(6)
			Dvbbs.Showerr()

		Else

			Set Rs=Dvbbs.Plus_Execute("Select UserEg,UserPg,UserSignIn,UserResume,UserOnLeave,UserId,UserAppeal,UserPay from [Dv_LuZiOffice_User] where UserName='"&UserName&"'")
			
			If rs.eof then
			Else
				UserId = ""&Trim(Rs("UserId"))&""
				UserSignIn = ""&Trim(Rs("UserSignIn"))&""
				UserOnLeave = ""&Trim(Rs("UserOnLeave"))&""
				UserEg = ""&Trim(Rs("UserEg"))&""
				UserPg = ""&Trim(Rs("UserPg"))&""
				UserAppeal = ""&Trim(Rs("UserAppeal"))&""
				UserPay = ""&Trim(Rs("UserPay"))&""
				UserResume = ""&Trim(Rs("UserResume"))&""
			End If
		End If
	rs.close 
	set rs=nothing

End Sub

Public Sub Plus_Tools_Postings(NewUserName)
	Dvbbs.Plus_Execute("update Dv_LuZiOffice_User set UserName = '" & NewUserName & "' Where username='" & Dvbbs.MemberName & "'")
	Dvbbs.Plus_Execute("update Dv_LuZiOffice_Pay set PayName = '" & NewUserName & "' , PayManipulator = '" & NewUserName & "' Where PayName='" & Dvbbs.MemberName & "'")
	Dvbbs.Plus_Execute("update Dv_LuZiPlus_Log set UserName = '" & NewUserName & "' , Manipulator = '" & NewUserName & "' Where username='" & Dvbbs.MemberName & "'")
	Dvbbs.Plus_Execute("update Dv_LuZiOffice_SignIn set UserName = '" & NewUserName & "' Where UserName='" & Dvbbs.MemberName & "'")
End Sub

Public Sub AdminInfo()

Response.Write "<table width=""95%"" border=0 cellspacing=1 cellpadding=3  align=center class=tableBorder>"
Response.Write "<tr align=left valign=middle height=25>"
Response.Write "<th align=left class=forumrow>设置说明</th></tr>"
Response.Write "<tr height=25 valign=middle>"
Response.Write "<td align=left valign=top class=forumrow><p><B>说明</B>：<BR />"
Response.Write "2、请在填写信息的时<b>不要在表单内使用英文的逗号和引号</b>，若出现程序问题后果自负<br />"
Response.Write "3、若在使用过程中发现什么BUG或者有疑问可以加我的QQ：<font style=""font-family:Georgia;"">307760488</font>和QQ群：<font style=""font-family:Georgia;"">6572625</font></td>"
Response.Write "</tr><tr>"
Response.Write "<td align=left class=forumrow height=25>"
Response.Write "[<A Href=ForumOffice.Asp>插件首页</A>] [<A Href=ForumOffice.Asp?Action=UserInfo Title=版主档案处><Font Color=red>版主档案处</Font></A>]"
Response.Write " [<a onMouseOver=""showmenu(event,'<div class=menuitems><a href=ForumOffice.Asp?Action=EgNot Title=点击进入>奖励审核</a><br /><a href=ForumOffice.Asp?Action=PgNot Title=点击进入>投诉审核</a><br /><a href=ForumOffice.Asp?Action=ResignNot Title=点击进入>辞职审核</a><br /><a href=ForumOffice.Asp?Action=PaymentNot Title=点击进入>工资疑义</a></div>')"">审核部分</a>]"
Response.Write " [<a onMouseOver=""showmenu(event,'<div class=menuitems><a href=ForumOffice.Asp?Action=LeaveList Title=点击进入>请假日志</a><br /><a href=ForumOffice.Asp?Action=EgLog Title=点击进入>奖励日志</a><br /><a href=ForumOffice.Asp?Action=ResignLog Title=点击进入>辞职日志</a><br /><a href=ForumOffice.Asp?Action=PgLog Title=点击进入>投诉日志</a><br /><a href=ForumOffice.Asp?Action=WordLog Title=点击进入>留言日志</a>')"">查看日志</a>]"
Response.Write " [<a onMouseOver=""showmenu(event,'<div class=menuitems><a href=ForumOffice.Asp?Action=SignIn><Font Color=red>创建签到记录</Font></a><br /><a href=ForumOffice.Asp?Action=SignInLog>查看往期签到</a>')""><Font Color=Blue>版主签到</Font></a>]"
Response.Write "</td></tr></table>"
Response.Write "<br />"

End Sub

'//斑竹请假跳转
Public Sub UserLeave()
	Call PlusInfo()
	Dim Rs,UserFettle
	
	Set Rs=Dvbbs.Plus_Execute("Select * from [Dv_LuZiOffice_User] Where UserName = '"&UserName&"' And UserFettle = 1")
		
	If Rs.Eof Then

	Else
		UserFettle = ""&Rs("UserFettle")&""

		If CInt(UserFettle) = 1 Then Response.Redirect("Plus_ForumOffice_team.asp?Action=UserLeave")

	End If

End Sub

Public Sub PlusConst()

	If Dvbbs.UserID=0 Then
	Else
		Call PlusInfo()
		Dim Rs,SQL
		'//斑竹资料创建
		If Cint(Dvbbs.UserGroupID) = 2 Or Cint(Dvbbs.UserGroupID) = 3 then
			'==============
			Dim SignInGross

			Set Rs=Dvbbs.Plus_Execute("Select count(*) from [Dv_LuZiOffice_SignIn]")

				If rs.eof then

					SignInGross = 0 '签到记录总数

				Else

					SignInGross = ""&Cint(Rs(0))&""
					
				End If


			'==============
			Set Rs=Dvbbs.Plus_Execute("Select * from [Dv_LuZiOffice_User] where UserName='"&UserName&"'")

				If Rs.Eof Then

					Dim UserSignIn

					UserSignIn = 0
					
					Set Rs=Dvbbs.Plus_Execute("insert into [Dv_LuZiOffice_User](UserSignIn,UserName,RegTime,UserResume) Values("&Cint(Cint(SignInGross) + Cint(UserSignIn))&",'"&UserName&"','"&RegTime&"','')")
					Set Rs=Dvbbs.Execute("insert into dv_message(sender,incept,title,content,sendtime,issend) values('办公室' , '"&UserName&"' , '帐号信息' ,  '恭喜您，您已经正式入住版主办公室大厅，[URL=Plus_ForumOffice_Index.Asp]点击这里查看[/URL]' , '"&now()&"' , '1')")
				Else
				End If
		End If
	End If
	'//系统创建签到
	If Cint(XiaoLu.setting(8)) = 0 Then

		Dim SignInDate

		Set Rs=Dvbbs.Plus_Execute("Select top 1 * from [Dv_LuZiOffice_SignIn] order by ID desc")

		If Rs.Eof Then
			SignInDate = Cint(XiaoLu.Setting(9))
		Else
			SignInDate = DateDiff("d", Rs(4), Now())
			
		End If
		


		If Cint(SignInDate) < Cint(XiaoLu.Setting(9)) Then  '设置10小时内不允许重复发布

		Else


			'//创建签到
			Set Rs=Dvbbs.Plus_Execute("Select top 1 * from [Dv_LuZiOffice_SignIn] order by ID desc")
			If Rs.eof then
			Else
				Dim ID
				ID=Rs(0)
				Set Rs=Dvbbs.Plus_Execute("update [Dv_LuZiOffice_SignIn] set SignInClass=1 Where ID="&ID&"")
			End If
				Set Rs=Dvbbs.Plus_Execute("insert into [Dv_LuZiOffice_SignIn](UserName,System,SignInTitle,SignInAction) Values('"&UserName&"',0,'"&Now()&" 签到记录','本期暂无通告，但希望各个斑竹还需要努力的做好自己的本职工作。')")
				Call SignInMessage()


			'//幸运用户创建
			Set Rs=Dvbbs.Execute("insert into dv_message(sender,incept,title,content,sendtime,issend) values('办公室' , '"&UserName&"' , '幸运用户' ,  '"&UserName&"恭喜您，您成为论坛本期的幸运用户，您将得 "&Setting(16)&"  个金币作为奖励。' , '"&now()&"' , '1')")
			Set Rs=Dvbbs.Plus_Execute("insert into [Dv_LuZiPlus_Log](UserName,ClassId,NewTime) Values('"&UserName&"',18,'"&Now()&"')")

	

			'//创建结束


		End If
	Else
	End If

End Sub


'//栏目
Public Sub Channel()
	Response.Write "<table width="&Dvbbs.mainsetting(0)&" border=0 align=center cellpadding=3 cellspacing=1>"
	Response.Write "<tr><th height=25>"
	'------------ 菜单部分 ----
	Response.Write "<table width=""100%"" border=0 cellpadding=0 cellspacing=0>"
	Response.Write "<tr>"
	Response.Write "<td Width=""14%"" align=center id=tabletitlelink><A Href=?Action=SignIn Title=我要签到><B>我要签到</B></A></td>"
	Response.Write "<td Width=""14%"" align=center id=tabletitlelink><A Href=?Action=OnLeave Title=有事请假><B>有事请假</B></A></td>"
	Response.Write "<td Width=""14%"" align=center id=tabletitlelink><A Href=?Action=Finance Title=财政日志><B>财政日志</B></A></td>"
	Response.Write "<td Width=""14%"" align=center id=tabletitlelink><A Href=?Action=Payment Title=我的工资><B>我的工资</B></A></td>"
	Response.Write "<td Width=""14%"" align=center id=tabletitlelink><A Href=?Action=SignInLog Title=签到记录><B>签到记录</B></A></td>"
	Response.Write "<td Width=""15%"" align=center id=tabletitlelink><A Href=?Action=Suggestion Title=我的留言本><B>我的留言本</B></A></td>"
	Response.Write "<td Width=""15%"" align=center id=tabletitlelink><A Href=?Action=Resign Title=申请辞职><B>申请辞职</B></A></td>"

	Response.Write "</tr></table>"
	'------------ 菜单部分 ----
	Response.Write "</th></td></table>"
End Sub

Public Sub LogChannel()
		Response.Write "<table border=0 cellpadding=3 cellspacing=1 align=center class=Tableborder1>"
		Response.Write "<tr>"
		Response.Write "<th height=25 Align=left>"&XiaoLu.UserName&" 给版主的："
		Response.Write " [<a onMouseOver=""showmenu(event,'<div class=menuitems><a href=?Action=EgEnd Title=点击查看>已审核日志</a><br /><a href=?Action=EgNot Title=点击查看>未审核日志</a></div>')"">奖励日志</a>]"
		Response.Write " [<a onMouseOver=""showmenu(event,'<div class=menuitems><a href=?Action=PgEnd Title=点击查看>已审核日志</a><br /><a href=?Action=PgNot Title=点击查看>未审核日志</a></div>')"">投诉日志</a>]"
		Response.Write " [<a onMouseOver=""showmenu(event,'<div class=menuitems><a href=?Action=WordEnd Title=点击查看>已回复留言</a><br /><a href=?Action=WordNot Title=点击查看>未回复留言</a></div>')"">留言内容</a>]</th></tr>"
		Response.Write "</table>"
End Sub

Public Sub UserInfo()

Response.Write "<table border=0 cellpadding=3 cellspacing=1 align=center class=Tableborder1 Style=""Width:100%"">"
Response.Write "<tr><th>个人资料 [<A href=Plus_ForumOffice_Team.asp?Action=UserInfo&Name="&UserName&"><Font Color=Red>我的评定资料</Font></A>]</th></tr><tr>"
Response.Write "<td align=center class=tablebody1>"

Response.Write "<table border=0 cellpadding=3 cellspacing=1 align=center style=""Width:95%"">"

Response.Write "<tr><td class=tablebody2>金币：<b><font color="&Dvbbs.mainsetting(1)&">"&usermoney&"</font></b> 个</td></tr>"
Response.Write "<tr><td class=tablebody1>金钱："&userwealth&"</td></tr>"
Response.Write "<tr><td class=tablebody2>签到 "&UserSignIn&" 次</td></tr>"
Response.Write "<tr><td class=tablebody1>请假 "&UserOnLeave&" 次</td></tr>"
Response.Write "<tr><td class=tablebody2>登陆 "&UserLogins&" 次</td></tr>"
Response.Write "<tr><td class=tablebody1>经验："&userep&"</td></tr>"
Response.Write "<tr><td class=tablebody2>被奖励金币：<b><font color="&Dvbbs.mainsetting(1)&">"&UserEg&"</font></b> 个</td></tr>"
Response.Write "<tr><td class=tablebody1>被处罚金币：<b><font color="&Dvbbs.mainsetting(1)&">"&UserPg&"</font></b> 个</td></tr>"
Response.Write "<tr><td class=tablebody2></td></tr>"

Response.Write "</table></td></tr></table>"

End Sub

Public Sub SignInMessage()

dim MessageName,LuRs

	Set LuRs=Dvbbs.Execute("Select * From [Dv_User] Where Cint(UserGroupID)=2 Or Cint(UserGroupID)=3")

		Do While Not LuRs.EOF
			
			MessageName = LuRs(1)
			Dim InRs
			Set InRs=Dvbbs.Execute("insert into dv_message(sender,incept,title,content,sendtime,issend) values('办公室' , '"&MessageName&"' , '签到信息' , '系统已找到新的一期签到记录，请到办公室办理签到' , '"&now()&"' , '1')")
			
		LuRs.movenext
		loop	  
End Sub

End Class

XiaoLu.Class_Setting() '执行数组
%>