www.gusucode.com > 易心博客[圣诞版] 3.5手动安装码程序 > Admin_Log.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="Conn.asp"--> <!--#include file="Ex_Cls/Ex_SkinCls.asp"--> <!--#include file="Ex_Cls/Ex_SplitPageCls.asp"--> <!--#include file="Ex_Cls/Ex_RefreshCls.asp"--> <!--#include file="Ex_Cls/Ex_ImgCls.asp"--> <!--#include file="Ex_Cls/Ex_FilterHtmlCls.asp"--> <%Server.ScriptTimeOut=9999%> <% Response.charset="GB2312" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <link rel="stylesheet" href="Admin_Style.css"> <title>日志管理</title> <script src="inc/jquery.js"></script> <script type="text/javascript" src="AienUpload/init.js"></script> <script type="text/javascript" charset="gb2312" src="wbTextBox/kindeditor.js"></script> <script language="JavaScript"> /*自动保存函数*/ function autosave() { var title=document.getElementById("title").value; var tags=document.getElementById("tags").value; var content=KE.util.getData('Body'); var abody=KE.util.getData('aBody');; $.ajax({ url:'admin_log.asp?action=autosave', type:'POST', timeout:2000, error: function(){}, data:"action=autosave&title="+escape(title)+"&content="+escape (content)+"&tags="+escape (tags)+"&abody="+escape(abody), success:function(msg){ document.getElementById("autosavemsg").innerHTML=document.getElementById("autosavemsg").innerHTML+"<br><a href=javascript:restore('"+msg+"')>"+msg.replace('_',' ').replace('#',":").replace('#',":")+"</a>"; } }) } setInterval(autosave,60000); function restore(fname) { if (confirm('是否要恢复'+fname.replace('_',' ').replace('#',":").replace('#',":")+'存稿?')) { $.ajax({ url:'admin_log.asp?action=restore', type:'POST', timeout:2000, error: function(){}, data:"fname="+fname, success:function(msg){ var arr=msg.split("$exblog#$!"); document.getElementById("title").value=arr[0]; document.getElementById("tags").value=arr[1]; document.getElementById("aBody").value=arr[2]; document.getElementById("Body").value=arr[3]; KE.util.setExData('Body',arr[3]); KE.util.setExData('aBody',arr[2]); } }) } } /*显示自动保存*/ function showautosavemsg() { document.getElementById('autosavemsg').style.display=''; } /*隐藏自动保存*/ function hideautosavemsg() { document.getElementById('autosavemsg').style.display='none'; } /*检测是否有自动保存文件*/ function checkautosave() { $.ajax({ url:'admin_log.asp?action=checkautosave', type:'POST', timeout:2000, error: function(){}, data:'type=new', success:function(msg){ var flag; if (msg=="") { return false; } if (1==1) { var arr=msg.split("|"); for (var i=0;i<arr.length ;i++ ) { document.getElementById("autosavemsg").innerHTML=document.getElementById("autosavemsg").innerHTML+"<br><a href=javascript:restore('"+arr[i]+"')>"+arr[i].replace('_',' ').replace('#',":").replace('#',":")+"</a>"; } } } }) } /*检测自定义静态文件名是否重复*/ function checkfilename(filename){ if (filename!="") { if (filename.indexOf("/")!=-1 || filename.indexOf("\\")!=-1) { document.getElementById("filename").value="false"; alert("自定义文件名中不能出现 \\ 和 /"); return false; } if (isNumber(filename)) { document.getElementById("filename").value="false"; alert("自定义文件名不能全为数字"); return false; } if (document.getElementById("filenamed")!=null) { if (filename==document.getElementById("filenamed").value) { document.getElementById("filename").value=""; return false; } } $.ajax({ url:'admin_log.asp?action=checkfilename', type:'POST', timeout:2000, error: function(){}, data:'filename='+filename, success:function(msg){ if (msg=="false") { document.getElementById("filename").value="false"; alert("自定义静态文件名重复,请重新填写"); document.getElementById("file_name").focus(); } else{ document.getElementById("filename").value=""; } } }) } } /*判断是否为数字*/ function isNumber(oNum) { if(!oNum) return false; var strP=/^\d+(\.\d+)?$/; if(!strP.test(oNum)) return false; try{ if(parseFloat(oNum)!=oNum) return false; } catch(ex) { return false; } return true; } //灾难恢复 把日志暂时存储在粘贴板上 function copyclip(meintext) { if (window.clipboardData){ if (window.clipboardData.setData("Text", meintext)){ alert('日志已经复制到了粘贴板'); return true; } else { alert('复制失败\n请允许网页访问"剪切板"'); return false; } }else if (window.netscape) { try{ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); } catch (e) { alert("被浏览器拒绝!\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'"); return false; } var clip = Components.classes['@mozilla.org/widget/clipboard;1'] .createInstance(Components.interfaces.nsIClipboard); if (!clip) return false; var trans = Components.classes['@mozilla.org/widget/transferable;1'] .createInstance(Components.interfaces.nsITransferable); if (!trans) return false; trans.addDataFlavor('text/unicode'); var str = new Object(); var len = new Object(); var str = Components.classes["@mozilla.org/supports-string;1"] .createInstance(Components.interfaces.nsISupportsString); var copytext=meintext; str.data=copytext; trans.setTransferData("text/unicode",str,copytext.length*2); var clipid=Components.interfaces.nsIClipboard; if (!clip) return false; clip.setData(trans,null,clipid.kGlobalClipboard); } alert('日志已经复制到了粘贴板'); return true; } //用户自定义函数---检测表单填写 //t[为chang 则]清空摘要 function Checkpostdata(t) { if (document.getElementById("filename").value=="false") { alert("自定义静态文件名重复或者包含不允许的字符,请重新填写"); document.getElementById("file_name").focus(); return false; } if(document.all.title.value=="" || document.all.title.value.length>50) {alert("标题不能为空,并且不能超过50个字符"); document.all.title.focus(); return false; } if(KE.util.getData('Body')=="") {alert("内容不能为空"); return false; } if(document.all.classx.value=="") {alert("你没有选择分类"); document.all.classx.focus(); return false; } document.getElementById("aBody").value=KE.util.getData('aBody'); if (t=="change") { if (confirm('是否根据日志内容自动生成摘要?')) { document.getElementById('aBody').value='<P> </P>'; } } //copyclip(document.getElementById("Body").value); return true; } </script> </head> <body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor" > <% Dim ExLog Set ExLog=new ExLogCls ExLog.Execute Class ExLogCls Dim ExComm,ExFso,ExImg,ExHtml Private Sub class_initialize Set ExComm=new Ex_CommonCls ExComm.GetConfigCache("*") ExComm.IsAdLogin ExComm.IsIpAllow Set ExFso=new Ex_FsoCls Set ExImg=new Ex_ImgCls Set ExHtml=new Ex_FilterHtmlCls End Sub Private Sub class_terminate Set ExComm=Nothing Set ExFso=Nothing Set ExImg=Nothing Set ExHtml=Nothing End Sub Public Sub execute dim action action=request.QueryString("action") select case action case "addform" AddForm case "add" Add RefreshTxtSkin case "changeform" ChangeForm case "change" Change RefreshTxtSkin case "del" Del RefreshTxtSkin Case "delmore" Delmore RefreshTxtSkin Case "autosave" AutoSave Case "restore" Restore Case "delautosave" DelAutoSave Case "checkautosave" CheckAutoSave Case "checkfilename" CheckFileName case else call search() end Select End Sub '检测自定义静态文件名是否重复 Sub CheckFileName() Dim Fn fn=request.Form("filename") Response.Clear If Conn.Execute("select count(*) from Ex_Log where file_name='"&fn&"'")(0)<>0 Then Response.Write("false") Else Response.Write("true") End If End Sub '自动保存 Sub AutoSave() Dim title,tags,abody,content,fname title=request.Form("title") tags=request.Form("tags") abody=request.Form("abody") content=request.Form("content") fname=Replace(now,":","#") fname=Replace(fname," ","_") ExFso.CreateFile "Temp\LogTemp\"&fname&".ExTemp",title&"$exblog#$!"&tags&"$exblog#$!"&abody&"$exblog#$!"&content Response.Clear Response.write(fname) End Sub '恢复存搞 Sub Restore Dim Content,Fname Fname=Request.Form("fname") Response.Clear Content=ExFso.ReadFile("Temp\LogTemp\"&fname&".ExTemp") Response.Write(Content) End Sub '清空存稿 Sub DelAutoSave ExFso.DelFolder "Temp\LogTemp" ExFso.CreateRoute "Temp\LogTemp" End Sub '获取存搞文件名列表 Sub checkautosave() Dim Content Response.Clear Content=ExFso.GetSubFiles("Temp\LogTemp") If Trim(Content)<>"文件夹不存在" Then Response.Write(Replace(Content,".ExTemp","")) Else Response.Write("") End If End Sub '从新生成模板 Function RefreshTxtSkin ExComm.ClearCaches(sn) Dim ExSkin Set ExSkin=new Ex_SkinCls ExSkin.RefreshSkinCache Set ExSkin=Nothing End Function '************************************* '发布引用 '参数:引用地址 日志地址 日志标题 日志简要 博客名称 '************************************* Private Function Trackback(trackback_url, url, title, excerpt, blog_name,tags) Dim querystring, objXMLHTTP, objDOM title = ExComm.cutStr(Server.URLEncode(title),100) excerpt = ExComm.cutStr(Server.URLEncode(excerpt), 252) url = Server.URLEncode(url) blog_name = Server.URLEncode(blog_name) querystring = "title="&title&"&url="&url&"&blog_name="&blog_name&"&excerpt="&excerpt&"&tags="&tags Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP") 'Set objXMLHTTP = Server.CreateObject("microsoft.XMLHTTP") Set objDom = Server.CreateObject("Microsoft.XMLDOM") objXMLHTTP.Open "POST", trackback_url, false 'objXMLHTTP.Open "POST", trackback_url, false objXMLHTTP.setRequestHeader "Content-Type","application/x-www-Form-urlencoded" On Error Resume Next objXMLHTTP.send querystring If objXMLHTTP.readyState <> 4 Then objXMLHTTP.waitForResponse 15 End If If Err.Number <> 0 Then Trackback = "0$$TrackBack 错误:无法连接服务器" Else If (objXMLHTTP.readyState <> 4) Or (objXMLHTTP.Status <> 200) Then objXMLHTTP.Abort Trackback = "0$$Trackback 超时" Else objDom.async=false objDom.loadXML(objXMLHTTP.responseText) If objDom.parseError.errorCode <> 0 Then Trackback = "0$$TrackBack 响应解析错误" Else If objDom.getElementsByTagName("error")(0).Text="0" Then Trackback = "1$$Trackback 成功" Else Trackback = "0$$Trackback 错误:"&objDom.getElementsByTagName("message")(0).Text End If End If End If End If Set objXMLHTTP = Nothing Set objDom = Nothing End Function %> <%sub addform()%> <form action="?action=add" method="post" name="Dvform" onSubmit="JavaScript:return Checkpostdata('');"> <table width="98%" border="0" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border"> <tr> <th colspan="9" class="topbg">日志发表</th> </tr> <tr> <td class="tdbg" width="9%" ><div align="center">日志标题:<font color="red">*</font></div></td> <td class="tdbg" colspan="8"><input name="title" type="text" id="title"> 最多不应超过50字</td> </tr> <tr> <td class="tdbg"><div align="center">日志分类:<font color="red">*</font></div></td> <td class="tdbg" colspan="8"><label> <select name="classx" id="classx"> <option value="">选择分类</option> <%=ExComm.GetClassSelectCache(0)%> </select> 自定义静态文件名: <input name="file_name" type="text" id="file_name" size="20" maxlength="38" onchange="checkfilename(this.value)">.html 留空则为默认静态名 <input type="hidden" id="filename" value=""> </label></td> </tr> <tr> <td class="tdbg"><div align="center">日志标签:</div></td> <td class="tdbg" colspan="8"><input name="tags" type="text" id="tags" size="30" title="标签之间用空格分开" value="标签之间用空格分开" onClick="if(this.value=='标签之间用空格分开') this.value='';"> <input name="btinsertTag" type="button" id="btinsertTag" style="border:solid 1px" onClick="window.open ('Admin_InsertTags.asp', 'newwindow', 'height=400, width=200, top=50,left=600, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no,status=no')" value="选择日志标签"/> <input name="btinsertTag" type="button" id="btinsertTag" style="border:solid 1px" onClick="KE.util.insertHtml('Body','$ex_cut$');" value="插入摘要标记" style="display:none"/> <input name="btinsertTag" type="button" id="btinsertTag" style="border:solid 1px" onClick=";if(this.value=='显示摘要框'){this.value='隐藏摘要框';abstract.style.display='';}else{this.value='显示摘要框';abstract.style.display='none';}" value="隐藏摘要框"/></td> </tr> <tr id="abstract"> <td class="tdbg"><div align="center">日志摘要:</div></td> <td class="tdbg" colspan="8"> <textarea id="aBody" name="aBody"> </textarea> <!--#include file="htmedit_a.asp"--> </td> </tr> <tr> <td class="tdbg"><div align="center">日志正文:<font color="red">*</font></div></td> <td class="tdbg" colspan="8"> <span style="float:left;"> <textarea name="Body" id="Body"></textarea><!--编辑器初始值的设置--> <!--#include file="htmedit.asp"--> </span> <span id="autosavetitle" style="float:right;margin-top:0px;text-align:left;">以下为自动保存的草稿<br>每一分钟自动保存一次<br>点击时间连接可以恢复<br><a href="javascript:showautosavemsg();">显示时间</a> <a href="javascript:hideautosavemsg();">隐藏时间</a><div id="autosavemsg" style="display:none"></div></span><script>checkautosave()</script></td> </tr> <tr> <%Dim defaultRs,defaultSql defaultSql="select ishide,istop,iscmt,copyright from Ex_LogDefault" defaultRs=Conn.execute(defaultSql)%> <td class="tdbg" height="26"><div align="center">高级选项:</div></td> <td width="12%" class="tdbg">查看 <select name="ishide" id="select2"> <option value="游客" <%if trim(defaultRs(0))="游客" then response.Write("selected") end if%>>游客</option> <option value="会员" <%if trim(defaultRs(0))="会员" then response.Write("selected") end if%>>会员</option> <option value="隐藏" <%if trim(defaultRs(0))="隐藏" then response.Write("selected")end if%>>隐藏</option> </select></td> <td width="7%" class="tdbg">置顶 <input name="istop" type="checkbox" id="istop" value="true" <%if defaultRs(1)=true then response.Write("checked")end if%>></td> <td width="14%" class="tdbg">允许回复 <select name="iscmt" id="select3"> <option value="游客" <%if trim(defaultRs(2))="隐藏" then response.Write("selected")end if%>>游客</option> <option value="会员" <%if trim(defaultRs(2))="会员" then response.Write("selected")end if%>>会员</option> <option value="禁止" <%if trim(defaultRs(2))="禁止" then response.Write("selected")end if%>>禁止</option> </select></td> <td width="10%" class="tdbg">原创声明 <input name="copyright" type="checkbox" id="copyright" value="true" <%if defaultRs(3)=true then response.Write("checked")end if%>></td> <td width="14%" class="tdbg">日志密码 <input name="logpass" type="text" id="logpass" size="5" value=""></td> <td width="11%" class="tdbg">存为草稿 <label> <input name="savedraft" type="checkbox" id="savedraft" value="0"> </label></td> <td width="15%" class="tdbg">推荐等级 <input name="recommend" type="text" id="recommend" size="5" value="0" onBlur="if(!isNumber(this.value)){alert('必须为数字');this.focus();}"></td> <td width="8%" class="tdbg">存图 <input name="saveimg" type="checkbox" id="saveimg" value="yes"> </td> </tr> <tr> <td class="tdbg"><div align="center">日志心情:</div></td> <td class="tdbg" colspan="8"><input name="emotion" type="radio" value="0"> 无 <input name="emotion" type="radio" value="1" checked> <img src="images/emotion/em01.gif" width="19" height="19"> <input type="radio" name="emotion" value="2" > <img src="images/emotion/em02.gif" width="19" height="19"> <input type="radio" name="emotion" value="3"> <img src="images/emotion/em03.gif" width="19" height="19"> <input type="radio" name="emotion" value="4"> <img src="images/emotion/em04.gif" width="19" height="19"> <input type="radio" name="remotion" value="5"> <img src="images/emotion/em05.gif" width="19" height="19"> <input type="radio" name="emotion" value="6"> <img src="images/emotion/em06.gif" width="19" height="19"> <input type="radio" name="emotion" value="7"> <img src="images/emotion/em07.gif" width="19" height="19"> <input type="radio" name="emotion" value="8"> <img src="images/emotion/em08.gif" width="19" height="19"> <input type="radio" name="emotion" value="9"> <img src="images/emotion/em09.gif" width="19" height="19"></td> </tr> <tr style="display:none;"> <td class="tdbg"><div align="center">引用通告:</div></td> <td class="tdbg" colspan="8"><textarea name="textarea" cols="70" wrap="VIRTUAL" id="textarea"></textarea></td> </tr> <tr> <td class="tdbg"><div align="center">定时发布:</div></td> <td class="tdbg" colspan="8"><input type="hidden" name="submittime" id="submittime" value="<%=now()%>"> <select name="selecty" id="selecty"> <% dim y y=2005 while y<=2010 if year(now())=y then response.Write "<option value="&y&" selected>"&y&"</option>" else response.Write "<option value="&y&">"&y&"</option>" end if y=y+1 wend %> </select> 年 <select name="selectm" id="selectm" > <% dim m m=1 while m<=12 if month(now())=m then response.Write "<option value="&m&" selected>"&m&"</option>" else response.Write "<option value="&m&">"&m&"</option>" end if m=m+1 wend %> </select> 月 <select name="selectd" id="selectd" > <% dim d,maxday d=1 while d<=31 if day(now())=d then response.Write "<option value="&d&" selected>"&d&"</option>" else response.Write "<option value="&d&">"&d&"</option>" end if d=d+1 wend %> </select> 日 <!--增加时、分选择功能Begin,program by hotlion at 08-03-22--> <select name="selecth" id="selecth" > <% dim h h=0 while h<=23 if hour(now())=h then response.Write "<option value="&h&" selected>"&h&"</option>" else response.Write "<option value="&h&">"&h&"</option>" end if h=h+1 wend %> </select> 时 <select name="selectmin" id="selectmin" > <% dim min min=0 while min<=59 if minute(now())=min then response.Write "<option value="&min&" selected>"&min&"</option>" else response.Write "<option value="&min&">"&min&"</option>" end if min=min+1 wend %> </select> 分 <!--增加时、分选择功能End--></td> </tr> <tr> <td class="tdbg"> </td> <td class="tdbg" colspan="8"><div align="center"> <input type="submit" name="Submit3" value="提交"> <input type="reset" name="Submit22" value="清除"> </div></td> </tr> </table> </form> </body> </html> <%end Sub '***************************** '截取日志摘要文字 '参数:str 日志内容 '**************************** Function GetAbstractHtml(ByVal str) Dim Char,Temp,Arr,I,Content,Ln Ln=CInt(Application(sn&"logdefaultnum")) Content=ExComm.ClearHtml(Str) If Len(Content)>Ln Then Char=Mid(Content,Ln,1) Arr=Split(Str,Char) For I=0 To UBound(Arr) Temp=Temp&Arr(I)&Char If Len(ExComm.ClearHtml(Temp))>=Ln Then GetAbstractHtml=Temp Exit For End If Next GetAbstractHtml=Temp Else GetAbstractHtml=Str End If End Function '***************************** '及时生成日志信息静态页 '参数:日志id '**************************** Function CreateLOG(id) Dim ExRefresh,I ExComm.ClearCaches(sn) RefreshTxtSkin ExComm.GetConfigCache("*") Set ExRefresh=new Ex_RefreshCls If InStr(id,",")<>0 Then Id=Split(id,",") For I=0 To UBound(id) ExRefresh.CreateView id(I) Next Else ExRefresh.CreateView id End If End Function '插入标签 Sub InsertTag(ByVal Tags,Classid) Dim I Tags=Split(Tags," ") For I=0 To UBound(Tags) Conn.Execute "insert into Ex_tags (tagname,classid,times) values('"&Tags(I)&"',"&classid&",0)" Next End Sub sub add() dim title,tags,classx,content,ishide,istop,iscmt,logpass,emotion,quote,submittime,Recommend,file_name '增加变量file_name用于接收日志静态文件名值 Modify by Hotlion at 2009-2-14 Dim strsql,rs,log_postyear,log_postmonth,log_postday,log_posthour,log_postmin,copyright,textnum,logtype,abstract title=server.htmlencode(request.Form("title")) tags=Trim(server.htmlencode(request.Form("tags"))) classx=request.Form("classx") content=request.Form("body") abstract=Request.Form("aBody") ishide=request.Form("ishide") istop=request.Form("istop") iscmt=request.Form("iscmt") logpass=request.Form("logpass") emotion=request.Form("emotion") quote=request.Form("quote") copyright=request.Form("copyright") submittime=request.Form("submittime") log_postyear=request.Form("selecty") log_postmonth=request.Form("selectm") log_postday=request.Form("selectd") log_posthour=request.Form("selecth") log_postmin=request.Form("selectmin") textnum=request.Form("savedraft") logtype=request.Form("logtype") Recommend=Request.Form("recommend") file_name=Request.Form("file_name") If Tags="标签之间用空格分开" Then Tags="" End If If Tags<>"" Then InsertTag tags,classx End If If Year(submittime)<>log_postyear Or Month(submittime)<>log_postmonth Or Day(submittime)<>log_postday Then Submittime=log_postyear&"-"&log_postmonth&"-"&log_postday&" "&log_posthour&":"&log_postmin&":"&Second(now) End If If Trim(textnum)="" Then textnum=1 End If strsql="select * from Ex_log" set rs=server.CreateObject("adodb.recordset") rs.open strsql,Conn,0,2 rs.addnew rs("title")=title rs("classid")=cint(classx) If request("saveimg")="yes" Then ExImg.imgPath="UpFile\"&Year(Now())&"\"&Month(Now())&"" ExFso.CreateRoute ExImg.imgPath content=ExImg.ReplaceUrl(content) End If rs("submittime")=submittime rs("log_postyear")=log_postyear rs("log_postmonth")=log_postmonth rs("log_postday")=log_postday if tags<>"" then rs("tags")=tags end if if ishide<>"" then rs("ishide")=ishide end if if copyright="" then rs("copyright")=false end if if istop<>"" then rs("istop")=istop end if if iscmt<>"" then rs("iscmt")=iscmt end if if logpass<>"" then rs("logpass")=logpass end if if emotion<>"" then rs("emotion")=emotion end if if quote<>"" then rs("quote")=quote end If Abstract=Replace(Abstract,"<P> </P>","") If Trim(Abstract)="" And InStr(content,"$ex_cut$")<>0 Then Abstract=ExHtml.GetHtml(Mid(content,1,InStr(content,"$ex_cut$")-1)) ElseIf Trim(Abstract)="" And InStr(content,"$ex_cut$")=0 Then Abstract=ExHtml.GetHtml(GetAbstractHtml(content)) End If Rs("abstract")=Abstract rs("content")=Replace(content,"$ex_cut$","") rs("textnum")=textnum rs("logtype")=logtype Rs("recommend")=CInt(Recommend) Rs("file_name")=file_name '自定义文件名写入数据库 modify by Hotlion at 2009-2-14 rs.update rs.close set rs=Nothing '引用开始 IF Quote<>"" Then Dim TBlogID,TBlogTmp,tbCode,tbMessage TBlogID=Conn.Execute("SELECT TOP 1 ID FROM Ex_log ORDER BY id DESC")(0) If TBlogID>0 then TBlogTmp=Split(Trackback(Quote, Application(sn&"blogurl")&"/blogview.asp?ID="&tblogid,Title, ExComm.CutStr(content,252),Application(sn&"blogname"),tags),"$$") tbCode=TBlogTmp(0) tbMessage=TBlogTmp(1) End If End If Application.lock Application(sn&"logtotal")=Application(sn&"logtotal")+1 Application.unlock '静态生成 If ishide="游客" And textnum<>0 Then Createlog Conn.execute("select max(id) from Ex_log")(0) End If DelAutoSave ExComm.ShowMsg "日志添加成功,"&tbmessage&"","Admin_log.asp?action=addform" end sub%> <%sub changeform() dim rss,sql,id id=request.querystring("id") sql="select * from Ex_log where id="&id set rss=Conn.execute(sql) %> <form action="?action=change&id=<%=id%>" method="post" name="Dvform" onSubmit="JavaScript:return Checkpostdata('change');"> <table width="98%" border="0" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border"> <tr> <th class="topbg" colspan="15">日志修改</th> </tr> <tr> <td class="tdbg" width="9%"><div align="center">日志标题:<font color="red">*</font></div></td> <td class="tdbg" colspan="14"><input name="title" type="text" id="title" value="<%=rss("title")%>"> 最多不应超过50字</td> </tr> <tr> <td class="tdbg"><div align="center">日志分类:<font color="red">*</font></div></td> <td class="tdbg" colspan="14"> <select name="classx" id="classx"> <option value="">选择分类</option> <%=ExComm.GetClassSelectCache(rss("classid"))%> </select> 自定义静态文件名: <input name="file_name" type="text" id="file_name" size="20" maxlength="38" value="<%=Rss("file_name")%>" onchange="checkfilename(this.value)">.html 留空则为默认静态名 <input type="hidden" id="filename" value=""> <input type="hidden" id="filenamed" value="<%=Rss("file_name")%>"> </label> </td> </tr> <tr> <td class="tdbg"><div align="center">日志标签:</div></td> <td class="tdbg" colspan="14"><input name="tags" type="text" id="tags" size="30" value="<%=rss("tags")%>" title="标签之间用空格分开"> <input type="button" name="btinsertTag" value="选择日志标签" style="border:solid 1px" onClick="window.open ('Admin_InsertTags.asp', 'newwindow', 'height=400, width=200, top=50,left=600, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no,status=no')"/> <input type="button" name="btinsertTag" value="插入摘要标记" style="border:solid 1px" onClick="WBTB_Composition.focus();WBTB_Composition.document.execCommand('paste','','$ex_cut$');" style="display:none"/> <input type="button" name="btinsertTag" value="隐藏摘要框" style="border:solid 1px" onClick=";if(this.value=='显示摘要框'){this.value='隐藏摘要框';abstract.style.display='';}else{this.value='显示摘要框';abstract.style.display='none';}"/> </td> </tr> <tr id="abstract"> <td class="tdbg"><div align="center">日志摘要:</div></td> <td class="tdbg" colspan="14"> <textarea id="aBody" name="aBody"> <%=server.htmlencode(rss("abstract"))%> </textarea> <!--#include file="htmedit_a.asp"--> </td> </tr> <tr> <td class="tdbg"><div align="center">日志正文:<font color="red">*</font></div></td> <td class="tdbg" colspan="14"> <span style="float:left"> <textarea name="Body" id="Body"> <%=server.htmlencode(rss("content"))%> </textarea><!--编辑器初始值的设置--> <!--#include file="htmedit.asp"--> </span> <span id="autosavetitle" style="float:right;margin-top:0px;text-align:left;">以下为自动保存的草稿<br>每一分钟自动保存一次<br>点击时间连接可以恢复<br><a href="javascript:showautosavemsg();">显示时间</a> <a href="javascript:hideautosavemsg();">隐藏时间</a><div id="autosavemsg" style="display:none"></div></span><script>checkautosave()</script> </td> </tr> <tr> <td class="tdbg" height="26"><div align="center">高级选项:</div></td> <td width="12%" class="tdbg">查看 <select name="ishide" id="select2"> <option value="游客" <%if instr(rss("ishide"),"游客")<>0 then response.Write("selected")%>>游客</option> <option value="会员" <%if instr(rss("ishide"),"会员")<>0 then response.Write("selected")%>>会员</option> <option value="隐藏" <%if instr(rss("ishide"),"隐藏")<>0 then response.Write("selected")%>>隐藏</option> </select></td> <td width="7%" class="tdbg">置顶 <input name="istop" type="checkbox" id="istop2" value="true" <%if rss("istop")=true then%>checked<%end if%>> </td> <td width="14%" class="tdbg">允许回复 <select name="iscmt" id="select3"> <option value="游客" <%if instr(rss("iscmt"),"游客")<>0 then response.Write("selected")%>>游客</option> <option value="会员" <%if instr(rss("iscmt"),"会员")<>0 then response.Write("selected")%>>会员</option> <option value="禁止" <%if instr(rss("iscmt"),"禁止")<>0 then response.Write("selected")%>>禁止</option> </select></td> <td width="10%" class="tdbg">原创声明 <input name="copyright" type="checkbox" id="copywright" value="true" <%if rss("copyright")=true then%>checked<%end if%>> </td> <td width="14%" class="tdbg">日志密码 <input name="logpass" type="text" id="logpass" size="5" value="<%=rss("logpass")%>"> </td> <td width="11%" class="tdbg">存为草稿 <label> <input name="savedraft" type="checkbox" id="savedraft" value="0" <%If Rss("textnum")=0 Then Response.write "checked"%>/> </label></td> <td width="15%" class="tdbg">推荐等级 <input name="recommend" type="text" id="recommend" size="5" value="<%=Rss("recommend")%>" onBlur="if(!isNumber(this.value)){alert('必须为数字');this.focus();}"></td> <td width="8%" class="tdbg">存图 <input name="saveimg" type="checkbox" id="saveimg" value="yes"> </td> </tr> <tr> <td class="tdbg"><div align="center">日志心情:</div></td> <td class="tdbg" colspan="14"> <%dim i if rss("emotion")=0 then%> <input name="emotion" type="radio" value="0" checked> 无 <%else%> <input name="emotion" type="radio" value="0"> 无 <%end if%> <%for i=1 to 9 if rss("emotion")=i then%> <input type="radio" name="emotion" value="<%=i%>" checked> <img src="images/emotion/em0<%=i%>.gif" width="19" height="19"> <%else%> <input type="radio" name="emotion" value="<%=i%>"> <img src="images/emotion/em0<%=i%>.gif" width="19" height="19"> <%end if next%> </td></tr> <tr style="display:none;"> <td class="tdbg"><div align="center">引用通告:</div></td> <td class="tdbg" colspan="14"><textarea name="quote" cols="70" wrap="VIRTUAL" id="quote"><%=rss("quote")%></textarea></td> </tr> <tr> <td class="tdbg"><div align="center">定时发布:</div></td> <td class="tdbg" colspan="14"> <input type="hidden" name="submittime" id="submittime" value="<%=now()%>"> <select name="selecty" id="selecty"> <% dim y y=2005 while y<=2010 if rss("log_postyear")=y then response.Write "<option value="&y&" selected>"&y&"</option>" else response.Write "<option value="&y&">"&y&"</option>" end if y=y+1 wend %> </select> 年 <select name="selectm" id="selectm" > <% dim m m=1 while m<=12 if rss("log_postmonth")=m then response.Write "<option value="&m&" selected>"&m&"</option>" else response.Write "<option value="&m&">"&m&"</option>" end if m=m+1 wend %> </select> 月 <select name="selectd" id="selectd" > <% dim d,maxday d=1 while d<=31 if rss("log_postday")=d then response.Write "<option value="&d&" selected>"&d&"</option>" else response.Write "<option value="&d&">"&d&"</option>" end if d=d+1 wend %> </select> 日 <!--增加时、分修改功能Begin,program by hotlion at 08-03-22--> <select name="selecth" id="selecth" > <% dim h,getTime,getHour getTime= split(rss("Submittime"),":") getHour= Cint(trim(right(getTime(0),2))) h=0 while h<=23 if getHour=h then response.Write "<option value="&h&" selected>"&h&"</option>" else response.Write "<option value="&h&">"&h&"</option>" end if h=h+1 wend %> </select> 时 <select name="selectmin" id="selectmin" > <% dim min min=0 while min<=59 if Cint(getTime(1))=min then response.Write "<option value="&min&" selected>"&min&"</option>" else response.Write "<option value="&min&">"&min&"</option>" end if min=min+1 wend %> </select>分<!--增加时、分修改功能End--> </td> </tr> <tr> <td class="tdbg"> </td> <td class="tdbg" colspan="14"><div align="center"> <input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="清除"> </div></td> </tr> </table> </form> </body> </html> <%set rss=nothing end sub%> <%sub change() dim title,tags,classx,content,ishide,istop,iscmt,logpass,emotion,quote,submittime,strsql,rs,Recommend,file_name '添加file_name变量用于接收用户自定义文件名值 modify by Hotlion at 2009-2-14 Dim id,log_postyear,log_postmonth,log_postday,log_posthour,log_postmin,copyright,logtype,textnum,abstract id=ExComm.G(request.querystring("id")) title=server.htmlencode(request.Form("title")) tags=Trim(server.htmlencode(request.Form("tags"))) classx=request.Form("classx") content=request.Form("body") abstract=request.Form("abody") copyright=request.Form("copyright") ishide=request.Form("ishide") istop=request.Form("istop") iscmt=request.Form("iscmt") logpass=request.Form("logpass") emotion=request.Form("emotion") quote=request.Form("quote") submittime=request.Form("submittime") log_postyear=request.Form("selecty") log_postmonth=request.Form("selectm") log_posthour=request.Form("selecth") log_postmin=request.Form("selectmin") log_postday=request.Form("selectd") Recommend=Request.Form("recommend") file_name=Request.Form("file_name") '接收修改自定义文件名值 modify by Hotlion at 2009-2-14 If InStr(content,"DrawImage") = 0 Then content = Replace(content, "<img", "<img onload=""DrawImage(this)""") End If If Year(submittime)<>log_postyear Or Month(submittime)<>log_postmonth Or Day(submittime)<>log_postday Then Submittime=log_postyear&"-"&log_postmonth&"-"&log_postday&" "&log_posthour&":"&log_postmin&":"&Second(now) End If logtype=request.Form("logtype") textnum=request.Form("savedraft") If Trim(textnum)="" Then textnum=1 End If strsql="select * from Ex_log where id="&id set rs=server.CreateObject("adodb.recordset") rs.open strsql,Conn,0,2 rs("title")=title rs("classid")=classx If request("saveimg")="yes" Then ExImg.imgPath="UpFile\"&Year(Now())&"\"&Month(Now())&"" ExFso.CreateRoute ExImg.imgPath content=ExImg.ReplaceUrl(content) End If rs("submittime")=submittime rs("log_postyear")=log_postyear rs("log_postmonth")=log_postmonth rs("log_postday")=log_postday If "" = Recommend Then Recommend =0 End If Rs("Recommend")=CInt(Recommend) if tags<>"" then rs("tags")=tags Else rs("tags")="" end if if ishide<>"" then rs("ishide")=ishide Else rs("ishide")=false end if if copyright<>"" then rs("copyright")=copyright Else rs("copyright")=false end if if istop<>"" then rs("istop")=istop Else rs("istop")=false end if if iscmt<>"" then rs("iscmt")=iscmt Else rs("iscmt")=false end if if logpass<>"" then rs("logpass")=logpass Else rs("logpass")="" end if if emotion<>"" then rs("emotion")=emotion Else rs("emotion")="" end if if quote<>"" then rs("quote")=quote Else rs("quote")="" end If Abstract=Replace(Abstract,"<P> </P>","") If Trim(Abstract)="" And InStr(content,"$ex_cut$")<>0 Then Abstract=ExHtml.GetHtml(Mid(content,1,InStr(content,"$ex_cut$")-1)) ElseIf Trim(Abstract)="" And InStr(content,"$ex_cut$")=0 Then Abstract=ExHtml.GetHtml(GetAbstractHtml(content)) End If Rs("abstract")=Abstract rs("content")=Replace(content,"$ex_cut$","") rs("textnum")=textnum rs("logtype")=logtype rs("file_name")=file_name rs.update rs.close set Rs=Nothing Createlog id ExComm.ShowMsg "日志修改成功","?action=show" end sub%> <% sub search()%> <form name="form1" method="post" action="?action=search"> <table width="98%" border="0" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border"> <tr> <td class="tdbg" colspan="6" align="center">日志管理</td> </tr> <tr> <td class="tdbg" width="10%">日志分类 <div align="center"></div></td> <td class="tdbg" width="21%"><select name="classx" id="classx"> <option value="0">选择分类</option> <%=ExComm.GetClassSelectCache(0)%> </select></td> <td class="tdbg" width="13%">标题内容</td> <td class="tdbg" width="24%"><select name="stype" size="1"> <option value="title">日志标题</option> <option value="content">日志内容</option> </select></td> <td class="tdbg" width="24%"><input name="keyword" type="text" size="20"></td> <td class="tdbg" width="8%"><input type="submit" name="Submit" value="提交"></td> </tr><tr> <td class="tdbg" colspan="6">如果查找所有日志,请在关键字处留空</td></tr> </table> </form> <% dim stype,classx,keyword,rs,strsql stype=request("stype") classx=request("classx") keyword=request("keyword") Dim ExPages,page Set ExPages=new Ex_SplitPageCls Expages.letConn=Conn Expages.letColumns="select classid,title,bits,cmt,submittime,id,log_postyear,log_postmonth,log_postday,textnum,istop " '添加查询字段textnum,isTop Modify by Hotlion at 08-04-02 ExPages.letDataFrom="from Ex_log" ExPages.letOrder=" order by istop,submitTime desc" '根据使用习惯将日志排列由按id改为按置顶及发表时间逆充排列 modify by Hotlion at 08-03-22 If stype<>"" Then If classx<>"0" Then ExPages.letWhere="where classid="&cint(classx)&" and "&stype&" like '%"&keyword&"%'" Else ExPages.letWhere="where "&stype&" like '%"&keyword&"%'" End if End if set rs=server.createobject("adodb.recordset") Expages.letPageSize="15" If ExComm.G(request("page"))="" Then page=1 Else page=ExComm.G(request("page")) End if ExPages.letPage=CInt(page) ExPages.letStrPage="&action=show&stype="&stype&"&classx="&classx&"&keyword="&keyword ExPages.Execute() %> <script language="JavaScript"> function CheckAll() { for (var i=0;i<document.manger.elements.length;i++) { var e = document.manger.elements[i]; if (e.Name != "allselect") e.checked = document.all.allselect.checked; } } function check() { var delmore=document.getElementsByName("delmore"); for (var i=0;i<delmore.length ;i++ ) { if (delmore[i].checked) { if (delmore[i].value=="delmore") { return confirm("确实要删除吗?\n与这篇日志相关的评论也将被删除"); } } } } </script> <FORM METHOD=POST ACTION="?action=delmore" name="manger" id="manger" onSubmit="return check()"> <table width="98%" border="0" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border"> <tr> <td class="tdbg" colspan="7"><div align="center">总共搜索到 <%=ExPages.getRsCount%> 条符合要求的记录</div></td> </tr> <tr> <td class="tdbg" width="6%">选中</td> <td class="tdbg" width="17%"><div align="center">分类</div></td> <td class="tdbg" width="31%"><div align="center">标题</div></td> <td class="tdbg" width="7%">点/评</td> <td class="tdbg" width="16%"><div align="center">时间</div></td> <td class="tdbg" colspan="2"><div align="center">操作</div></td> </tr> <% Set Rs=ExPages.getRs Dim markStatus '定义变量 program by Hotlion at 08-04-02 If ExPages.getRsCount<>0 Then Do While Not rs.eof '根据字段istop判断该日志是否为置顶 Program by Hotlion at 08-04-02 If rs("istop") then markStatus = "<font color=red>[置顶]</font>" Else markStatus = "" End if '根据字段textnum判断该日志是否为草稿 Program by Hotlion at 08-04-02 If rs("textnum")=0 then markStatus = markStatus&"<font color=blue>[草稿]</font>" End if %> <tr> <td class="tdbg"> <div align="left"> <input type="checkbox" name="checkbox" value="<%=rs("id")%>"> </div></td> <td class="tdbg"><%=ExComm.GetClassName(rs("classid"))%></td> <td class="tdbg"><a href="blogview.asp?id=<%=rs("id")%>" target=_blank><%=rs("title")&"</a>"&markStatus%></td> <td class="tdbg"><%=rs("bits")%>/<%=rs("cmt")%></td> <td class="tdbg"><%=rs("log_postyear")&"-"&rs("log_postmonth")&"-"&rs("log_postday")%></td> <td class="tdbg" width="11%"><div align="center"><a href="?action=changeform&id=<%=rs("id")%>">修改</a></div></td> <td class="tdbg" width="12%"><div align="center"><a href="?action=del&id=<%=rs("id")%>" onClick="return confirm('是否删除?\n与这篇日志相关的评论也将被删除.')">删除</a></div></td> </tr> <%rs.movenext loop %> <tr> <td class="tdbg"><input type="checkbox" name="allselect" value="allselect" onClick="JavaScript:CheckAll()"></td> <td class="tdbg">全选</td> <td class="tdbg"><INPUT TYPE="radio" NAME="delmore" value="delmore">删除<INPUT TYPE="radio" NAME="delmore" value="moveto">移动到<SELECT NAME="classx"> <%=ExComm.GetClassSelectCache(0)%> </SELECT> 发布<INPUT TYPE="radio" NAME="delmore" value="posthtml"> </td> <td class="tdbg"><INPUT TYPE="submit" value="操作"></td> <td class="tdbg"> </td> <td class="tdbg" colspan="2"> </td> </tr> <tr><td class="tdbg" colspan="7" align="center"> <% response.write ExPages.Show() end if %></td></tr> <tr> <td class="tdbg"> </td> <td class="tdbg"> </td> <td class="tdbg"> </td> <td class="tdbg"> </td> <td class="tdbg"> </td> <td class="tdbg" colspan="2"> </td> </tr> </table> </FORM> <%end sub%> <%sub del() dim id,strsql id=ExComm.G(request.querystring("id")) strsql="delete from Ex_log where id="&id Conn.execute(strsql) strsql="delete from Ex_comment where parentid="&id Application.lock Application(sn&"logtotal")=Application(sn&"logtotal")-1 Application.unlock Conn.execute(strsql) If Application(sn&"runmode")="静态" Then ExComm.ShowMsg "删除成功",request.servervariables("http_referer") Else ExComm.ShowMsg "删除成功",request.servervariables("http_referer") End if end Sub Sub delmore() dim action,ids,i,strsql ids=request.Form("checkbox") action=request.Form("delmore") select case action case "delmore" ids=Split(ids,",") for i=0 to ubound(ids) strsql="delete from Ex_log where id="&CInt(Trim(ids(i))) Conn.execute(strsql) strsql="delete from Ex_comment where parentid="&CInt(Trim(IDS(i))) Conn.execute(strsql) Next Application.lock Application(sn&"logtotal")=Application(sn&"logtotal")-ubound(ids)-1 Application.unlock If Application(sn&"runmode")="静态" Then ExComm.ShowMsg "删除成功",request.servervariables("http_referer") Else ExComm.ShowMsg "删除成功",request.servervariables("http_referer") End if case "moveto" Dim classid classid=request.Form("classx") ids=request.Form("checkbox") ids=Split(IDS,",") For i=0 To UBound(IDS) strSql="update Ex_log set classid="&classid&" where id="&IDS(i) Conn.execute(strSql) Next If Application(sn&"runmode")="静态" Then ExComm.ShowMsg "移动成功",request.servervariables("http_referer") Else ExComm.ShowMsg "移动成功",request.servervariables("http_referer") End if case "posthtml" createlog ids ExComm.ShowMsg "日志静态页发布成功",request.servervariables("http_referer") end select End Sub End Class %>