最近有很多朋友都试用了本修改方法,并提出了很多之前我没有考虑到的一些问题,在此表示感谢。但是也不得不提醒各位,本贴的内容要求具有较高的动手修改代码和分析代码的能力,所以建议对ASP不熟悉的朋友还是尽量地使用由丹MM整合的版本。当然,今后发现的一些问题,我也会尽量利用空闲时间做出更新,但由于工作关系,有时不可能做出及时回复,还望见谅。
PS:需要其他帮助的朋友请不要加我的QQ了,因为我不经常上的。有问题可在论坛里PM我,我能解决的会在第一时间做出响应的。
修改好后的文件下载:
放在根目录下:
下载此文件放在class目录下:
下载此文件放在common目录下:
下载此文件2007-1-29
修正可多次回复的Bug
修正可回复自己评论的Bug
放出已经修改好的文件下载
2007-1-19
经过Wady提醒又修改了几处错漏。
2007-1-13
刚刚发现之前写掉了一处修改的地方,赶紧加上。
数据库修改
blog_Comment表
增加字段:comm_parentID(数字型)被回复的评论ID、comm_hasReply(布尔型)是否有回复
文件修改
/blogcomm.asp
找到以下内容,并增加红色部分:
'====================== 评论发表函数 ===========================================================
function postcomm
dim username,post_logID,post_From,post_FromURL,post_disImg,post_DisSM,post_DisURL,post_DisKEY,post_DisUBB,post_Message,validate,china,parentID,hasReply
dim password
dim ReInfo,LastMSG,FlowControl
ReInfo=Array("错误信息","","MessageIcon")
username=trim(CheckStr(request.form("username")))
password=trim(CheckStr(request.form("password")))
post_logID=CheckStr(request.form("logID"))
validate=trim(request.form("validate"))
post_Message=CheckStr(request.form("Message"))
parentID=cint(request.form("parentID"))
hasReply=cbool(request.form("hasReply"))
FlowControl=false
找到以下内容,并增加红色部分:
'插入数据
Dim AddComm
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),Array("comm_parentID",parentID),Array("comm_hasReply ",false))
DBQuest "blog_Comment",AddComm,"insert"
'Conn.ExeCute("Insert INTO blog_Comment(blog_ID,comm_Content,comm_Author,comm_DisSM,comm_DisUBB,comm_DisIMG,comm_AutoURL,comm_PostIP,comm_AutoKEY) VALUES ("&post_logID&",'"&post_Message&"','"&username&"',"&post_DisSM&","&post_DisUBB&","&post_disImg&","&post_DisURL&",'"&getIP()&"',"&post_DisKEY&")")
if hasReply then
Conn.ExeCute("update blog_Comment set comm_hasReply=true where comm_ID="&parentID)
end if
/class/cls_article.asp
在文件末尾添加下列代码:
'*******************************************
' 显示日志回复评论内容
'*******************************************
Sub ShowReplyComm(commID)
dim blog_Comment,Pcount,comm_Num,blog_CommID,blog_CommAuthor,blog_CommContent,Url_Add,commArr
Set blog_Comment=Server.CreateObject("Adodb.RecordSet")
Pcount=0
SQL="Select comm_ID,comm_Content,comm_Author,comm_PostTime,comm_DisSM,comm_DisUBB,comm_DisIMG,comm_AutoURL,comm_PostIP,comm_AutoKEY FROM blog_Comment Where comm_parentID="&commID
blog_Comment.Open SQL,Conn,1,1
SQLQueryNums=SQLQueryNums+1
IF blog_Comment.EOF AND blog_Comment.BOF Then
else
commArr=blog_Comment.GetRows(blog_Comment.RecordCount)
blog_Comment.close
set blog_Comment = nothing
blog_CommID=commArr(0,Pcount)
blog_CommAuthor=commArr(2,Pcount)
blog_CommContent=commArr(1,Pcount)
%>
<%=UBBCode(HtmlEncode(blog_CommContent),commArr(4,Pcount),blog_commUBB,blog_commIMG,commArr(7,Pcount),commArr(9,Pcount))%>
end sub%>
找到以下内容,并增加红色部分:
blog_CommID=commArr(0,Pcount)
blog_CommAuthor=commArr(2,Pcount)
blog_CommContent=commArr(1,Pcount)
comm_hasReply=cbool(commArr(10,Pcount))
找到以下内容,并增加红色部分:
dim blog_Comment,Pcount,comm_Num,blog_CommID,blog_CommAuthor,blog_CommContent,Url_Add,commArr,commArrLen,comm_hasReply
Set blog_Comment=Server.CreateObject("Adodb.RecordSet")
Pcount=0
SQL="Select comm_ID,comm_Content,comm_Author,comm_PostTime,comm_DisSM,comm_DisUBB,comm_DisIMG,comm_AutoURL,comm_PostIP,comm_AutoKEY,comm_hasReply FROM blog_Comment Where blog_ID="&LogID&" and comm_parentID=0 UNION ALL Select 0,tb_Intro,tb_Title,tb_PostTime,tb_URL,tb_Site,tb_ID,0,'127.0.0.1',0,0 FROM blog_Trackback Where blog_ID="&LogID&" orDER BY comm_PostTime "&comDesc
找到以下内容,并增加红色部分:
<%=UBBCode(HtmlEncode(blog_CommContent),commArr(4,Pcount),blog_commUBB,blog_commIMG,commArr(7,Pcount),commArr(9,Pcount))%>
<%
if comm_hasReply then
ShowReplyComm(blog_CommID)
end if
%>
找到以下内容,并增加红色部分:
/common/common.js
在文件末尾添加下列代码:
function replyComment(author,commID) {
document.getElementById("MsgHead").innerHTML="回复 "+ author + " 的评论";
if (document.getElementById("editMask") != undefined) {
showUBB('Message');
}
document.getElementById("hasReply").value="true";
document.getElementById("parentID").value=commID;
document.getElementById("Message").focus();
}
function resetReply() {
document.getElementById("MsgHead").innerHTML="发表评论";
document.getElementById("hasReply").value="false";
document.getElementById("parentID").value="0";
}