break; case 'UEC': case 'UEO': $closed = $action == 'UEO' ? 1 : 0; DB::query("UPDATE " . DB::table('forum_thread') . " SET closed='{$closed}' WHERE tid IN ({$tids})", 'UNBUFFERED'); DB::query("UPDATE " . DB::table('forum_threadmod') . " SET status='0' WHERE tid IN ({$tids}) AND action IN ('EOP', 'ECL', 'CLK')", 'UNBUFFERED'); break; case 'UED': DB::query("UPDATE " . DB::table('forum_threadmod') . " SET status='0' WHERE tid IN ({$tids}) AND action='EDI'", 'UNBUFFERED'); $digestarray = $authoridarry = array(); $query = DB::query("SELECT authorid, digest FROM " . DB::table('forum_thread') . " WHERE tid IN ({$tids})"); while ($digest = DB::fetch($query)) { $authoridarry[] = $digest['authorid']; $digestarray[$digest['digest']][] = $digest['authorid']; } foreach ($digestarray as $digest => $authorids) { batchupdatecredit('digest', $authorids, array("digestposts=digestposts+'-1'"), -$digest, $fid = 0); } DB::query("UPDATE " . DB::table('forum_thread') . " SET digest='0' WHERE tid IN ({$tids})", 'UNBUFFERED'); break; case 'SPD': DB::query("UPDATE " . DB::table('forum_thread') . " SET " . buildbitsql('status', 5, FALSE) . " WHERE tid IN ({$tids})", 'UNBUFFERED'); DB::query("UPDATE " . DB::table('forum_threadmod') . " SET status='0' WHERE tid IN ({$tids}) AND action IN ('SPA')", 'UNBUFFERED'); break; } } require_once libfile('function/post'); foreach ($actionarray as $action => $tids) { updatemodlog(implode(',', $tids), $action, 0, 1); } }
} } elseif($action == 'stamp' && $allowstampthread) { @include_once DISCUZ_ROOT.'./forumdata/cache/cache_stamps.php'; if(!submitcheck('modsubmit')) { include template('topicadmin_action'); } else { $modaction = $stamp !== '' ? 'SPA' : 'SPD'; checkreasonpm(); $db->query("UPDATE {$tablepre}threads SET moderated='1', ".buildbitsql('status', 5, $stamp !== '')." WHERE tid='$tid'"); $resultarray = array( 'redirect' => "viewthread.php?tid=$tid&page=$page", 'reasonpm' => ($sendreasonpm ? array('data' => array($thread), 'var' => 'thread', 'item' => $stamp !== '' ? 'reason_stamp_update' : 'reason_stamp_delete') : array()), 'modaction' => $stamp !== '' ? 'S'.sprintf('%02d', $stamp) : 'SPD', 'modlog' => $thread ); $modpostsnum = 1; updatemodlog($tid, $modaction); $db->query("UPDATE {$tablepre}threadsmod SET stamp='$stamp' WHERE tid='$tid' ORDER BY dateline DESC LIMIT 1"); } } else {
function set_stamp($typeid) { global $tablepre, $db, $_DCACHE, $moderatetids, $expiration; if (array_key_exists($typeid, $_DCACHE['stamptypeid'])) { $db->query("UPDATE {$tablepre}threads SET " . buildbitsql('status', 5, TRUE) . " WHERE tid IN ({$moderatetids})"); updatemodlog($moderatetids, 'SPA', $expiration, 0, $_DCACHE['stamptypeid'][$typeid]); } }
$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_warn_post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason), 'warningexpiration' => $_G['setting']['warningexpiration'], 'warninglimit' => $_G['setting']['warninglimit'], 'warningexpiration' => $_G['setting']['warningexpiration'], 'authorwarnings' => $authorwarnings), 'modtids' => 0, 'modlog' => $thread); procreportlog('', $pids); } } elseif ($_G['gp_action'] == 'stamp' && $_G['group']['allowstampthread']) { loadcache('stamps'); if (!submitcheck('modsubmit')) { include template('forum/topicadmin_action'); } else { $modaction = $_G['gp_stamp'] !== '' ? 'SPA' : 'SPD'; $reason = checkreasonpm(); DB::query("UPDATE " . DB::table('forum_thread') . " SET moderated='1', " . buildbitsql('status', 5, $_G['gp_stamp'] !== '') . " WHERE tid='{$_G['tid']}'"); $resultarray = array('redirect' => "forum.php?mod=viewthread&tid={$_G['tid']}&page={$page}", 'reasonpm' => $sendreasonpm ? array('data' => array($thread), 'var' => 'thread', 'item' => $_G['gp_stamp'] !== '' ? 'reason_stamp_update' : 'reason_stamp_delete') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason), 'stamp' => $_G['cache']['stamps'][$stamp]['text']), 'modaction' => $_G['gp_stamp'] !== '' ? 'S' . sprintf('%02d', $_G['gp_stamp']) : 'SPD', 'modlog' => $thread); $modpostsnum = 1; updatemodlog($_G['tid'], $modaction); DB::query("UPDATE " . DB::table('forum_threadmod') . " SET stamp='{$_G['gp_stamp']}' WHERE tid='{$_G['tid']}' ORDER BY dateline DESC LIMIT 1"); } } elseif ($_G['gp_action'] == 'stickreply' && $_G['group']['allowstickreply']) { $topiclist = $_G['gp_topiclist']; if (empty($topiclist)) { showmessage('admin_stickreply_invalid'); } elseif (!$_G['tid']) { showmessage('admin_nopermission', NULL); } $posttable = getposttablebytid($_G['tid']); $sticktopiclist = $posts = array(); foreach ($topiclist as $pid) {
function set_stamp($typeid, $stampaction, &$threadlist, $expiration) { global $_G; $moderatetids = dimplode(array_keys($threadlist)); if (empty($threadlist)) { return false; } if (array_key_exists($typeid, $_G['cache']['stamptypeid'])) { DB::query("UPDATE " . DB::table('forum_thread') . " SET " . buildbitsql('status', 5, TRUE) . " WHERE tid IN ({$moderatetids})"); if ($stampaction == 'SPD') { $stamptids = array(); foreach ($threadlist as $stamptid => $thread) { $currentstamp = DB::fetch_first("SELECT * FROM " . DB::table('forum_threadmod') . " WHERE tid='{$stamptid}' AND status='1' ORDER BY dateline DESC LIMIT 1"); if (!empty($currentstamp) && $currentstamp['stamp'] == $_G['cache']['stamptypeid'][$typeid]) { $stamptids[] = $stamptid; } } if (!empty($stamptids)) { $moderatetids = dimplode($stamptids); } else { $moderatetids = ''; } } !empty($moderatetids) && updatemodlog($moderatetids, $stampaction, $expiration, 0, $_G['cache']['stamptypeid'][$typeid]); } }
case 'UEC': case 'UEO': $closed = $action == 'UEO' ? 1 : 0; $db->query("UPDATE {$tablepre}threads SET closed='{$closed}' WHERE tid IN ({$tids})", 'UNBUFFERED'); $db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ({$tids}) AND action IN ('EOP', 'ECL', 'CLK')", 'UNBUFFERED'); break; case 'UED': $db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ({$tids}) AND action='EDI'", 'UNBUFFERED'); $digestarray = $authoridarry = array(); $query = $db->query("SELECT authorid, digest FROM {$tablepre}threads WHERE tid IN ({$tids})"); while ($digest = $db->fetch_array($query)) { $authoridarry[] = $digest['authorid']; $digestarray[$digest['digest']][] = $digest['authorid']; } $db->query("UPDATE {$tablepre}members SET digestposts=digestposts+'-1' WHERE uid IN (" . implode(',', $authoridarry) . ")", 'UNBUFFERED'); foreach ($digestarray as $digest => $authorids) { updatecredits(implode('\',\'', $authorids), $creditspolicy['digest'], 0 - $digest); } $db->query("UPDATE {$tablepre}threads SET digest='0' WHERE tid IN ({$tids})", 'UNBUFFERED'); break; case 'SPD': $db->query("UPDATE {$tablepre}threads SET " . buildbitsql('status', 5, FALSE) . " WHERE tid IN ({$tids})", 'UNBUFFERED'); $db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ({$tids}) AND action IN ('SPA')", 'UNBUFFERED'); break; } } require_once DISCUZ_ROOT . './include/post.func.php'; foreach ($actionarray as $action => $tids) { updatemodlog(implode(',', $tids), $action, 0, 1); } }