private function _commentReply($res, $data) { global $_G; require DISCUZ_ROOT . './source/function/function_home.php'; require_once libfile('function/portalcp'); // 在DISCUZ_ROOT/source/include/portalcp/portalcp_comment.php基础上二次开发 if (!checkperm('allowcommentarticle')) { return $this->makeErrorInfo($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle']), array('login' => 1)); } switch ($data['idType']) { case 'aid': $_POST['aid'] = $data['id']; break; case 'tid': $_POST['topicid'] = $data['id']; break; default: return $this->makeErrorInfo($res, 'mobcent_error_params'); } $id = 0; $idtype = ''; if (!empty($_POST['aid'])) { $id = intval($_POST['aid']); $idtype = 'aid'; } elseif (!empty($_POST['topicid'])) { $id = intval($_POST['topicid']); $idtype = 'topicid'; } // 获取评论内容 $_POST['message'] = $commentText = ''; foreach ($data['content'] as $line) { $line['type'] = $this->_transCommentType($line['type']); // 引用评论 if (isset($data['quoteCommentId']) && $data['quoteCommentId'] > 0) { $quoteComment = DzPortalComment::getCommentById($data['quoteCommentId']); if (!empty($quoteComment)) { $commentText .= $this->_getCommentMessage($quoteComment); } } if ($line['type'] == 'text') { $line['infor'] = rawurldecode($line['infor']); $commentText .= WebUtils::t($line['infor']); } } $_POST['message'] = $commentText; $message = $_POST['message']; require_once libfile('function/spacecp'); if (($checkMessage = mobcent_cknewuser()) != '') { return $this->makeErrorInfo($res, WebUtils::emptyHtml($checkMessage)); } $waittime = interval_check('post'); if ($waittime > 0) { return $this->makeErrorInfo($res, 'operating_too_fast', array('{waittime}' => $waittime), array('return' => true)); } $retmessage = addportalarticlecomment($id, $message, $idtype); return $this->makeErrorInfo($res, $retmessage, array('noError' => $retmessage == 'do_success' ? 1 : 0)); }
protected function getCommentList($data) { $res = array('list' => array(), 'count' => 0); $list = array(); $comments = DzPortalComment::getComments($data['id'], $data['idType'], $data['page'], $data['pageSize']); foreach ($comments as $comment) { $tmpComment = array(); $tmpComment['managePanel'] = array(array('type' => 'quote', 'action' => '', 'title' => WebUtils::t('引用'))); $tmpComment['id'] = (int) $comment['cid']; $tmpComment['uid'] = (int) $comment['uid']; $tmpComment['username'] = $comment['username']; $tmpComment['avatar'] = UserUtils::getUserAvatar($comment['uid']); $tmpComment['time'] = date('Y-m-d H:i', $comment['dateline']); $tmpComment['content'] = $this->transCommentMessage($comment['message']); $list[] = $tmpComment; } $res['list'] = $list; $res['count'] = DzPortalComment::getCount($data['id'], $data['idType']); return $res; }