<%
'Oblog Group Class
'Class_Group.asp
'teamusers中state的状态
'teamusers: state 1有效;2申请加入3被邀请4 副管理员 5 管理员
'拒绝后删除该记录,无论通过还是删除，系统会自动发一条消息给用户
Class Class_Team
	Public Group_id,Group_Name,Group_Ico,CssFile,Group_Links,Group_Creater,Group_ManagerId,Group_ManagerName,Group_CreateTime
	Public Group_Placard 
	Public PageFrameWork,PageBody,ShowMode,ErrMsg
	Private iPage,Sql,rs,imMode,pid,icoGood,icoTop,icoBlog
	
	Private Sub Class_initialize()
		Set rs=Server.CreateObject("Adodb.RecordSet")
		iPage=20
		On Error Resume Next
        If Not IsObject(conn) Then Link_DataBase
        pid=1
       ' icoBlog="<img src=""oBlogStyle/level/tu-001.gif"" border=0  title=""日志发布"" />"
'        icoTop="<img src=""oBlogStyle/level/light.gif"" border=0  title=""置顶"" />"
'        icoGood="<img src=""oBlogStyle/level/good.gif""  border=0 title=""精华"" />"
		icoBlog="[日志]"
        icoTop="[置顶]"
        icoGood="[精华]"
	End Sub
	
	Private Sub Class_terminate()
    On Error Resume Next
        If IsObject(conn) Then conn.Close: Set conn = Nothing
    If ErrMsg<>"" Then Response.Write ErrMsg
    End Sub
	
	Public Property Let GroupId(byval Value)
		Group_id=Int(Value)
		rs.Open "Select * From oblog_team Where teamid=" & Group_id,conn,1,1
		If rs.Eof Then
			Response.Write "目标" &P_QQ_NAME& "不存在!"
			Response.End
		Else
			If rs("iState") = 1 Then
				Response.Write "目标" &P_QQ_NAME& "尚未被管理员审核!"
				Response.End 
			ElseIf rs("iState") = 2 Then
				Response.Write "目标" &P_QQ_NAME& "被锁定!"
				Response.End 			
			End if
		End If
		rs.Filter="iState=3"

		If Not Rs.EOF Then 
			Group_Name=rs("t_name")
			Group_Ico=rs("t_ico")
			Group_CreateTime=rs("CreateTime")
			Group_ManagerId=rs("ManagerId")
			Group_ManagerName=rs("ManagerName")
			
			Call GetTheme
			Call IsManager
							
			Group_Links=rs("t_links")
		Else 
			Response.Write "目标" &P_QQ_NAME& "已经被删除!"
			Response.End
		End If
		rs.Close
		Set rs=Nothing
	End Property
	
	
	Public Sub Show
		PageFrameWork=MakeMainPage()
		iMode=Request("mode")
		Select Case ShowMode
			Case 1
				PageBody=GetIndexList(iMode)
			Case 2
				PageBody=ShowPost(pid)
			Case 3
				PageBody=GetUser(Group_id)
			Case Else
				PageBody=ErrMsg
		End Select
		'If ShowMode Then
		PageFrameWork=Replace(PageFrameWork,"$group_list$",PageBody)
		Response.Write PageFrameWork
		PageFrameWork=""
	End Sub
	
	'显示单一日志及回复
	Public Sub ShowPost(pid)
		Dim sRet,sPost,sReply,sEditor
		GetPost pid,sPost,sReply
		sRet=MakeMainPage()
		sRet=Replace(sRet,"$group_posts$",sPost)
		sRet=Replace(sRet,"$group_replys$",sReply)
		Response.Write sRet
		sRet=""
	End Sub
	
	'显示日志列表
	Public Sub ShowList(iType)
		Dim sRet
		sRet=MakeMainPage()
		sRet=Replace(sRet,"$group_replys$","")
		sRet=Replace(sRet,"$group_posts$",GetIndexList(iType))
		Response.Write sRet
		sRet=""
	End Sub
	
	Public Sub ShowUsers()
		Dim sRet
		sRet=MakeMainPage()
		sRet=Replace(sRet,"$group_replys$","")
		sRet=Replace(sRet,"$group_posts$",GetUsers)
		Response.Write sRet
		sRet=""
	End Sub
	
	Public Sub ShowInfo()
		Dim sRet
		sRet=MakeMainPage()
		sRet=Replace(sRet,"$group_replys$","")
		sRet=Replace(sRet,"$group_posts$",GetInfo)
		Response.Write sRet
		sRet=""
	End Sub

	
	Public Sub ShowLinksForm()
		Dim sRet
		sRet=MakeMainPage()
		sRet=Replace(sRet,"$group_replys$","")
		sRet=Replace(sRet,"$group_posts$",LinksForm)
		Response.Write sRet
		sRet=""
	End Sub
	
	Public Sub ShowPlacardForm()
		Dim sRet
		sRet=MakeMainPage()
		sRet=Replace(sRet,"$group_replys$","")
		sRet=Replace(sRet,"$group_posts$",PlacardForm)
		Response.Write sRet
		sRet=""
	End Sub
	
	Public Sub PostForm()
		Dim sRet
		sRet=MakeMainPage()
		sRet=Replace(sRet,"$group_replys$","")
		sRet=Replace(sRet,"$group_posts$",CommentForm(postid))
		Response.Write sRet
		sRet=""
	End Sub
	
	
	Public Sub ShowJoinForm()
		Dim sRet
		sRet=MakeMainPage()
		sRet=Replace(sRet,"$group_replys$","")
		sRet=Replace(sRet,"$group_posts$",JoinForm(Group_id))
		Response.Write sRet
		sRet=""
	End Sub	
	
	Public Sub ActionJoin()
		Dim sRet
		sRet=MakeMainPage()
		sRet=Replace(sRet,"$group_replys$","")
		sRet=Replace(sRet,"$group_posts$",AcceptJoin())
		Response.Write sRet
		sRet=""
	End Sub
	
	'群组帖子的几种获取类型;1: 全部，不分圈;2：某圈全部;3：某圈精华;4：某圈某人;5:最新发布;6:最新回复;
	Function GetIndexList(iMode)
		Dim SqlPart,sRet,sRet1,i,r
		Dim rs,lPage,lAll,lPages,sTitle,sMBar
		Select Case iMode
			Case "1"
				SqlPart=" And isbest=1 "
			Case "2"
				SqlPart=" And isblog=1 "
			Case "3"
				SqlPart=" And isblog=0 "
			Case Else
		End Select
		G_P_Filename="group.asp?gid=" & Group_id & "&mode="&imode&"&page="
		sRet=""
		Set rs=Server.CreateObject("Adodb.RecordSet")
		Sql="Select  * from (select top 500 isbest,istop,logid,postid,topic,author,replys,lastupdate From oblog_teampost Where teamid=" & Group_id & " And iDepth=0 And isTop=1 " & SqlPart & " Order By Lastupdate Desc"
		Sql= Sql & " union "
		Sql= Sql & " Select  top 500 isbest,istop,logid,postid,topic,author,replys,lastupdate From oblog_teampost Where teamid=" & Group_id & " And iDepth=0 And isTop=0  " & SqlPart & " Order by Lastupdate desc ) DERIVEDTBL ORDER BY istop DESC , lastupdate DESC"
		rs.Open Sql,conn,1,1
		'response.Write(sql)
		'Set rs=oblog.Execute(Sql)
		If rs.Eof Then
			rs.Close
			sRet="<div>目前还没有任何主题<div>"
			GetIndexList=sRet
			sRet=""
			Exit Function
		End If
		'分页
		If Request("page") = "" Or Request("page") ="0" then
			lPage = 1 
		Else
			lPage = Int(Request("page"))
		End If
		lAll=INT(rs.recordcount)
		'设置缓存大小 = 每页需显示的记录数目
		rs.CacheSize = iPage
		rs.PageSize = iPage
		rs.movefirst		
		lPages = rs.PageCount
		If lPage>lPages Then lPage=lPages
		rs.AbsolutePage = lPage
		Do While Not rs.Eof And i < rs.PageSize
		'写内容
			sTitle=""
			If rs("isbest")=1 Then 
				sTitle= icoGood  & sTitle
			End If
			If rs("istop")=1 Then 
				sTitle= icoTop  & sTitle
			End If
			If rs("logid")>0 Then sTitle= icoBlog  & sTitle
			if int(i/2)*2=i then r=1 else r=2
			sRet1="<td class='s1'>"&sTitle&"<a href='group.asp?gid="& Group_Id &"&pid=" & rs("postid")&"' title=""标题"&OB_IIF(rs("topic"),"无题")&""">"&OB_IIF(rs("topic"),"无题")&"</a></td>"
			sRet1=sRet1&"<td class='s2'><a href='go.asp?user="&rs("author")&"' title=""作者"&rs("author")&""">"&rs("author")&"</td>"
			sRet1=sRet1&"<td class='s3'>"&rs("replys")&"</td>"
			sRet1=sRet1&"<td class='s4'>"&rs("Lastupdate")&"</td>"
			sRet1="<tr class='r"&r&"'>"&sRet1&"</tr>"
			sRet=sRet & sRet1 & vbcrlf
			i=i+1
			rs.MoveNext
		Loop
		rs.Close
		Set rs=Nothing
		'生成一个底部分页条
		sRet="<table id='indexlist'><tbody><tr class='top'><td class='s1'>话题</td><td class='s2'>作者</td><td class='s3'>回复</td><td class='s4'>最后更新</td></tr>"&sRet&"</tbody></table>"
		sRet=sRet & "<div id=team_post_pages>" & PageBarNum(lAll,iPage,lPage,G_P_Filename) & "</div>"
		'兼容脚本错误
		sRet= sRet & vbcrlf & "<div id=""comment_list""></div>"
		GetIndexList=sRet
		sRet=""
		
	End Function
	
	Function GetUsers()
		Dim sRet
		Dim rs,lPage,lAll,lPages,i
		G_P_Filename="group.asp?gid=" & Group_id & "&cmd="&cmd&"&page="
		Sql="Select a.userid,a.province,a.city,username,nickname,blogname,user_icon1,log_count,user_group,scores From oblog_user a,"
		Sql= Sql & "(Select  userid,state From oblog_teamusers Where Teamid=" & Group_id & ") b Where a.userid=b.userid and b.state>2 Order By b.state Desc"
		Set rs=Server.CreateObject("Adodb.RecordSet")
		rs.open sql,conn,1,1
		If rs.EOF Then 
			GetUsers="<div id=""user_list""> 管理员帐号不存在或者已经被删除 </div>"
			Exit Function
		End if
		If Request("page") = "" Or Request("page") ="0" then
			lPage = 1 
		Else
			lPage = Int(Request("page"))
		End If
		lAll=INT(rs.recordcount)
		'设置缓存大小 = 每页需显示的记录数目
		rs.CacheSize = iPage
		rs.PageSize = iPage
		rs.movefirst		
		lPages = rs.PageCount
		If lPage>lPages Then lPage=lPages
		rs.AbsolutePage = lPage
		Do While Not rs.Eof and i < rs.PageSize
			sRet= sRet & "<ul><li class=""u1""><img src=""" & OB_IIF(rs("user_icon1"),"images/ico_default.gif") & """ border=0 width=48 height=48></li>" & vbcrlf
			sRet= sRet & "<li class=""u2""><a href=""go.asp?userid=" & rs("userid") & """ target=_blank>" &  rs("username") &"</a></li>" & vbcrlf
			sRet= sRet & "<li class=""u3"">(" & rs("province") & rs("city")  &")</li>" & vbcrlf
			sRet= sRet & "</ul>" & vbcrlf
			i=i+1
			rs.Movenext			
		Loop
		rs.Close
		Set rs=Nothing
		sRet=sRet & "<div id=team_post_pages>" & PageBarNum(lAll,iPage,lPage,G_P_Filename) & "</div>"
		GetUsers="<div id=""user_list"">" & sRet & "</div>"
		sRet=""
	End Function
	

	Sub SaveComment()
		Dim title,content,author,userid,url,sql,rs,pid,iDepth,modify
		modify=trim(request("modify"))
		author=Request.Form("username")	
		pid=Request("pid")
		If pid="" Then 
			pid=0
			iDepth=0
		Else
			iDepth=1
		End If
		pid=Int(pid)
		title=RemoveHtml(Request.Form("commenttopic"))
		content=Request.Form("oblog_edittext")
		'验证码校验
		if oblog.CacheConfig(30)=1 Then
			If  request("CodeStr")="" then
				oblog.showok "验证码错误，请返回刷新后重新输入！",""
				exit sub
			Else
				if not oblog.codepass then 
					oblog.showok "验证码错误，请返回刷新后重新输入！",""
					exit sub
				end if
			End If
		end if
		If Len(content)=0 Or Len(content)>50000 Then
			oblog.showok "发布的内容不能为空，且长度不能大于50000",""
			exit sub
		End If
		If oblog.checkuserlogined() Then 
			Author= oblog.l_uname
			userid=oblog.l_uid
		Else
			
		End If
		If pid=0 Then
			If IsMember=false Then
				oblog.showok "非本" &P_QQ_NAME& "成员不可以发起主题，仅可回复，您可以申请加入该" &P_QQ_NAME& "",""
				exit sub
			End If
		End If
		Set rs=Server.CreateObject("Adodb.RecordSet")
		rs.Open "Select * From oblog_teampost Where postid=" & pid,conn,1,3
		If rs.Eof Then
			If pid>0 Then
				rs.Close
				Set rs=Nothing
				ErrMsg= "目标主题不存在"
				Exit Sub
			End If
		else
			If IsManager=false and modify="1" then
				if rs("userid")<>oblog.l_uid then
					rs.Close
					Set rs=Nothing
					ErrMsg= "无权限"
					Exit Sub
				end if 
			end if
		End If		
		if modify<>"1" then	
			rs.AddNew
			rs("teamid")=Group_Id
			rs("author")=Author
			rs("parentid")=pid
			rs("iDepth")=iDepth
			rs("logid")=0
			rs("userid")=userid
			rs("addip")=oblog.userip
			rs("addtime")=ServerDate(Now)
			rs("LastUpdate")=ServerDate(Now) 
			rs("ispass")=1
			rs("istop")=0
			rs("isbest")=0
		end if
		if pid>0 and modify<>"1" then
			rs("content")=oblog.Ubb_comment(EncodeJP(oblog.filt_badword(content)))
		else
			rs("content")=EncodeJP(oblog.filt_badword(content))
		end if
		rs("topic")=EncodeJP(oblog.InterceptStr(oblog.filt_badword(title),50))
		rs.Update
		if pid>0 and modify<>"1" then oblog.Execute("Update oblog_teampost Set replys=replys+1,LastUpdate='" & ServerDate(Now) & "' Where teamid=" & Group_id &" and postid="&pid)
		if modify<>"1" then oblog.Execute("Update oblog_team Set icount2=icount2+1 Where teamid=" & Group_id)
		If userid>0 and modify<>"1" Then oblog.Execute("Update oblog_teamusers Set post_replys=post_replys+1 Where userid=" & userid & " And teamid=" & Group_id)
		rs.Close
		Set rs=Nothing
		If pid=0 Then
			Response.Redirect "group.asp?gid=" & Group_id
		Else
			Response.Redirect "group.asp?gid=" & Group_id & "&pid=" & pid
		End If
	End Sub
	
	'管理模式：置顶/取消置顶/精华/取消精华/删除
	Sub PostManage(cmd,pid)
		Dim targetUrl
		If IsManager=false and cmd<>"del" Then
			ErrMsg= "你没有权限进行此操作"
			Exit Sub
		End If
		pid=Int(pid)
		Select Case Cstr(cmd)
			Case "good1"
				Sql="Update oblog_teampost Set isbest=1 Where postid=" & pid
				targetUrl= "group.asp?gid=" & Group_id & "&pid=" &pid
			Case "good0"
				Sql="Update oblog_teampost Set isbest=0 Where postid=" & pid
				targetUrl= "group.asp?gid=" & Group_id & "&pid=" &pid
			Case "top1"
				Sql="Update oblog_teampost Set istop=1 Where postid=" & pid
				targetUrl= "group.asp?gid=" & Group_id & "&pid=" &pid
			Case "top0"
				Sql="Update oblog_teampost Set istop=0 Where postid=" & pid
				targetUrl= "group.asp?gid=" & Group_id & "&pid=" &pid
			Case "del"
				if IsManager then
					sql="Select userid,parentid From oblog_teampost Where postid=" & Pid
				else
					if oblog.CheckUserLogined then
						sql="Select userid,parentid From oblog_teampost Where postid=" & Pid&" and userid="&oblog.l_uid
					else
						exit sub
					end if
				end if
				Set rs=oblog.Execute(sql)
				If Not rs.Eof Then
					oblog.Execute "Update oblog_teampost Set replys=replys-1,scores=scores-1 Where postid=" & rs(1)
					'response.End()
					If Ob_IIF(rs(0),0)>0 Then oblog.Execute "Update oblog_teamusers Set post_all=post_all-1 ,post_replys=post_replys-1 Where userid=" & rs(0) & " And teamid=" & Group_Id
					oblog.Execute "Delete From  oblog_teampost Where postid=" & pid
					Sql="Update oblog_team Set icount1=icount1-1 Where teamid=" & Group_id
				end if
				targetUrl= "group.asp?gid=" & Group_id
				'oblog.Execute Sql
			Case "6"
				Dim rs
				Set rs=oblog.Execute("Select userid,parentid From oblog_teampost Where postid=" & Pid)
				If Not rs.Eof Then
					oblog.Execute "Delete From  oblog_teampost Where postid=" & pid
					'重新结算回复数目
					oblog.Execute "Update oblog_teampost Set replys=replys-1,scores=scores-1 Where postid=" & rs(1)
					If Ob_IIF(rs(0),0)>0 Then oblog.Execute "Update oblog_teamusers Set post_all=post_all-1 ,post_replys=post_replys-1 Where userid=" & rs(0) & " And teamid=" & Group_Id
					Sql="Update oblog_team Set icount2=icount2-1 Where teamid=" & Group_id
				End If
				'删除一个回复
				Sql="Delete From  oblog_teampost Where postid=" & pid
				oblog.Execute Sql
				targetUrl= "group.asp?gid=" & Group_id & "&pid=" &pid
		End Select
		If Sql<>"" Then oblog.Execute Sql
		oblog.showok "操作成功!",targetUrl
		'Response.Redirect targetUrl
	End Sub
	Function Search()
		
	End Function
	
	'-----------------------------
	'构建显示页面
	'-----------------------------
	
	'构建基础页面模型
	Private Function MakeMainPage()
		Dim sMList,sMButtons,sRet,sRet1,rs,Sql
		'进行模板处理
		if postid<>"" then
			sRet=Application(cache_name&"_group_theme_more")
		else
			sRet=Application(cache_name&"_group_theme_main")
		end if
		sRet=Replace(sRet,"$group_m_buttons$","")
		sRet=Replace(sRet,"$group_id$",Group_Id)	
		sRet=Replace(sRet,"$group_name$",Group_Name)
		If OB_IIF(Group_Ico,"")="" Then
			sRet=Replace(sRet,"$group_ico$",Group_Ico)
		Else
			sRet=Replace(sRet,"$group_ico$","")
		End If
		sRet=Replace(sRet,"$group_creater$",Group_creater)
		sRet=Replace(sRet,"$group_id$",Group_Id)
		'顶部
		sRet=Replace(sRet,"$group_top$","<div id=""ad_teamtop""><script src='ad/ad_teamtopjs.htm'></script></div>"&index_showtop())
		'底部
		sRet=Replace(sRet,"$group_bottom$",oblog.CacheConfig(10)&"<div id=""ad_teambot""><script src='ad/ad_teambotjs.htm'></script></div>")
		Dim arr
		Call GetGroupInfo(arr)
		if postid<>"" then
			sRet=Replace(sRet,"$group_mini_list$",getminilist())
		else
			'公告
			sRet=Replace(sRet,"$group_placard$", arr(1))
			'友情连接
			sRet=Replace(sRet,"$group_links$",arr(2)&"<div id=""ad_teamlinks""><script src='ad/ad_teamlinksjs.htm'></script></div>")
			'群组信息
			sRet=Replace(sRet,"$group_info$","")
			'活跃用户
			sRet=Replace(sRet,"$group_bestuser$",index_showuser("best"))
			'最新加入
			sRet=Replace(sRet,"$group_newuser$",index_showuser("new"))
		end if
		
		'最新群组
		'最活跃群组
		MakeMainPage=sRet
	End Function
	
	function index_showtop()
		Dim sRet
		sRet=""
		sRet=sRet & "<img class=""g_img"" src=""" &OB_IIF(Group_Ico,"images/default_groupico.gif") & """ border=0 width=80 height=80/>"
		sRet=sRet & "<div class=""g_name"">" & Group_Name &"</div>"
		sRet=sRet & "<div class=""g_url""> <a href=""group.asp?gid="&group_id&""">"&oblog.cacheConfig(3)&"group.asp?gid="&group_id&"</a> <a href=""javascript:window.clipboardData.setData('Text','"&oblog.cacheConfig(3)&"group.asp?gid="&group_id&"');void('0');"">复制</a> / <a href=""javascript:window.external.AddFavorite(document.location,'"&replace(Group_Name,"'","")&"')"">收藏</a></div>"
		'sRet=sRet & "<div class=""g_info"">"&rs("intro")&"</div>"
		sRet="<div id=""group_top"">"&sRet&"</div>"
		index_showtop=sRet
		sRet=""
		Set rs=Nothing
	end function
	
	function index_showuser(action)
		dim sql,tmp,i
		if action="best" then
			tmp="Order By post_replys Desc"
		else
			tmp="Order By addtime Desc"
		end if
		Sql="Select a.*,b.nickname,b.username,b.user_icon1 From (Select top 9 * From oblog_teamusers Where state>2 and teamid=" & Group_Id & " "&tmp&") a,oblog_user b Where a.userid=b.userid"
		'response.Write(sql)
		Set rs=oblog.Execute(Sql)
		If Not rs.Eof Then
			Do While Not rs.Eof
				i=i+1
				if i>9 then exit do
				index_showuser=index_showuser & "<ul class=""bestuser"">"
				index_showuser=index_showuser & "<li class=""userimg""><a href=""go.asp?userid=" & rs("userid")&""" target=_blank><img src=""" & OB_IIF(rs("user_icon1"),"images/ico_default.gif")&""" /></a></li>"					
				index_showuser=index_showuser & "<li class=""username""><a href=""go.asp?userid=" & rs("userid")&"""  target=_blank>" & OB_IIF(rs("nickname"),rs("username"))&"</a></li>"
				index_showuser=index_showuser & "</ul>"				
				rs.movenext
			Loop
		End If
		Set rs=Nothing
	end function
	

	
	'主题内容置顶，其它分页
	Function GetPost(byval pid,sRet,sRet1)
		Dim i,rs,Sql,sTitle,sMBar
		Dim lPage,lAll,lPages
		Set rs=Server.CreateObject("Adodb.RecordSet")
		Sql="Select a.*,b.user_icon1 From oblog_teampost a,oblog_user b Where a.postid="& pid &" and a.userid=b.userid And iDepth=0"
		G_P_Filename="group.asp?gid="&Group_Id&"&pid=" & pid & "&page="
		Set rs=oblog.execute(Sql)
		If rs.Eof Then
			sRet="<li>编号为" & pid & "的主题不存在</li>"
			Set rs=Nothing
			Exit Function
		End If
		sTitle=OB_IIF(rs("topic"),"无题")
		If rs("isbest")=1 Then 
			sMBar="<a href=""group.asp?cmd=good0&gid=" & Group_Id & "&pid=" & rs("postid") & """>取消精华</a> | "
		Else
			sMBar="<a href=""group.asp?cmd=good1&gid=" & Group_Id & "&pid=" & rs("postid") & """>设为精华</a> | "
		End If
		If rs("istop")=1 Then 
			sMBar=" | <a href=""group.asp?cmd=top0&gid=" & Group_Id & "&pid=" & rs("postid") & """>取消置顶</a> | " & sMBar
		Else
			sMBar=" | <a href=""group.asp?cmd=top1&gid=" & Group_Id & "&pid=" & rs("postid") & """>设为置顶</a> | " & sMBar
		End If
		'If rs("logid")>0 Then sTitle= icoBlog  & sTitle
		sMBar=sMBar & "<a href=""group.asp?cmd=del&gid=" & Group_Id & "&pid=" & rs("postid") & """ onclick=""return confirm('确定删除此帖子？');"">删除</a> | "
		sMBar=sMBar & "<a href=""group.asp?cmd=post&modify=1&gid=" & Group_Id & "&pid=" & rs("postid") & """>编辑</a>"
		sRet=Application(cache_name&"_group_theme_post")
		'替换ID,进行显示
		sRet=Replace(sRet,"c_content_down", "c_content_down1")
		sRet=Replace(sRet,"$group_post_title$", sTitle)
		sRet=Replace(sRet,"$group_content$",rs("content"))
		sRet=Replace(sRet,"$group_post_userico$",OB_IIF(rs("user_icon1"),"images/ico_default.gif"))
		sRet=Replace(sRet,"$group_post_user$",rs("author"))
		sRet=Replace(sRet,"$group_post_time$",rs("addtime"))
		sRet=Replace(sRet,"$group_post_content$",filtscript(rs("content")))
		sRet=Replace(sRet,"$group_post_id$",rs("postid"))
		sRet=Replace(sRet,"$group_post_replys$",rs("replys"))
		sRet=Replace(sRet,"$group_tags$",OB_IIF(rs("tags"),""))
		sRet=Replace(sRet,"$group_post_link$","#")
		sRet=Replace(sRet,"$group_post_userurl$","go.asp?user="&rs("author"))
		
		If imMode=1 Then
			sRet=Replace(sRet,"$group_post_m$",sMBar)
		Else
			if oblog.CodeCookie(rs("author"))=Request.Cookies(cookies_name)("username") then
				sRet=Replace(sRet,"$group_post_m$","<a href=""group.asp?cmd=del&gid=" & Group_Id & "&pid=" & rs("postid") & """>删除</a> | <a href=""group.asp?cmd=post&modify=1&gid=" & Group_Id & "&pid=" & rs("postid") & """>编辑</a>")
			else
				sRet=Replace(sRet,"$group_post_m$","")
			end if
		End If
		rs.Close
		'挂广告
		sRet=sRet & vbcrlf & "<div id=""oblog_ad_team_post_1""></div>" & Vbcrlf
		'挂内容
		rs.Open "Select a.*,b.user_icon1,b.username From (Select top 500 * From oblog_teampost Where idepth>0 And parentid=" & pid & " Order By postid Desc) a,oblog_user b Where a.userid=b.userid",conn,1,1
		If rs.Eof Then
			sRet1=""			
		Else
			i=0
			'分页
			If Request("page") = "" Or Request("page") ="0" then
				lPage = 1 
			Else
				lPage = Int(Request("page"))
			End If
			lAll=INT(rs.recordcount)
			'设置缓存大小 = 每页需显示的记录数目
			rs.CacheSize = iPage
			rs.PageSize = iPage
			rs.movefirst		
			lPages = rs.PageCount
			If lPage>lPages Then lPage=lPages
			rs.AbsolutePage = lPage
			sRet1=""
			i=0
			Do While Not rs.Eof And i < rs.PageSize
				i=i+1
				sRet1=sRet1 & vbcrlf & Replace(Application(cache_name&"_group_theme_reply"),"$group_topic$","") & vbcrlf
				sRet1=Replace(sRet1,"$group_reply_content$",rs("content"))
				sRet1=Replace(sRet1,"$group_reply_user$","<a href='go.asp?user="&rs("author")&"'>"&rs("author")&"</a>")
				sRet1=Replace(sRet1,"$group_reply_time$",rs("addtime"))
				sRet1=Replace(sRet1,"$group_reply_userico$",OB_IIF(rs("user_icon1"),"images/ico_default.gif"))
				sRet1=Replace(sRet1,"$group_reply_high$","第<span class=""xx"">" & i & "</span>楼")
				If imMode=1 or oblog.CodeCookie(rs("author"))=Request.Cookies(cookies_name)("username") Then
					sRet1=Replace(sRet1,"$group_reply_m$","<a href=""group.asp?cmd=del&gid=" & Group_id &"&pid=" & rs("postid")& """>删除</a>")
				Else
					sRet1=Replace(sRet1,"$group_reply_m$","")
				End If
				rs.MoveNext
			Loop			
		End If
		sRet1= vbcrlf &  "<div id=""comment_list"">" & sRet1 &"</div>" & vbcrlf
		'挂分页代码
		sRet1= sRet1 & "<div id=team_post_pages>" & PageBarNum(lAll,iPage,lPage,G_P_Filename) & "</div>"
		'挂回复
		sRet1=sRet1 & CommentForm(pid)
	End Function
	
	'获取最新回复
	Function GetNewComments()
		Dim rs,Sql,sRet
		Sql="Select top 5 content From oblog_teampost Where iDepth>0 And teamid=" & Group_id & " Order By postid Desc"
		Set rs=oblog.Execute(Sql)
		If rs.Eof Then
			sRet="<li>-<li>"
		Else
			Do While Not rs.Eof
				sRet=sRet & "<li>" & Left(RemoveHtml(rs(0)),10) & "...</li>"
				rs.MoveNext
			Loop
		End if
		Set rs=Nothing
		GetNewComments=sRet
		sRet=""
	End Function
	
	'获得群组信息
	Sub GetGroupInfo(byref arrInfo)
		Dim rs,rst,sRet
		Redim arrInfo(2)
		Sql="Select * From oblog_team Where teamid=" & Group_id 
		Set rs=oblog.Execute(Sql)
		If rs.Eof Then
			Set rs=Nothing
			Exit Sub
		End If
		'获取群组基本信息
		sRet=""
		sRet=sRet & "<li>" & rs("t_name") &"</li>"
		sRet=sRet & "<li>创建者:" & rs("managername") &"</li>"
		sRet=sRet & "<li>创建时间:" & rs("createtime") &"</li>"
		sRet=sRet & "<li>成员人数:" & rs("icount0") &"</li>"
		sRet=sRet & "<li>主题回复:" & rs("icount1") &"/"& rs("icount2") &"</li>"		
		arrInfo(0)=sRet
		sRet=""
		'获取公告信息
		arrInfo(1)=OB_IIF(rs("announce"),"没有设置")
		'获取有情连接信息
		arrInfo(2)=OB_IIF(rs("links"),"没有设置")
		Set rs=Nothing
		Set rst=Nothing
		sRet=""
		Set rs=Nothing
	End Sub
	
	
	function GetInfo()
		Dim rs,rst,sRet
		Sql="Select * From oblog_team Where teamid=" & Group_id 
		Set rs=oblog.Execute(Sql)
		If rs.Eof Then
			Set rs=Nothing
			Exit function
		End If
		sRet=""
		sRet=sRet & "<div id=""group_info""><h1>" &P_QQ_NAME& "信息</h1><li>" &P_QQ_NAME& "名称:" & rs("t_name") &"</li>"
		sRet=sRet & "<li>创建者:" & rs("managername") &"</li>"
		sRet=sRet & "<li>创建时间:" & rs("createtime") &"</li>"
		sRet=sRet & "<li>成员人数:" & rs("icount0") &"</li>"
		sRet=sRet & "<li>主题回复:" & rs("icount1") &"/"& rs("icount2") &"</li></div>"
		GetInfo=sRet
		sRet=""
		Sql="Select a.userid,a.province,a.city,username,nickname,blogname,user_icon1,log_count,user_group,scores From oblog_user a,"
		Sql= Sql & "(Select  userid,state,addtime From oblog_teamusers Where Teamid=" & Group_id & ") b Where a.userid=b.userid and b.state=5 Order By b.addtime Desc"
		Set rs=Oblog.Execute(Sql)
		Do While Not rs.Eof
			sRet= sRet & "<ul><li class=""u1""><img src=""" & OB_IIF(rs("user_icon1"),"images/ico_default.gif") & """ border=0 width=48 height=48></li>" & vbcrlf
			sRet= sRet & "<li class=""u2""><a href=""go.asp?userid=" & rs("userid") & """ target=_blank>" &  rs("username") &"</a></li>" & vbcrlf
			sRet= sRet & "<li class=""u3"">(" & rs("province") & rs("city")  &")</li>" & vbcrlf
			sRet= sRet & "</ul>" & vbcrlf
			rs.MoveNext
		Loop
		GetInfo=GetInfo&"<div id=""user_list""><h1>" &P_QQ_NAME& "管理员</h1>"&sRet&"</div>"
	end  function

	'获取相关的群组列表信息
	Function GetTeams(byval sNumber,byval sType)
		Dim Sql,rs,sRet,sField1,sField2
		Select Case sType
			Case 1
				' hot 最热,回复最多
				sField1="icount2"
				sField2="icount2 Desc"
			Case 2
				'active 最积极,发表文章最多
				sField1="icount1"
				sField2="icount1 Desc"
			Case 3
				'最庞大
				sField1="icount0"
				sField2="icount0 Desc"
			Case 4
				'最新加入
				sField= "icount0"	
				sField= "teamid Desc"		
		End Select
		Sql="Select top " & sNumber & " teamid,t_name, " &  sField & " From oblog_team Order by " & sField
		Set rs=oblog.Execute(Sql)
		If rs.Eof Then
			sRet="<li>还没有任何" & P_QQ_Name &"信息</li>"
		Else
			Do While Not rs.Eof
				sRet=sRet & "<li><a href=""group.asp?Group_id=" & rs(0) & """ target=_blank>" & rs(1) & "</a>(" & rs(2) & ")</li>"
				rs.Movenext
			Loop	
		End If
		Set rs=Nothing
		GetHotTeams=sRet
		sRet=""
	End Function
	
	Function CommentForm(id)
		Dim sName,sRet,sTopic,sContent,modify,sql
		modify=trim(request("modify"))
		'If oblog.checkuserlogined()=false Then
		'	CommentForm="<p><a href='login.asp?fromurl=group.asp?cmd="&cmd&"$gid="&Group_Id&"$pid="&id&"'>您必须登录后才能进行回复或者发起新的主题</a></p>"
		'	Exit Function
		'End If
		if trim(request("modify"))="1" and id<>"" then
			if IsManager=true then
				sql="select * from oblog_teampost where postid="&clng(id)
			else
				sql="select * from oblog_teampost where postid="&clng(id)&" and userid="&oblog.l_uid
			end if
			set rs=oblog.execute(sql)
			if not rs.eof then
				sTopic=rs("topic")
				sContent=rs("content")
			end if
		end if
		sRet="<div id=""form_comment""><a name=""add_comment""></a><form action='group.asp?cmd=save&gid="&Group_Id&"&pid=" & id &"&modify="&trim(request("modify"))&"' method='post' name='commentform' id='commentform'>"& vbcrlf 
		sRet=sRet&"<div id=""ad_teamcomment""><script src='ad/ad_teamcommentjs.htm'></script></div>"
		sName=oblog.l_uname
		If  sName ="" Then  sName="游客"
		sRet=sRet & "<ul><p>" & sName & " , 欢迎您参与" &P_QQ_NAME& "讨论,在此处发布的内容将不显示在您的博客中</p></ul>"
		If Id="" Then sRet=sRet & "<ul>仅该" &P_QQ_NAME& "成员可以发起主题，非成员仅可以回复</ul>"
		If Not oblog.checkuserlogined() Then
			sRet=sRet & "<ul>用户名：<input name='UserName' type='text' id='UserName' size='15' maxlength='20' value='' /></ul>" & vbcrlf 
			sRet=sRet & "<ul>密&nbsp;&nbsp;&nbsp;&nbsp;码：<input name='Password' type='password' id='Password' size='15' maxlength='20' value='' /> </ul>" & vbcrlf 
		Else
			sRet=sRet & "<ul style=""display:none"">昵称：<input name='UserName' type='text' id='UserName' size='15' maxlength='20' value='' /></ul>" & vbcrlf 
			sRet=sRet & "<ul style=""display:none;"">密码：<input name='Password' type='password' id='Password' size='15' maxlength='20' value='' /> (游客无须输入密码)</ul>" & vbcrlf 
			sRet=sRet & "<ul style=""display:none;"">主页：<input name='homepage' type='text' id='homepage' size='42' maxlength='50' value='http://' /></ul>"  & vbcrlf 
		End If
		If Id="" or modify="1" Then sRet=sRet & "<ul>标&nbsp;&nbsp;&nbsp;&nbsp;题：<input name='commenttopic' type='text' id='commenttopic' size='50' maxlength='50' value='"&sTopic&"' /></ul>"  & vbcrlf 
		sRet=sRet & "<ul>" & vbcrlf 
		if id="" or modify="1" then
			sRet=sRet & "<div id=""oblog_edit""><span id=""loadedit"" style=""font-size:12px""><img src='images/loading.gif' align='absbottom'> 正在载入编辑器...</span><textarea id=""oblog_edittext"" name=""oblog_edittext"" style=""width:400px;height:250px; display:none"" >"&sContent&"</textarea></div> " & vbcrlf
		else
			sRet=sRet & "<div id=""oblog_edit""><img src=""images/loading.gif""></div> " & vbcrlf
		end if 
		sRet=sRet & "</ul>" & vbcrlf 
		sRet=sRet & "<ul><span id=""ob_code"" style=""display:none"">验证码：<input name=""CodeStr"" type=""text"" size=""6"" maxlength=""4"" /> "&oblog.getcode&"</span><input type='submit' value=' 提交 '></ul>" & vbcrlf 
		sRet=sRet & "</form></div>"& vbcrlf
		if oblog.CacheConfig(30)=1 Then 
			sRet=sRet & "<script>document.getElementById(""ob_code"").style.display='';</script>"
		end if
		if id<>"" and modify<>"1" then
			sRet=sRet & "<script>function addcode(){return true;}</script>"
			sRet=sRet & "<script src=""commentedit.asp""></script>"
		else

		end If
		if id="" or modify="1" then
			'载入编辑器
			sRet=sRet&	"<script language=JavaScript src='"&C_Editor&"/scripts/language/schi/editor_lang.js'></script>"
			sRet=sRet&	"<script language=JavaScript src='"&C_Editor&"/scripts/innovaeditor.js'></script>"
			sRet=sRet&	"<script language=""JavaScript"">"
			sRet=sRet&	"var oEdit1 = new InnovaEditor(""oEdit1"");"
			sRet=sRet&	"oEdit1.width=397;"
			sRet=sRet&	"oEdit1.height=260;"
			sRet=sRet&	"oEdit1.features=[""Hyperlink"",""Image"",""Flash"",""Media"",""CustomObject"",""|"",	""ClearAll"",""PasteWord"",""PasteText"",""RemoveFormat"",""|"",	""Bold"",""Italic"",""Underline"",""Strikethrough"",""|"",							""ForeColor"",""BackColor"",""|""];"
			sRet=sRet&	"oEdit1.cmdCustomObject = ""modelessDialogShow('"&blogdir&"editor/scripts/emot.htm',280,200)""; "
			sRet=sRet&	"oEdit1.cmdAssetManager=""modalDialogShow('"&blogdir&"editupload.asp',640,465)"";"
			sRet=sRet&	"oEdit1.REPLACE(""oblog_edittext"");"
			sRet=sRet&	"oEdit1.focus();"
			sRet=sRet&	"</script>"
			'编辑器载入完毕
		End if
		CommentForm=sRet
		sRet=""
	End Function 
	
	
	
	Function GetTheme()
		Dim oFso,oStream,sRet,objReg
		If Application(cache_name&"_group_theme_main")="" Then
			Application.Lock
			'模板
			Set oFso=Server.CreateObject(oblog.CacheCompont(1))
			Set oStream=oFSO.OpenTextFile(Server.Mappath("common/group/default/group.htm"),1,False)
			sRet = oStream.ReadAll
			Application(cache_name&"_group_theme_main")=sRet
			Set oStream=oFSO.OpenTextFile(Server.Mappath("common/group/default/post.htm"),1,False)
			sRet = oStream.ReadAll
			Application(cache_name&"_group_theme_post")=sRet
			Set oStream=oFSO.OpenTextFile(Server.Mappath("common/group/default/reply.htm"),1,False)
			sRet = oStream.ReadAll
			Application(cache_name&"_group_theme_reply")=sRet
			Set oStream=oFSO.OpenTextFile(Server.Mappath("common/group/default/more.htm"),1,False)
			sRet = oStream.ReadAll
			Application(cache_name&"_group_theme_more")=sRet
			'广告
			'Set oStream=oFSO.OpenTextFile(Server.Mappath("ad/ad_teamtop.htm"),1,False)
'			sRet = oStream.ReadAll
'			Application(cache_name&"_group_ad_teamtop")=sRet
'			Set oStream=oFSO.OpenTextFile(Server.Mappath("ad/ad_teamlinks.htm"),1,False)
'			sRet = oStream.ReadAll
'			Application(cache_name&"_group_ad_teamlinks")=sRet
'			Set oStream=oFSO.OpenTextFile(Server.Mappath("ad/ad_teamcomment.htm"),1,False)
'			sRet = oStream.ReadAll
'			Application(cache_name&"_group_ad_teamcomment")=sRet
'			Set oStream=oFSO.OpenTextFile(Server.Mappath("ad/ad_teambot.htm"),1,False)
'			sRet = oStream.ReadAll
'			Application(cache_name&"_group_ad_teambot")=sRet
			Application.Unlock
			sRet=""
			Set oStream=Nothing
			Set oFso=Nothing
		End If	
	End Function
	
	Function IsManager()
		IsManager=false
		imMode=0
		If oblog.CodeCookie(Group_ManagerName)=Request.Cookies(cookies_name)("username") Then
			If oblog.checkuserlogined()=true Then
				imMode=1
				IsManager=true
			End If
		End If
	End Function
	
	Function IsMember()
		Dim rs
		IsMember=false
		If oblog.checkuserlogined()=true Then
			Set rs=oblog.Execute("Select id From oblog_teamusers Where state>2 and teamid=" & Group_id & " And userid=" & oblog.l_uid )
			If Not rs.Eof Then
				IsMember=true
			End If
			Set rs=Nothing
		End If
	End Function
	'----------------------------------------------------
	'群组管理功能模块
	'----------------------------------------------------
	'申请加入模块
	Function JoinForm(id)
		Dim sRet,rs
		'If oblog.checkuserlogined()=false Then
		'	JoinForm="<p><a href='login.asp?fromurl=group.asp?cmd=join$gid="&Group_id&"'>您必须先登录后才能申请加入</a></p>"
		'	Exit Function
		'End If
		'判断加入条件
		Set rs=oblog.execute("Select joinlimit,joinscores,icount0 From oblog_team Where teamid="& int(id))
		If rs.Eof Then
			ErrMsg="目标" &P_QQ_NAME& "不存在!"
			Response.End
		End If
		Select Case rs(0)
			Case 1
			Case 2
				ErrMsg="本" &P_QQ_NAME& "只能由组长发出邀请，不能申请加入"
			Case 3
				If oblog.l_uscores<rs(1) Then
					ErrMsg="加入本" &P_QQ_NAME& "需要至少 " & rs(1) & " 点积分,您的积分不足"
				End If
		End Select
		if rs(2)>=p_Group_MaxUser then
			ErrMsg="本" &P_QQ_NAME& "成员已达到系统上限"&p_Group_MaxUser&"人。"
		end if
		Set rs=Nothing
		If ErrMsg<>"" Then	
			JoinForm=ErrMsg		
			Exit Function
		End If
		'是否任何人都可以加入
		sRet="<form action=group.asp?cmd=savejoin&gid="&Group_id&" method=""post"">" & vbcrlf
		If Not oblog.checkuserlogined() Then
			sRet=sRet & "游客,请填写您的申请信息<br/>"
			sRet=sRet & "<ul>用户名：<input name='UserName' type='text' id='UserName' size='15' maxlength='20' value='' /></ul>" & vbcrlf 
			sRet=sRet & "<ul>密&nbsp;&nbsp;&nbsp;&nbsp;码：<input name='Password' type='password' id='Password' size='15' maxlength='20' value='' /> </ul>" & vbcrlf 
		Else
			sRet=sRet & oblog.DecodeCookie(Request.Cookies(cookies_name)("username")) & ",请填写您的申请信息<br/>"
			sRet=sRet & "<ul style=""display:none"">昵称：<input name='UserName' type='text' id='UserName' size='15' maxlength='20' value='' /></ul>" & vbcrlf 
			sRet=sRet & "<ul style=""display:none;"">密码：<input name='Password' type='password' id='Password' size='15' maxlength='20' value='' /> (游客无须输入密码)</ul>" & vbcrlf 
			sRet=sRet & "<ul style=""display:none;"">主页：<input name='homepage' type='text' id='homepage' size='42' maxlength='50' value='http://' /></ul>"  & vbcrlf 
		End If
		sRet=sRet & "<textarea cols=50 rows=6 maxlength=200 name=info></textarea><br/>"
		sRet=sRet & "<input type=""submit"" value="" 提交 "">"
		sRet=sRet & "</form>"
		JoinForm=sRet
	End Function
	'批准模块
	Function AcceptJoin()
		Dim rs,sql,sRet,ustate
		'判断用户是否登录
		If oblog.checkuserlogined()=false Then
			AcceptJoin="<p>您必须登录后才能进行申请操作</p>"			
			Exit Function
		End If
		ustate=2
		'判断加入条件
		Set rs=oblog.execute("Select joinlimit,joinscores From oblog_team Where teamid="& int(Group_id))
		If rs.Eof Then			
			ErrMsg="目标" &P_QQ_NAME& "不存在!"
			Response.End
		End If
		Select Case rs(0)
			Case -1
				ustate=3
			Case 1
			Case 2
				ErrMsg="本" &P_QQ_NAME& "只能由组长发出邀请，不能申请加入"
			Case 3
				If oblog.l_uscores<rs(1) Then
					ErrMsg="加入本" &P_QQ_NAME& "需要至少 " & rs(1) & " 点积分,您的积分不足"
				End If
		End Select
		If ErrMsg<>"" Then	
			AcceptJoin=ErrMsg		
			Exit Function
		End If
		'判断之前是否已加入或申请
		Sql="Select * From oblog_teamusers Where teamid=" & Group_id & " And userid=" & oblog.l_uid
		Set rs=Server.CreateObject("Adodb.Recordset")
		rs.Open Sql,conn,1,3
		If Not rs.Eof Then
			Select Case rs("state")
				Case 3
					sRet="您已经是该" &P_QQ_NAME& "的成员。"
				Case 1
					sRet="您已经被邀请,请进入您的后台接受或拒绝该" &P_QQ_NAME& "的邀请。"
				Case 2
					sRet="您已经发出申请,请等待管理员审核。"
				Case 5
					sRet="您是该" &P_QQ_NAME& "管理员,不需要进行申请。"
			End Select
		Else
			'判断条件
			rs.AddNew
			rs("teamid")=Group_Id
			rs("userid")=oblog.l_uid
			rs("state")=ustate
			rs("info")= left(request("info"),200)
			rs("icount")=0
			rs("addtime")=Now
			rs.Update
			if ustate=3 then
				sRet="您已加入此" &P_QQ_NAME& "。"
			else
				sRet="您已成功发送申请,正在等待管理员审核。"
			end if
		End If
		rs.Close
		Set rs=Nothing
		AcceptJoin=sRet
	End Function
	
	'修改有情连接模块
	Function LinksForm()
		Dim sRet		
		sRet="<div id=""form_comment""><form action='group.asp?cmd=savelinks&gid="&Group_Id&"' method='post' name='commentform' id='commentform' onSubmit='return Verifycomment()'>"& vbcrlf 
		sRet=sRet & "<ul><p>请修改您的友情连接</p></ul>"
		sRet=sRet & "<ul style=""display:none"">昵称：<input name='UserName' type='text' id='UserName' size='15' maxlength='20' value='' /></ul>" & vbcrlf 
		sRet=sRet & "<ul style=""display:none;"">密码：<input name='Password' type='password' id='Password' size='15' maxlength='20' value='' /> (游客无须输入密码)</ul>" & vbcrlf 
		sRet=sRet & "<ul style=""display:none;"">主页：<input name='homepage' type='text' id='homepage' size='42' maxlength='50' value='http://' /></ul>"  & vbcrlf 
		sRet=sRet & "<ul><input type='hidden' name='edit' id='edit' value='' />" & vbcrlf 
		sRet=sRet & "<div id=""oblog_edit""></div> " & vbcrlf 
		sRet=sRet & "</ul>" & vbcrlf 
		sRet=sRet & "<ul><span id=""ob_code""></span><input type='submit' value=' 提交 '></ul>" & vbcrlf 
		sRet=sRet & "</form></div>"& vbcrlf 
		sRet=sRet & "<script src=""commentedit.asp""></script>"
		LinksForm=sRet
		sRet=""
	End Function 
	Function SaveLinks()
		'判断是否为管理员
		If IsManager=false Then
			ErrMsg= "你没有权限进行此操作"
			Exit Function
		End If
		Dim rs,content
		content=Request.Form("oblog_edittext")
		Set rs=Server.CreateObject("Adodb.Recordset")
		rs.Open "Select * From oblog_team Where teamid=" & Group_Id,conn,1,3
		rs("links")=oblog.Ubb_comment(EncodeJP(oblog.InterceptStr(oblog.filt_badword(content),250)))
		rs.Update
		rs.Close
		Set rs=Nothing
		Response.Redirect "group.asp?gid=" & Group_id
	End Function
	'修改站点公告模块
	Function PlacardForm()
		Dim sRet		
		sRet="<div id=""form_comment""><form action='group.asp?cmd=saveplacard&gid="&Group_Id&"' method='post' name='commentform' id='commentform' onSubmit='return Verifycomment()'>"& vbcrlf 
		sRet=sRet & "<ul><p>请修改您的" &P_QQ_NAME& "公告</p></ul>"
		sRet=sRet & "<ul style=""display:none"">昵称：<input name='UserName' type='text' id='UserName' size='15' maxlength='20' value='' /></ul>" & vbcrlf 
		sRet=sRet & "<ul style=""display:none;"">密码：<input name='Password' type='password' id='Password' size='15' maxlength='20' value='' /> </ul>" & vbcrlf 
		sRet=sRet & "<ul style=""display:none;"">主页：<input name='homepage' type='text' id='homepage' size='42' maxlength='50' value='http://' /></ul>"  & vbcrlf 
		sRet=sRet & "<ul><input type='hidden' name='edit' id='edit' value='' />" & vbcrlf 
		sRet=sRet & "<div id=""oblog_edit""></div> " & vbcrlf 
		sRet=sRet & "</ul>" & vbcrlf 
		sRet=sRet & "<ul><span id=""ob_code""></span><input type='submit' value=' 提交 '></ul>" & vbcrlf 
		sRet=sRet & "</form></div>"& vbcrlf 
		sRet=sRet & "<script src=""commentedit.asp""></script>"
		PlacardForm=sRet
		sRet=""
	End Function
	Function SavePlacard()
		'判断是否为管理员
		If IsManager=false Then
			ErrMsg= "你没有权限进行此操作"
			Exit Function
		End If
		Dim rs,content
		content=Request.Form("oblog_edittext")
		Set rs=Server.CreateObject("Adodb.Recordset")
		rs.Open "Select * From oblog_team Where teamid=" & Group_Id,conn,1,3
		rs("announce")=oblog.Ubb_comment(EncodeJP(oblog.InterceptStr(oblog.filt_badword(content),250)))
		rs.Update
		rs.Close
		Set rs=Nothing
		Response.Redirect "group.asp?gid=" & Group_id
	End Function
	'解散模块(暂不启用)
	
	function getminilist()
		Dim rs,Sql,sRet
		Sql="Select top 20 topic,postid,author,teamid From oblog_teampost Where iDepth=0 And teamid=" & Group_id & " Order By postid Desc"
		Set rs=oblog.Execute(Sql)
		If rs.Eof Then
			sRet="<li>-<li>"
		Else
			Do While Not rs.Eof
				sRet=sRet & "<li><a href=""group.asp?gid="&rs(3)&"&pid="&rs(1)&""">" & RemoveHtml(rs(0))&"</a> ("&rs(2)&")</li>"
				rs.MoveNext
			Loop
		End if
		Set rs=Nothing
		getminilist=sRet
		sRet=""
	end function
	
	Function CheckQQLogin()
		Dim username,password
		username=oblog.filt_badstr(trim(request.form("username")))
		if username="" or oblog.strLength(username)>20 then oblog.adderrstr("名字不能为空且不能大于20个字符！")
		if oblog.chk_badword(username)>0 then oblog.adderrstr("名字中含有系统不允许的字符！")
		password=trim(request.form("password"))
		if oblog.checkuserlogined()=false then
			password=md5(password)
			oblog.ob_chklogin username,password,0
		end if
	End Function
End Class
%>