评论回复(免修改数据库) For PJblog3

作者:戒聊
首发:www.leoyung.com
For PJblog3版直接增加了博主可见可能,静态下20%无效,为什么20%,有兴趣的研究下。

如果您的PJblog原来装过评论回复For PJblog2.6的,在修改完后请先登录,然后执行压缩包update中的update.asp进行数据移植,否则请跳一跳执行update1中的update1.asp。

另外别忘了在后台增加过滤关键词[Reply_JieLiao],否则要是有人猜到了这个玩意儿,恐怕会打不开。

后台的评论回复方法:直接在当前评论的后面加
[Reply_JieLiao]回复内容[Reply_JieLiao]管理员名称[Reply_JieLiao]回复时间
   即可。

PS:由于修改或升级过程中可能会遇到一些未预料到的错误,请做好备份,另外强烈建议用DREAMWEAVER或EDITPLUS来编辑代码,因为记事本经常会造成断行或者乱码。

1.打开Class下的cls_article.asp
             ShowComm = ShowComm&"<a href=""member.asp?action=view&memName="&Server.URLEncode(blog_CommAuthor)&"""><strong>"&blog_CommAuthor&"</strong></a>"
        '底部的翻页
       ShowComm = ShowComm&"<div class=""pageContent"">"&MultiPage(comm_Num,blogcommpage,CurPage,Url_Add,aName,"float:right" ,BaseUrl,aEvent)&"</div>"
之间的代码,全部替换为:
            'EDIT BY JieLiao
            'ShowComm = ShowComm&"<span class=""commentinfo"">["&DateToStr(commArr(3,Pcount),"Y-m-d H:I A")&"<span class=""ownerClassComment""> | <a href=""blogcomm.asp?action=del&commID="&blog_CommID&""" onclick=""return delCommentConfirm()""><img src=""images/del1.gif"" alt=""del"" border=""0""/></a></span>]</span>"

            
            ShowComm = ShowComm&"<span class=""commentinfo"">["&DateToStr(commArr(3,Pcount),"Y-m-d H:I A")&"</span>"
        If stat_Admin then
            Dim urlLink
            if blog_postFile = 2 then
                urlLink = "article/"&LogID&".htm"
            else
                urlLink = "?id="&LogID
            end if
            ShowComm = ShowComm&"<span class=""ownerClassComment"">| <a href="""&urlLink&"#MsgReplyContent"" onclick=""document.frm1.commID.value="&blog_CommID&";document.frm1.commID.value="&blog_CommID&";MsgReplyContent.style.display='';""><img src=""Plugins/guestbook/reply.gif"" alt=""回复"" border=""0"" style=""margin-bottom:-3px""/></a> | <a href=""blogcomm.asp?action=del&commID="&blog_CommID&""" onclick=""return delCommentConfirm()""><img src=""images/del1.gif"" alt=""del"" border=""0""/></a>]</span>"
        End If
            'EDIT BY JieLiao
        
            '评论内容
            'EDIT BY JieLiao
            ShowComm = ShowComm&"</div><div class=""commentcontent"" id=""commcontent_"&blog_CommID&""">"
            Dim Comm_content
            Comm_content = Split(blog_CommContent,"[Reply_JieLiao]")   '用[Reply_JieLiao]作分隔符,取消原来的增加字段.
            If stat_Admin or commArr(2,Pcount) = memName Then
                ShowComm = ShowComm&UBBCode(HtmlEncode(Comm_content(0)),commArr(4,Pcount),blog_commUBB,blog_commIMG,commArr(7,Pcount),commArr(9,Pcount))
            ElseIf Comm_content(1) = 1 Then
                ShowComm = ShowComm&"此评论管理员可见"
            Else
                ShowComm = ShowComm&UBBCode(HtmlEncode(Comm_content(0)),commArr(4,Pcount),blog_commUBB,blog_commIMG,commArr(7,Pcount),commArr(9,Pcount))
            End If
            ShowComm = ShowComm&"</div>"
            If UBound(Comm_content)>1 Then '显示回复,可根据自己需要调整显示方式.
                ShowComm=ShowComm&"<fieldset><legend><img src=""images/reply.gif"" border=""0"" style=""margin:0px 3px -3px 0px""/><a href=""member.asp?action=view&memName="&Comm_content(3)&"""><b>"&Comm_content(3)&"</b></a> <span class=""commentinfo"">["&DateToStr(Comm_content(4),"Y-m-d H:I:S")&"]</span></legend><div class=""commentcontent"">"&UBBCode(HtmlEncode(Comm_content(2)),commArr(4,Pcount),blog_commUBB,blog_commIMG,commArr(7,Pcount),commArr(9,Pcount))&"</div></fieldset>"
            End If
            Pcount = Pcount + 1
            ShowComm=ShowComm&"</div>"
            'EDIT BY JieLiao
        Loop



找到:
        Call showCommentPost(logID,DisComment)


在下面插入以下代码:
'================================
' 输出评论回复框  EDIT BY JieLiao
'================================
%>
<div id="MsgReplyContent" name="MsgReplyContent" style="width:94%; display:none;"><div id="MsgHead">发表回复</div><div id="MsgBody">
<%
        If Not stat_Admin Then
            response.Write ("你没有权限发表回复!")
            response.Write ("</div></div>")
        Else
        %>
              <form name="frm1" id="frm1" action="blogcomm.asp" method="post" onsubmit="return checkCommentPost()" style="margin:0px;">      
                      <input name="commID" id="commID" type="hidden"/>
              <table width="100%" cellpadding="0" cellspacing="0">      
              <tr><td align="right" width="70" valign="top"><strong>内 容:</strong><br/>
              </td><td style="padding:2px;"><label>
              <textarea name="Comm_replycontent" id="Comm_replycontent" cols="45" rows="5">
<%
            Comm_content = Split(blog_CommContent,"[Reply_JieLiao]")   '用[Reply_JieLiao]作分隔符,取消原来的增加字段.
If UBound(Comm_content)>1 Then '显示回复,可根据自己需要调整显示方式.
    response.write Comm_content(2)
end if
%>
</textarea>
              </label></td>
              </tr>
                  <tr>
                    <td colspan="2" align="center" style="padding:3px;">
                      <input name="logID" type="hidden" value="<%=LogID%>"/>
                      <input name="action" type="hidden" value="postReply"/>
                      <input name="submit2" type="submit" class="userbutton" value="发表回复" accesskey="S"/>
                      <input name="button" type="reset" class="userbutton" value="重写"/></td>
                  </tr>
              </table>
              </form>
              </div></div>
    <%
        End If
'EDIT BY JieLiao


找到:
                     <label for="label7"><input name="log_DisKey" type="checkbox" id="label7" value="1" />禁止自动转换关键字</label>

在下面插入下面代码:
                     <label for="label8"><input name="Comm_IsLegal" type="checkbox" id="label8" value="1" />
                     是否管理员可见</label>



打开Blogcomm.asp,找到:
Dim password

替换为:
Dim password,Comm_IsLegal

找到:
<%
Else
    response.Write ("非法操作!!")
End If


在其上面插入以下代码:
<%
ElseIf Request.Form("action") = "postReply" Then
    Dim PostReplyBComm
    PostReplyBComm = postReplycomm
%>
   <div style="text-align:center;">
    <div id="MsgContent" style="width:300px">
      <div id="MsgHead"><%=PostReplyBComm(0)%></div>
      <div id="MsgBody">
         <div class="<%=PostReplyBComm(2)%>"></div>
         <div class="MessageText"><%=PostReplyBComm(1)%></div>
      </div>
    </div>
  </div>


在本文档的最后一个之前插入以下代码:
'====================== 评论回复发表函数 ===========================================================

Function postReplycomm
    Dim post_logID, post_Message, post_commID
    Dim ReInfo
    ReInfo = Array("错误信息", "", "MessageIcon")
    post_logID = CLng(CheckStr(request.Form("logID")))
    post_commID = CLng(CheckStr(request.Form("commID")))
    post_Message = CheckStr(request.Form("Comm_replycontent"))

    If Not stat_Admin Then
        ReInfo(0) = "评论回复错误信息"
        ReInfo(1) = "<b>你没有权限回复评论</b><br/><a href=""javascript:history.go(-1);"">单击返回</a>"
        ReInfo(2) = "ErrorIcon"
        postReplycomm = ReInfo
        Exit Function
    End If

    If Len(post_Message)<1 Then
        ReInfo(0) = "评论回复错误信息"
        ReInfo(1) = "<b>不允许回复空评论</b><br/><a href=""javascript:history.go(-1);"">单击返回</a>"
        ReInfo(2) = "ErrorIcon"
        postReplycomm = ReInfo
        Exit Function
    End If
    '修改数据
    Dim Comm_content1,Comm_Reply
    Set Comm_Reply = Conn.Execute("select comm_Content from blog_Comment where comm_ID="&post_commID&"")
    If Not Comm_Reply.EOF Then
        Comm_content1 = Split(Comm_Reply("comm_Content"),"[Reply_JieLiao]")   '用[Reply_JieLiao]作分隔符,取消原来的增加字段.
    Else
        ReInfo(0) = "评论回复错误信息"
        ReInfo(1) = "<b>该评论不存在或者已经被删除!</b><br/><a href=""javascript:history.go(-1);"">单击返回</a>"
        ReInfo(2) = "ErrorIcon"
        postReplycomm = ReInfo
        Exit Function
    End If
        conn.Execute("update blog_Comment set comm_Content='"&Comm_content1(0)&"'&'[Reply_JieLiao]'&'"&Comm_content1(1)&"'&'[Reply_JieLiao]'&'"&post_Message&"'&'[Reply_JieLiao]'&'"&memName&"'&'[Reply_JieLiao]'&'"&now()&"' where comm_ID="&post_commID&"")

    getInfo(2)
    ReInfo(0) = "评论回复成功"
    ReInfo(1) = "<b>你成功地回复了该评论</b><br/><a href=""default.asp?id="&post_logID&"#"&post_commID&""">单击返回该日志</a>"
    ReInfo(2) = "MessageIcon"
    Session("GetCode") = Empty
    Session(CookieName&"_LastDo") = "AddComment"
    postReplycomm = ReInfo
    PostArticle post_logID, False
    call newEtag
End Function


找到:
    post_DisKEY = request.Form("log_DisKey")

在下面插入一行:
    Comm_IsLegal = request.Form("Comm_IsLegal")


找到:
    If post_DisKEY = 1 Then post_DisKEY = 0 Else post_DisKEY = 1
在下面插入:
    '是否管理员可见
    If Comm_IsLegal = 1 Then Comm_IsLegal = 1 Else Comm_IsLegal = 0


找到:
    AddComm = Array(Array("blog_ID", post_logID), Array("comm_Content", post_Message), Array("comm_Author", username), Array("comm_DisSM", post_DisSM), Array("comm_DisUBB", post_DisUBB), Array("comm_DisIMG", post_disImg), Array("comm_AutoURL", post_DisURL), Array("comm_PostIP", getIP), Array("comm_AutoKEY", post_DisKEY))


修改为:
    AddComm = Array(Array("blog_ID", post_logID), Array("comm_Content", post_Message&"[Reply_JieLiao]"&Comm_IsLegal), Array("comm_Author", username), Array("comm_DisSM", post_DisSM), Array("comm_DisUBB", post_DisUBB), Array("comm_DisIMG", post_disImg), Array("comm_AutoURL", post_DisURL), Array("comm_PostIP", getIP), Array("comm_AutoKEY", post_DisKEY))


打开Template下的static.htm
找到:
                      <input name="log_DisKey" type="checkbox" id="label7" value="1" />
                      禁止自动转换关键字</label>

在下面插入:
                    <label for="label8"><input name="Comm_IsLegal" type="checkbox" id="label8" value="1" />是否管理员可见</label>


打开common下的chche.asp,找到:
    If action<>2 Then
        Dim Comment_Item_Len
        If UBound(blog_Comment, 1) = 0 Then
            NewComment = ""
            Exit Function
        End If
        Comment_Item_Len = UBound(blog_Comment, 2)
        dim url
        For i = 0 To Comment_Item_Len
            If blog_postFile = 2 Then
                   url = SiteURL&"article/"&blog_Comment(1, i)&".htm#comm_"&blog_Comment(0, i)
              else
                   url = SiteURL&"article.asp?id="&blog_Comment(1, i)&"#comm_"&blog_Comment(0, i)
            end if
            NewComment = NewComment&"<a class=""sideA"" href="""&url&""" title="""&blog_Comment(2, i)&" 于 "&blog_Comment(4, i)&" 发表评论"&Chr(10)&CCEncode(CutStr(DelQuote(blog_Comment(3, i)), 100))&""">"&CCEncode(CutStr(DelQuote(blog_Comment(3, i)), 25))&"</a>"
      
        Next

        For i = 0 To Comment_Item_Len
        Next
,在For之前插入一句
Dim Comm_content
把这中间一段的代码全部换成(不包括这两句):
            Comm_content = Split(blog_Comment(3, i),"[Reply_JieLiao]")   '用[Reply_JieLiao]作分隔符,取消原来的增加字段.
            
            If blog_postFile = 2 Then
                   url = SiteURL&"article/"&blog_Comment(1, i)&".htm#comm_"&blog_Comment(0, i)
              else
                   url = SiteURL&"article.asp?id="&blog_Comment(1, i)&"#comm_"&blog_Comment(0, i)
            end if
            If Comm_content(1)=1 then
                NewComment = NewComment&"<a class=""sideA"" href="""&url&""" title="""&blog_Comment(2, i)&" 于 "&blog_Comment(4, i)&" 发表评论"&Chr(10)&CCEncode(CutStr(DelQuote(Comm_content(0)), 100))&""">博主可见</a>"
            Else
                NewComment = NewComment&"<a class=""sideA"" href="""&url&""" title="""&blog_Comment(2, i)&" 于 "&blog_Comment(4, i)&" 发表评论"&Chr(10)&CCEncode(CutStr(DelQuote(Comm_content(0)), 100))&""">"&CCEncode(CutStr(DelQuote(Comm_content(0)), 25))&"</a>"
            End If

下载文件 update
下载文件 update1


[本日志由 小戒 于 2008-08-28 02:42 AM 编辑]
上一篇: eval(function(p,a,c,k,e,d)系列加密解密javascript程序
下一篇: 让你的侧边栏区分动静态 For PJblog3
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: 评论 回复 PJBLOG
相关日志:
评论: 8 | 引用: 0 | 查看次数: -
hyphon
回复回复hyphon[2009-03-02 04:31 PM | | | del]
引用来自 jessicamiao 引用来自 jessicamiao
额?还是需要转成全静态的啊?

挺不错的~
mildnes
回复回复mildnes[2008-10-30 05:07 PM | | | del]
修改了后,就是cls_article出错
第一处是
Microsoft VBScript 编译器错误 错误 '800a040e' <br/><br/>'loop' 语句缺少 'do' <br/><br/>/class/cls_article.asp,行 325 <br/><br/>Loop第二处是

引用内容 引用内容
Microsoft VBScript 编译器错误 错误 '800a0411'

名称重定义

/class/cls_article.asp,行 333

Dim urlLink




回复来自 小戒 的评论 小戒 于 2008-10-30 08:09 PM 回复
应该是修改错误。不过157版本已经自带了此功能了。如果还没升级的话建议升级。
jessicamiao
回复回复jessicamiao[2008-08-19 08:26 PM | | | del]
额?还是需要转成全静态的啊?
半岛饭盒
回复回复半岛饭盒[2008-08-13 01:33 PM | | | del]
哎。。为什么我改过了还是出错的呢。。。麻烦博主能把改过的文件发一份吗。。不知道是不是自己改错了。。
回复来自 小戒 的评论 小戒 于 2008-08-13 14:51:53 回复
请问提示什么错误?正常情况下是没有问题的。
残阳博客
回复回复残阳博客[2008-08-11 06:10 PM | | | del]
广告挡住了很多文字  看不明白那写的什么   无法更改
回复来自 小戒 的评论 小戒 于 2008-08-11 18:26:54 回复
广告没有遮住文字。放心修改吧。
ilank
回复回复ilank[2008-08-10 11:19 AM | | | del]
很强,也很复杂,支持一下
feiyang
回复回复feiyang[2008-08-04 04:36 AM | | | del]
恩,隐隐约约发先这个问题~


还有个问题是为什么我的游客评论不了呢?

会员正常,留言板也正常。

我可能改错了哪里,但找了很久找不到啊,

请指点一下

ilmusic.cn
回复来自 小戒 的评论 小戒 于 04/08/2008 11:53:17 回复
测试了,正常.
十年博客
回复回复十年博客[2008-07-28 09:03 AM | | | del]
不错
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 支持Gravatar头像.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.