@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin($js,$userkey);
|
||||
switch($ts){
|
||||
|
||||
case "do":
|
||||
|
||||
$authcode = strtolower($_POST['authcode']);
|
||||
|
||||
if ($TS_SITE ['isauthcode']) {
|
||||
if ($authcode != $_SESSION ['verify']) {
|
||||
getJson ( "验证码输入有误,请重新输入!" ,$js,0);
|
||||
}
|
||||
}
|
||||
|
||||
$shopid = intval($_POST['shopid']);
|
||||
$content = tsClean($_POST['content'],$js);
|
||||
$content2 = emptyText($_POST['content']);//测试空内容
|
||||
$ispublic = intval($_POST['ispublic']);
|
||||
|
||||
//过滤内容开始
|
||||
if($TS_USER['isadmin']==0){
|
||||
aac('system')->antiWord($content,$js);
|
||||
}
|
||||
//过滤内容结束
|
||||
|
||||
if($content2==''){
|
||||
getJson('没有任何内容是不允许你通过滴^_^',$js);
|
||||
}else{
|
||||
$commentid = $new['shop']->create('shop_comment',array(
|
||||
'shopid' => $shopid,
|
||||
'userid' => $userid,
|
||||
'content' => $content,
|
||||
'addtime'=> time(),
|
||||
));
|
||||
|
||||
|
||||
|
||||
//发送系统消息(通知楼主有人回复他的帖子啦)
|
||||
$strshop = $new['shop']->find('shop',array(
|
||||
'shopid'=>$shopid,
|
||||
));
|
||||
|
||||
if($strshop['userid'] != $TS_USER['userid']){
|
||||
|
||||
$msg_userid = '0';
|
||||
$msg_touserid = $strshop['userid'];
|
||||
$msg_content = '你的商品:《'.$strshop['shopname'].'》新增一条评论,快去看看给个回复吧^_^ ';
|
||||
$msg_tourl = tsUrl('shop','show',array('id'=>$shopid));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_tourl);
|
||||
|
||||
}
|
||||
|
||||
header("Location: ".tsUrl('shop','show',array('id'=>$shopid)));
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//删除评论
|
||||
case "delete":
|
||||
|
||||
$commentid = intval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['shop']->find('shop_comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$strshop = $new['shop']->find('shop',array(
|
||||
'shopid'=>$strComment['shopid'],
|
||||
));
|
||||
|
||||
|
||||
|
||||
if($strshop['userid']==$userid || $TS_USER['isadmin']==1 || $strComment['userid']==$userid){
|
||||
|
||||
$new['shop']->delete('shop_comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//跳转回到帖子页
|
||||
header("Location: ".tsUrl('shop','show',array('id'=>$strComment['shopid'])));
|
||||
|
||||
break;
|
||||
}
|
||||
Reference in New Issue
Block a user