<!--#include file="user_top.asp"-->
<!--#include file="inc/class_blog.asp"-->
<%
'获取用户日志专辑分类
Dim rsSubject,sClass
Dim allsub,substr
Dim allClass
Set rsSubject=Server.CreateObject("Adodb.Recordset")
rsSubject.Open "Select subjectid,subjectname From oblog_subject Where userid=" & oblog.l_uid & " And subjecttype=" &t,conn,1,3
If rsSubject.Eof Then
'	sClass= "您还没有设置相关日志分类"
	sClass="<select name=subjectid1 disabled>"
	sClass=sClass & "<option value=0>您还没有设置相关日志分类</option>"	
	sClass=sClass & "</select>"
Else
	sClass="<select name=subjectid1>"
	Do While Not rsSubject.Eof
		substr=substr&"<option value="&rsSubject(0)&">"&rsSubject(1)&"</option>"
		allsub=allsub&rsSubject(0)&"!!??(("&rsSubject(1)&"##))=="		
		sClass=sClass & "<option value=" & rsSubject("subjectid") & ">" & rsSubject("subjectname") & "</option>"
		rsSubject.movenext
	Loop
	sClass=sClass & "</select>"
End If
Dim trs
Set trs=Server.CreateObject("Adodb.Recordset")
trs.Open "Select id,classname From oblog_logclass ",conn,1,1
Do While Not trs.eof 
	allClass=allClass&trs(0)&"!!??(("&trs(1)&"##))=="
	trs.MoveNext
Loop 
trs.Close
Set trs = Nothing
%>
<script src="oBlogStyle/move.js" type="text/javascript"></script>
<script language=javascript>
<!--
function moveaction(){
	document.myform.action.value="move";
	if (document.all.chkclassid1.checked) document.myform.chkclassid.value=1
	if (document.all.chksubjectid1.checked) document.myform.chksubjectid.value=1;
	if ((document.all.chksubjectid1.checked||document.all.chkclassid1.checked)==0){
		alert("请选择转移类型");
		return false;
		}
	document.myform.classid.value=document.all.classid1.value;
	document.myform.subjectid.value=document.all.subjectid1.value;	
	document.myform.submit();
	ShowHide("2",null);
	}

function initialize()
{
	var a = new xWin("1",300,150,292,40,"重新发布","<p>重新发布</p><p><input name='Submit' type='image' src='oBlogStyle/UserAdmin/4/btu_ok.png' value='确认修改' onclick='ShowHide(\"1\",null)' style='cursor:pointer;' /></p>");
	var b = new xWin("2",200,80,386,40,"移动专题","<p> <input type='Checkbox' name='chkclassid1' value=1>系统分类:<select name='classid1' id='classid1' <%=oblog.show_Postclass(0)%></select><br><br><input type='Checkbox' name='chksubjectid1' value=1>目标专题:<%=sClass%><br/><br/><input name='Submit' type='button'  value='移动' onclick='moveaction();' style='cursor:pointer;' />&nbsp;&nbsp;<input name='Submit' type='button' value='关闭' onclick='ShowHide(\"2\",null);'/></p>");
	ShowHide("1","none");//隐藏窗口
	ShowHide("2","none");//隐藏窗口
}
window.onload = initialize;
//-->
</script>
<style type="text/css">
<!--
	#content_li .content_li_conten .t2 {color:#f60;}
-->
</style>
</head>
<body scroll="no" style="overflow:auto!important;overflow:hidden;background:#fff;">
<%
Dim rs,sql,id, usersearch, Keyword, sField, uid, action
Dim selectsub, wsql, truedel ,isdraft
truedel=False
isdraft=False
Keyword = Trim(request("keyword"))
If Keyword <> "" Then Keyword = oblog.filt_badstr(Keyword)
sField = Trim(request("Field"))
usersearch = Trim(request("usersearch"))
selectsub = Trim(request("selectsub"))
action = Trim(request("action"))
id = request("id")
If id<>"" And Instr(id,",")<=0 Then id=Int(id)
uid = Int(request("uid"))
G_P_FileName = "user_blogmanage.asp?t=" & t
If usersearch = "" Then
    usersearch = 0
Else
    usersearch = Int(usersearch)
    G_P_FileName = "user_blogmanage.asp?usersearch=" & usersearch & "&t=" & t
End If
'request("truedel")删除单篇日志
if usersearch=6 Or LCase(request("truedel"))="true" Then truedel=True
if usersearch=5 then isdraft=True
If selectsub <> "" Then
    selectsub = Int(selectsub)
    G_P_FileName = "user_blogmanage.asp?usersearch=10&selectsub=" & selectsub & "&t=" & t
Else
    selectsub = 0
End If
If Keyword <> "" Then
    G_P_FileName="user_blogmanage.asp?usersearch=10&keyword="&Keyword&"&Field="&sField & "&t="  & t
End If

G_P_FileName =G_P_FileName & "&page="
If request("page") <> "" Then G_P_This = Int(request("page")) Else G_P_This = 1
wsql=" and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )"

Select Case LCase(action)
    Case "del"
        Call delblog
    Case "move"
        Call moveblog
    Case "updatelog"
        Call updatelog
    Case "downlog"
        Call BackUp
	Case "delall"
		Call delallblog
    Case Else
        Call main
End Select
Set rs = Nothing
%>

<div id="user_page_search">
    <form name="form1" action="user_blogmanage.asp" method="get">
    	
        <input type="hidden" name="t" value="<%=t%>">
快速查找:
        <select size=1 name="usersearch" onChange="javascript:submit()">
          <option value="10" selected>请选择查找类型</option>
          <option value="0">列出所有<%=tName%></option>
          <option value="1">未通过审核的<%=tName%></option>
          <option value="2">已通过审核的<%=tName%></option>
          <option value="3">推荐<%=tName%></option>
           <option value="5">草稿箱</option>
        </select> &nbsp;
      按专题查找:&nbsp;
       <select name="selectsub" id="selectsub" onChange="javascript:submit()">
		<option value=''>请选择专题</option>
<%=substr%>
<option value=0>未分类</option>
        </select>&nbsp;
搜索:
        <select name="Field" id="Field">
            <option value="id"><%=tName%>ID号</option>
            <option value="topic" selected><%=tName%>标题</option>
            <option value="tag">标签(TAG)</option>
         </select>
         <input name="Keyword" type="text" id="Keyword" size="20" maxlength="30">
         <input type="submit" name="Submit2" value=" 搜索 ">
  </form>
</div>

</div>


<div id="user_post_track">
</div>
<div id="user_post_update">
</div>
</body>
</html>
<%
Set rsSubject=Nothing

Sub main()
    Server.ScriptTimeOut = 999999999
    Dim  selectsql,i,lPage,lAll,lPages,iPage
    selectsql = "TOP 500 logid,userid,iis,commentnum,topic,author,addtime,logfile,isbest,isdraft,passcheck,subjectid,istop,ispassword,ishide,classid,authorid"
    G_P_Guide = ""
    Select Case usersearch
        Case 0
            sql="select "&selectsql&" from oblog_log where isdel=0 And logtype=" & t & " And ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&") order by istop desc,addtime desc"
            G_P_Guide = G_P_Guide & "最新500篇" & tName
        Case 1
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And passcheck=0 And logtype=" & t & " and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by addtime desc"
            G_P_Guide = G_P_Guide & "未通过审核" & tName
        Case 2
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And passcheck=1  And logtype=" & t & " and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by addtime desc"
            G_P_Guide = G_P_Guide & "已通过审核" & tName
        Case 3
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And isbest=1  And logtype=" & t & " and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by addtime desc"
            G_P_Guide = G_P_Guide & "推荐" & tName
        Case 4
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )  And logtype=" & t & " order by addtime desc"
            G_P_Guide = G_P_Guide & "我的" & tName
        Case 5
            sql="select "&selectsql&" from [oblog_log] where  isdel=0 And isdraft=1  And logtype=" & t & "  and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by addtime desc"
            G_P_Guide = G_P_Guide & "草稿箱"
		 Case 6
            sql="select "&selectsql&" from [oblog_log] where  isdel=1  And logtype=" & t & "  and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" ) order by addtime desc"
            G_P_Guide = G_P_Guide & "回收站"
        Case 10
            If Keyword = "" Then
                sql="select "&selectsql&" from [oblog_log] where  isdel=0 And (userid="&oblog.l_uid&" or authorid="&oblog.l_uid&") and subjectid="&selectsub&"   And logtype=" & t & " order by addtime desc"
                G_P_Guide=G_P_Guide & "专题id为"&selectsub&"的" & tName
            Else
                Select Case sField
                Case "id"
                    If IsNumeric(Keyword) = False Then
                        oblog.adderrstr (tName & "id必须是整数！")
                        oblog.showusererr
                    Else
                        sql="select "&selectsql&" from [oblog_log] where  isdel=0 And logid =" & Int(Keyword)&"  And logtype=" & t & " and (userid="&oblog.l_uid&" or authorid="&oblog.l_uid&")"
                        G_P_Guide = G_P_Guide & "id等于<font color=red> " & Int(Keyword) & " </font>的" & tName
                    End If
                Case "topic"
                    sql="select "&selectsql&" from [oblog_log] where  isdel=0 And topic like '%" & Keyword & "%' and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )   And logtype=" & t & " order by addtime desc"
                    G_P_Guide = G_P_Guide & "标题中含有“ <font color=red>" & Keyword & "</font> ”的" & tName
                Case "tag"
                    sql="select "&selectsql&" from [oblog_log] where  isdel=0 And logTags like '%" & Keyword & "%' and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )   And logtype=" & t & " order by addtime desc"
                    G_P_Guide = G_P_Guide & "标签中含有“ <font color=red>" & Keyword & "</font> ”的" & tName
                Case "content"
                    sql="select "&selectsql&" from [oblog_log] where  isdel=0 And logtext like '%" & Keyword & "%' and ( userid="&oblog.l_uid&" or authorid="&oblog.l_uid&" )   And logtype=" & t & " order by addtime desc"
                    G_P_Guide = G_P_Guide & "正文中含有“ <font color=red>" & Keyword & "</font> ”的" & tName
                End Select
            End If
        Case Else
            oblog.adderrstr ("错误的参数")
            oblog.showusererr
    End Select
    Set rs = Server.CreateObject("Adodb.RecordSet")
    'response.Write(sql)
    rs.open sql, conn, 1, 3
    lAll=INT(rs.recordcount)
    If lAll=0 Then
    	%>
    <div id="user_page_content">
    	<div id="content_li">
    	<ul class="content_li_conten" id="u0">    		
			<li class="t1"></li><li class="t3"></li>
			</ul>
    	<ul class="content_li_conten" id="u1">    		
			<li class="t1">&nbsp;</li><li class="t3"><center><%=G_P_Guide & " 没有相关记录"%></center></li>
			</ul>
			</div>
		</div>
		<%
    	rs.Close
    	Set rs=Nothing
    	Exit Sub
    End If
    i=0
    iPage=12
	'分页
	If Request("page") = "" Or Request("page") ="0" then
		lPage = 1
	Else
		lPage = Int(Request("page"))
	End If
	
	'设置缓存大小 = 每页需显示的记录数目
	rs.CacheSize = iPage
	rs.PageSize = iPage
	rs.movefirst		
	lPages = rs.PageCount
	If lPage>lPages Then lPage=lPages
	rs.AbsolutePage = lPage
	i=0
	%>
<style type="text/css">
<!--
	.content_li_top .t2 {width:110px;padding-left:2px;}
	#content_li .t2 {width:110px;padding:6px 0 4px 0;}
	.content_li_top .t3 {margin:-1px 0 0 0;}
	.content_li_top .t4 {margin:-2px 0 0 0;}
	.content_li_conten .t4 {font-weight:600;font-family:Century Gothic,verdana,tahoma,Arial,Helvetica,sans-serif;font-size:10px;}
	.content_li_conten .t5 {margin:-1px 0 0 0;color:#999;}
-->
</style>
<ul id="user_page_top">
	<li id="p7"><a href="#" onclick="chk_idAll(myform,1);">全部选择</a></li>
	<li id="p8"><a href="#" onclick="chk_idAll(myform,0);">全部取消</a></li>
	<li id="p4"><a href="#" onclick="if (chk_idBatch(myform,'删除选中的<%=tName%>吗?')==true) {document.myform.action.value='del'; document.myform.submit();}"><%if truedel then response.Write("彻底删除") else response.Write("日志删除")%></a></li>
  <li id="p6"><a href="#" onclick="if (chk_idBatch(myform,'重新发布选中的<%=tName%>吗?')==true) {document.myform.action.value='updatelog'; document.myform.submit();}"><%if truedel then response.Write("恢复日志") else response.Write("重新发布")%></a></li>
  <%if not truedel then%>
  <li id="p5"><a href="#" onclick="ShowHide('2',null);return false;">移动专题</a></li>
  <%Else%>
  <li id="p4"><a href="#" onclick="chk_idAll(myform,1);if (chk_idBatch(myform,'清空回收站中所有的<%=tName%>吗?')==true) {document.myform.action.value='delall'; document.myform.submit();}">清空回收站</a></li>
  <%end if%>
</ul>
<div id="showpage">
<%=MakeMiniPageBar(lAll,iPage,lPage,G_P_FileName)%>
</div>
<form name="myform" method="Post" action="user_blogmanage.asp?t=<%=t%>&usersearch=<%=usersearch%>" onSubmit="return confirm('确定要执行选定的操作吗？');">
   <div id="user_page_content">
		<ul class="content_li_top">
			<li class="t1">选中</li>
			<li class="t11">日志分类</li>
			<li class="t2">我的专题</li>
			<li class="t3">日志标题&nbsp;<strong>[<%=G_P_Guide%>]</strong></li>
			<li class="t4">点/评</li>
			<li class="t5">发表时间</li>
			<li class="t6">操作</li>
		</ul>
		<div id="content_li">
	<%
	Do While Not rs.Eof And i < rs.PageSize
		i=i+1
	%>
		<ul class="content_li_conten" id="u<%=rs("logid")%>"  onclick="chk_iddiv('<%=rs("logid")%>')">
			<li class="t1" title="点击选中"><input name='id' type='checkbox' id="c<%=rs("logid")%>" value='<%=rs("logid")%>' onclick="chk_iddiv('<%=rs("logid")%>')"/></li>	
			<li class="t11"><%
				Dim thisMainName
				thisMainName=getsubname(rs("classid"),allClass)
				If thisMainName="未分类" Then
					Response.Write "未分类"
				Else
					Response.Write "<span style=""color:#e66;"">" & thisMainName & "</span>"
				End If%></li>
			<li class="t2"><%
				Dim thisSubName
				thiSsubName=getsubname(rs("subjectid"),allsub) 
				If thiSsubName="未分类" Then
					Response.Write "<span style=""color:#999;"">未分类</span>"
				Else
					Response.Write thiSsubName
				End If
				%></li>
			<%If rs("logfile")<>"" then%>
				<li class="t3">
					<%If rs("userid")<>rs("authorid") Then %>[共同撰写]<%End if%>
					<%If rs("passcheck")=0 Then Response.Write "[待审]"%>
					<a href="<%=rs("logfile")%>" target="_blank" title="<%=tName%><%=oblog.filt_html(rs("topic"))%>" ><%=oblog.filt_html(Left(rs("topic"),20))%></a></li>
			<%Else%>
				<li class="t3"><span class="txt9">[草稿]</span> <a href="user_post.asp?logid=<%=rs("logid")%>"  title="<%=tName%><%=oblog.filt_html(rs("topic"))%>"><%=oblog.filt_html(rs("topic"))%></a></li>
			<%End If%>
				<%
				If rs("istop")=1 Then
				%>
				 <img src="oBlogStyle/level/light.gif" alt="该篇文章被您设置为固顶" align="absmiddle" />
				<%
				End If
				If rs("isbest")=1 Then
				%>
				 <img src="oBlogStyle/level/tu-001.gif" alt="该篇文章被系统管理员设置为精华" align="absmiddle" />
				 <%
				End If
				If OB_IIF(rs("ispassword"),"")<>"" Then
				%>
				 <img src="oBlogStyle/level/lock.gif" alt="该篇文章被您设置为加密" align="absmiddle" />
				 <%
				End If
				If rs("ishide")=1 Then
				%>
				 <img src="oBlogStyle/level/hidden.gif" alt="该篇文章被您设置为隐藏，仅对好友可见" align="absmiddle" />
				  <%
				End If
				%>
			</li>
			<li class="t4"><%=rs("iis")&"/"&rs("commentnum")%></li>
			<li class="t5" title="<%=formatdatetime(rs("addtime"),2) %>"><%=formatdatetime(rs("addtime"),1)%> 				
				</li>
			<li class="t6">
			<%if truedel then%>
				<a href="user_blogmanage.asp?action=updatelog&id=<%=rs("logid")%>&userid=<%=rs("userid")%>" onClick="return confirm('确定要恢复此日志吗？');">恢复</a>
			<%else%>
			<a href="user_post.asp?logid=<%=rs("logid")%>"  title="<%=tName%><%=oblog.filt_html(rs("topic"))%>">修改</a><%End if%>&nbsp;<a href="user_blogmanage.asp?action=del&id=<%=rs("logid")%>&truedel=<%=truedel%>" onClick="return confirm('确定要删除此日志吗？');">删除</a></li>
		</ul>
		<%
		rs.MoveNext
	Loop
    rs.Close
    Set rs = Nothing
%>
</div>
</div>
<input type="hidden" name="action" value="">
<input type="hidden" name="subjectid" value="">
<input type="hidden" name="chksubjectid" value="">
<input type="hidden" name="chkclassid" value="">
<input type="hidden" name="classid" value="">
</form>

<%
End Sub
%>

<%
Sub delblog()
    If id = "" Then
        oblog.adderrstr ("请指定要删除的" & tName)
        oblog.showusererr
        Exit Sub
    End If
    If InStr(id, ",") > 0 Then
        Dim n, i
        id = FilterIDs(id)
        n = Split(id, ",")
        For i = 0 To UBound(n)
            deloneblog (n(i))
        Next
    Else
        deloneblog (id)
    End If
	response.Write("<script>parent.get_draft();window.location='"&oblog.comeurl&"';</script>")
	response.Flush()
End Sub

Sub deloneblog(logid)
    logid = Int(logid)
    Dim uid, delname, rst, fso, sid,Scores,sYear,sMonth
    Set rst = Server.CreateObject("adodb.recordset")
    If Not IsObject(conn) Then link_database
    rst.open "select userid,logfile,subjectid,logtype,scores,isdel,addtime from oblog_log where logid="&logid&wsql,conn,1,3
    If rst.Eof Then
        rst.Close
        Set rst = Nothing
        Exit Sub
    End If
	uid = rst(0)
	sYear=Year(rst(6))
	sMonth=Month(rst(6))
	delname = Trim(rst(1))
	sid = rst(2)
	'清理图片记录,已取消
'	If rst("logtype") = 1 Then
'	    Call DeletePhotos(logid)
'	End If
	'真实域名需要重新整理文件数据
	'物理文件即时删除
	If true_domain = 1 And delname <> "" Then
	    If InStr(delname, "archives") Then
	        delname = Right(delname, Len(delname) - InStrRev(delname, "archives") + 1)
	    Else
	        delname = Right(delname, Len(delname) - InStrRev(delname, "/"))
	    End If
	    delname=oblog.l_udir&"/"&oblog.l_ufolder&"/"&delname
	    'response.write(delname)
	    'response.end
	End If
	If delname <> "" Then
	    Set fso = Server.CreateObject(oblog.CacheCompont(1))
	    If fso.FileExists(Server.MapPath(delname)) Then fso.DeleteFile Server.MapPath(delname)
	End If
	Scores=OB_IIF(rst("scores"),0)
	'回收与删除
	'response.Write(truedel)
	'response.End()
	If not truedel Then
		rst("isdel")=1
		rst.Update
	Else	
		rst.Delete
	End If
	rst.Close
	'--------------------------------------------
	'更新计数器
	If not truedel Then
		oblog.Execute ("Update oblog_comment Set isdel=1 where mainid=" & Int(logid)) 
		If Not isdraft Then
			oblog.Execute ("update oblog_user set log_count=log_count-1 where userid=" & uid)	
			'如果不是草稿进行积分操作，因为保存为草稿并未加分
			Call oblog.GiveScore("",-1*Scores,"")
			oblog.Execute ("update oblog_subject set subjectlognum=subjectlognum-1 where subjectid=" & Int(sid))
		End if
		'删除积分
	Else
		Call Tags_UserDelete(logid)	
		oblog.Execute ("delete from oblog_comment where mainid=" & Int(logid))
	End If	
	'--------------------------------------------
	Set rst=oblog.Execute("Select Count(logid) From oblog_log Where isdel=0 and isdraft=0 And Year(addtime)=" & sYear & " And Month(addtime)=" & sMonth)
	'增加日历文件的处理
	If rst(0)=0 Then
		On Error Resume Next
		fso.delete Server.Mappath(blogdir & oblog.l_udir & oblog.l_ufolder & "/calendar/" & cYear & Right("0" & sMonth,2) & ".htm" )
	End If
	Dim blog
	Set blog = New class_blog
	blog.userid = uid
	blog.Update_Subject uid
	blog.Update_index 0
	blog.Update_newblog (uid)
	Set blog = Nothing
	Set fso = Nothing
	Set rst = Nothing
End Sub

Sub delallblog()
    Dim uid, delname, rst, fso, sid,Scores,logid
    Set rst = Server.CreateObject("adodb.recordset")
    If Not IsObject(conn) Then link_database
    rst.open "select userid,logfile,subjectid,logtype,logid,isdel from oblog_log where isdel=1"&wsql,conn,1,3
    If rst.Eof Then
        rst.Close
        Set rst = Nothing
        Exit Sub
    End If
	While Not rst.eof 
		uid = rst(0)
		delname = Trim(rst(1))
		sid = rst(2)
		logid=rst(4)
		'清理图片记录,已取消
	'	If rst("logtype") = 1 Then
	'	    Call DeletePhotos(logid)
	'	End If
		'真实域名需要重新整理文件数据
		'物理文件即时删除
		If true_domain = 1 And delname <> "" Then
			If InStr(delname, "archives") Then
				delname = Right(delname, Len(delname) - InStrRev(delname, "archives") + 1)
			Else
				delname = Right(delname, Len(delname) - InStrRev(delname, "/"))
			End If
			delname=oblog.l_udir&"/"&oblog.l_ufolder&"/"&delname
			'response.write(delname)
			'response.end
		End If
		If delname <> "" Then
			Set fso = Server.CreateObject(oblog.CacheCompont(1))
			If fso.FileExists(Server.MapPath(delname)) Then fso.DeleteFile Server.MapPath(delname)
		End If
		'回收与删除
		'response.Write(truedel)
		'response.End()
		rst.Delete
		'--------------------------------------------
		Call Tags_UserDelete(logid)		
		rst.MoveNext
	Wend 
	rst.Close
	'更新计数器
	oblog.Execute ("delete from oblog_comment where isdel=1 ")
	'--------------------------------------------
	Dim blog
	Set blog = New class_blog
	blog.userid = uid
	blog.Update_Subject uid
	blog.Update_index 0
	blog.Update_newblog (uid)
	Set blog = Nothing
	Set fso = Nothing
	Set rst = Nothing
	response.Write("<script>parent.get_draft();window.location='"&oblog.comeurl&"';</script>")
	response.Flush()
End Sub

Sub moveblog()
    If id = "" Then
        oblog.adderrstr ("请指定要移动的" & tName)
        oblog.showusererr
        Exit Sub
    End If
    Dim subjectid,classid,chkclass,chksubject
    chkclass=Request("chkclassid")
    chksubject=Request("chksubjectid")
    subjectid = Trim(request("subjectid"))
    classid = Trim(request("classid"))
    If chksubject="1" Then
	    If subjectid = "" Then
	        oblog.adderrstr ("请指定要移动的目标专题")
	        oblog.showusererr
	        Exit Sub
	    Else
	        subjectid = Int(subjectid)
	    End If
	End If
	If chkclass="1" Then
	    If classid = "" Then
	        oblog.adderrstr ("请指定要移动的系统分类")
	        oblog.showusererr
	        Exit Sub
	    Else
	        classid = Int(classid)
	    End If
	End If
    If InStr(id, ",") > 0 Then
        id = FilterIDs(id)
        If chksubject="1" Then conn.execute("Update [oblog_log] set subjectid="&subjectid&" where logid in (" & id & ")"&wsql)
        If chkclass="1" Then conn.execute("Update [oblog_log] set classid="&classid&" where logid in (" & id & ")"&wsql)      	
    Else
         If chksubject="1" Then conn.execute("Update [oblog_log] set subjectid="&subjectid&" where logid=" & Int(id) &wsql)
         If chkclass="1" Then conn.execute("Update [oblog_log] set classid="&classid&" where logid=" & Int(id) &wsql)
    End If
    If chksubject="1" Then 
	    Dim blog, rs1
	    Set blog = New class_blog
	    blog.userid = oblog.l_uId     
	    Set rs = oblog.Execute("select subjectid from oblog_subject where userid=" & oblog.l_uId & " And Subjecttype=" & t)
	    While Not rs.EOF
	        Set rs1 = oblog.Execute("select count(logid) from oblog_log where oblog_log.subjectid=" & rs(0))
	        oblog.Execute ("update oblog_subject set subjectlognum=" & rs1(0) & " where oblog_subject.subjectid=" & rs(0))
	        rs.Movenext
	    Wend   
	    Set rs = Nothing
	    Set rs1 = Nothing 
	    blog.Update_Subject oblog.l_uId   
	    Set blog = Nothing     
	    oblog.showok "更新成功,需要重新发布首页，才可使专题统计准确!", ""	  
    End If
    If chkclass="1" Then oblog.showok "更新系统分类成功!", ""   
End Sub

Sub updatelog()
	Dim aIds,i,tuid,trs
	Dim log_isTrouble
	tuid = Trim(request("userid"))
    Response.Write ("<div id=""prompt""><ul>")
    id = FilterIds(Id)
    Dim blog, p, rs, uid
    Set blog = New class_blog
    aIds=Split(id,",")
    blog.progress_init
    p = 6
    blog.IsMulti="1"
    blog.progress Int(1 / p * 100), "生成静态" & tName & "文件"
    blog.progress Int(2 / p * 100), "生成" & tName & "文件"
	log_isTrouble = 0
    For i=0 To UBound(aIds)
		If tuid <>"" Then 
			tuid=CLng(tuid)
		Else 
			Set trs = Server.CreateObject("adodb.recordset")
			trs.open "SELECT userid,topic,abstract,logtext FROM oblog_log WHERE logid="&aIds(i)&wsql,conn,1,3
			If trs.eof Then 
				trs.close
				Exit Sub 
			Else 
				tuid=CLng(trs(0))
				Dim iChk1,iChk2,iChk3
				iChk1=oblog.chk_badword(trs(1))
				iChk2=oblog.chk_badword(trs(2))
				iChk3=oblog.chk_badword(trs(3))
				If iChk1=0.1 Or iChk2=0.1 Or iChk3=0.1 Then
					'记录
					oblog.execute("Update oblog_user Set isTrouble=isTrouble+1 Where userid=" & oblog.l_uid)
					'写系统日志
					Dim rstLog
					Set rstLog=Server.CreateObject("Adodb.Recordset")
					rstLog.Open "Select * From oblog_syslog Where 1=0",conn,1,3
					rstLog.AddNew
					rstLog("username")=oblog.l_uname
					rstLog("addtime")=Now
					rstLog("addip")=oblog.userip
					rstLog("desc")="用户名："&oblog.l_uname & "(ID：" & oblog.l_uid & ")" & " 于 " & Now() & " 自 " & oblog.userip & " 发布一篇文章包含以下禁止发表的关键字（文章被禁止发布）:<br/><font color=red>日志标题：" & EncodeJP(trs(1)) & "<br/>可疑关键字：" & oblog.ShowBadWord & "</font>"
					rstLog("itype")=2 '用户日志来源
					rstLog.Update
					rstLog.Close
					oblog.adderrstr ("内容中存在绝对禁止的关键字,请注意您的言论!")
					
					'判断是否需要封禁
					If oblog.CacheConfig(13)<>"0" And  Trim(oblog.CacheConfig(13))<>"" Then
						Dim isRedirect
						rstLog.Open "Select istrouble,lockuser From oblog_user Where userid=" & oblog.l_uid,conn,1,3	
						If rstLog(0)>CInt(oblog.CacheConfig(13)) Then
							rstLog("lockuser")=1
							rstLog.Update
							rstLog.Close
							isRedirect = 1
						End If
					End If
					Set rstLog=Nothing
					If oblog.errstr <> "" Then 
						If isRedirect = 1 Then 
							response.write "<script language=JavaScript>alert('您发布的敏感字过多，已经被封禁！');top.location='index.asp';</script>"
							Response.End
						Else 
							response.Write "<script language=JavaScript>alert(""" & oblog.errstr & """);history.go(-1)</script>"
							Response.End
						End If 
					End If
				Elseif iChk1 >=1 Or iChk2>=1 Or iChk3>=1 Then
					log_isTrouble=1
				End If
				trs.update
				trs.close
				Set trs=Nothing
			End if
		End if
	    oblog.execute("update oblog_log set isdraft=0,isdel=0,istrouble = "&log_isTrouble&" where logid="&aIds(i)&wsql)
		oblog.Execute ("update oblog_user set log_count=log_count+1 where userid=" & tuid)
	    set rs=oblog.execute("select userid,subjectid from oblog_log where logid="&aIds(i)&wsql)
	    If Not rs.EOF Then
	        blog.userid = rs(0)	
	        blog.Update_log aIds(i), 1	
	        blog.Update_calendar (aIds(i))        	
	    Else
	        Set rs = Nothing
	        oblog.adderrstr ("无操作权限!")
	        oblog.showusererr
	    End If	
	   Next
	   '最后再进行首页/分类的更新
	   blog.progress Int(3 / p * 100), "生成首页"
	   blog.Update_index 0
	   blog.progress Int(4 / p * 100), "生成" & tName & "分类列表"
	   blog.Update_Subject oblog.l_uid
	   blog.progress Int(5 / p * 100), "生成新" & tName & "列表"
	   blog.Update_newblog oblog.l_uid
	   blog.progress Int(6 / p * 100), "发布" & tName & "完成"
	   Set rs = Nothing
	   Response.Clear
	   	response.Write("<script>parent.get_draft();</script>")
	   Response.Write ("<li><a href='user_blogmanage.asp'>&lt;&lt; 返回日志管理</a></li></ul></div>")
End Sub

'删除关联相册文件
Sub DeletePhotos(logid)
    Dim rst, fs, fsize, uid, imgsrc, fid
    Set rst = oblog.Execute("select file_path,file_size,userid,fileid from oblog_upfile where logid=" & logid)
    If Not rst.EOF Then
        Set fs = CreateObject(oblog.CacheCompont(1))
        Do While Not rst.EOF
        fsize = rst(1)
        uid = rst(2)
        imgsrc = rst(0)
        fid = rst(3)
        If fs.FileExists(Server.MapPath(imgsrc)) Then
            fs.DeleteFile (Server.MapPath(imgsrc))
        End If
        If InStr("jpg,bmp,gif,png,pcx", Right(imgsrc, 3)) > 0 Then '删除缩略图
            imgsrc = Replace(imgsrc, Right(imgsrc, 3), "jpg")
            imgsrc = Replace(imgsrc, Right(imgsrc, Len(imgsrc) - InStrRev(imgsrc, "/")), "pre" & Right(imgsrc, Len(imgsrc) - InStrRev(imgsrc, "/")))
            If fs.FileExists(Server.MapPath(imgsrc)) Then
                fs.DeleteFile Server.MapPath(imgsrc)
            End If
        End If
        oblog.Execute ("delete from [oblog_upfile] where fileid=" & fid)
        oblog.execute("update [oblog_user] set user_upfiles_size=user_upfiles_size-"&fsize&",user_upfiles_num=user_upfiles_num-1 where userid="&uid)
        rst.Movenext
        Loop
        Set fs = Nothing
        Set rst = Nothing
    End If
End Sub

Sub BackUp()
%>
<body  style="overflow:hidden;" scroll="no">
<form name="oblogform" method="post" action="user_logzip.asp?t=<%=t%>">
	<table class='win_update_table' align='center' border='0' cellpadding='0' cellspacing='1'>
		<tr>
			<td colspan='2' class='win_update_table_top'>日志备份</td>
		</tr>
		<tr>
			<td colspan='2'>请选择日志备份的起止日期：</td>
		</tr>
		<tr>
			<td class='win_update_table_td'>开始日期：</td>
			<td><%oblog.type_dateselect dateadd("m",-1,date),1%></td>
		</tr>
		<tr>
			<td class='win_update_table_td'>结束日期：</td>
			<td><%oblog.type_dateselect date(),2%>
			</td>
		</tr>
		<tr>
			<td class='win_update_table_td'>备份格式：</td>
			<td><input name="filetype" type="radio" value="txt" checked>TXT纯文本 <input type="radio" name="filetype" value="htm">HTM网页 <input type="radio" name="filetype" value="xml">XML
			</td>
		</tr>
		<tr>
			<td colspan='2' align="center"><input type="submit" value=" 导出数据 " /></td>
		</tr>
	</table>
</form>
</body>
<%end sub
%>