@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin($js,$userkey);
|
||||
|
||||
$authcode = strtolower((string) $_POST['authcode']);
|
||||
|
||||
if ($TS_SITE ['isauthcode'] && $authcode) {
|
||||
if ($authcode != $_SESSION ['verify']) {
|
||||
getJson ( "验证码输入有误,请重新输入!" ,$js,0);
|
||||
}
|
||||
}
|
||||
|
||||
$ptable = tsTrim($_POST['ptable']);
|
||||
if(!preg_match("/^[a-z_]*$/i", $ptable)){
|
||||
getJson('非法操作!',$js);
|
||||
}
|
||||
|
||||
$pkey = tsTrim($_POST['pkey']);
|
||||
if(!preg_match("/^[a-z_]*$/i", $pkey)){
|
||||
getJson('非法操作!',$js);
|
||||
}
|
||||
|
||||
$pid = tsIntval($_POST['pid']);
|
||||
|
||||
|
||||
$referid = tsIntval($_POST['referid']);
|
||||
$touserid = tsIntval($_POST['touserid']);
|
||||
|
||||
|
||||
$content = tsClean($_POST['content'],$js);
|
||||
$content2 = emptyText($_POST['content']);//测试空内容
|
||||
$ispublic = tsIntval($_POST['ispublic']);
|
||||
|
||||
|
||||
//匿名用户
|
||||
$isniming = tsIntval($_POST['isniming']);
|
||||
if($TS_SITE['isniming']==1 && $isniming==1) $userid = aac('user')->getNimingId();
|
||||
|
||||
|
||||
//过滤内容开始
|
||||
if($TS_USER['isadmin']==0){
|
||||
$content = antiWord($content);
|
||||
}
|
||||
//过滤内容结束
|
||||
|
||||
if($ptable=='' || $pkey=='' || $pid=='' || $content2=='' || $content==''){
|
||||
getJson('没有任何内容是不允许你通过滴^_^',$js);
|
||||
}else{
|
||||
|
||||
|
||||
$isaudit = 0;
|
||||
if($TS_APP['comment_isaudit']==1 && $TS_USER['isadmin']==0) $isaudit=1;
|
||||
|
||||
$commentid = $new['comment']->create('comment',array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
|
||||
'referid'=>$referid,
|
||||
'userid'=>$userid,
|
||||
'touserid'=>$touserid,
|
||||
|
||||
'content' => $content,
|
||||
'ispublic'=>$ispublic,
|
||||
'isaudit'=>$isaudit,
|
||||
'addtime'=> time(),
|
||||
));
|
||||
|
||||
//统计评论数
|
||||
$count_comment = $new['comment']->findCount('comment',array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
));
|
||||
|
||||
//更新项目最后回应时间和评论数
|
||||
$new['comment']->update($ptable,array(
|
||||
$pkey=>$pid,
|
||||
),array(
|
||||
'count_comment'=>$count_comment,
|
||||
'uptime'=>time(),
|
||||
));
|
||||
|
||||
#更新ptable评论数
|
||||
aac('pubs')->upPtableComment($ptable,$pkey,$pid,$count_comment);
|
||||
|
||||
//发送系统消息(通知楼主有人回复他的帖子啦)
|
||||
$strProject = $new['comment']->find($ptable,array(
|
||||
$pkey=>$pid,
|
||||
));
|
||||
|
||||
if($referid){
|
||||
|
||||
$strComment = $new['comment']->find('comment',array(
|
||||
'commentid'=>$referid,
|
||||
));
|
||||
|
||||
//创建消息
|
||||
if($strComment['userid'] != $userid){
|
||||
$msg_userid = $userid;
|
||||
$msg_touserid = $strComment['userid'];
|
||||
$msg_content = '回复了你:'.t($content);
|
||||
$msg_tourl = getProjectUrl($ptable,$pid);
|
||||
$msg_extend = json_encode(array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_tourl,$msg_extend);
|
||||
}
|
||||
|
||||
#上级评论用户加分
|
||||
aac ( 'user' )->doScore ( $TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'], $TS_URL['ts'],$strComment['userid']);
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
//创建消息
|
||||
if($strProject['userid'] != $userid){
|
||||
$msg_userid = $userid;
|
||||
$msg_touserid = $strProject['userid'];
|
||||
$msg_content = '评论了你发布的:《'.$strProject['title'].'》';
|
||||
$msg_tourl = getProjectUrl($ptable,$pid);
|
||||
$msg_extend = json_encode(array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_tourl,$msg_extend);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$daytime = strtotime(date('Y-m-d 00:00:01'));
|
||||
$count_comment = $new['comment']->findCount('comment',"`userid`='$userid' and `addtime`>'$daytime'");
|
||||
|
||||
#每日前1条给积分
|
||||
if($count_comment<2){
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'], $TS_URL['ts']);
|
||||
}
|
||||
|
||||
getJson('评论成功',$js,2,getProjectUrl($ptable,$pid));
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
// 管理入口
|
||||
if (is_file('app/' . $TS_URL['app'] . '/action/admin/' . $mg . '.php')) {
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/admin/' . $mg . '.php';
|
||||
} else {
|
||||
qiMsg('sorry:no index!');
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch ($ts){
|
||||
|
||||
case "list":
|
||||
|
||||
$userid = tsIntval($_GET['userid']);
|
||||
$ptable = isset($_GET['ptable']) ? tsTrim($_GET['ptable']) : '';
|
||||
$pid = tsIntval($_GET['pid']);
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = SITE_URL.'index.php?app=comment&ac=admin&mg=comment&ts=list&ptable='.$ptable.'&userid='.$userid.'&page=';
|
||||
$lstart = $page*10-10;
|
||||
|
||||
$where = null;
|
||||
|
||||
if($ptable){
|
||||
$where = "`ptable`='$ptable'";
|
||||
}
|
||||
|
||||
if($userid){
|
||||
$where .= " and `userid`='$userid'";
|
||||
}
|
||||
|
||||
if($pid){
|
||||
$where .= "`pid`='$pid'";
|
||||
}
|
||||
|
||||
$arrComment = $new['comment']->findAll('comment',$where,'addtime desc',null,$lstart.',10');
|
||||
|
||||
$commentNum = $new['comment']->findCount('comment',$where);
|
||||
|
||||
$pageUrl = pagination($commentNum, 10, $page, $url);
|
||||
|
||||
include template("admin/comment_list");
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "delete":
|
||||
|
||||
$commentid = tsIntval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['comment']->find('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$ptable = $strComment['ptable'];
|
||||
$pkey = $strComment['pkey'];
|
||||
$pid = $strComment['pid'];
|
||||
|
||||
$new['comment']->delete('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$new['comment']->delComment($ptable,$pkey,$pid,$commentid);
|
||||
|
||||
#处理积分
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'], $TS_URL['ts'],$strComment['userid']);
|
||||
|
||||
qiMsg('删除成功');
|
||||
|
||||
break;
|
||||
|
||||
case "isaudit":
|
||||
|
||||
$commentid = tsIntval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['comment']->find('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
if($strComment['isaudit']==1){
|
||||
$isaudit = 0;
|
||||
}else{
|
||||
$isaudit = 1;
|
||||
}
|
||||
|
||||
$new['comment']->update('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
),array(
|
||||
'isaudit'=>$isaudit,
|
||||
));
|
||||
|
||||
qiMsg('操作成功!');
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
//基本配置
|
||||
case "":
|
||||
$strOption = getAppOptions('comment');
|
||||
|
||||
include template("admin/options");
|
||||
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
$arrOption = $_POST['option'];
|
||||
|
||||
#更新app配置选项
|
||||
upAppOptions('comment',$arrOption);
|
||||
|
||||
#更新app导航和我的导航
|
||||
upAppNav('comment',$arrOption['appname']);
|
||||
|
||||
qiMsg('修改成功!');
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// api入口
|
||||
if (is_file ( 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php' )) {
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php';
|
||||
} else {
|
||||
qiMsg ( 'sorry:no api!' );
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin($js,$userkey);
|
||||
|
||||
$commentid = tsIntval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['comment']->find('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$ptable = $strComment['ptable'];
|
||||
$pkey = $strComment['pkey'];
|
||||
$pid = $strComment['pid'];
|
||||
|
||||
if($TS_USER['isadmin']==1 || $strComment['userid']==$userid){
|
||||
|
||||
$new['comment']->delComment($ptable,$pkey,$pid,$commentid);
|
||||
|
||||
//处理积分
|
||||
aac('user')->doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'], $TS_URL['ts'],$strComment['userid']);
|
||||
|
||||
}
|
||||
|
||||
//跳转回到详情页
|
||||
header("Location: ".getProjectUrl($ptable,$pid));
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// 我的入口
|
||||
if (is_file ( 'app/' . $TS_URL['app'] . '/action/my/' . $TS_URL['my'] . '.php' )) {
|
||||
$userid = aac('user')->isLogin();
|
||||
$strUser = aac('user')->getOneUser($userid);
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/my/' . $TS_URL['my'] . '.php';
|
||||
} else {
|
||||
qiMsg ( 'sorry:no index!' );
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = tsUrl ( 'comment', 'my', array ('my'=>'index','page' => '' ) );
|
||||
$lstart = $page * 20 - 20;
|
||||
|
||||
$arrComment = $new ['comment']->findAll ( 'comment', array (
|
||||
'userid' => $strUser['userid'],
|
||||
), 'addtime desc', null, $lstart . ',20' );
|
||||
|
||||
$commentNum = $new ['comment']->findCount ( 'comment', array (
|
||||
'userid' => $strUser['userid'],
|
||||
) );
|
||||
|
||||
$pageUrl = pagination ( $commentNum, 20, $page, $url );
|
||||
|
||||
|
||||
|
||||
$title = '我的评论';
|
||||
include template('my/index');
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$referid = tsIntval($_GET['referid']);
|
||||
$userid = tsIntval($_GET['userid']);
|
||||
|
||||
$arrRecomment = $new['comment']->recomment($referid,$userid);
|
||||
|
||||
include template('recomment');
|
||||
Reference in New Issue
Block a user