} if (!$isorigauthor) { updatemodworks('EDT', 1); require_once DISCUZ_ROOT . './include/misc.func.php'; modlog($thread, 'EDT'); } } else { if ($isfirstpost && $thread['replies'] > 0) { showmessage($thread['special'] == 3 ? 'post_edit_reward_already_reply' : 'post_edit_thread_already_reply', NULL, 'HALTED'); } if ($thread['special'] == 3) { if ($thread['price'] < 0 && $thread['dateline'] + 1 == $orig['dateline']) { showmessage('post_edit_reward_nopermission', NULL, 'HALTED'); } } elseif ($thread['special'] == 6 && $isfirstpost && $videoopen) { videodelete($tid); } updatepostcredits('-', $orig['authorid'], $isfirstpost ? $postcredits : $replycredits); if ($thread['special'] == 3 && $isfirstpost) { $db->query("UPDATE {$tablepre}members SET extcredits{$creditstransextra['2']}=extcredits{$creditstransextra['2']}+{$thread['price']} WHERE uid='{$orig['authorid']}'", 'UNBUFFERED'); $db->query("DELETE FROM {$tablepre}rewardlog WHERE tid='{$tid}'", 'UNBUFFERED'); } $thread_attachment = $post_attachment = 0; $query = $db->query("SELECT pid, attachment, thumb, remote FROM {$tablepre}attachments WHERE tid='{$tid}'"); while ($attach = $db->fetch_array($query)) { if ($attach['pid'] == $pid) { $post_attachment++; dunlink($attach['attachment'], $attach['thumb'], $attach['remote']); } else { $thread_attachment = 1; }
function deletethreads($tids = array()) { global $db, $tablepre, $losslessdel, $creditspolicy; static $cleartable = array('threadsmod', 'relatedthreads', 'posts', 'polls', 'polloptions', 'trades', 'activities', 'activityapplies', 'debates', 'videos', 'debateposts', 'attachments', 'favorites', 'mythreads', 'myposts', 'subscriptions', 'typeoptionvars', 'forumrecommend'); $threadsdel = 0; if ($tids = implodeids($tids)) { $auidarray = array(); $query = $db->query("SELECT uid, attachment, dateline, thumb, remote FROM {$tablepre}attachments WHERE tid IN ({$tids})"); while ($attach = $db->fetch_array($query)) { dunlink($attach['attachment'], $attach['thumb'], $attach['remote']); if ($attach['dateline'] > $losslessdel) { $auidarray[$attach['uid']] = !empty($auidarray[$attach['uid']]) ? $auidarray[$attach['uid']] + 1 : 1; } } if ($auidarray) { updateattachcredits('-', $auidarray, $creditspolicy['postattach']); } $videoopen && videodelete($moderate, TRUE); foreach ($cleartable as $tb) { $db->query("DELETE FROM {$tablepre}{$tb} WHERE tid IN ({$tids})", 'UNBUFFERED'); } $db->query("DELETE FROM {$tablepre}threads WHERE tid IN ({$tids})"); $threadsdel = $db->affected_rows(); } return $threadsdel; }
if ($forum['recyclebin']) { $db->query("UPDATE {$tablepre}threads SET displayorder='-1', digest='0', moderated='1' WHERE tid IN ({$moderatetids})"); $db->query("UPDATE {$tablepre}posts SET invisible='-1' WHERE tid IN ({$moderatetids})"); } else { $auidarray = array(); $query = $db->query("SELECT uid, attachment, dateline, thumb, remote FROM {$tablepre}attachments WHERE tid IN ({$moderatetids})"); while ($attach = $db->fetch_array($query)) { dunlink($attach['attachment'], $attach['thumb'], $attach['remote']); if ($attach['dateline'] > $losslessdel) { $auidarray[$attach['uid']] = !empty($auidarray[$attach['uid']]) ? $auidarray[$attach['uid']] + 1 : 1; } } if ($auidarray) { updateattachcredits('-', $auidarray, $postattachcredits); } $videoopen && videodelete($moderate, TRUE); foreach (array('threads', 'threadsmod', 'relatedthreads', 'posts', 'polls', 'polloptions', 'trades', 'activities', 'activityapplies', 'debates', 'videos', 'debateposts', 'attachments', 'favorites', 'mythreads', 'myposts', 'subscriptions', 'typeoptionvars', 'forumrecommend') as $value) { $db->query("DELETE FROM {$tablepre}{$value} WHERE tid IN ({$moderatetids})", 'UNBUFFERED'); } $updatemodlog = FALSE; } if ($globalstick && $stickmodify) { require_once DISCUZ_ROOT . './include/cache.func.php'; updatecache('globalstick'); } updateforumcount($fid); } elseif ($operation == 'close') { $expiration = checkexpiration($expirationclose); $modaction = $expiration ? 'ECL' : 'CLS'; $db->query("UPDATE {$tablepre}threads SET closed='1', moderated='1' WHERE tid IN ({$moderatetids})"); $db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ({$moderatetids}) AND action IN ('CLS','OPN','ECL','UCL','EOP','UEO')", 'UNBUFFERED');