if (!$post || $post['tid'] != $thread['tid'] || !$post['authorid']) { showmessage('rate_post_error'); } require_once libfile('function/misc'); if (!submitcheck('ratesubmit')) { $referer = $_G['siteurl'] . 'forum.php?mod=viewthread&tid=' . $_G['tid'] . '&page=' . $page . ($_GET['from'] ? '&from=' . $_GET['from'] : '') . '#pid' . $_GET['pid']; $ratelogs = array(); foreach (C::t('forum_ratelog')->fetch_all_by_pid($_GET['pid'], 'ASC') as $ratelog) { $ratelog['dbdateline'] = $ratelog['dateline']; $ratelog['dateline'] = dgmdate($ratelog['dateline'], 'u'); $ratelog['scoreview'] = $ratelog['score'] > 0 ? '+' . $ratelog['score'] : $ratelog['score']; $ratelogs[] = $ratelog; } include template('forum/rate'); } else { $reason = checkreasonpm(); if (!empty($_GET['logidarray'])) { if ($sendreasonpm) { $ratescore = $slash = ''; } $rate = $ratetimes = 0; $logs = array(); foreach (C::t('forum_ratelog')->fetch_all_by_pid($_GET['pid']) as $ratelog) { if (in_array($ratelog['uid'] . ' ' . $ratelog['extcredits'] . ' ' . $ratelog['dateline'], $_GET['logidarray'])) { $rate += $ratelog['score'] = -$ratelog['score']; $ratetimes += ceil(max(abs($rating['min']), abs($rating['max'])) / 5); updatemembercount($post['authorid'], array($ratelog['extcredits'] => $ratelog['score'])); C::t('common_credit_log')->delete_by_uid_operation_relatedid($post['authorid'], 'PRC', $_GET['pid']); C::t('forum_ratelog')->delete_by_pid_uid_extcredits_dateline($_GET['pid'], $ratelog['uid'], $ratelog['extcredits'], $ratelog['dateline']); $logs[] = dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['adminid']}\t{$ratelog['username']}\t{$ratelog['extcredits']}\t{$ratelog['score']}\t{$_G['tid']}\t{$thread['subject']}\t{$reason}\tD"); if ($sendreasonpm) {
private function _topicAdmin_band($fid, $tid, $pid, $act, $type, $params = array()) { extract($params); global $_G; // 在DISCUZ_ROOT/source/include/topicadmin/topicadmin_banpost.php基础上进行二次开发 if (!$_G['group']['allowbanpost']) { $this->_exitWithHtmlAlert('no_privilege_banpost'); } $topiclist = $_GET['topiclist']; $modpostsnum = count($topiclist); if (!($banpids = dimplode($topiclist))) { $this->_exitWithHtmlAlert('admin_banpost_invalid'); } elseif (!$_G['group']['allowbanpost'] || !$_G['tid']) { $this->_exitWithHtmlAlert('admin_nopermission'); } $posts = $authors = array(); $banstatus = 0; foreach (C::t('forum_post')->fetch_all('tid:' . $_G['tid'], $topiclist) as $post) { if ($post['tid'] != $_G['tid']) { continue; } $banstatus = $post['status'] & 1 || $banstatus; $authors[$post['authorid']] = 1; $posts[] = $post; } $authorcount = count(array_keys($authors)); if (!empty($_POST)) { $banned = intval($_GET['banned']); $modaction = $banned ? 'BNP' : 'UBN'; $reason = checkreasonpm(); include_once libfile('function/member'); $pids = $comma = ''; foreach ($posts as $k => $post) { if ($banned) { C::t('forum_postcomment')->delete_by_rpid($post['pid']); C::t('forum_post')->increase_status_by_pid('tid:' . $_G['tid'], $post['pid'], 1, '|', true); crime('recordaction', $post['authorid'], 'crime_banpost', lang('forum/misc', 'crime_postreason', array('reason' => $reason, 'tid' => $_G['tid'], 'pid' => $post['pid']))); } else { C::t('forum_post')->increase_status_by_pid('tid:' . $_G['tid'], $post['pid'], 1, '^', true); } $pids .= $comma . $post['pid']; $comma = ','; } $resultarray = array('redirect' => "forum.php?mod=viewthread&tid={$_G['tid']}&page={$page}", 'reasonpm' => $sendreasonpm ? array('data' => $posts, 'var' => 'post', 'item' => 'reason_ban_post', 'notictype' => 'post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason), 'modtids' => 0, 'modlog' => $thread); return $resultarray; } $banid = $checkunban = $checkban = ''; foreach ($topiclist as $id) { $banid .= '<input type="hidden" name="topiclist[]" value="' . $id . '" />'; } $banstatus ? $checkunban = 'checked="checked"' : ($checkban = 'checked="checked"'); if ($modpostsnum == 1 || $authorcount == 1) { include_once libfile('function/member'); $crimenum = crime('getcount', $posts[0]['authorid'], 'crime_banpost'); $crimeauthor = $posts[0]['author']; } $this->getController()->renderPartial('topicAdmin', array('formUrl' => WebUtils::createUrl_oldVersion('forum/topicadminview', array('fid' => $fid, 'tid' => $tid, 'pid' => $pid, 'act' => $act, 'type' => $type)), 'errorMsg' => $errorMsg, 'action' => $act, '_G' => $_G, 'banid' => $banid, 'checkunban' => $checkunban, 'checkban' => $checkban, 'modpostsnum' => $modpostsnum, 'crimenum' => $crimenum, 'crimeauthor' => $crimeauthor)); exit; }
while ($post = $db->fetch_array($query)) { if ($post['first'] && $thread['digest'] == '-1') { showmessage('special_noaction'); } $posts[] = $post; } if (!submitcheck('banpostsubmit')) { $banid = ''; foreach ($topiclist as $id) { $banid .= '<input type="hidden" name="topiclist[]" value="' . $id . '" />'; } include template('topicadmin_banpost'); } else { $banned = intval($banned); $modaction = $banned ? 'BNP' : 'UBN'; checkreasonpm(); $db->query("UPDATE {$tablepre}posts SET status='{$banned}' WHERE pid IN ({$banpids}) AND tid='{$tid}'", 'UNBUFFERED'); $resultarray = array('redirect' => "viewthread.php?tid={$tid}&page={$page}", 'reasonpm' => $sendreasonpm ? array('data' => $posts, 'var' => 'post', 'item' => 'reason_ban_post') : array(), 'modtids' => 0, 'modlog' => $thread); } } else { showmessage('undefined_action', NULL, 'HALTED'); } if ($resultarray) { if ($resultarray['modtids']) { updatemodlog($resultarray['modtids'], $modaction, $resultarray['expiration']); } updatemodworks($modaction, $modpostsnum); if (is_array($resultarray['modlog'])) { if (isset($resultarray['modlog']['tid'])) { modlog($resultarray['modlog'], $modaction); } else {
private function _viewRate($res, $tid, $pid) { $res = $this->_checkRate($res, $tid, $pid); $status = WebUtils::checkError($res); $location = WebUtils::createUrl_oldVersion('index/returnmobileview'); if ($status) { $str = <<<HTML <script> alert("{$res['head']['errInfo']}"); location.href = "{$location}"; </script> HTML; echo $str; exit; } // [add]修复gbk编码导致的评分理由不显示。Author:HanPengyu Data:04.09.27 if (!empty($_POST)) { // 把$_POST转成utf-8, 这是由于discuz源码会在mobile情况下把$_POST预先转码成对应的charset, $_POST = array_intersect_key($_REQUEST, $_POST); // 手动把转成utf-8的$_POST数据再次转成对应的charset foreach ($_POST as $key => $value) { if (is_string($value)) { $_POST[$key] = WebUtils::t($value); } } $_GET = array_merge($_GET, $_POST); } global $_G; require_once libfile('function/misc'); require_once libfile('function/forum'); //今日剩余积分 $maxratetoday = $this->_getratingleft($_G['group']['raterange']); $post = C::t('forum_post')->fetch('tid:' . $tid, $pid); $thread = C::t('forum_thread')->fetch($tid); if (!empty($_POST)) { $reason = checkreasonpm(); $rate = $ratetimes = 0; $creditsarray = $sub_self_credit = array(); getuserprofile('extcredits1'); foreach ($_G['group']['raterange'] as $id => $rating) { $score = intval($_GET['score' . $id]); if (isset($_G['setting']['extcredits'][$id]) && !empty($score)) { if ($rating['isself'] && intval($_G['member']['extcredits' . $id]) - $score < 0) { //抱歉,您的{extcreditstitle}(评分栏目)不足,无法评分 $errorMsg = lang('message', 'thread_rate_range_self_invalid', array('extcreditstitle' => $_G['setting']['extcredits'][$id]['title'])); $this->_renderTemplates($tid, $pid, $errorMsg); exit; } if (abs($score) <= $maxratetoday[$id]) { if ($score > $rating['max'] || $score < $rating['min']) { //请输入正确的分值 $errorMsg = lang('message', 'thread_rate_range_invalid'); $this->_renderTemplates($tid, $pid, $errorMsg); exit; } else { $creditsarray[$id] = $score; if ($rating['isself']) { $sub_self_credit[$id] = -abs($score); } $rate += $score; $ratetimes += ceil(max(abs($rating['min']), abs($rating['max'])) / 5); } } else { //抱歉,24 小时评分数超过限制 $errorMsg = lang('message', 'thread_rate_ctrl'); $this->_renderTemplates($tid, $pid, $errorMsg); exit; } } } if (!$creditsarray) { //请输入正确的分值 $errorMsg = lang('message', 'thread_rate_range_invalid'); $this->_renderTemplates($tid, $pid, $errorMsg); exit; } updatemembercount($post['authorid'], $creditsarray, 1, 'PRC', $_GET['pid']); if (!empty($sub_self_credit)) { updatemembercount($_G['uid'], $sub_self_credit, 1, 'RSC', $_GET['pid']); } C::t('forum_post')->increase_rate_by_pid('tid:' . $_G['tid'], $_GET['pid'], $rate, $ratetimes); if ($post['first']) { $threadrate = intval(@($post['rate'] + $rate) / abs($post['rate'] + $rate)); C::t('forum_thread')->update($_G['tid'], array('rate' => $threadrate)); } require_once libfile('function/discuzcode'); $sqlvalues = $comma = ''; $sqlreason = censor(trim($_GET['reason'])); $sqlreason = cutstr(dhtmlspecialchars($sqlreason), 40, '.'); foreach ($creditsarray as $id => $addcredits) { $insertarr = array('pid' => $_GET['pid'], 'uid' => $_G['uid'], 'username' => $_G['username'], 'extcredits' => $id, 'dateline' => $_G['timestamp'], 'score' => $addcredits, 'reason' => $sqlreason); C::t('forum_ratelog')->insert($insertarr); } include_once libfile('function/post'); $_G['forum']['threadcaches'] && @deletethreadcaches($_G['tid']); $reason = dhtmlspecialchars(censor(trim($reason))); //对是否通知作者做的一些初始工作 if ($_G['group']['resasonpm'] == 2 || $_G['group']['reasonpm'] == 3 || !empty($_GET['sendreasonpm'])) { $forumname = strip_tags($_G['forum']['name']); $sendreasonpm = 1; } else { $sendreasonpm = 0; } if ($sendreasonpm) { $ratescore = $slash = ''; foreach ($creditsarray as $id => $addcredits) { $ratescore .= $slash . $_G['setting']['extcredits'][$id]['title'] . ' ' . ($addcredits > 0 ? '+' . $addcredits : $addcredits) . ' ' . $_G['setting']['extcredits'][$id]['unit']; $slash = ' / '; } sendreasonpm($post, 'rate_reason', array('tid' => $thread['tid'], 'pid' => $_GET['pid'], 'subject' => $thread['subject'], 'ratescore' => $ratescore, 'reason' => $reason, 'from_id' => 0, 'from_idtype' => 'rate')); } $logs = array(); foreach ($creditsarray as $id => $addcredits) { $logs[] = dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['adminid']}\t{$post['author']}\t{$id}\t{$addcredits}\t{$_G['tid']}\t{$thread['subject']}\t{$reason}"); } update_threadpartake($post['tid']); C::t('forum_postcache')->delete($_GET['pid']); writelog('ratelog', $logs); //评分成功 $this->getController()->redirect(WebUtils::createUrl_oldVersion('index/returnmobileview')); } $this->_renderTemplates($tid, $pid); }