예제 #1
0
                    $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) {
                        $ratescore .= $slash . $_G['setting']['extcredits'][$ratelog['extcredits']]['title'] . ' ' . ($ratelog['score'] > 0 ? '+' . $ratelog['score'] : $ratelog['score']) . ' ' . $_G['setting']['extcredits'][$ratelog['extcredits']]['unit'];
                        $slash = ' / ';
                    }
                }
            }
            C::t('forum_postcache')->delete($_GET['pid']);
            writelog('ratelog', $logs);
            if ($sendreasonpm) {
                sendreasonpm($post, 'rate_removereason', array('tid' => $thread['tid'], 'pid' => $_GET['pid'], 'subject' => $thread['subject'], 'ratescore' => $ratescore, 'reason' => $reason, 'from_id' => 0, 'from_idtype' => 'removerate'));
            }
            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));
            }
        }
        showmessage('thread_rate_removesucceed', dreferer());
    }
} elseif ($_GET['action'] == 'viewratings' && $_GET['pid']) {
    $loglist = $logcount = array();
    $post = C::t('forum_post')->fetch('tid:' . $_G['tid'], $_GET['pid']);
    if ($post['invisible'] != 0) {
        $post = array();
    }
예제 #2
0
        $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 {
            foreach ($resultarray['modlog'] as $thread) {
                modlog($thread, $modaction);
            }
        }
    }
    if ($resultarray['reasonpm']) {
        include language('modactions');
        $modaction = $modactioncode[$modaction];
        foreach ($resultarray['reasonpm']['data'] as ${$resultarray['reasonpm']['var']}) {
            sendreasonpm($resultarray['reasonpm']['var'], $resultarray['reasonpm']['item']);
        }
    }
    showmessage(isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed', $resultarray['redirect']);
}
예제 #3
0
            uc_user_deleteavatar($uid);
            $cleartype[] = lang('forum/misc', 'avatar');
            crime('recordaction', $uid, 'crime_avatar', lang('forum/misc', 'crime_reason', array('reason' => $reason)));
        }
        if (in_array('sightml', $_GET['operations'])) {
            C::t('common_member_field_forum')->update($uid, array('sightml' => ''), 'UNBUFFERED');
            $cleartype[] = lang('forum/misc', 'signature');
            crime('recordaction', $uid, 'crime_sightml', lang('forum/misc', 'crime_reason', array('reason' => $reason)));
        }
        if (in_array('customstatus', $_GET['operations'])) {
            C::t('common_member_field_forum')->update($uid, array('customstatus' => ''), 'UNBUFFERED');
            $cleartype[] = lang('forum/misc', 'custom_title');
            crime('recordaction', $uid, 'crime_customstatus', lang('forum/misc', 'crime_reason', array('reason' => $reason)));
        }
        if ($_G['group']['reasonpm'] == 2 || $_G['group']['reasonpm'] == 3 || !empty($_GET['sendreasonpm'])) {
            sendreasonpm(array('authorid' => $uid), 'reason_quickclear', array('cleartype' => implode(',', $cleartype), 'reason' => $reason, 'from_id' => 0, 'from_idtype' => 'quickclear'));
        }
        showmessage('quickclear_success', $_POST['redirect'], array(), array('showdialog' => 1, 'closetime' => true, 'msgtype' => 2, 'locationtime' => 1));
    }
} elseif ($_GET['action'] == 'getpostfeed') {
    $tid = intval($_GET['tid']);
    $pid = intval($_GET['pid']);
    $flag = intval($_GET['flag']);
    $feed = $thread = array();
    if ($tid) {
        $thread = C::t('forum_thread')->fetch($tid);
        if ($flag) {
            $post = C::t('forum_post')->fetch($thread['posttableid'], $pid);
            require_once libfile('function/discuzcode');
            require_once libfile('function/followcode');
            $post['message'] = followcode($post['message'], $tid, $pid);
예제 #4
0
                $thumbdata = array('bid' => $block['bid'], 'itemid' => 0, 'pic' => $thumbpath, 'picflag' => $picflag, 'type' => '0');
                C::t('common_block_pic')->insert($thumbdata);
            }
            if (!empty($_POST['updateblock'])) {
                block_updatecache($bid, true);
            }
            if ($_G['group']['reasonpm'] == 2 || $_G['group']['reasonpm'] == 3 || !empty($_GET['sendreasonpm'])) {
                $sendreasonpm = 1;
            } else {
                $sendreasonpm = 0;
            }
            if ($sendreasonpm) {
                require_once libfile('function/misc');
                if (in_array($_GET['idtype'], array('tids', 'tid', 'gtid'))) {
                    $sendreasonpmcontent = C::t('forum_thread')->fetch($item['id']);
                    sendreasonpm($sendreasonpmcontent, 'recommend_note_post', array('tid' => $item['id'], 'subject' => $sendreasonpmcontent['subject'], 'from_id' => 0, 'from_idtype' => 'recommend'));
                }
            }
            $showrecommendrate = '';
            if ($_G['group']['raterange'] && in_array($_GET['idtype'], array('tids', 'tid', 'gtid'))) {
                $showrecommendrate = 1;
            }
            if ($showrecommendrate) {
                showmessage('do_success', dreferer('portal.php'), array(), array('showdialog' => true, 'closetime' => 0.01, 'extrajs' => '<script type="text/javascript" reload="1">
					showWindow("rate", "forum.php?mod=misc&action=rate&tid=' . $item[id] . '&pid=' . $_GET[recommend_thread_pid] . '&showratetip=1", "get", -1);
					</script>'));
            } elseif ($_GET['showrecommendtip']) {
                showmessage('do_success', dreferer('portal.php'), array(), array('showdialog' => true, 'closetime' => true, 'extrajs' => '<script type="text/javascript" reload="1">
					window.location.reload();
					</script>'));
            } else {
예제 #5
0
                } else {
                    updatemodlog($moderatetids, $modaction, $expiration, 0, $reason);
                }
            }
            updatemodworks($modaction, $modpostsnum);
            foreach ($threadlist as $thread) {
                modlog($thread, $modaction);
            }
            if ($sendreasonpm) {
                $modactioncode = lang('forum/modaction');
                $modaction = $modactioncode[$modaction];
                foreach ($threadlist as $thread) {
                    if ($operation == 'move') {
                        sendreasonpm($thread, 'reason_move', array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason), 'tofid' => $toforum['fid'], 'toname' => $toforum['name']));
                    } else {
                        sendreasonpm($thread, 'reason_moderate', array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason)));
                    }
                }
            }
            if ($stampstatus) {
                set_stamp($stampstatus, $stampaction, $threadlist, $expiration);
            }
        }
        showmessage('admin_succeed', $_G['referer']);
    }
}
function checkexpiration($expiration, $operation)
{
    global $_G;
    if (!empty($expiration) && in_array($operation, array('recommend', 'stick', 'digest', 'highlight', 'close'))) {
        $expiration = strtotime($expiration) - $_G['setting']['timeoffset'] * 3600 + date('Z');
예제 #6
0
            while ($ratelog = $db->fetch_array($query)) {
                if (in_array($ratelog['uid'] . ' ' . $ratelog['extcredits'] . ' ' . $ratelog['dateline'], $logidarray)) {
                    $rate += $ratelog['score'] = -$ratelog['score'];
                    $ratetimes += ceil(max(abs($rating['min']), abs($rating['max'])) / 5);
                    updatecredits($post['authorid'], array($ratelog['extcredits'] => $ratelog['score']));
                    $db->query("DELETE FROM {$tablepre}ratelog WHERE pid='{$pid}' AND uid='{$ratelog['uid']}' AND extcredits='{$ratelog['extcredits']}' AND dateline='{$ratelog['dateline']}'", 'UNBUFFERED');
                    $logs[] = dhtmlspecialchars("{$timestamp}\t{$discuz_userss}\t{$adminid}\t{$post['author']}\t{$ratelog['extcredits']}\t{$ratelog['score']}\t{$tid}\t{$thread['subject']}\t{$reason}\tD");
                    if ($sendreasonpm) {
                        $ratescore .= $slash . $extcredits[$ratelog['extcredits']]['title'] . ' ' . ($ratelog['score'] > 0 ? '+' . $ratelog['score'] : $ratelog['score']) . ' ' . $extcredits[$ratelog['extcredits']]['unit'];
                        $slash = ' / ';
                    }
                }
            }
            writelog('ratelog', $logs);
            if ($sendreasonpm) {
                sendreasonpm('post', 'rate_removereason');
            }
            $db->query("UPDATE {$tablepre}posts SET rate=rate+({$rate}), ratetimes=ratetimes-{$ratetimes} WHERE pid='{$pid}'");
            if ($post['first']) {
                $threadrate = @intval(@($post['rate'] + $rate) / abs($post['rate'] + $rate));
                $db->query("UPDATE {$tablepre}threads SET rate='{$threadrate}' WHERE tid='{$tid}'");
            }
        }
        showmessage('thread_rate_removesucceed', dreferer());
    }
} elseif ($action == 'viewratings' && $pid) {
    $queryr = $db->query("SELECT * FROM {$tablepre}ratelog WHERE pid='{$pid}' ORDER BY dateline");
    $queryp = $db->query("SELECT p.* " . ($bannedmessages ? ", m.groupid " : '') . " FROM {$tablepre}posts p " . ($bannedmessages ? "LEFT JOIN {$tablepre}members m ON m.uid=p.authorid" : '') . " WHERE p.pid='{$pid}' AND p.invisible='0'");
    if (!$db->num_rows($queryr) || !$db->num_rows($queryp)) {
        showmessage('thread_rate_log_nonexistence');
    }
 private function _adminTopic($fid, $tid, $pid, $act, $type)
 {
     global $_G;
     $errorMsg = '';
     $_GET['topiclist'] = array($_GET['pid']);
     // 在DISCUZ_ROOT/source/module/forum/forum_topicadmin.php基础上进行二次开发
     $_GET['topiclist'] = !empty($_GET['topiclist']) ? is_array($_GET['topiclist']) ? array_unique($_GET['topiclist']) : $_GET['topiclist'] : array();
     loadcache(array('modreasons', 'stamptypeid', 'threadtableids'));
     require_once libfile('function/post');
     require_once libfile('function/misc');
     $modpostsnum = 0;
     $resultarray = $thread = array();
     if ($_G['group']['reasonpm'] == 2 || $_G['group']['reasonpm'] == 3 || !empty($_GET['sendreasonpm'])) {
         $forumname = strip_tags($_G['forum']['name']);
         $sendreasonpm = 1;
     } else {
         $sendreasonpm = 0;
     }
     if ($type == 'topic') {
         if ($act == 'band') {
             $resultarray = $this->_topicAdmin_band($fid, $tid, $pid, $act, $type, array('sendreasonpm' => $sendreasonpm, 'thread' => $_G['forum_thread']));
         } else {
             // 在DISCUZ_ROOT/source/include/topicadmin/topicadmin_moderate.php基础上进行二次开发
             $thread = $_G['forum_thread'];
             $thread['dblastpost'] = $thread['lastpost'];
             $threadlist[$thread['tid']] = $thread;
             $modpostsnum = count($threadlist);
             $stickcheck = $closecheck = $digestcheck = array('', '', '', '', '');
             empty($threadlist[$_G['tid']]['displayorder']) ? $stickcheck[0] = 'selected="selected"' : ($stickcheck[$threadlist[$_G['tid']]['displayorder']] = 'selected="selected"');
             empty($threadlist[$_G['tid']]['digest']) ? $digestcheck[0] = 'selected="selected"' : ($digestcheck[$threadlist[$_G['tid']]['digest']] = 'selected="selected"');
             empty($threadlist[$_G['tid']]['closed']) ? $closecheck[0] = 'checked="checked"' : ($closecheck[1] = 'checked="checked"');
             if (!empty($_POST)) {
                 $tidsarr = array_keys($threadlist);
                 $moderatetids = dimplode($tidsarr);
                 $reason = checkreasonpm();
                 $stampstatus = 0;
                 $stampaction = 'SPA';
                 $operationMap = array('top' => 'stick', 'marrow' => 'digest', 'delete' => 'delete');
                 $operation = $operationMap[$act];
                 $updatemodlog = TRUE;
                 switch ($act) {
                     case 'top':
                         $sticklevel = intval($_GET['sticklevel']);
                         if ($sticklevel < 0 || $sticklevel > 3 || $sticklevel > $_G['group']['allowstickthread']) {
                             // showmessage('no_privilege_stickthread');
                             $this->_exitWithHtmlAlert('no_privilege_stickthread');
                         }
                         $expiration = checkexpiration($_GET['expirationstick'], $operation);
                         $expirationstick = $sticklevel ? $_GET['expirationstick'] : 0;
                         $forumstickthreads = $_G['setting']['forumstickthreads'];
                         $forumstickthreads = isset($forumstickthreads) ? dunserialize($forumstickthreads) : array();
                         C::t('forum_thread')->update($tidsarr, array('displayorder' => $sticklevel, 'moderated' => 1), true);
                         $delkeys = array_keys($threadlist);
                         foreach ($delkeys as $k) {
                             unset($forumstickthreads[$k]);
                         }
                         C::t('common_setting')->update('forumstickthreads', $forumstickthreads);
                         $stickmodify = 0;
                         foreach ($threadlist as $thread) {
                             $stickmodify = (in_array($thread['displayorder'], array(2, 3)) || in_array($sticklevel, array(2, 3))) && $sticklevel != $thread['displayorder'] ? 1 : $stickmodify;
                         }
                         if ($_G['setting']['globalstick'] && $stickmodify) {
                             require_once libfile('function/cache');
                             updatecache('globalstick');
                         }
                         $modaction = $sticklevel ? $expiration ? 'EST' : 'STK' : 'UST';
                         C::t('forum_threadmod')->update_by_tid_action($tidsarr, array('STK', 'UST', 'EST', 'UES'), array('status' => 0));
                         if (!$sticklevel) {
                             $stampaction = 'SPD';
                         }
                         $stampstatus = 1;
                         break;
                     case 'marrow':
                         $digestlevel = intval($_GET['digestlevel']);
                         if ($digestlevel < 0 || $digestlevel > 3 || $digestlevel > $_G['group']['allowdigestthread']) {
                             // showmessage('no_privilege_digestthread');
                             $this->_exitWithHtmlAlert('no_privilege_digestthread');
                         }
                         $expiration = checkexpiration($_GET['expirationdigest'], $operation);
                         $expirationdigest = $digestlevel ? $expirationdigest : 0;
                         C::t('forum_thread')->update($tidsarr, array('digest' => $digestlevel, 'moderated' => 1), true);
                         foreach ($threadlist as $thread) {
                             if ($thread['digest'] != $digestlevel) {
                                 if ($digestlevel == $thread['digest']) {
                                     continue;
                                 }
                                 $extsql = array();
                                 if ($digestlevel > 0 && $thread['digest'] == 0) {
                                     $extsql = array('digestposts' => 1);
                                 }
                                 if ($digestlevel == 0 && $thread['digest'] > 0) {
                                     $extsql = array('digestposts' => -1);
                                 }
                                 if ($digestlevel == 0) {
                                     $stampaction = 'SPD';
                                 }
                                 updatecreditbyaction('digest', $thread['authorid'], $extsql, '', $digestlevel - $thread['digest']);
                             }
                         }
                         $modaction = $digestlevel ? $expiration ? 'EDI' : 'DIG' : 'UDG';
                         C::t('forum_threadmod')->update_by_tid_action($tidsarr, array('DIG', 'UDI', 'EDI', 'UED'), array('status' => 0));
                         $stampstatus = 2;
                         break;
                     case 'delete':
                         if (!$_G['group']['allowdelpost']) {
                             // showmessage('no_privilege_delpost');
                             $this->_exitWithHtmlAlert('no_privilege_delpost');
                         }
                         loadcache('threadtableids');
                         $stickmodify = 0;
                         $deleteredirect = $remarkclosed = array();
                         foreach ($threadlist as $thread) {
                             if ($thread['digest']) {
                                 updatecreditbyaction('digest', $thread['authorid'], array('digestposts' => -1), '', -$thread['digest']);
                             }
                             if (in_array($thread['displayorder'], array(2, 3))) {
                                 $stickmodify = 1;
                             }
                             if ($_G['forum']['status'] == 3 && $thread['closed'] > 1) {
                                 $deleteredirect[] = $thread['closed'];
                             }
                             if ($thread['isgroup'] == 1 && $thread['closed'] > 1) {
                                 $remarkclosed[] = $thread['closed'];
                             }
                         }
                         $modaction = 'DEL';
                         require_once libfile('function/delete');
                         $tids = array_keys($threadlist);
                         if ($_G['forum']['recyclebin']) {
                             deletethread($tids, true, true, true);
                             manage_addnotify('verifyrecycle', $modpostsnum);
                         } else {
                             deletethread($tids, true, true);
                             $updatemodlog = FALSE;
                         }
                         $forumstickthreads = $_G['setting']['forumstickthreads'];
                         $forumstickthreads = !empty($forumstickthreads) ? dunserialize($forumstickthreads) : array();
                         $delkeys = array_keys($threadlist);
                         foreach ($delkeys as $k) {
                             unset($forumstickthreads[$k]);
                         }
                         C::t('common_setting')->update('forumstickthreads', $forumstickthreads);
                         C::t('forum_forum_threadtable')->delete_none_threads();
                         if (!empty($deleteredirect)) {
                             deletethread($deleteredirect);
                         }
                         if (!empty($remarkclosed)) {
                             C::t('forum_thread')->update($remarkclosed, array('closed' => 0));
                         }
                         if ($_G['setting']['globalstick'] && $stickmodify) {
                             require_once libfile('function/cache');
                             updatecache('globalstick');
                         }
                         updateforumcount($_G['fid']);
                         if ($_GET['crimerecord']) {
                             include_once libfile('function/member');
                             foreach ($threadlist as $thread) {
                                 crime('recordaction', $thread['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => $reason, 'tid' => $thread['tid'], 'pid' => 0)));
                             }
                         }
                         break;
                     case 'close':
                         if (!$_G['group']['allowclosethread']) {
                             $this->_exitWithHtmlAlert('no_privilege_closethread');
                         }
                         $expiration = checkexpiration($_GET['expirationclose'], $operation);
                         $modaction = $expiration ? 'ECL' : 'CLS';
                         C::t('forum_thread')->update($tidsarr, array('closed' => 1, 'moderated' => 1), true);
                         C::t('forum_threadmod')->update_by_tid_action($tidsarr, array('CLS', 'OPN', 'ECL', 'UCL', 'EOP', 'UEO'), array('status' => 0));
                         break;
                     case 'open':
                         if (!$_G['group']['allowclosethread']) {
                             $this->_exitWithHtmlAlert('no_privilege_openthread');
                         }
                         $expiration = checkexpiration($_GET['expirationclose'], $operation);
                         $modaction = $expiration ? 'EOP' : 'OPN';
                         C::t('forum_thread')->update($tidsarr, array('closed' => 0, 'moderated' => 1), true);
                         C::t('forum_threadmod')->update_by_tid_action($tidsarr, array('CLS', 'OPN', 'ECL', 'UCL', 'EOP', 'UEO'), array('status' => 0));
                         break;
                     case 'move':
                         if (!$_G['group']['allowmovethread']) {
                             $this->_exitWithHtmlAlert('no_privilege_movethread');
                         }
                         $moveto = $_GET['moveto'];
                         $toforum = C::t('forum_forum')->fetch_info_by_fid($moveto);
                         if (!$toforum || $_G['adminid'] != 1 && $toforum['status'] != 1 || $toforum['type'] == 'group') {
                             // showmessage('admin_move_invalid');
                             $this->_exitWithHtmlAlert('admin_move_invalid');
                         } elseif ($_G['fid'] == $toforum['fid']) {
                             continue;
                         } else {
                             $moveto = $toforum['fid'];
                             $modnewthreads = (!$_G['group']['allowdirectpost'] || $_G['group']['allowdirectpost'] == 1) && $toforum['modnewposts'] ? 1 : 0;
                             $modnewreplies = (!$_G['group']['allowdirectpost'] || $_G['group']['allowdirectpost'] == 2) && $toforum['modnewposts'] ? 1 : 0;
                             if ($modnewthreads || $modnewreplies) {
                                 // showmessage('admin_move_have_mod');
                                 $this->_exitWithHtmlAlert('admin_move_have_mod');
                             }
                         }
                         if ($_G['adminid'] == 3) {
                             $priv = C::t('forum_forumfield')->check_moderator_for_uid($moveto, $_G['uid'], $_G['member']['accessmasks']);
                             if (($priv['postperm'] && !in_array($_G['groupid'], explode("\t", $priv['postperm'])) || $_G['member']['accessmasks'] && ($priv['allowview'] || $priv['allowreply'] || $priv['allowgetattach'] || $priv['allowpostattach']) && !$priv['allowpost']) && !$priv['istargetmod']) {
                                 // showmessage('admin_move_nopermission');
                                 $this->_exitWithHtmlAlert('admin_move_nopermission');
                             }
                         }
                         $moderate = array();
                         $stickmodify = 0;
                         $toforumallowspecial = array(1 => $toforum['allowpostspecial'] & 1, 2 => $toforum['allowpostspecial'] & 2, 3 => isset($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]) && $toforum['allowpostspecial'] & 4, 4 => $toforum['allowpostspecial'] & 8, 5 => $toforum['allowpostspecial'] & 16, 127 => $_G['setting']['threadplugins'] ? dunserialize($toforum['threadplugin']) : array());
                         foreach ($threadlist as $tid => $thread) {
                             $allowmove = 0;
                             if (!$thread['special']) {
                                 $allowmove = 1;
                             } else {
                                 if ($thread['special'] != 127) {
                                     $allowmove = $toforum['allowpostspecial'] ? $toforumallowspecial[$thread['special']] : 0;
                                 } else {
                                     if ($toforumallowspecial[127]) {
                                         $posttable = getposttablebytid($thread['tid']);
                                         $message = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
                                         $message = $message['message'];
                                         $sppos = strrpos($message, chr(0) . chr(0) . chr(0));
                                         $specialextra = substr($message, $sppos + 3);
                                         $allowmove = in_array($specialextra, $toforumallowspecial[127]);
                                     } else {
                                         $allowmove = 0;
                                     }
                                 }
                             }
                             if ($allowmove) {
                                 $moderate[] = $tid;
                                 if (in_array($thread['displayorder'], array(2, 3))) {
                                     $stickmodify = 1;
                                 }
                                 if ($_GET['appbyme_movetype'] == 'redirect') {
                                     // if($_GET['type'] == 'redirect') {
                                     $insertdata = array('fid' => $thread['fid'], 'readperm' => $thread['readperm'], 'author' => $thread['author'], 'authorid' => $thread['authorid'], 'subject' => $thread['subject'], 'dateline' => $thread['dateline'], 'lastpost' => $thread['dblastpost'], 'lastposter' => $thread['lastposter'], 'views' => 0, 'replies' => 0, 'displayorder' => 0, 'digest' => 0, 'closed' => $thread['tid'], 'special' => 0, 'attachment' => 0, 'typeid' => $_GET['threadtypeid']);
                                     $newtid = C::t('forum_thread')->insert($insertdata, true);
                                     if ($newtid) {
                                         C::t('forum_threadclosed')->insert(array('tid' => $thread['tid'], 'redirect' => $newtid), true, true);
                                     }
                                 }
                             }
                         }
                         if (!($moderatetids = implode(',', $moderate))) {
                             showmessage('admin_moderate_invalid');
                         }
                         $fieldarr = array('fid' => $moveto, 'isgroup' => 0, 'typeid' => $_GET['threadtypeid'], 'moderated' => 1);
                         if ($_G['adminid'] == 3) {
                             $fieldarr['displayorder'] = 0;
                         }
                         C::t('forum_thread')->update($tidsarr, $fieldarr, true);
                         C::t('forum_forumrecommend')->update($tidsarr, array('fid' => $moveto));
                         loadcache('posttableids');
                         $posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
                         foreach ($posttableids as $id) {
                             C::t('forum_post')->update_by_tid($id, $tidsarr, array('fid' => $moveto));
                         }
                         $typeoptionvars = C::t('forum_typeoptionvar')->fetch_all_by_tid_optionid($tidsarr);
                         foreach ($typeoptionvars as $typeoptionvar) {
                             C::t('forum_typeoptionvar')->update_by_tid($typeoptionvar['tid'], array('fid' => $moveto));
                             C::t('forum_optionvalue')->update($typeoptionvar['sortid'], $typeoptionvar['tid'], $_G['fid'], "fid='{$moveto}'");
                         }
                         if ($_G['setting']['globalstick'] && $stickmodify) {
                             require_once libfile('function/cache');
                             updatecache('globalstick');
                         }
                         $modaction = 'MOV';
                         $_G['toforum'] = $toforum;
                         updateforumcount($moveto);
                         updateforumcount($_G['fid']);
                         break;
                     default:
                         $errorMsg = '错误的动作参数';
                         break;
                 }
                 if ($errorMsg == '') {
                     if ($updatemodlog) {
                         if ($operation != 'delete') {
                             updatemodlog($moderatetids, $modaction, $expiration);
                         } else {
                             updatemodlog($moderatetids, $modaction, $expiration, 0, $reason);
                         }
                     }
                     updatemodworks($modaction, $modpostsnum);
                     foreach ($threadlist as $thread) {
                         modlog($thread, $modaction);
                     }
                     if ($sendreasonpm) {
                         $modactioncode = lang('forum/modaction');
                         $modtype = $modaction;
                         $modaction = $modactioncode[$modaction];
                         foreach ($threadlist as $thread) {
                             if ($operation == 'move') {
                                 sendreasonpm($thread, 'reason_move', array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason, 'tofid' => $toforum['fid'], 'toname' => $toforum['name'], 'from_id' => 0, 'from_idtype' => 'movethread'));
                             } else {
                                 sendreasonpm($thread, 'reason_moderate', array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason, 'from_id' => 0, 'from_idtype' => 'moderate_' . $modtype));
                             }
                         }
                     }
                     if ($stampstatus) {
                         set_stamp($stampstatus, $stampaction, $threadlist, $expiration);
                     }
                     $this->getController()->redirect(WebUtils::createUrl_oldVersion('index/returnmobileview'));
                 }
             } else {
                 if ($act == 'move') {
                     require_once libfile('function/forumlist');
                     $forumselect = forumselect(FALSE, 0, $threadlist[$_G['tid']]['fid'], $_G['adminid'] == 1 ? TRUE : FALSE);
                 }
             }
         }
     } else {
         if ($type == 'post') {
             if ($act == 'band') {
                 $resultarray = $this->_topicAdmin_band($fid, $tid, $pid, $act, $type, array('sendreasonpm' => $sendreasonpm, 'thread' => $_G['forum_thread']));
             } else {
                 // 在DISCUZ_ROOT/source/include/topicadmin/topicadmin_delpost.php基础上进行二次开发
                 $resultarray = array();
                 $thread = $_G['forum_thread'];
                 $topiclist = array($pid);
                 $modpostsnum = 1;
                 $pids = $posts = $authors = array();
                 $posttable = getposttablebytid($_G['tid']);
                 foreach (C::t('forum_post')->fetch_all('tid:' . $_G['tid'], $topiclist, false) as $post) {
                     if ($post['tid'] != $_G['tid']) {
                         continue;
                     }
                     if ($post['first'] == 1) {
                         dheader("location: {$_G['siteurl']}forum.php?mod=topicadmin&action=moderate&operation=delete&optgroup=3&fid={$_G['fid']}&moderate[]={$thread['tid']}&inajax=yes" . ($_GET['infloat'] ? "&infloat=yes&handlekey={$_GET['handlekey']}" : ''));
                     } else {
                         $authors[$post['authorid']] = 1;
                         $pids[] = $post['pid'];
                         $posts[] = $post;
                     }
                 }
                 if (!empty($_POST)) {
                     $reason = checkreasonpm();
                     $uidarray = $puidarray = $auidarray = array();
                     $losslessdel = $_G['setting']['losslessdel'] > 0 ? TIMESTAMP - $_G['setting']['losslessdel'] * 86400 : 0;
                     if ($pids) {
                         require_once libfile('function/delete');
                         if ($_G['forum']['recyclebin']) {
                             deletepost($pids, 'pid', true, false, true);
                             manage_addnotify('verifyrecyclepost', $modpostsnum);
                         } else {
                             $logs = array();
                             $ratelog = C::t('forum_ratelog')->fetch_all_by_pid($pids);
                             $rposts = C::t('forum_post')->fetch_all('tid:' . $_G['tid'], $pids, false);
                             foreach (C::t('forum_ratelog')->fetch_all_by_pid($pids) as $rpid => $author) {
                                 if ($author['score'] > 0) {
                                     $rpost = $rposts[$rpid];
                                     updatemembercount($rpost['authorid'], array($author['extcredits'] => -$author['score']));
                                     $author['score'] = $_G['setting']['extcredits'][$id]['title'] . ' ' . -$author['score'] . ' ' . $_G['setting']['extcredits'][$id]['unit'];
                                     $logs[] = dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['adminid']}\t{$rpost['author']}\t{$author['extcredits']}\t{$author['score']}\t{$thread['tid']}\t{$thread['subject']}\t{$delpostsubmit}");
                                 }
                             }
                             if (!empty($logs)) {
                                 writelog('ratelog', $logs);
                                 unset($logs);
                             }
                             deletepost($pids, 'pid', true);
                         }
                         if ($_GET['crimerecord']) {
                             include_once libfile('function/member');
                             foreach ($posts as $post) {
                                 crime('recordaction', $post['authorid'], 'crime_delpost', lang('forum/misc', 'crime_postreason', array('reason' => $reason, 'tid' => $post['tid'], 'pid' => $post['pid'])));
                             }
                         }
                     }
                     updatethreadcount($_G['tid'], 1);
                     updateforumcount($_G['fid']);
                     $_G['forum']['threadcaches'] && deletethreadcaches($thread['tid']);
                     $modaction = 'DLP';
                     $resultarray = array('redirect' => "forum.php?mod=viewthread&tid={$_G['tid']}&page={$_GET['page']}", 'reasonpm' => $sendreasonpm ? array('data' => $posts, 'var' => 'post', 'item' => 'reason_delete_post', 'notictype' => 'post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason), 'modtids' => 0, 'modlog' => $thread);
                 }
             }
         }
     }
     // 在DISCUZ_ROOT/source/module/forum/forum_topicadmin.php基础上进行二次开发
     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 {
                 foreach ($resultarray['modlog'] as $thread) {
                     modlog($thread, $modaction);
                 }
             }
         }
         if ($resultarray['reasonpm']) {
             $modactioncode = lang('forum/modaction');
             $modaction = $modactioncode[$modaction];
             foreach ($resultarray['reasonpm']['data'] as $var) {
                 sendreasonpm($var, $resultarray['reasonpm']['item'], $resultarray['reasonvar'], $resultarray['reasonpm']['notictype']);
             }
         }
         // showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'), $resultarray['redirect']);
         $this->getController()->redirect(WebUtils::createUrl_oldVersion('index/returnmobileview'));
     }
     $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, 'stickcheck' => $stickcheck, 'digestcheck' => $digestcheck, 'closecheck' => $closecheck, 'forumselect' => WebUtils::u($forumselect)));
 }
예제 #8
0
                }
                $db->query("UPDATE {$tablepre}threads SET typeid='{$typeid}', moderated='1' WHERE tid IN ({$moderatetids})");
                $modaction = 'TYP';
            }
            if ($updatemodlog) {
                updatemodlog($moderatetids, $modaction, $expiration);
            }
            updatemodworks($modaction, $modpostsnum);
            foreach ($threadlist as $thread) {
                modlog($thread, $modaction);
            }
            if ($sendreasonpm) {
                include_once language('modactions');
                $modaction = $modactioncode[$modaction];
                foreach ($threadlist as $thread) {
                    sendreasonpm('thread', $operation == 'move' ? 'reason_move' : 'reason_moderate');
                }
            }
            procreportlog($moderatetids, '', $operation == 'delete');
            if ($stampstatus) {
                set_stamp($stampstatus);
            }
        }
        showmessage('admin_succeed', $referer);
    }
}
function checkexpiration($expiration)
{
    global $operation, $timestamp, $timeoffset;
    if (!empty($expiration) && in_array($operation, array('recommend', 'stick', 'digest', 'highlight', 'close'))) {
        $expiration = strtotime($expiration) - $timeoffset * 3600 + date('Z');
예제 #9
0
                if (in_array($ratelog['uid'] . ' ' . $ratelog['extcredits'] . ' ' . $ratelog['dateline'], $_G['gp_logidarray'])) {
                    $rate += $ratelog['score'] = -$ratelog['score'];
                    $ratetimes += ceil(max(abs($rating['min']), abs($rating['max'])) / 5);
                    updatemembercount($post['authorid'], array($ratelog['extcredits'] => $ratelog['score']));
                    DB::delete('common_credit_log', array('uid' => $post['authorid'], 'operation' => 'PRC', 'relatedid' => $_G['gp_pid']));
                    DB::query("DELETE FROM " . DB::table('forum_ratelog') . " WHERE pid='{$_G['gp_pid']}' AND uid='{$ratelog['uid']}' AND extcredits='{$ratelog['extcredits']}' AND dateline='{$ratelog['dateline']}'", 'UNBUFFERED');
                    $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) {
                        $ratescore .= $slash . $_G['setting']['extcredits'][$ratelog['extcredits']]['title'] . ' ' . ($ratelog['score'] > 0 ? '+' . $ratelog['score'] : $ratelog['score']) . ' ' . $_G['setting']['extcredits'][$ratelog['extcredits']]['unit'];
                        $slash = ' / ';
                    }
                }
            }
            writelog('ratelog', $logs);
            if ($sendreasonpm) {
                sendreasonpm($post, 'rate_removereason', array('tid' => $thread['tid'], 'pid' => $_G['gp_pid'], 'subject' => $thread['subject'], 'ratescore' => $ratescore, 'reason' => stripslashes($reason)));
            }
            DB::query("UPDATE " . DB::table($posttable) . " SET rate=rate+({$rate}), ratetimes=ratetimes-{$ratetimes} WHERE pid='{$_G['gp_pid']}'");
            if ($post['first']) {
                $threadrate = @intval(@($post['rate'] + $rate) / abs($post['rate'] + $rate));
                DB::query("UPDATE " . DB::table('forum_thread') . " SET rate='{$threadrate}' WHERE tid='{$_G['tid']}'");
            }
        }
        showmessage('thread_rate_removesucceed', dreferer());
    }
} elseif ($_G['gp_action'] == 'viewratings' && $_G['gp_pid']) {
    $posttable = getposttablebytid($_G['tid']);
    $queryr = DB::query("SELECT * FROM " . DB::table('forum_ratelog') . " WHERE pid='{$_G['gp_pid']}' ORDER BY dateline DESC");
    $queryp = DB::query("SELECT p.* " . ($_G['setting']['bannedmessages'] ? ", m.groupid " : '') . " FROM " . DB::table($posttable) . " p " . ($_G['setting']['bannedmessages'] ? "LEFT JOIN " . DB::table('common_member') . " m ON m.uid=p.authorid" : '') . " WHERE p.pid='{$_G['gp_pid']}' AND p.invisible='0'");
    if (!DB::num_rows($queryr) || !DB::num_rows($queryp)) {
        showmessage('thread_rate_log_nonexistence');
예제 #10
0
    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);
    }
예제 #11
0
                    updatemodlog($moderatetids, $modaction, $expiration, 0, $reason);
                }
            }
            updatemodworks($modaction, $modpostsnum);
            foreach ($threadlist as $thread) {
                modlog($thread, $modaction);
            }
            if ($sendreasonpm) {
                $modactioncode = lang('forum/modaction');
                $modtype = $modaction;
                $modaction = $modactioncode[$modaction];
                foreach ($threadlist as $thread) {
                    if ($operation == 'move') {
                        sendreasonpm($thread, 'reason_move', array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason, 'tofid' => $toforum['fid'], 'toname' => $toforum['name'], 'from_id' => 0, 'from_idtype' => 'movethread'));
                    } else {
                        sendreasonpm($thread, 'reason_moderate', array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason, 'from_id' => 0, 'from_idtype' => 'moderate_' . $modtype));
                    }
                }
            }
            if ($stampstatus) {
                set_stamp($stampstatus, $stampaction, $threadlist, $expiration);
            }
        }
        showmessage('admin_succeed', $_G['referer']);
    }
}
function checkexpiration($expiration, $operation)
{
    global $_G;
    if (!empty($expiration) && in_array($operation, array('recommend', 'stick', 'digest', 'highlight', 'close'))) {
        $expiration = strtotime($expiration) - $_G['setting']['timeoffset'] * 3600 + date('Z');
예제 #12
0
    $sendreasonpm = 0;
}
$_GET['handlekey'] = 'mods';
if (preg_match('/^\\w+$/', $_GET['action']) && file_exists($topicadminfile = libfile('topicadmin/' . $_GET['action'], 'include'))) {
    require_once $topicadminfile;
} else {
    showmessage('undefined_action', NULL);
}
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 {
            foreach ($resultarray['modlog'] as $thread) {
                modlog($thread, $modaction);
            }
        }
    }
    if ($resultarray['reasonpm']) {
        $modactioncode = lang('forum/modaction');
        $modaction = $modactioncode[$modaction];
        foreach ($resultarray['reasonpm']['data'] as $var) {
            sendreasonpm($var, $resultarray['reasonpm']['item'], $resultarray['reasonvar'], $resultarray['reasonpm']['notictype']);
        }
    }
    showmessage(isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed', $resultarray['redirect']);
}