<%@ LANGUAGE = VBScript CodePage = 936%>
<!--#include file="../conn.asp"-->
<!--#include  file="class_sys.asp"-->
<!--#include  file="Inc_Calendar.asp"-->
<!--#include  file="Inc_ubb.asp"-->
<%
Dim oBlog
Set oBlog = New class_sys
oBlog.start

'用户全功能类模块
'本模块目前尽可能与其他模块独立
Class Class_UserCommand
	Public Action
	Public ID
	Public rst
	Public Title
	Public ErrMsg
	Public mUserSkinLog,mYear,mMonth,mDay
	Private mUserName,mUserId,mUserPath,mUserNickName,mUserFolder,mBlogName,mUserPhotoRow,mUsersublist,mUserCmdpath,mUserLogPath,mUserIndexlist
	Private strLogN,strUrl
	Private Sql,SqlStart,SqlPart,SqlEnd,rstSubject,strErrMsg

	Private Sub Class_Initialize()
		userid=Request("uid")
		'G_P_PerMax=5	
	End Sub
		
	Private Sub Class_Terminate()

	End Sub

	Public Property Let userid(ByVal Values)
		Dim rstmp, strSql
		mUserid = CLng(Values)
		'SqlStart = "Select  * From oblog_log Where userid="& mUserId & " "
		SqlStart = "Select  * From oblog_log Where (userid="& mUserId & " Or authorid=" & mUserId & ") "
		'SqlEnd="  And ishide=0 and passcheck=1 and isdraft=0 and blog_password=0 Order by istop,addtime Desc"
		SqlEnd=" and passcheck=1 and isdraft=0 and isdel=0 Order by istop,addtime Desc"
		Action=LCase(Request("do"))		
		Id=Request("Id")
		Call GetUserInfo()
		G_P_FileName=mUserCmdpath&"cmd."&f_ext&"?uid="&mUserid&"&do="
	End Property

	Public Function Process()
		Dim strReturn,strMonth,strDay
		Id=CheckInt(Id)
		strMonth=Request("month")
		strDay=Request("day")
		'Response.Write "动作2：" & Action & "<BR/>" & vbCrlf
		'Response.Write "编号2：" & Id & "<BR/>" & vbCrlf
		Select Case Action
			Case "index"	
				SqlPart=" "	
				Sql=SqlStart &	SqlEnd
				G_P_FileName = G_P_FileName & "index"		
				strReturn = ShowList(Sql,"篇日志","0")
			Case "blogs"
				If Id="" OR Id=0 Then				
					SqlPart=" And logType=0"
					G_P_FileName = G_P_FileName & "blogs"	
				Else
					SqlPart=" And logType=0 And Subjectid=" & Id
					G_P_FileName = G_P_FileName & "blogs&id=" & Id
				End If
				Sql=SqlStart & SqlPart & SqlEnd
				strReturn = ShowList(Sql,"篇日志","0")
			Case "photos"
				If Id="" OR Id=0 Then				
					SqlPart=" And logType=1"
					G_P_FileName = G_P_FileName & "photos"
				Else
					SqlPart=" And logType=1 And Subjectid=" & Id
					G_P_FileName = G_P_FileName & "photos&id=" & Id
				End If	
				Sql=SqlStart & SqlPart & SqlEnd
				strReturn = ShowList(Sql,"篇日志","0")		
			Case "month"
				G_P_FileName = G_P_FileName & "month&month=" & strMonth
				strDay=Left(strMonth,4) & "-" & Right(strMonth,2) & "-01"
				mYear=Left(strMonth,4)
				mMonth=Right(strMonth,2)			
				If Not IsDate(strDay) Then
					ErrMsg = "<center>错误的日期数据，应为YYYYMMDD格式，如：20050801</center>"
					Exit Function
				End If
				if is_sqldata=0 then				
					SqlPart=" And Datediff('m',Addtime,'" & strDay &"')=0"
				else
					SqlPart=" And Datediff(m,Addtime,'" & strDay &"')=0"
				end if
				Sql=SqlStart & SqlPart & SqlEnd
				strReturn = ShowList(Sql,"篇日志","0")	
			Case "day"
				G_P_FileName = G_P_FileName & "day&day=" & strDay
				mYear=Year(strDay)
				mMonth=Month(strDay)
				If Not IsDate(strDay) Then
					strReturn = "<center>错误的日期格式，应为YYYYMMDD格式，如：20050801</center>"
					Exit Function
				End If
				if is_sqldata=0 then
					SqlPart=" And Datediff('d',Addtime,'" & strDay &"')=0"
				else
					SqlPart=" And Datediff(d,Addtime,'" & strDay &"')=0"
				end if
				Sql=SqlStart & SqlPart & SqlEnd
				strReturn = ShowList(Sql,"篇日志","0")	
			Case "message"
				Sql="select * from oblog_message where userid=" & mUserId & " order by messageid desc"
				G_P_FileName = G_P_FileName & "message"	
				strReturn = ShowList(Sql,"个留言","1")	
			Case "comment"
			Case "tag_blogs" '此处将日志与相册合并显示
				G_P_FileName = G_P_FileName & "tag_blogs&id=" & Id
				Sql="Select a.userid,b.* From "
				Sql=Sql & " (Select logid,userid From oblog_usertags Where userid=" & mUserId  & " and tagid=" & id &") a ,"
				'Sql=Sql & " (Select * From oblog_log where userid=" & mUserId & " And logType=0) b Where a.logid=b.logid "	
				Sql=Sql & " (Select * From oblog_log where userid=" & mUserId & ") b Where a.logid=b.logid "
				Sql=Sql & " order By b.addtime Desc"	
				strReturn = ShowList(Sql,"篇日志","0")	
			Case "tag_photos"
				G_P_FileName = G_P_FileName & "tag_photos&id=" & Id
				Sql="Select a.userid,b.* From "
				Sql=Sql & " (Select logid,userid From oblog_usertags Where userid=" & mUserId  & " and tagid=" & id &") a ,"
				Sql=Sql & " (Select * From oblog_log where userid=" & mUserId & " And logType=1) b Where a.logid=b.logid "	
				Sql=Sql & " order By b.addtime Desc"	
				strReturn = ShowList(Sql,"篇日志","0")		
			Case "tags"
				strReturn = GetUserTags()
			Case "show"
				strReturn = ShowOneBlog(Id,0)
			Case "album"
				'by 叶开
				'G_P_FileName = G_P_FileName & "album"
	'				if id>0 then
	'					sql="select file_path,logid from oblog_upfile where isphoto=1 and isPower=0 and userid="&mUserId&" and userClassId="&id&"  order by fileid desc"
	'				else
	'					sql="select file_path,logid from oblog_upfile where isphoto=1 and isPower=0 and userid="&mUserId&"  order by fileid desc"
	'				end if
	'				strReturn = ShowList(sql,"个相片","2")
				strReturn = "<div style=""margin:0;width:500px;text-align:center;""><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='100%' height='500' align='middle'><param name=""wmode"" value=""transparent"" /><param name='movie' value='"&blogurl&"photo.swf?blogurl="&blogurl&"&userid="&mUserId&"' /><param name='quality' value='high' /><embed src='"&blogurl&"photo.swf?blogurl="&blogurl&"&userid="&mUserId&"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='100%' height='500'></embed></object></div>"
				'strReturn="var so = new SWFObject("""&blogurl&"photo.swf?blogurl="&blogurl&"&userid="&mUserId&""", ""photo"", ""100%"", ""500"", ""9"", ""#FFFFFF"");so.addParam(""wmode"", ""transparent"");so.write(""oblog_usercontent"");"
			Case "info"
				strReturn=showinfo()
			Case Else	
				SqlPart=" "	
				Sql=SqlStart &	SqlEnd
				strReturn = ShowList(Sql,"篇日志","0")					
		End Select
		'Response.Write Sql
		'Response.End
		'strReturn ="oblog_usercontent.innerHTML='" & Replace(Replace(strReturn,"'","\'"),"""","\""") & "';" & VbCrlf & "calendar.innerHTML='" & Replace(Replace(Calendar(2000,1,1),"'","\'"),"""","\""") & "';"
		'strReturn ="oblog_usercontent.innerHTML='" & Replace(strReturn,"'","\'") & "';" & VbCrlf
		'strReturn= strReturn & "calendar.innerHTML='" & Replace(Calendar(2000,1,1),"'","\'") & "';"
		'strReturn =Replace(strReturn,"""","")
		'if action<>"album" then strReturn=oblog.htm2js_div(filtskinpath(strReturn),"oblog_usercontent")
		strReturn=oblog.htm2js_div(filtskinpath(strReturn),"oblog_usercontent")
		Process=strReturn
		'Process="document.write('" & strReturn & "');"
	End Function		

	Public Function CreateCalendar()
		Dim strReturn
		If mYear="" Then
			mYear=Year(Date)
			mMonth=Month(Date)
		End If
		strReturn=oblog.htm2js_div(Calendar(mYear,mMonth,mUserId),"calendar")
		CreateCalendar=strReturn
	End Function

	Private Function ShowUserBlogs(rst)
		Dim strBlogs
		Do While Not rst.Eof
			strBlogs= strBlogs & GetOneBlogInfo(rst,"")	& "<BR/>"
			rst.Movenext
		Loop	
		'进行统一处理，不必每篇处理
		strLogMore=Replace(strLogMore,"$show_blogtag$","")
		strLogMore=Replace(strLogMore,"$show_blogzhai$","")		
		strLogMore=Replace(strLogMore,"$show_blogtag","")		
		strLogMore=filt_inc(strLogMore)
		strLogMore=strLogMore & "<script src="""&BlogDir&"count.asp?action=logs&id="&strLogN&"""></script>"			
		'strLogMore=Replace(user_skin_main,"$show_log$",strLogMore)	
		ShowUserBlogs= strLogMore		
		strLogMore=""
		'分页横条，每次只取符合条件的G_P_PerMax条，不全部取出
	End Function

	Private Function ShowOneBlog(BlogId,isPower)
		Set rst=oblog.Execute("Select * From oBlog_log Where logid=" & BlogId)
		ShowOneBlog=GetOneBlogInfo(rst,"1")
	End FUnction

	'获取一篇日志的所有内容
	'注意摘要/内容以及尾部标签的处理
	Public Function GetOneBlogInfo(byref rst,byval strMode)
		Dim strTopic,strEmot,strAddtime,strLogtext,strAuthor,strLogInfo,strMore
		Dim strOneLog,strTopictxt,strLogMore,show,rssubject,strTmp,xmlstr,rstmp,strart,i
		'表情
		'If rst("face")="0" Then strEmot="" Else	strEmot="<img src="&blogurl&"images/face/" & rst("face") &".gIf />"
		'作者
		If mUserNickName=""  Then
			strAuthor=mUserName
		Else
			strAuthor=mUserNickName
		End If
		If rst("authorid")<>mUserId Then
			If Not IsNull(rst("author")) Then
				strAuthor=rst("author")
			End If
		End If
		strAddtime=rst("addtime")
		strTopic=strEmot
		If rst("istop")=1 Then strTopic="[置顶]"
		If rst("subjectid")>0 Then
			rstSubject.Filter="subjectid=" & rst("subjectid")
			If Not rstSubject.Eof Then
				strTopic=strTopic & "<a href="""& BlogDir & UserPath &"/cmd."&f_ext&"?do=subject&id="">["&oblog.filt_html(rssubject(1))&"]</a>"
			End If
		End If
		strTopictxt="<a href="""& BlogDir & rst("logfile")& """>" & oblog.filt_html(rst("topic")) & "</a>"
		If rst("isbest")=1 Then strTopictxt = strTopictxt & "　<img src=../../images/jhinfo.gIf >"
		strTopic = strTopic & strTopictxt
		If rst("istop")=1 Then strTopictxt = "[置顶]" & strTopictxt
		strLogInfo = strAuthor & " 发表于 " & strAddtime
		strMore = "<a href="""& BlogDir & rst("logfile")&""">阅读全文<span id=""ob_logr" & rst("logid") & """></span></a>"
		strMore = strMore&" | "&"<a href=""" & BlogDir & rst("logfile")&"#comment"">回复<span id=""ob_logc" & rst("logid") & """></span></a>"
		strMore = strMore&" | "&"<a href=""../../showtb.asp?id=" & rst("logid") & """ target=""_blank"">引用通告<span id=""ob_logt" & rst("logid") & """></span></a>"
		'摘要
		'If Not IsNull(rst("Abstract")) Then	
		'	strLogtext=rst("Abstract")
		'Else
			strLogtext=rst("logtext")
		'End If
		'用来进行计数累计
		strLogN=strLogN&"$"&rst("logid")
		
		'处理内容模板数据
		strOneLog = Replace(mUserSkinLog,"$show_topic$",strTopic)
		strOneLog = Replace(strOneLog,"$show_loginfo$",strLogInfo)
		strOneLog = Replace(strOneLog,"$show_logtext$",strLogtext)
		strOneLog = Replace(strOneLog,"$show_more$",strMore)
		strOneLog = Replace(strOneLog,"$show_emot$",strEmot)
		'strOneLog = Replace(strOneLog,"$show_author$",strAuthor)
		strOneLog = Replace(strOneLog,"$show_addtime$",strAddtime)
		strOneLog = Replace(strOneLog,"$show_topictxt$",strTopictxt)
		strLogMore=strLogMore&strOneLog	
		If strMode="1" Then
			strLogMore=Replace(strLogMore,"$show_blogtag$","")
			strLogMore=Replace(strLogMore,"$show_blogzhai$","")		
			strLogMore=Replace(strLogMore,"$show_blogtag","")		
			'strLogMore=filt_inc(strLogMore)
			strLogMore=strLogMore & "<script src="""&BlogDir&"count.asp?action=logs&id="&strLogN&"""></script>"	
		End If
		GetOneBlogInfo = strLogMore
	End Function

	'用户TAG，不进行分页(Cloud),根据标签查询到的内容不区分日志还是相册
	Private Function GetUserTags()
		Dim sContent,sSql,rst,iFont,iFontSize
		sSql = "Select a.TagId,a.Name,b.TagNum From oblog_tags a,"
		sSql = sSql & "(Select Count(*) as TagNum,TagId From oblog_UserTags Where userid=" & mUserId & " Group By TagId ) b Where "
		sSql = sSql & "a.tagid=b.tagid "
		'Response.Write sSql
		Set rst=conn.Execute(sSql)
		If rst.Eof Then
			sContent=""
		Else
			Do While Not rst.Eof
				'基数为10
				iFont=rst("TagNum") Mod 10
				If iFont=0 Then iFontSize=9
				If iFont>-1 And iFont<40 Then iFontSize=12 + iFont
				If iFont >40 Then iFontSize=42
				sContent= sContent & "<li><span><a href="""&mUserCmdpath&"cmd."&f_ext&"?uid="&mUserid&"&do=tag_blogs&id=" & rst("tagID") & """><font style=""font-size:"& iFontSize &"px;"">" & rst("Name")& "</font></a></span><br />"
				sContent= sContent & "<a href="&blogurl&"tags.asp?tagid=" & rst("tagID") &" target=_blank><img src="&blogurl&"images/icon_blogs.gif border=0 title='本站使用过该标签的日志'/></a>"
				sContent= sContent & "<a href="&blogurl&"tags.asp?t=user&tagid=" & rst("tagID") &" target=_blank><img src="&blogurl&"images/icon_users.gif border=0 title='本站使用过该标签的用户'/></a></li>"
				rst.Movenext
			Loop
		End If
		rst.Close
		Set rst=Nothing
		GetUserTags="<div id=""ob_usertags""><ul>"&sContent&"</ul></div>"
		sContent=""
	End Function

	Private Function ShowList(strSql,strUnit,strMode)
		Dim strReturn
		if action="photos" or action="album" then strReturn="<div id=""albumtop""><ul>"&GetUserClasses(action)&"<ul></div>"
		If Request("page")<>"" Then
			G_P_This=CLNG(Request("page"))
		Else
			G_P_This=1
		End If
		If Not IsObject(conn) Then link_database
		Set rst=Server.CreateObject("Adodb.RecordSet")
		'Response.Write strSql
		'response.End()
		rst.Open strSql,Conn,1,1
		'Response.Write "符合条件的纪录数目为:" & rst.RecordCount
		If rst.Eof  Then
			strReturn=strReturn & "<ul>无记录</ul>"
			ShowList = strReturn
			rst.Close
			Set rst=Nothing
			Exit Function
		End If
		G_P_AllRecords=rst.RecordCount
		'strReturn=strReturn & "共调用" & G_P_AllRecords & strUnit & "<br>"
		If G_P_This<1 Then
			G_P_This=1
		End If
		If (G_P_This-1)*G_P_PerMax>G_P_AllRecords Then
			If (G_P_AllRecords mod G_P_PerMax)=0 Then
				G_P_This= G_P_AllRecords \ G_P_PerMax
			Else
				G_P_This= G_P_AllRecords \ G_P_PerMax + 1
			End If
		End If
		If G_P_This=1 Then
			Select Case strMode
					Case "0"
						strReturn = strReturn&ShowOnePage(rst)
						strReturn=strReturn & oblog.showpage(false,true,strUnit)
					Case "1"
						strReturn = ShowMessages(rst)
						strReturn="<h1>留言板首页(<a href='"&blogdir&mUserPath&"/message."&f_ext&"#cmt'>签写留言</a>)</h1>" & vbCrLf & strReturn & oblog.showpage(false,true,strUnit)
					Case "2"
						strReturn = strReturn&getPhotolist(rst)
						strReturn=strReturn & oblog.showpage(false,true,strUnit)
			End Select	
		Else
			If (G_P_This-1) * G_P_PerMax < G_P_AllRecords Then
				rst.move  (G_P_This-1) * G_P_PerMax
				'Dim bookmark
				'bookmark=rst.bookmark
				Select Case strMode
					Case "0"
						strReturn = ShowOnePage(rst)
						strReturn=strReturn & oblog.showpage(false,true,strUnit)
					Case "1"
						strReturn = ShowMessages(rst)
						strReturn="<h1>留言板首页(<a href='"&blogdir&mUserPath&"/message."&f_ext&"#cmt'>签写留言</a>)</h1>" & vbCrLf & strReturn & oblog.showpage(false,true,strUnit)
					Case "2"
						strReturn = strReturn&getPhotolist(rst)
						strReturn=strReturn & oblog.showpage(false,true,strUnit)
				End Select	
			Else
				G_P_This=1
				Select Case strMode
					Case "0"
						strReturn = ShowOnePage(rst)
						strReturn=strReturn & oblog.showpage(false,true,strUnit)
					Case "1"
						strReturn = ShowMessages(rst)
						strReturn="<h1>留言板首页(<a href='"&blogdir&mUserPath&"/message."&f_ext&"#cmt'>签写留言</a>)</h1>" & vbCrLf & strReturn & oblog.showpage(G_P_FileName,G_P_AllRecords,G_P_PerMax,false,true,strUnit)
					Case "2"
						strReturn = strReturn&getPhotolist(rst)
						strReturn=strReturn & oblog.showpage(false,true,strUnit)
				End Select	           	
			End If
		End If
		rst.Close
		Set rst=Nothing
		ShowList=strReturn
	End Function

	Private Function ShowOnePage(rst)
		Dim strBody,strContent,strTmp,rssubject,i,substr
		Dim strTopic,strLoginfo,strLogtext,strMore,strEmot,strAuthor,strAddtime,strTopictxt
		Set rssubject = oblog.execute("select subjectid,subjectname from oblog_subject where userid="&mUserid)
		While Not rssubject.EOF
			substr = substr & rssubject(0) & "!!??((" & rssubject(1) & "##))=="
			rssubject.movenext
		Wend
		substr = substr & "0!!??((全部日志##))=="
		i=0
		Do While Not rst.EOF
			if (mUsersublist=1 and id>0) or mUserIndexlist=1 then '列表显示
				strBody="<li><a href="&mUserLogpath&rst("logfile")&" >"&oblog.filt_html(rst("topic"))&"</a>　"&oblog.filt_html(rst("author"))&" <span>"&rst("addtime")&"</span></li>"&vbcrlf				
			else
				'If rst("face") = "0" Then
	'					strEmot = ""
	'				Else
	'					strEmot = "<img src="&blogurl&"images/face/" & rst("face") & ".gif />"
	'				End If
				If mUserNickName = "" Or IsNull(mUserNickName) Then
					strAuthor = mUserName
				Else
					strAuthor = mUserNickName
				End If

				If rst("authorid") <> mUserId Then strAuthor = rst("author")
				strAddtime = rst("addtime")
				strTopic = strEmot
				If rst("subjectid") > 0 Then
					strTopic = strTopic & "<a href=""" & mUserCmdpath & "cmd."&f_ext&"?uid="&mUserid&"&do=blogs&id=" & rst("subjectid") & """>[" & oblog.filt_html(getsubname(rst("subjectid"),substr)) & "]</a>"
				End If
				strTopictxt = "<a href=""" & mUserLogpath&rst("logfile") & """>" & oblog.filt_html(rst("topic")) & "</a>"
				If rst("isbest") = 1 Then strTopictxt = strTopictxt & "　<img src=" & blogurl & "images/jhinfo.gif >"
				strTopic = strTopic & strTopictxt
				If rst("istop") = 1 Then strTopictxt = "[置顶]" & strTopictxt
				strLoginfo = strAuthor & " 发表于 " & strAddtime
				strMore = "<a href=""" & mUserLogpath&rst("logfile") & """>阅读全文("&rst("iis")&")</a>"
				strMore = strMore & " | <a href=""" & mUserLogpath & rst("logfile") & "#cmt"">回复("&rst("commentnum")&")</a>"
				strMore = strMore & " | <a href=""" & blogurl & "showtb.asp?id=" & rst("logid") & """ target=""_blank"">引用通告("&rst("trackbacknum")&")</a>"
				'兼容以前数据
				If rst("ishide") = 1 Then strTmp = "此日志为隐藏日志，仅好友可见，<a href='" & blogurl & "more.asp?id=" & rst("logid") & "'>点击进入验证页面</a>。"
				If rst("ispassword") <> "" Then strTmp = "<form method='post' action='" & blogurl & "more.asp?id=" & rst("logid") & "' target='_blank'>请输入日志访问密码：<input type=""password"" size=""15"" name=""password"" />  <input type=""submit"" value=""提交""></form>"
				If rst("passcheck") = 0 Then strTmp = "此日志需要管理员审核后才可见。"
				If strTmp <> "" Then
					strLogtext = strTmp
					strTmp = ""
				Else
					If rst("Abstract")="" Or IsNull(rst("Abstract"))  then
						strLogtext = rst("logtext")
						strLogtext = trimlog(strLogtext, rst("showword"))
						'If Left(strLogtext, 7) = "#isubb#" Then
							'strLogtext = UBBCode(strLogtext, 1)
							'strLogtext = Replace(strLogtext, Chr(10), "<br /> ")
							
						'End If
						strLogtext = Replace(strLogtext, "#isubb#", "")
						strLogtext = filtimg(strLogtext)
						If oblog.cacheConfig(45)=1 Then strLogtext = profilthtm(strLogtext)
					Else 
						strLogtext = rst("Abstract")
					End if
				End If
				 strLogtext=oblog.filt_badword(UBBCode(strLogtext,1))
				 '当使用相对路径时，替换为绝对路径
				 'if is_relativepath=1 then
					'	strLogtext=filtskinpath(strLogtext)
				 'end if
				 strlogn = strlogn & "$" & rst("logid")
				 strBody = Replace(mUserSkinLog, "$show_topic$", strTopic)
				 strBody = Replace(strBody, "$show_loginfo$", strLoginfo)
				 strBody = Replace(strBody, "$show_logtext$", strLogtext)
				 strBody = Replace(strBody, "$show_more$", strMore)
				 strBody = Replace(strBody, "$show_emot$", strEmot)
				 strBody = Replace(strBody, "$show_author$", strAuthor)
				 strBody = Replace(strBody, "$show_addtime$", strAddtime)
				 strBody = Replace(strBody, "$show_topictxt$", strTopictxt)	
				 strBody = Replace(strBody, "$show_blogzhai$", "")	
				 strBody = Replace(strBody, "$show_blogtag$", "")	
				 'show_logmore = show_logmore & strBody
			 end if
			 strContent = strContent & VBCRLF & strBody	
			 rst.movenext
			 i=i+1
			 if i>=G_P_PerMax then exit do
		  Loop
		  set rssubject=nothing
		  ShowOnePage=strContent
		  if (mUsersublist=1 and id>0) or mUserIndexlist=1 then
			ShowOnePage="<div id=""subject_index""><ul>"&oblog.filt_html(getsubname(id,substr))&ShowOnePage&"</ul></div>"
		  end if
	End Function	

	Public Function ShowMessages(rst)
		Dim strtopic, stremot, straddtime, strlogtext, strauthor, strloginfo, strmore, strMessage, strtopictxt, strContent
		Dim homepage_str, user_filepath,i
		If Not rst.EOF Then
			Do While Not rst.EOF
				If IsNull(rst("homepage")) Then
					homepage_str = "个人主页"
				Else
					If Trim(Replace(rst("homepage"), "http://", "")) = "" Then
						homepage_str = "个人主页"
					Else
						homepage_str = "<a href=""" & oblog.filt_html(rst("homepage")) & """ target=""_blank"">个人主页</a>"
					End If
				End If
				strtopic = oblog.filt_html(rst("messagetopic")) & "<a name='" & rst("messageid") & "'></a>"
				If rst("isguest") = 1 Then
					strauthor = oblog.filt_html(rst("message_user")) & "(游客)"
				Else
					strauthor = oblog.filt_html(rst("message_user"))
				End If
				straddtime = rst("addtime")
				strtopictxt = strtopic
				strloginfo = strauthor & "发表留言于" & straddtime
				'strlogtext = oblog.Ubb_Comment(rst("message"))
				If rst("ubbedit")= 2 Then 
					strlogtext = oblog.FilterUbbFlash(filtscript(rst("message")))
				Else
					strlogtext = oblog.Ubb_Comment(rst("message")) 
				End if
				strmore = homepage_str & " | <a href='"&blogurl&"user_messages.asp?action=modify&re=true&id=" & rst("messageid") & "'>回复</a>"
				strmore = strmore & " | <a href=""" & blogurl & "user_messages.asp?action=del&id=" & rst("messageid") & """  target=""_blank"">删除</a>"
				if rst("ishide")=1 then 
					strtopictxt="悄悄话"
					strtopic="悄悄话"
					strlogtext="此留言为悄悄话。"
					strmore=replace(strmore,"回复","查看")
				end if
				strMessage = Replace(mUserSkinLog, "$show_topic$", strtopic)
				strMessage = Replace(strMessage, "$show_loginfo$", strloginfo)
				strMessage = Replace(strMessage, "$show_logtext$", strlogtext)
				strMessage = Replace(strMessage, "$show_more$", strmore)
				strMessage = Replace(strMessage, "$show_emot$", "")
				strMessage = Replace(strMessage, "$show_author$", strauthor)
				strMessage = Replace(strMessage, "$show_addtime$", straddtime)
				strMessage = Replace(strMessage, "$show_topictxt$", strtopictxt)
				strMessage = Replace(strMessage, "$show_blogtag$", "")
				strMessage = Replace(strMessage, "$show_blogzhai$", "")
				strContent = strContent & strMessage
				rst.movenext
				i=i+1
				If i>=G_P_PerMax Then Exit Do
			Loop
		Else
			strContent = "暂无留言"
		End If
		ShowMessages=strContent

	End Function

	'获取用户信息
	Private Function GetUserInfo()
		Dim rst,rst1,ustr
		Set rst=oBlog.Execute("Select * From oBlog_User Where UserId=" & mUserId)
		If rst.Eof Then
			Set rst = Nothing
			Response.Write "错误的用户编号"
			Response.End
		Else
			'判断是否整站加密
			if rst("blog_password")<>""  and Request.Cookies(cookies_name)("blogpw")<>rst("blog_password") then
				set rst=nothing
				response.Write "window.location='"&blogurl&"chkblogpassword.asp?userid="&mUserId&"';"
				response.End()
			end if		
			mUserFolder=rst("user_folder")
			mUserPath=rst("user_dir")&"/"&rst("user_folder")
			mBlogName=rst("blogname")
			mUserName=rst("username")		
			mUserNickName=rst("nickname")
			G_P_PerMax=rst("user_showlog_num")
			mUserPhotoRow=rst("user_photorow_num")
			ustr=rst("user_info")
			mUserIndexlist=rst("indexlist")
			if ustr="" or isnull(ustr) then
				mUsersublist=0
			else
				ustr=split(ustr,"$")
				if ustr(0)<>"" then mUsersublist=cint(ustr(0)) else mUsersublist=0
			end if
			if mUsersublist=1 and id>0 then G_P_PerMax=40 '列表模式调用50条
			if mUserPhotoRow<=0 or isnull(mUserPhotoRow) then mUserPhotoRow=1
			If IsNull(rst("user_skin_showlog")) OR rst("user_skin_showlog")="" Then
				Set rst1 = oBlog.Execute("select skinshowlog from oBlog_userskin where isdefault=1")
				If Not rst1.EOF Then
					mUserSkinLog = rst1("skinshowlog")
					Set rst1 = Nothing
				Else
					Set rst1 = Nothing
					Set rs = Nothing
					Response.Write ("模板错误")
					Response.End
				End If
			Else
				mUserSkinLog=rst("user_skin_showlog")
			End If
			if true_domain=1 then
				mUserCmdpath="/"
				mUserLogpath=""
			else
				mUserCmdpath=blogdir&mUserPath&"/"
				mUserLogpath=blogdir
			end if
			'mUserSkinLog=filtskinpath(mUserSkinLog)
		End If		
		Set rst=Nothing
	End Function

	Function getPhotolist(rsPhoto)
		Dim i,bstr,n,fso,sReturn
		Dim title,imgsrc
		Set fso = server.CreateObject(oblog.CacheCompont(1))	
		sReturn="<table width='100%'  align='center' cellpadding='0' cellspacing='1'><tbody>"& vbcrlf
		Do While not rsPhoto.eof
			sReturn=sReturn&"<tr>"& vbcrlf
			For n=1 to mUserPhotoRow
				if rsPhoto.eof then
					sReturn=sReturn&"<td width='25%'></td>"& vbcrlf
				Else
					title="<BR/><a href=" & blogurl & "more.asp?id=" & rsPhoto(1) &" target=_blank >阅读相片介绍</a><BR/><BR/>"
					imgsrc=blogurl & rsPhoto(0)
					'imgsrc=replace(imgsrc,right(imgsrc,3),"jpg")
					'imgsrc=replace(imgsrc,right(imgsrc,len(imgsrc)-InstrRev(imgsrc,"/")),"pre"&right(imgsrc,len(imgsrc)-InstrRev(imgsrc,"/")))
					'if  not fso.FileExists(Server.MapPath(imgsrc)) then
						'imgsrc=blogurl&rsPhoto(0)
					'End if
					sReturn=sReturn&"<td align='center'> <a href='"& blogurl & rsPhoto(0)&"' target='_blank' title='点击查看原图'><img src='"&imgsrc&"' height='100' width='130' border='0' /></a><br />"&title&"</td>"& vbcrlf
					i=i+1
					if not rsPhoto.eof then rsPhoto.movenext
				End if
			Next
			sReturn=sReturn&"</tr>"& vbcrlf
			if i>=G_P_PerMax then exit do	
		loop		
		sReturn=sReturn&"</tbody></table>"	& VBCRLF
		Set fso=nothing
		getPhotolist=sReturn
	End Function

	'获取用户分类
	Function GetUserClasses(typestr)
		Dim rst,sReturn,strPlayerUrl
		strPlayerUrl= blogurl & "PhotoPlayer.asp?userid="&muserid
		Set rst=conn.Execute("Select * From oblog_subject Where subjecttype=1 and userid="&mUserid&" order by ordernum")
		If rst.Eof Then
			sReturn=""
		Else
			Do While Not rst.Eof
				sReturn=sReturn&"<option value="&rst("subjectid")&">" & rst("subjectname") & "</option>" & VBCRLF
				rst.Movenext
			Loop
			sReturn = "<option value="""">请选择相片分类</option><option value='0'>所有分类</option>" & VBCRLF & sReturn
			sReturn="<select name=classid onchange=""javascript:window.location='"&mUserCmdpath&"cmd."&f_ext&"?uid="&muserid&"&do="&typestr&"&id='+this.options[this.selectedIndex].value;"">" & VBCRLF & sReturn & "</select>"
		End If
		rst.Close
		Set rst=Nothing
		sReturn=sReturn&"　<a href=""#"" onclick=""window.open('"&strPlayerUrl&"','_photo','height=500, width=480, top=100, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=yes,status=no')"">启用自动播放</a>" & VBCRLF
		if typestr="album" then
			sReturn=sReturn&"  <a href='"&mUserCmdpath&"cmd."&f_ext&"?uid="&mUserid&"&do=photos'>日志方式浏览</a>"
		else
			sReturn=sReturn&"  <a href='"&mUserCmdpath&"cmd."&f_ext&"?uid="&mUserid&"&do=album'>相册方式浏览</a>"
		end if
		GetUserClasses = sReturn	
	End Function


	function showinfo()
		dim rs,str,c0,c1,c2
		select case trim(request("infotype"))
		case "1"
			str=str&"<ul class=""ob_user_friend"">"
			set rs=oblog.execute("select a.username,a.nickname,a.user_icon1,a.userid from oblog_user a,oblog_friend  b where a.userid=b.friendid and b.userid ="&Muserid&" and b.isblack=0 order by b.id desc")
			while not rs.eof 
				str=str&"<li><a href=" &blogurl & "go.asp?userid="&rs(3)&" target=_blank><img src=""" & ProIco(rs(2),1) & """ class=""ob_face_info"" /><br />"&OB_IIF(rs(1),rs(0))&"</a></li>"&vbcrlf
				rs.movenext
			wend
			str=str&"</ul>"& vbcrlf
			c1=" class='nowselect' "
		case "2"
			str=str&"<ul class=""ob_user_group"">"
			set rs=oblog.execute("select a.t_name,a.teamid,a.t_ico from oblog_team a,oblog_teamusers  b where a.teamid=b.teamid and a.istate=3 and (b.state=3 or b.state=5 ) and userid ="&Muserid)
			while not rs.eof 
				str=str&"<li><a href=" &blogurl & "group.asp?gid="&rs(1)&" target=""_blank""><img src=""" & ProIco(rs(2),2) & """ class=""group_logo_info"" /><br />"&oblog.filt_html(left(rs(0),18))&"</a></li>"&vbcrlf
				rs.movenext
			wend
			str=str&"</ul>"& vbcrlf
			c2=" class='nowselect' "
		case else
			set rs=oblog.execute("select * from oblog_user where userid="&Muserid)
			if not rs.eof then
				str=str&"<ul class=""ob_user_info""><img src=""" & ProIco(rs("user_icon1"),1) & """ class=""ob_face_info"" /><li>用户名："&rs("username")&"</li><li>昵　称："&rs("nickname")&"</li><li>性　别："&ob_IIF2(rs("sex")=1,"男","女")&"</li><li>真　名："&rs("truename")&"</li><li>所在地："&rs("province")&rs("city")&"</li><li>生　日："&rs("birthday")&"</li><li>职　业："&rs("job")&"</li><li>ＭＳＮ："&rs("msn")&"</li><li>Ｑ　Ｑ："&rs("qq")&"</li><li>地　址："&rs("address")&"</li><li>简　介："&oblog.filt_html(rs("siteinfo"))&"</li></ul>"& vbcrlf
			end if
			c0=" class='nowselect' "
		end select
		showinfo="<div id=""ob_userinfo""><ul class=""top""><li"&c0&"><a href='"&mUserCmdpath&"cmd."&f_ext&"?uid="&mUserid&"&do=info'>详细资料</a></li><li"&c1&"><a href='"&mUserCmdpath&"cmd."&f_ext&"?uid="&mUserid&"&do=info&infotype=1'>好友</a></li><li"&c2&"><a href='"&mUserCmdpath&"cmd."&f_ext&"?uid="&mUserid&"&do=info&infotype=2'>" &P_QQ_NAME& "</a></li></ul>"&str&"</div>"
		set rs=nothing
	end function	
End Class	
%>