<% ''' SDCMS 评论 ''' ================================================================== ''' 版权所有 http://www.sdcms.cn ''' ------------------------------------------------------------------ ''' 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用; ''' 未经授权不允许对程序代码以任何形式任何目的的再发布。 ''' ================================================================== ''' 编写: IT平民 ''' 修改:IT平民 in 2012.12 sub userstaus() dim gourl:gourl=sdcms.enhtml(sdcms.fpost("gourl",0)) dim str:str="" dim avatar:avatar=0 dim staus str=str&"
" str=str&"
" str=str&"
" str=str&"
" str=str&" {staus}" str=str&"
" str=str&"
" str=str&"
" dim nickname:nickname=sdcms.get_cityname("")&"网友" staus="
"&nickname&"
" str=replace(str,"{avatar}",0) str=replace(str,"{staus}",staus) sdcms.echo str end sub sub adddb() dim t0,t1,id t0=sdcms.enhtml(sdcms.fpost("t0",0)) t1=sdcms.enhtml(sdcms.fpost("t1",0)) id=sdcms.getint(sdcms.fget("id",0),0) if not(syscomment) then sdcms.ajaxjson "系统未开启评论",0 exit sub end if dim f,passnum if commentconfig(1) then f=1 passnum=0 else f=2 passnum=1 end if if not(sdcms.checkpost) then sdcms.ajaxjson "禁止外部提交数据",0 exit sub end if if id=0 then sdcms.ajaxjson "参数错误",0 exit sub end if if sdcms.strlen(t0)=0 then sdcms.ajaxjson "内容不能为空",0 exit sub end if if sdcms.strlen(t0)<5 then sdcms.ajaxjson "至少输入5个字符",0 exit sub end if if sdcms.strlen(t1)=0 then sdcms.ajaxjson "昵称不能为空",0 exit sub end if if sdcms.loadcookie("comment_add_"&id)<>"" then if int(datediff("s",sdcms.loadcookie("comment_add_"&id),now()))<=60 then sdcms.ajaxjson "请勿重复提交",0 exit sub end if end if dim data,comments,tname data=sdcms.db.dbload(1,"comments,iscomment,title","sd_content","id="&id&"","") if ubound(data)<0 then sdcms.ajaxjson "参数错误",0 exit sub else comments=data(0,0) tname=data(2,0) if data(1,0)=0 then sdcms.ajaxjson "本文禁止评论",0 exit sub end if end if data=array(array("contentid",id,0,1),array("username",t1,20,1),array("content",t0,255,1),array("createdate",sqltime,0,0),array("islock",passnum,0,0),array("followid",0,0,0),array("postip",sdcms.getip,0,1)) sdcms.db.insert "sd_expand_comment",data sdcms.setcookie "comment_add_"&id,now() sdcms.setcookie "content_"&id,"" sdcms.db.dbupdate "sd_content","id="&id&"",array(array("comments",comments+1,0,0)) dim body:body="" dim title:title="您有一条新评论(来自网站)" body=body&"昵 称:"&t1 body=body&"
日 期:"&now() body=body&"
标 题:"&tname body=body&"
内 容:"&t0 sdcms.sendmail sdcms.getsys("adminemail"),title,body if commentconfig(1) then sdcms.ajaxjson f&"提交成功,审核后显示!",1 else sdcms.ajaxjson f&"提交成功!",1 end if end sub sub loadtop() dim id:id=sdcms.getint(sdcms.fget("id",0),0) if id=0 then exit sub end if if not(syscomment) then sdcms.echo "系统未开启评论" exit sub end if dim data:data=sdcms.db.dbload(10,"commentid,username,createdate,content,reply","sd_expand_comment","contentid="&id&" and islock=1","commentid desc") if ubound(data)<0 then sdcms.echo "

沙发很寂寞

" exit sub else dim i,str,temp,show temp="" temp=temp&"
" temp=temp&"
" temp=temp&"
{username}{createdate}
" temp=temp&"
{content}
" temp=temp&" {reply}" temp=temp&"
" temp=temp&"
" for i=0 to ubound(data,2) show=temp show=replace(show,"{username}",data(1,i)) show=replace(show,"{createdate}",sdcms.get_date(data(2,i))) show=replace(show,"{content}",data(3,i)) if sdcms.strlen(data(4,i))>0 then show=replace(show,"{reply}","
回复:"&data(4,i)&"
") else show=replace(show,"{reply}","") end if str=str&show next str=str&"
查看更多评论
" sdcms.echo str end if end sub dim act:act=sdcms.fget("act",0) select case act case "islogin":userstaus case "add":adddb case "load":loadtop case else if not(syscomment) then dim errormsg:errormsg="系统未开启评论" sdcms.show theme_404,"" sdcms.die end if dim infoid:infoid=sdcms.getint(sdcms.fget("id",0),0) dim data,comments data=sdcms.db.dbload(1,"comments,iscomment,title,isurl,url,catedir,intro,classid,islock","sd_content left join sd_category on sd_content.classid=sd_category.cateid","id="&infoid&"","") if ubound(data)<0 then errormsg="参数错误" sdcms.show theme_404,"" sdcms.die else if data(8,0)<>1 then errormsg="您查看的内容不存在" sdcms.show theme_404,"" sdcms.die end if if data(1,0)=0 then errormsg="本文禁止评论" sdcms.show theme_404,"" sdcms.die end if dim infotitle,infourl,infointro,infopoint,classid infotitle=data(2,0) infourl=sdcms.geturl(infoid,data(7,0),data(3,0),data(4,0)) infointro=data(6,0) classid=data(7,0) data=sdcms.getclassdb(classid) dim parentid:parentid=data(6) end if dim sqlwhere:sqlwhere="and contentid="&infoid&"" sdcms.show theme_comment,"" end select sdcms.db.dbclose %>