コード例 #1
0
 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));
 }
コード例 #2
0
     $redirecturl = $url ? $url : '';
     $showmessagecontent = $modnewreplies && $commentcable[$type] != 'article' ? 'do_success_thread_share_mod' : '';
 } elseif ($currenttype == 'article') {
     if (!checkperm('allowcommentarticle')) {
         showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
     }
     include_once libfile('function/spacecp');
     include_once libfile('function/portalcp');
     cknewuser();
     $waittime = interval_check('post');
     if ($waittime > 0) {
         showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
     }
     $aid = intval($currentid);
     $message = $_POST['general'];
     $retmessage = addportalarticlecomment($aid, $message);
     if ($retmessage != 'do_success') {
         showmessage($retmessage);
     }
 } elseif ($currenttype == 'picid' || $currenttype == 'blogid') {
     if (!checkperm('allowcomment')) {
         showmessage('no_privilege_comment', '', array(), array('return' => true));
     }
     cknewuser();
     $waittime = interval_check('post');
     if ($waittime > 0) {
         showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
     }
     $message = getstr($_POST['general'], 0, 1, 1, 2);
     if (strlen($message) < 2) {
         showmessage('content_is_too_short', '', array(), array('return' => true));
コード例 #3
0
}
$seccodecheck = $_G['group']['seccode'] ? $_G['setting']['seccodestatus'] & 4 : 0;
$secqaacheck = $_G['group']['seccode'] ? $_G['setting']['secqaa']['status'] & 2 : 0;
if (submitcheck('commentsubmit', 0, $seccodecheck, $secqaacheck)) {
    if (!checkperm('allowcommentarticle')) {
        showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
    }
    $id = 0;
    $idtype = '';
    if (!empty($_POST['aid'])) {
        $id = intval($_POST['aid']);
        $idtype = 'aid';
    } elseif (!empty($_POST['topicid'])) {
        $id = intval($_POST['topicid']);
        $idtype = 'topicid';
    }
    $message = $_POST['message'];
    require_once libfile('function/spacecp');
    cknewuser();
    $waittime = interval_check('post');
    if ($waittime > 0) {
        showmessage('operating_too_fast', '', array('waittime' => $waittime), array('return' => true));
    }
    $retmessage = addportalarticlecomment($id, $message, $idtype);
    if ($retmessage == 'do_success') {
        showmessage('do_success', $_POST['referer'] ? $_POST['referer'] : "portal.php?mod=comment&id={$id}&idtype={$idtype}");
    } else {
        showmessage($retmessage, dreferer("portal.php?mod=comment&id={$id}&idtype={$idtype}"));
    }
}
include_once template("portal/portalcp_comment");