function deletemember($uids, $delpost = true) { if (!$uids) { return; } require_once libfile('function/sec'); updateMemberOperate($uids, 2); if ($delpost) { deleteattach($uids, 'uid'); deletepost($uids, 'authorid'); } require_once libfile('function/forum'); foreach ($uids as $uid) { my_thread_log('deluser', array('uid' => $uid)); } $uids = dimplode($uids); $numdeleted = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member') . " WHERE uid IN ({$uids})"); foreach (array('common_member_field_forum', 'common_member_field_home', 'common_member_count', 'common_member_log', 'common_member_profile', 'common_member_verify', 'common_member_verify_info', 'common_member_status', 'common_member_validate', 'common_member_magic', 'forum_access', 'forum_moderator', 'common_member_action_log') as $table) { DB::delete($table, "uid IN ({$uids})"); } $doids = array(); $query = DB::query("SELECT * FROM " . DB::table('home_doing') . " WHERE uid IN ({$uids})"); while ($value = DB::fetch($query)) { $doids[$value['doid']] = $value['doid']; } $delsql = !empty($doids) ? "doid IN (" . dimplode($doids) . ") OR " : ""; DB::delete('home_docomment', "{$delsql} uid IN ({$uids})"); DB::delete('common_domain', "id IN ({$uids}) AND idtype='home'"); DB::delete('home_feed', "uid IN ({$uids}) OR (id IN ({$uids}) AND idtype='uid')"); DB::delete('home_notification', "uid IN ({$uids}) OR authorid IN ({$uids})"); DB::delete('home_poke', "uid IN ({$uids}) OR fromuid IN ({$uids})"); DB::delete('home_comment', "(uid IN ({$uids}) OR authorid IN ({$uids}) OR (id IN ({$uids}) AND idtype='uid'))"); DB::delete('home_visitor', "uid IN ({$uids}) OR vuid IN ({$uids})"); DB::delete('home_friend', "uid IN ({$uids}) OR fuid IN ({$uids})"); DB::delete('home_friend_request', "uid IN ({$uids}) OR fuid IN ({$uids})"); DB::delete('common_invite', "uid IN ({$uids}) OR fuid IN ({$uids})"); DB::delete('common_myinvite', "touid IN ({$uids}) OR fromuid IN ({$uids})"); DB::delete('common_moderate', "id IN (" . $uids . ") AND idtype='uid_cid'"); $query = DB::query("SELECT filepath, thumb, remote FROM " . DB::table('home_pic') . " WHERE uid IN ({$uids})"); while ($value = DB::fetch($query)) { $pics[] = $value; } deletepicfiles($pics); include_once libfile('function/home'); $query = DB::query("SELECT * FROM " . DB::table('home_album') . " WHERE uid IN ({$uids})"); while ($value = DB::fetch($query)) { pic_delete($value['pic'], 'album', 0, $value['picflag'] == 2 ? 1 : 0); } DB::query("DELETE FROM " . DB::table('common_mailcron') . ", " . DB::table('common_mailqueue') . " USING " . DB::table('common_mailcron') . ", " . DB::table('common_mailqueue') . " WHERE " . DB::table('common_mailcron') . ".touid IN ({$uids}) AND " . DB::table('common_mailcron') . ".cid=" . DB::table('common_mailqueue') . ".cid", 'UNBUFFERED'); foreach (array('home_doing', 'home_share', 'home_album', 'common_credit_rule_log', 'common_credit_rule_log_field', 'home_pic', 'home_blog', 'home_blogfield', 'home_class', 'home_clickuser', 'home_userapp', 'home_userappfield', 'home_show', 'common_member') as $table) { DB::delete($table, "uid IN ({$uids})"); } manyoulog('user', $uids, 'delete'); return $numdeleted; }
} require_once libfile('function/delete'); $deletes = deletethread($deletetids); updatemoderate('tid', $moderation['delete'], 2); } if ($moderation['validate']) { require_once libfile('function/forum'); $forums = array(); $validatetids = '\'' . implode('\',\'', $moderation['validate']) . '\''; $tids = $authoridarray = $moderatedthread = array(); $query = DB::query("SELECT t.fid, t.tid, t.authorid, t.subject, t.author, t.dateline, t.posttableid FROM " . DB::table('forum_thread') . " t\r\n\t\t\tWHERE t.tid IN ({$validatetids}) {$fidadd['and']}{$fidadd['t']}{$fidadd['fids']}"); while ($thread = DB::fetch($query)) { $posttable = $thread['posttableid'] ? "forum_post_{$thread['posttableid']}" : 'forum_post'; $poststatus = DB::result_first("SELECT status FROM " . DB::table($posttable) . " WHERE tid='{$thread['tid']}' AND first='1'"); $tids[] = $thread['tid']; my_thread_log('validate', array('tid' => $thread['tid'])); if (getstatus($poststatus, 3) == 0) { updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']); $attachcount = DB::result_first("SELECT COUNT(*) FROM " . DB::table(getattachtablebytid($thread['tid'])) . " WHERE tid='{$thread['tid']}'"); updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']); } $forums[] = $thread['fid']; $validatedthreads[] = $thread; $pm = 'pm_' . $thread['tid']; if (isset($_G['gp_' . $pm]) && $_G['gp_' . $pm] != '' && $thread['authorid']) { $pmlist[] = array('action' => 'modthreads_validate', 'notevar' => array('tid' => $thread['tid'], 'threadsubject' => $thread['subject'], 'reason' => dhtmlspecialchars($_G['gp_' . $pm])), 'authorid' => $thread['authorid']); } } if ($tids) { $tidstr = dimplode($tids); $validates = DB::query("UPDATE " . DB::table(getposttable()) . " SET status='4' WHERE tid IN ({$tidstr}) AND status='0' AND invisible='-2'");
/** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: forum_viewthread.php 30000 2012-05-07 04:11:29Z liulanbo $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } require_once libfile('function/forumlist'); require_once libfile('function/discuzcode'); require_once libfile('function/post'); $thread =& $_G['forum_thread']; $forum =& $_G['forum']; if (!$_G['forum_thread'] || !$_G['forum']) { my_thread_log('redelete', array('tid' => $_G['gp_tid'])); showmessage('thread_nonexistence'); } $page = max(1, $_G['page']); if ($_G['setting']['cachethreadlife'] && $_G['forum']['threadcaches'] && !$_G['uid'] && $page == 1 && !$_G['forum']['special'] && empty($_G['gp_do']) && !defined('IN_ARCHIVER') && !defined('IN_MOBILE')) { viewthread_loadcache(); } $threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array(); $threadtable_info = !empty($_G['cache']['threadtable_info']) ? $_G['cache']['threadtable_info'] : array(); $archiveid = $thread['threadtableid']; $thread['is_archived'] = $archiveid ? true : false; $thread['archiveid'] = $archiveid; $forum['threadtableid'] = $archiveid; $threadtable = $thread['threadtable']; $posttableid = $thread['posttableid']; $posttable = $thread['posttable'];
dunlink($attach); } require_once libfile('function/delete'); foreach (array('forum_thread', 'forum_threadmod', 'forum_relatedthread', 'forum_post', 'forum_poll', 'forum_polloption', 'forum_trade', 'forum_activity', 'forum_activityapply', 'forum_debate', 'forum_debatepost', 'forum_attachment', 'forum_typeoptionvar', 'forum_forumrecommend', 'forum_postposition') as $value) { if ($value == 'forum_post') { deletepost("tid IN ({$tids})", true); continue; } DB::query("DELETE FROM " . DB::table($value) . " WHERE tid IN ({$tids})", 'UNBUFFERED'); if ($value == 'attachments') { DB::query("DELETE FROM " . DB::table('forum_attachmentfield') . " WHERE tid IN ({$tids})", 'UNBUFFERED'); } } } if ($currow + $pp > $total) { my_thread_log('delforum', array('fid' => $fid)); DB::query("DELETE FROM " . DB::table('forum_forum') . " WHERE fid='{$fid}'"); DB::query("DELETE FROM " . DB::table('forum_forumfield') . " WHERE fid='{$fid}'"); DB::query("DELETE FROM " . DB::table('forum_moderator') . " WHERE fid='{$fid}'"); DB::query("DELETE FROM " . DB::table('forum_access') . " WHERE fid='{$fid}'"); echo 'TRUE'; exit; } echo 'GO'; exit; } else { if ($_G['gp_finished']) { updatecache('forums'); cpmsg('forums_delete_succeed', 'action=forums', 'succeed'); } if (DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_forum') . " WHERE fup='{$fid}'")) {
if (!($moderatetids = implode(',', $moderate))) { showmessage('admin_succeed', $_G['referer']); } $modaction = 'REG'; } if (in_array($operation, array('stick', 'highlight', 'digest', 'bump', 'down', 'delete', 'move', 'close', 'open'))) { foreach ($_G['gp_moderate'] as $tid) { if (!($tid = max(0, intval($tid)))) { continue; } $my_opt = $operation == 'stick' ? 'sticky' : $operation; $data = array('tid' => $tid); if ($my_opt == 'move') { $data['otherid'] = $toforum['fid']; } my_thread_log($my_opt, $data); } } 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');
function undeletethreads($tids) { global $_G; $threadsundel = 0; if ($tids && is_array($tids)) { foreach ($tids as $t) { my_thread_log('restore', array('tid' => $t)); } $tids = '\'' . implode('\',\'', $tids) . '\''; $tuidarray = $ruidarray = $fidarray = $posttabletids = array(); $query = DB::query('SELECT tid, posttableid FROM ' . DB::table('forum_thread') . " WHERE tid IN ({$tids})"); while ($thread = DB::fetch($query)) { $posttabletids[$thread['posttableid'] ? $thread['posttableid'] : 0][] = $thread['tid']; } foreach ($posttabletids as $posttableid => $ptids) { $query = DB::query('SELECT fid, first, authorid FROM ' . DB::table(getposttable($posttableid)) . " WHERE tid IN (" . dimplode($ptids) . ")"); while ($post = DB::fetch($query)) { if ($post['first']) { $tuidarray[] = $post['authorid']; } else { $ruidarray[] = $post['authorid']; } if (!in_array($post['fid'], $fidarray)) { $fidarray[] = $post['fid']; } } updatepost(array('invisible' => '0'), "tid IN (" . dimplode($ptids) . ")", true, $posttableid); } if ($tuidarray) { updatepostcredits('+', $tuidarray, 'post'); } if ($ruidarray) { updatepostcredits('+', $ruidarray, 'reply'); } DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='0', moderated='1' WHERE tid IN ({$tids})"); $threadsundel = DB::affected_rows(); updatemodlog($tids, 'UDL'); updatemodworks('UDL', $threadsundel); foreach ($fidarray as $fid) { updateforumcount($fid); } } return $threadsundel; }
$_G['gp_banexpirynew'] = $_G['gp_banexpirynew'] > TIMESTAMP ? $_G['gp_banexpirynew'] : 0; if ($_G['gp_banexpirynew']) { $member['groupterms']['main'] = array('time' => $_G['gp_banexpirynew'], 'adminid' => $member['adminid'], 'groupid' => $member['groupid']); $member['groupterms']['ext'][$groupidnew] = $_G['gp_banexpirynew']; $sql .= ', groupexpiry=\'' . groupexpiry($member['groupterms']) . '\''; } else { $sql .= ', groupexpiry=0'; } $adminidnew = -1; $_G['gp_delpost'] = array('uid' => $member['uid'], 'expiry' => groupexpiry($member['groupterms'])); if ($_G['gp_delpost']) { $my_data['otherid'] = 1; } my_thread_log('banuser', $my_data); } elseif ($member['groupid'] == 4 || $member['groupid'] == 5) { my_thread_log('unbanuser', array('uid' => $member['uid'])); if (!empty($member['groupterms']['main']['groupid'])) { $groupidnew = $member['groupterms']['main']['groupid']; $adminidnew = $member['groupterms']['main']['adminid']; unset($member['groupterms']['main']); unset($member['groupterms']['ext'][$member['groupid']]); $sql .= ', groupexpiry=\'' . groupexpiry($member['groupterms']) . '\''; } else { $groupidnew = DB::result_first("SELECT groupid FROM " . DB::table('common_usergroup') . " WHERE type='member' AND creditshigher<='{$member['credits']}' AND creditslower>'{$member['credits']}'"); $adminidnew = 0; } } else { $groupidnew = $member['groupid']; $adminidnew = $member['adminid']; } $sql .= ", adminid='{$adminidnew}', groupid='{$groupidnew}'";
$pids = array(); while ($post = DB::fetch($query)) { if (in_array($i, $nos)) { $pids[] = $post['pid']; } $i++; } if (!($pids = implode(',', $pids))) { showmessage('admin_split_new_invalid'); } $modaction = 'SPL'; $reason = checkreasonpm(); $subject = dhtmlspecialchars($_G['gp_subject']); DB::query("INSERT INTO " . DB::table('forum_thread') . " (fid, posttableid, subject) VALUES ('{$_G['fid']}', '{$posttableid}', '{$subject}')"); $newtid = DB::insert_id(); my_thread_log('split', array('tid' => $_G['tid'])); foreach ((array) explode(',', $pids) as $pid) { my_post_log('split', array('pid' => $pid)); } DB::query("UPDATE " . DB::table($posttable) . " SET tid='{$newtid}' WHERE pid IN ({$pids})"); DB::query("UPDATE " . DB::table('forum_attachment') . " SET tid='{$newtid}' WHERE pid IN ({$pids})"); $splitauthors = array(); $query = DB::query("SELECT pid, tid, authorid, subject, dateline FROM " . DB::table($posttable) . " WHERE tid='{$newtid}' AND invisible='0' GROUP BY authorid ORDER BY dateline"); while ($splitauthor = DB::fetch($query)) { $splitauthor['subject'] = $subject; $splitauthors[] = $splitauthor; } DB::query("UPDATE " . DB::table($posttable) . " SET first='1', subject='{$subject}' WHERE pid='" . $splitauthors[0]['pid'] . "'", 'UNBUFFERED'); $fpost = DB::fetch_first("SELECT pid, author, authorid, dateline FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' ORDER BY dateline LIMIT 1"); DB::query("UPDATE " . DB::table('forum_thread') . " SET author='" . addslashes($fpost['author']) . "', authorid='{$fpost['authorid']}', dateline='{$fpost['dateline']}', moderated='1' WHERE tid='{$_G['tid']}'"); DB::query("UPDATE " . DB::table($posttable) . " SET subject='" . addslashes($thread['subject']) . "' WHERE pid='{$fpost['pid']}'");
if ($_G['gp_reason'] != '' && $thread['authorid'] && $thread['authorid'] != $_G['uid']) { $pmlist[] = array('act' => 'modthreads_delete', 'notevar' => array('reason' => dhtmlspecialchars($_G['gp_reason']), 'threadsubject' => $thread['subject']), 'authorid' => $thread['authorid']); } } if ($recyclebintids) { DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='-1', moderated='1' WHERE tid IN ({$recyclebintids})"); updatemodworks('MOD', DB::affected_rows()); updatepost(array('invisible' => '-1'), "tid IN ({$recyclebintids})", true, 0); updatemodlog($recyclebintids, 'DEL'); } require_once libfile('function/delete'); deletethread($deletetids); updatemoderate('tid', $moderation['delete'], 2); } foreach ($moderation['validate'] as $tid) { my_thread_log('validate', array('tid' => $tid)); } if ($validatetids = dimplode($moderation['validate'])) { $tids = $moderatedthread = array(); $query = DB::query("SELECT t.fid, t.tid, t.authorid, t.subject, t.author, t.dateline FROM " . DB::table('forum_thread') . " t\r\n\t\t\t\tWHERE t.tid IN ({$validatetids}) AND t.displayorder='{$pstat}' AND " . ($modfidsadd ? "t.{$modfidsadd}" : '1')); while ($thread = DB::fetch($query)) { $tids[] = $thread['tid']; updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']); $validatedthreads[] = $thread; if ($_G['gp_reason'] != '' && $thread['authorid'] && $thread['authorid'] != $_G['uid']) { $pmlist[] = array('act' => 'modthreads_validate', 'notevar' => array('reason' => dhtmlspecialchars($_G['gp_reason']), 'tid' => $thread['tid'], 'threadsubject' => $thread['subject']), 'authorid' => $thread['authorid']); } } if ($tids) { $tidstr = dimplode($tids); updatepost(array('invisible' => '0'), "tid IN ({$tidstr}) AND first='1'", true, 0);
$result[$key] = isset($_G['gp_' . $key]) ? dhtmlspecialchars($_G['gp_' . $key]) : ''; } $threadoptionselect = array('', '', '', '', '', '', '', '', '', '', 999 => '', 888 => ''); $threadoptionselect[$threadoption] = 'selected'; $postlist = array(); $total = $multipage = ''; $cachekey = 'srchresult_recycle_thread' . $_G['fid']; if ($_G['fid'] && $_G['forum']['ismoderator'] && $modforums['recyclebins'][$_G['fid']]) { $srchupdate = false; if (in_array($_G['adminid'], array(1, 2, 3)) && ($op == 'delete' || $op == 'restore') && submitcheck('dosubmit')) { if ($ids = dimplode($_G['gp_moderate'])) { $query = DB::query("SELECT tid FROM " . DB::table('forum_thread') . " WHERE tid IN({$ids}) AND fid='{$_G['fid']}' AND displayorder='-1'"); while ($tid = DB::fetch($query)) { $tidarray[] = $tid['tid']; if ($op == 'restore') { my_thread_log('restore', array('tid' => $tid['tid'])); } } if ($tidarray) { if ($op == 'delete' && $_G['group']['allowclearrecycle']) { require_once libfile('function/delete'); deletethread($tidarray); } if ($op == 'restore') { require_once libfile('function/post'); undeletethreads($tidarray); } if ($_G['gp_oldop'] == 'search') { $srchupdate = true; } }
showmessage('special_noaction'); } if ($othertid == $_G['tid'] || $_G['adminid'] == 3 && $other['fid'] != $_G['forum']['fid']) { showmessage('admin_merge_invalid'); } $other['views'] = intval($other['views']); $other['replies']++; $firstpost = DB::fetch_first("SELECT pid, fid, authorid, author, subject, dateline FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' AND invisible='0' ORDER BY dateline LIMIT 1"); DB::query("UPDATE " . DB::table($posttable) . " SET tid='{$_G['tid']}' WHERE tid='{$othertid}'"); $postsmerged = DB::affected_rows(); DB::query("UPDATE " . DB::table('forum_attachment') . " SET tid='{$_G['tid']}' WHERE tid='{$othertid}'"); DB::query("DELETE FROM " . DB::table('forum_thread') . " WHERE tid='{$othertid}'"); DB::query("DELETE FROM " . DB::table('forum_threadmod') . " WHERE tid='{$othertid}'"); DB::query("UPDATE " . DB::table($posttable) . " SET first=(pid='{$firstpost['pid']}'), fid='{$firstpost['fid']}' WHERE tid='{$_G['tid']}'"); DB::query("UPDATE " . DB::table('forum_thread') . " SET authorid='{$firstpost['authorid']}', author='" . addslashes($firstpost['author']) . "', subject='" . addslashes($firstpost['subject']) . "', dateline='{$firstpost['dateline']}', views=views+{$other['views']}, replies=replies+{$other['replies']}, moderated='1' WHERE tid='{$_G['tid']}'"); my_thread_log('merge', array('tid' => $othertid, 'otherid' => $_G['tid'], 'fid' => $thread['fid'])); if ($_G['fid'] == $other['fid']) { DB::query("UPDATE " . DB::table('forum_forum') . " SET threads=threads-1 WHERE fid='{$_G['fid']}'"); } else { DB::query("UPDATE " . DB::table('forum_forum') . " SET threads=threads-1, posts=posts-{$postsmerged} WHERE fid='{$other['fid']}'"); DB::query("UPDATE " . DB::table('forum_forum') . " SET posts={$posts}+{$postsmerged} WHERE fid='{$_G['fid']}'"); } $_G['forum']['threadcaches'] && deletethreadcaches($thread['tid']); $modpostsnum++; $resultarray = array('redirect' => "forum.php?mod=forumdisplay&fid={$_G['fid']}", 'reasonpm' => $sendreasonpm ? array('data' => array($thread), 'var' => 'thread', 'item' => 'reason_merge') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason)), 'modtids' => $thread['tid'], 'modlog' => array($thread, $other)); } } elseif ($_G['gp_action'] == 'copy' && $_G['group']['allowcopythread'] && $thread) { if (!submitcheck('modsubmit')) { require_once libfile('function/forumlist'); $forumselect = forumselect(); include template('forum/topicadmin_action');
unset($member['groupterms']['main']); unset($member['groupterms']['ext'][$member['groupid']]); $sql .= ', groupexpiry=\'' . groupexpiry($member['groupterms']) . '\''; } else { $query = DB::query("SELECT groupid FROM " . DB::table('common_usergroup') . " WHERE type='member' AND creditshigher<='{$member['credits']}' AND creditslower>'{$member['credits']}'"); $groupidnew = DB::result($query, 0); $adminidnew = 0; } } else { $groupidnew = $member['groupid']; $adminidnew = $member['adminid']; } $sql .= ", adminid='{$adminidnew}', groupid='{$groupidnew}'"; DB::query("UPDATE " . DB::table('common_member') . " SET {$sql} WHERE uid='{$member['uid']}'"); $my_opt = in_array($groupidnew, array(4, 5)) ? 'banuser' : 'unbanuser'; my_thread_log($my_opt, array('uid' => $member['uid'])); if (DB::affected_rows()) { savebanlog($member['username'], $member['groupid'], $groupidnew, $banexpirynew, $reason); } DB::query("UPDATE " . DB::table('common_member_field_forum') . " SET groupterms='" . ($member['groupterms'] ? addslashes(serialize($member['groupterms'])) : '') . "' WHERE uid='{$member['uid']}'"); acpmsg('modcp_member_ban_succeed', "{$cpscript}?mod=modcp&action={$_G['gp_action']}&op={$op}"); } } elseif ($op == 'ipban' && $_G['group']['allowbanip']) { require_once libfile('function/misc'); $iptoban = getgpc('ip') ? dhtmlspecialchars(explode('.', getgpc('ip'))) : array('', '', '', ''); $updatecheck = $addcheck = $deletecheck = $adderror = 0; if (submitcheck('ipbansubmit')) { $_G['gp_delete'] = isset($_G['gp_delete']) ? $_G['gp_delete'] : ''; if ($ids = dimplode($_G['gp_delete'])) { DB::query("DELETE FROM " . DB::table('common_banned') . " WHERE id IN ({$ids}) AND ('{$_G['adminid']}'='1' OR admin='{$_G['username']}')"); $deletecheck = DB::affected_rows();
function deletemember($uids, $other = 1) { $query = DB::query("DELETE FROM " . DB::table('common_member') . " WHERE uid IN ({$uids})"); $numdeleted = DB::affected_rows(); DB::query("DELETE FROM " . DB::table('common_member_field_forum') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('common_member_field_home') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('common_member_count') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('common_member_log') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('common_member_profile') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('common_member_security') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('common_member_status') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('common_member_validate') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('forum_access') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('forum_moderator') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); if ($other) { DB::query("DELETE FROM " . DB::table('common_member_validate') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('common_member_magic') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); $query = DB::query("SELECT uid, attachment, thumb, remote, aid FROM " . DB::table('forum_attachment') . " WHERE uid IN ({$uids})"); while ($attach = DB::fetch($query)) { dunlink($attach); } DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); DB::query("DELETE FROM " . DB::table('forum_attachmentfield') . " WHERE uid IN ({$uids})", 'UNBUFFERED'); deletepost("authorid IN ({$uids})", true, false); } DB::query("DELETE FROM " . DB::table('home_feed') . " WHERE uid IN ({$uids}) OR (id IN ({$uids}) AND idtype='uid')"); $doids = array(); $query = DB::query("SELECT * FROM " . DB::table('home_doing') . " WHERE uid IN ({$uids})"); while ($value = DB::fetch($query)) { $doids[$value['doid']] = $value['doid']; } DB::query("DELETE FROM " . DB::table('home_doing') . " WHERE uid IN ({$uids})"); $delsql = !empty($doids) ? "doid IN (" . dimplode($doids) . ") OR " : ""; DB::query("DELETE FROM " . DB::table('home_docomment') . " WHERE {$delsql} uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('home_share') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('home_album') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('common_credit_rule_log') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('common_credit_rule_log_field') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('home_notification') . " WHERE (uid IN ({$uids}) OR authorid IN ({$uids}))"); DB::query("DELETE FROM " . DB::table('home_poke') . " WHERE (uid IN ({$uids}) OR fromuid IN ({$uids}))"); $query = DB::query("SELECT filepath, thumb, remote FROM " . DB::table('home_pic') . " WHERE uid IN ({$uids})"); while ($value = DB::fetch($query)) { deletepicfiles($value); } DB::query("DELETE FROM " . DB::table('home_pic') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('home_blog') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('home_blogfield') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('home_comment') . " WHERE (uid IN ({$uids}) OR authorid IN ({$uids}) OR (id IN ({$uids}) AND idtype='uid'))"); DB::query("DELETE FROM " . DB::table('home_visitor') . " WHERE (uid IN ({$uids}) OR vuid IN ({$uids}))"); DB::query("DELETE FROM " . DB::table('home_class') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('home_friend') . " WHERE (uid IN ({$uids}) OR fuid IN ({$uids}))"); DB::query("DELETE FROM " . DB::table('home_clickuser') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('common_invite') . " WHERE (uid IN ({$uids}) OR fuid IN ({$uids}))"); DB::query("DELETE FROM " . DB::table('common_mailcron') . ", " . DB::table('common_mailqueue') . " USING " . DB::table('common_mailcron') . ", " . DB::table('common_mailqueue') . " WHERE " . DB::table('common_mailcron') . ".touid IN ({$uids}) AND " . DB::table('common_mailcron') . ".cid=" . DB::table('common_mailqueue') . ".cid"); DB::query("DELETE FROM " . DB::table('common_myinvite') . " WHERE (touid IN ({$uids}) OR fromuid IN ({$uids}))"); DB::query("DELETE FROM " . DB::table('home_userapp') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('home_userappfield') . " WHERE uid IN ({$uids})"); DB::query("DELETE FROM " . DB::table('home_show') . " WHERE uid IN ({$uids})"); manyoulog('user', $uids, 'delete'); require_once libfile('function/forum'); foreach (explode(',', $uids) as $uid) { my_thread_log('deluser', array('uid' => $uid)); } return $numdeleted; }
if ($_G['forum']['threadcaches']) { deletethreadcaches($_G['tid']); } $param = array('fid' => $_G['fid'], 'tid' => $_G['tid'], 'pid' => $pid); dsetcookie('clearUserdata', 'forum'); if ($_G['forum_auditstatuson']) { if ($audit == 1) { updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid, '2'); showmessage('auditstatuson_succeed', $redirecturl, $param); } else { updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid); showmessage('audit_edit_succeed', '', $param); } } else { if (!empty($_G['gp_delete']) && $isfirstpost) { my_thread_log('delete', array('tid' => $_G['tid'])); showmessage('post_edit_delete_succeed', "forum.php?mod=forumdisplay&fid={$_G['fid']}", $param); } elseif (!empty($_G['gp_delete'])) { my_post_log('delete', array('pid' => $pid)); showmessage('post_edit_delete_succeed', "forum.php?mod=viewthread&tid={$_G['tid']}&page={$_G['gp_page']}&extra={$extra}" . ($vid && $isfirstpost ? "&vid={$vid}" : ''), $param); } else { if ($isfirstpost && $modnewthreads) { updatemoderate('tid', $_G['tid']); showmessage('edit_newthread_mod_succeed', $redirecturl, $param); } elseif (!$isfirstpost && $modnewreplies) { updatemoderate('pid', $pid); showmessage('edit_reply_mod_succeed', "forum.php?mod=forumdisplay&fid={$_G['fid']}", $param); } else { if ($pinvisible != -3) { my_post_log('update', array('pid' => $pid)); }
} } if ($ruidarray) { foreach ($ruidarray as $fid => $uids) { $_G['fid'] = $fid; updatepostcredits('-', $uids, 'reply'); } } require_once libfile('function/delete'); deletethread($moderate); DB::query("DELETE FROM " . DB::table('forum_postcomment') . " WHERE {$tidsadd} AND authorid='{$space['uid']}'"); foreach ($fids as $fid) { updateforumcount(intval($fid)); } foreach ($moderate as $tid) { my_thread_log('delete', array('tid' => $tid)); } $_G['cache']['space_thread'][$alltype] = array(); save_syscache('space_thread', $_G['cache']['space_thread']); showmessage('thread_delete_succeed', 'home.php?mod=space&uid=' . $space['uid'] . '&do=thread&view=all'); } } $orderactives = array($_G['gp_order'] => ' class="a"'); } elseif ($_G['gp_view'] == 'me') { if ($_GET['from'] == 'space') { $diymode = 1; } $viewtype = in_array($_G['gp_type'], array('reply', 'thread', 'postcomment')) ? $_G['gp_type'] : 'thread'; $filter = in_array($_G['gp_filter'], array('recyclebin', 'ignored', 'save', 'aduit', 'close', 'common')) ? $_G['gp_filter'] : ''; if ($viewtype == 'thread') { $statusfield = 'displayorder';
$sql .= ', groupexpiry=\'' . groupexpiry($member['groupterms']) . '\''; } $groupidnew = DB::result_first("SELECT groupid FROM " . DB::table('common_usergroup') . " WHERE type='member' AND creditshigher<='{$member['credits']}' AND creditslower>'{$member['credits']}'"); $adminidnew = 0; } else { $update = false; $groupidnew = $member['groupid']; $adminidnew = $member['adminid']; if (in_array('avatar', $_G['gp_clear'])) { $sql .= ', avatarstatus=\'0\''; loaducenter(); uc_user_deleteavatar($member['uid']); } } if (!empty($my_data) && !empty($mylogtype)) { my_thread_log($mylogtype, $my_data); } $sql .= ", adminid='{$adminidnew}', groupid='{$groupidnew}', status='" . ($_G['gp_bannew'] == 'status' ? -1 : 0) . "'"; DB::query("UPDATE " . DB::table('common_member') . " SET {$sql} WHERE uid='{$member['uid']}'"); if ($_G['group']['allowbanuser'] && DB::affected_rows()) { banlog($member['username'], $member['groupid'], $groupidnew, $_G['gp_banexpirynew'], $reason, $_G['gp_bannew'] == 'status' ? -1 : 0); } DB::query("UPDATE " . DB::table('common_member_field_forum') . " SET groupterms='" . ($member['groupterms'] ? addslashes(serialize($member['groupterms'])) : '') . "' WHERE uid='{$member['uid']}'"); if ($_G['adminid'] == 1 && !empty($_G['gp_clear']) && is_array($_G['gp_clear'])) { require_once libfile('function/delete'); $membercount = array(); if (in_array('post', $_G['gp_clear'])) { if ($member['uid']) { require_once libfile('function/post'); $tidsdelete = array(); loadcache('posttableids');
if ($_G['gp_digest_level'] == 0 && $thread['digest'] > 0) { $extsql = array('digestposts' => -1); } updatecreditbyaction('digest', $thread['authorid'], $extsql, '', $_G['gp_digest_level'] - $thread['digest'], 1, $thread['fid']); } DB::query("UPDATE " . DB::table('forum_thread') . " SET digest='{$_G['gp_digest_level']}' WHERE {$tidsadd}"); $my_act = $_G['gp_digest_level'] ? 'digest' : 'update'; foreach ($_G['gp_tidarray'] as $tid) { my_thread_log($my_act, array('tid' => $tid)); } $cpmsg = cplang('threads_succeed'); } elseif ($optype == 'addstatus') { DB::query("UPDATE " . DB::table('forum_thread') . " SET closed='{$_G['gp_status']}' WHERE {$tidsadd}"); $my_opt = $_G['gp_status'] ? 'close' : 'open'; foreach ($_G['gp_tidarray'] as $tid) { my_thread_log($my_opt, array('tid' => $tid)); } $cpmsg = cplang('threads_succeed'); } elseif ($operation == 'forumstick') { shownav('topic', 'threads_forumstick'); loadcache(array('forums', 'grouptype')); $forumstickthreads = DB::result_first("SELECT svalue FROM " . DB::table('common_setting') . " WHERE skey='forumstickthreads'"); $forumstickthreads = isset($forumstickthreads) ? unserialize($forumstickthreads) : array(); if (!submitcheck('forumsticksubmit')) { showsubmenu('threads_forumstick', array(array('admin', 'threads&operation=forumstick', !$do), array('add', 'threads&operation=forumstick&do=add', $do == 'add'))); showtips('threads_forumstick_tips'); if (!$do) { showformheader('threads&operation=forumstick'); showtableheader('admin', 'fixpadding'); showsubtitle(array('', 'subject', 'threads_forumstick_forum', 'threads_forumstick_group', 'edit')); if (is_array($forumstickthreads)) {
function undeletethreads($tids) { global $_G; $threadsundel = 0; if ($tids && is_array($tids)) { foreach ($tids as $t) { my_thread_log('restore', array('tid' => $t)); } $tids = '\'' . implode('\',\'', $tids) . '\''; $tuidarray = $ruidarray = $fidarray = array(); $postarray = getfieldsofposts('fid, first, authorid', "tid IN ({$tids})"); foreach ($postarray as $post) { if ($post['first']) { $tuidarray[] = $post['authorid']; } else { $ruidarray[] = $post['authorid']; } if (!in_array($post['fid'], $fidarray)) { $fidarray[] = $post['fid']; } } if ($tuidarray) { updatepostcredits('+', $tuidarray, 'post'); } if ($ruidarray) { updatepostcredits('+', $ruidarray, 'reply'); } updatepost(array('invisible' => '0'), "tid IN ({$tids})", true); DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='0', moderated='1' WHERE tid IN ({$tids})"); $threadsundel = DB::affected_rows(); updatemodlog($tids, 'UDL'); updatemodworks('UDL', $threadsundel); foreach ($fidarray as $fid) { updateforumcount($fid); } } return $threadsundel; }
break; case 'TOK': $actionarray['UES'][] = $expiry['tid']; break; case 'CCK': $actionarray['UEH'][] = $expiry['tid']; break; case 'CLK': $actionarray['UEC'][] = $expiry['tid']; break; case 'SPA': $actionarray['SPD'][] = $expiry['tid']; break; } if (in_array($expiry['action'], array('UES', 'UES'))) { my_thread_log('cron', array('tid' => $expiry['tid'])); } } if ($actionarray) { foreach ($actionarray as $action => $tids) { $tids = implode(',', $tids); switch ($action) { case 'UES': DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='0' WHERE tid IN ({$tids})", 'UNBUFFERED'); DB::query("UPDATE " . DB::table('forum_threadmod') . " SET status='0' WHERE tid IN ({$tids}) AND action IN ('EST', 'TOK')", 'UNBUFFERED'); require_once libfile('function/cache'); updatecache('globalstick'); break; case 'UEH': DB::query("UPDATE " . DB::table('forum_thread') . " SET highlight='0' WHERE tid IN ({$tids})", 'UNBUFFERED'); DB::query("UPDATE " . DB::table('forum_threadmod') . " SET status='0' WHERE tid IN ({$tids}) AND action IN ('EHL', 'CCK')", 'UNBUFFERED');