Beispiel #1
0
 function usesubmit()
 {
     global $_G;
     if (empty($_GET['pid'])) {
         showmessage(lang('magic/repent', 'repent_info_nonexistence'));
     }
     $_G['tid'] = $_GET['ptid'];
     $post = getpostinfo($_GET['pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status'));
     $this->_check($post);
     require_once libfile('function/post');
     require_once libfile('function/delete');
     if ($post['first']) {
         if ($have_replycredit = C::t('forum_replycredit')->fetch($post['tid'])) {
             $thread = C::t('forum_thread')->fetch($post['tid']);
             if ($thread['replycredit']) {
                 updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit));
             }
             C::t('forum_replycredit')->delete($post['tid']);
             C::t('common_credit_log')->delete_by_operation_relatedid(array('RCT', 'RCA', 'RCB'), $post['tid']);
         }
         deletethread(array($post['tid']));
         updateforumcount($post['fid']);
     } else {
         if ($post['replycredit'] > 0) {
             updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit']));
             C::t('common_credit_log')->delete_by_uid_operation_relatedid($post['authorid'], 'RCA', $post['tid']);
         }
         deletepost(array($_GET['pid']));
         updatethreadcount($post['tid']);
     }
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']);
     showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
 }
Beispiel #2
0
 function usesubmit()
 {
     global $_G;
     if (empty($_G['gp_pid'])) {
         showmessage(lang('magic/repent', 'repent_info_nonexistence'));
     }
     $_G['tid'] = $_G['gp_ptid'];
     $post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status'));
     $this->_check($post);
     require_once libfile('function/post');
     require_once libfile('function/delete');
     if ($post['first']) {
         if ($have_replycredit = DB::fetch_first("SELECT * FROM " . DB::table('forum_replycredit') . " WHERE tid ='{$post['tid']}' LIMIT 1")) {
             if ($replycredit = DB::result_first("SELECT replycredit FROM " . DB::table('forum_thread') . " WHERE tid = '{$post['tid']}'")) {
                 updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit));
             }
             DB::delete('forum_replycredit', "tid = '{$post['tid']}'");
             DB::delete('common_credit_log', "operation IN ('RCT', 'RCA', 'RCB') AND relatedid IN({$post['tid']})");
         }
         deletethread(array($post['tid']));
         updateforumcount($post['fid']);
     } else {
         if ($post['replycredit'] > 0) {
             updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit']));
             DB::delete('common_credit_log', "uid = '{$post['authorid']}' AND operation = 'RCA' AND relatedid IN({$post['tid']})");
         }
         deletepost(array($_G['gp_pid']));
         updatethreadcount($post['tid']);
     }
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']);
     showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
 }
Beispiel #3
0
	protected function _handleEvilPost($tid, $pid, $evilType, $evilLevel = 1) {

/*vot*/		include_once DISCUZ_ROOT.'./source/language/'.DISCUZ_LANG.'/lang_admincp_cloud.php';

		$securityService = Cloud::loadClass('Service_Security');
		$securityService->writeLog($pid, 'pid');

		$evilPost = C::t('#security#security_evilpost')->fetch($pid);

		if (count($evilPost)) {
			return true;
		} else {
			require_once libfile('function/delete');
			require_once libfile('function/forum');
			require_once libfile('function/post');

			$data = array('pid' => $pid, 'tid' => $tid, 'evilcount' => 1, 'eviltype' => $evilType, 'createtime' => TIMESTAMP);
			$post = get_post_by_pid($pid);

			if (is_array($post) && count($post) > 0) {
				if ($tid != $post['tid']) {
					return false;
				}

				$thread = get_thread_by_tid($tid);

				if ($post['first']) {
					$data['type'] = 1;
					if ($this->_checkThreadIgnore($tid)) {
						return false;
					}
					C::t('#security#security_evilpost')->insert($data, false, true);
					$this->_updateEvilCount('thread');
					deletethread(array($tid), true, true, true);
					updatemodlog($tid, 'DEL', 0, 1, $extend_lang['security_modreason']);
				} else {
					$data['type'] = 0;
					if ($this->_checkPostIgnore($pid, $post)) {
						return false;
					}
					C::t('#security#security_evilpost')->insert($data, false, true);
					$this->_updateEvilCount('post');

					deletepost(array($pid), 'pid', true, false, true);
				}
				if(!empty($post['authorid'])) {
					$data = array('uid' => $post['authorid'], 'createtime' => TIMESTAMP);
					C::t('#security#security_eviluser')->insert($data, false, true);
				}
			} else {
				$data['operateresult'] = 2;
				C::t('#security#security_evilpost')->insert($data, false, true);
			}
		}

		return true;
	}
Beispiel #4
0
function deleteThreadAndSeed($tid)
{
    $tbl = DB::table("ngpt_seed");
    $sql = <<<SQL
DELETE FROM {$tbl} WHERE tid={$tid};
SQL;
    DB::query($sql);
    deletethread(array($tid));
}
Beispiel #5
0
 function usesubmit()
 {
     global $_G;
     if (empty($_G['gp_pid'])) {
         showmessage(lang('magic/repent', 'repent_info_nonexistence'));
     }
     $_G['tid'] = $_G['gp_ptid'];
     $post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid'));
     $this->_check($post);
     require_once libfile('function/post');
     require_once libfile('function/delete');
     if ($post['first']) {
         deletethread("tid='{$post['tid']}'");
         updateforumcount($post['fid']);
     } else {
         deletepost("pid='{$_G['gp_pid']}'");
         updatethreadcount($post['tid']);
     }
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']);
     showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('showdialog' => 1, 'locationtime' => 1));
 }
        ?>
');parent.$('rbsearchform').searchsubmit.click();</script>
<?php 
    }
} elseif ($operation == 'clean') {
    if (!submitcheck('rbsubmit')) {
        shownav('topic', 'nav_recyclebin');
        showsubmenu('nav_recyclebin', array(array('recyclebin_list', 'recyclebin', 0), array('search', 'recyclebin&operation=search', 0), array('clean', 'recyclebin&operation=clean', 1)));
        showformheader('recyclebin&operation=clean');
        showtableheader('recyclebin_clean');
        showsetting('recyclebin_clean_days', 'days', '30', 'text');
        showsubmit('rbsubmit');
        showtablefooter();
        showformfooter();
    } else {
        $deletetids = array();
        $timestamp = TIMESTAMP;
        $query = DB::query("SELECT tm.tid FROM " . DB::table('forum_threadmod') . " tm, " . DB::table('forum_thread') . " t\n\t\t\tWHERE tm.action='DEL' AND tm.dateline<{$timestamp}-" . intval($_G['gp_days']) * 86400 . " AND t.tid=tm.tid AND t.displayorder='-1'");
        while ($thread = DB::fetch($query)) {
            $deletetids[] = $thread['tid'];
        }
        require_once libfile('function/delete');
        $threadsdel = deletethread($deletetids);
        $threadsundel = 0;
        if ($threadsdel) {
            cpmsg('recyclebin_succeed', 'action=recyclebin&operation=clean', 'succeed', array('threadsdel' => $threadsdel, 'threadsundel' => $threadsundel));
        } else {
            cpmsg('recyclebin_nothread', 'action=recyclebin&operation=clean', 'error');
        }
    }
}
                 }
                 foreach ($pidsdelete as $key => $pid) {
                     if (in_array($pidsthread[$pid], $tidsdelete)) {
                         unset($pidsdelete[$key]);
                         unset($prune['thread'][$pidsthread[$pid]]);
                         updatemodlog($pidsthread[$pid], 'DEL');
                     } else {
                         updatemodlog($pidsthread[$pid], 'DLP');
                     }
                 }
             }
             deletepost($pidsdelete, 'pid', false, $posttableid, true);
         }
         unset($postlist);
         if ($tidsdelete) {
             deletethread($tidsdelete, true, true, true);
         }
         if (!empty($prune)) {
             foreach ($prune['thread'] as $tid => $decrease) {
                 updatethreadcount($tid);
             }
             foreach (array_unique($prune['forums']) as $fid) {
             }
         }
         if ($_G['setting']['globalstick']) {
             updatecache('globalstick');
         }
     }
     $membercount['posts'] = 0;
     $membercount['threads'] = 0;
 }
Beispiel #8
0
             $recyclebintids .= ',' . $thread['tid'];
         } else {
             $deletetids[] = $thread['tid'];
         }
         if ($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
             $pmlist[] = array('act' => 'modthreads_delete', 'notevar' => array('reason' => dhtmlspecialchars($_GET['reason']), 'threadsubject' => $thread['subject']), 'authorid' => $thread['authorid']);
         }
     }
     if ($recyclebintids) {
         $rows = C::t('forum_thread')->update(explode(',', $recyclebintids), array('displayorder' => -1, 'moderated' => 1));
         updatemodworks('MOD', $rows);
         C::t('forum_post')->update_by_tid(0, explode(',', $recyclebintids), array('invisible' => -1), true);
         updatemodlog($recyclebintids, 'DEL');
     }
     require_once libfile('function/delete');
     deletethread($deletetids);
     updatemoderate('tid', $moderation['delete'], 2);
 }
 if ($validatetids = dimplode($moderation['validate'])) {
     $tids = $moderatedthread = array();
     foreach (C::t('forum_thread')->fetch_all_by_tid_displayorder($moderation['validate'], $pstat, '=', $modfids ? explode(',', $modfids) : null) as $thread) {
         $tids[] = $thread['tid'];
         $poststatus = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
         $poststatus = $poststatus['status'];
         if (getstatus($poststatus, 3) == 0) {
             updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
             $attachcount = C::t('forum_attachment_n')->count_by_id('tid:' . $thread['tid'], 'tid', $thread['tid']);
             updatecreditbyaction('postattach', $thread['authorid'], array(), '', $attachcount, 1, $thread['fid']);
         }
         $validatedthreads[] = $thread;
         if ($thread['authorid'] && $thread['authorid'] != $_G['uid']) {
                }
                $multipage = multi($threadcount, $lpp, $page, $mpurl, 0, 3);
            }
            showformheader('threadtypes&operation=content');
            showtableheader('admin', 'fixpadding');
            showsubtitle(array('', 'subject', 'forum', 'author', 'threads_replies', 'threads_views', 'threads_lastpost'));
            echo $threads;
            echo $multipage;
            showsubmit('', '', '', "<input type=\"submit\" class=\"btn\" name=\"delsortsubmit\" value=\"{$lang[threadtype_content_delete]}\"/>");
            showtablefooter();
            showformfooter();
        } elseif (submitcheck('delsortsubmit')) {
            require_once libfile('function/post');
            if ($_G['gp_tidsarray']) {
                require_once libfile('function/delete');
                deletethread($_G['gp_tidsarray']);
                if ($_G['setting']['globalstick']) {
                    updatecache('globalstick');
                }
                if ($_G['gp_fidsarray']) {
                    foreach (explode(',', $_G['gp_fidsarray']) as $fid) {
                        updateforumcount(intval($fid));
                    }
                }
            }
            cpmsg('threadtype_content_delete_succeed', 'action=threadtypes&operation=content', 'succeed');
        }
    }
} elseif ($operation == 'classlist') {
    $classoptions = '';
    $classidarray = array();
Beispiel #10
0
                    $multipage = multi($threadcount, $lpp, $page, $mpurl, 0, 3);
                }
            }
            showformheader('threadtypes&operation=content');
            showtableheader('admin', 'fixpadding');
            showsubtitle(array('', 'subject', 'forum', 'author', 'threads_replies', 'threads_views', 'threads_lastpost'));
            echo $threads;
            echo $multipage;
            showsubmit('', '', '', "<input type=\"submit\" class=\"btn\" name=\"delsortsubmit\" value=\"{$lang[threadtype_content_delete]}\"/>");
            showtablefooter();
            showformfooter();
        } elseif (submitcheck('delsortsubmit')) {
            require_once libfile('function/post');
            if ($_GET['tidsarray']) {
                require_once libfile('function/delete');
                deletethread($_GET['tidsarray']);
                if ($_G['setting']['globalstick']) {
                    updatecache('globalstick');
                }
                if ($_GET['fidsarray']) {
                    foreach (explode(',', $_GET['fidsarray']) as $fid) {
                        updateforumcount(intval($fid));
                    }
                }
            }
            cpmsg('threadtype_content_delete_succeed', 'action=threadtypes&operation=content', 'succeed');
        }
    }
} elseif ($operation == 'classlist') {
    $classoptions = '';
    $classidarray = array();
 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)));
 }
function handleEvilPost($tid, $pid, $evilType, $evilLevel = 1)
{
    global $_G;
    if (notOpenService()) {
        return false;
    }
    include_once DISCUZ_ROOT . './source/language/lang_admincp_cloud.php';
    loadSecLog($pid, 'pid');
    $evilPost = DB::fetch_first("SELECT * FROM " . DB::table('security_evilpost') . " WHERE pid='{$pid}'");
    if (is_array($evilPost)) {
        $data = $evilPost;
        $data['evilcount'] = $evilPost['evilcount'] + 1;
    } else {
        require_once libfile('function/delete');
        require_once libfile('function/forum');
        require_once libfile('function/post');
        $data = array('pid' => $pid, 'tid' => $tid, 'evilcount' => 1, 'eviltype' => $evilType, 'createtime' => TIMESTAMP);
        $post = get_post_by_pid($pid);
        if (is_array($post) && count($post) > 0) {
            if ($tid != $post['tid']) {
                return false;
            }
            if ($post['first']) {
                $data['type'] = 1;
                if (checkThreadIgnore($tid)) {
                    return false;
                }
                DB::insert('security_evilpost', $data, 0, 1);
                updateEvilCount('thread');
                DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='-1', digest='0', moderated='1' WHERE tid = '" . $tid . "'");
                deletethread(array($tid), true, true, true);
                updatepost(array('invisible' => '-1'), "tid = '" . $tid . "'");
                updatemodlog($tid, 'DEL', 0, 1, $extend_lang['security_modreason']);
            } else {
                $data['type'] = 0;
                if (checkPostIgnore($pid, $post)) {
                    return false;
                }
                DB::insert('security_evilpost', $data, 0, 1);
                updateEvilCount('post');
                deletepost(array($pid), 'pid', true, false, true);
            }
        } else {
            $data['operateresult'] = 2;
            DB::insert('security_evilpost', $data, 0, 1);
        }
    }
    return true;
}
Beispiel #13
0
     $log_handler = Cloud::loadClass('Cloud_Service_SearchHelper');
     foreach ($_GET['tidarray'] as $tid) {
         $log_handler->myThreadLog('move', array('tid' => $tid, 'otherid' => $_GET['toforum']));
     }
     $cpmsg = cplang('threads_succeed');
 } elseif ($optype == 'movesort') {
     if ($_GET['tosort'] != 0) {
         if (!C::t('forum_threadtype')->fetch($_GET['tosort'])) {
             cpmsg('threads_move_invalid', '', 'error');
         }
     }
     C::t('forum_thread')->update($tidsarray, array('sortid' => $_GET['tosort']));
     $cpmsg = cplang('threads_succeed');
 } elseif ($optype == 'delete') {
     require_once libfile('function/delete');
     deletethread($tidsarray, !$_GET['donotupdatemember'], !$_GET['donotupdatemember']);
     if ($_G['setting']['globalstick']) {
         updatecache('globalstick');
     }
     foreach (explode(',', $_GET['fids']) as $fid) {
         updateforumcount(intval($fid));
     }
     $log_handler = Cloud::loadClass('Cloud_Service_SearchHelper');
     foreach ($_GET['tidarray'] as $tid) {
         $log_handler->myThreadLog('delete', array('tid' => $tid));
     }
     $cpmsg = cplang('threads_succeed');
 } elseif ($optype == 'deleteattach') {
     require_once libfile('function/delete');
     deleteattach($tidsarray, 'tid');
     C::t('forum_thread')->update($tidsarray, array('attachment' => 0));
Beispiel #14
0
     }
     if ($member['uid']) {
         require_once libfile('function/post');
         $pidsdelete = $tidsdelete = '0';
         $postarray = getfieldsofposts('pid, fid, tid, first', "authorid='{$member['uid']}'");
         foreach ($postarray as $post) {
             $prune['forums'][] = $post['fid'];
             $prune['thread'][$post['tid']]++;
             if ($post['first']) {
                 $tidsdelete .= ",{$post['tid']}";
             }
             $pidsdelete .= ",{$post['pid']}";
         }
         deletepost("pid IN ({$pidsdelete})");
         deletepost("tid IN ({$tidsdelete})");
         deletethread("tid IN ({$tidsdelete})");
         if (!empty($prune)) {
             foreach ($prune['thread'] as $tid => $decrease) {
                 updatethreadcount($tid);
             }
             foreach (array_unique($prune['forums']) as $fid) {
                 updateforumcount($fid);
             }
         }
         if ($_G['setting']['globalstick']) {
             updatecache('globalstick');
         }
     }
 }
 if ($_G['gp_delblog']) {
     DB::query("DELETE FROM " . DB::table('home_blog') . " WHERE uid='{$member['uid']}'");
Beispiel #15
0
                 }
             }
         }
         $updatemodlog = FALSE;
     }
     $forumstickthreads = $_G['setting']['forumstickthreads'];
     $forumstickthreads = !empty($forumstickthreads) ? unserialize($forumstickthreads) : array();
     $delkeys = array_keys($threadlist);
     foreach ($delkeys as $k) {
         unset($forumstickthreads[$k]);
     }
     $forumstickthreads = serialize($forumstickthreads);
     DB::query("UPDATE " . DB::table('common_setting') . " SET svalue='{$forumstickthreads}' WHERE skey='forumstickthreads'");
     DB::delete('forum_forum_threadtable', "threads='0'");
     if (!empty($deleteredirect)) {
         deletethread("tid IN (" . dimplode($deleteredirect) . ")");
     }
     if (!empty($remarkclosed)) {
         DB::update('forum_thread', array('closed' => 0), "tid IN (" . dimplode($remarkclosed) . ")");
     }
     if ($_G['setting']['globalstick'] && $stickmodify) {
         require_once libfile('function/cache');
         updatecache('globalstick');
     }
     updateforumcount($_G['fid']);
 } elseif ($operation == 'close') {
     if (!$_G['group']['allowclosethread']) {
         showmessage('undefined_action');
     }
     $expiration = checkexpiration($_G['gp_expirationclose'], $operation);
     $modaction = $expiration ? 'ECL' : 'CLS';
         }
         $pm = 'pm_' . $thread['tid'];
         if (isset(${$pm}) && ${$pm} != '' && $thread['authorid']) {
             $pmlist[] = array('action' => 'modthreads_delete', 'notevar' => array('threadsubject' => $threadsubject, 'reason' => stripslashes($reason)), 'authorid' => $thread['authorid'], 'thread' => $thread['subject'], 'reason' => dhtmlspecialchars(${$pm}));
         }
     }
     if ($recyclebintids) {
         DB::query("UPDATE " . DB::table('forum_thread') . " SET displayorder='-1', moderated='1' WHERE tid IN ({$recyclebintids})");
         $recycles = DB::affected_rows();
         updatemodworks('MOD', $recycles);
         updatepost(array('invisible' => '-1'), "tid IN ({$recyclebintids})");
         updatemodlog($recyclebintids, 'DEL');
     }
     require_once libfile('function/delete');
     deletepost("tid IN ({$deletetids})");
     $deletes = deletethread("tid IN ({$deletetids})");
 }
 if ($moderation['validate']) {
     $forums = array();
     $validatetids = '\'' . implode('\',\'', $moderation['validate']) . '\'';
     $tids = $comma = $comma2 = '';
     $authoridarray = $moderatedthread = array();
     $query = DB::query("SELECT t.fid, t.tid, t.authorid, t.subject, t.author, t.dateline FROM " . DB::table('forum_thread') . " t\n\t\t\t\tWHERE t.tid IN ({$validatetids}) AND t.displayorder='{$displayorder}' {$fidadd['and']}{$fidadd['t']}{$fidadd['fids']}");
     while ($thread = DB::fetch($query)) {
         $tids .= $comma . $thread['tid'];
         $comma = ',';
         my_thread_log('validate', array('tid' => $thread['tid']));
         updatepostcredits('+', $thread['authorid'], 'post', $thread['fid']);
         $forums[] = $thread['fid'];
         $validatedthreads[] = $thread;
         $pm = 'pm_' . $thread['tid'];
Beispiel #17
0
             if ($post['first']) {
                 $tuidarray[] = $post['authorid'];
             } else {
                 $ruidarray[] = $post['authorid'];
             }
         }
         if ($tuidarray) {
             updatepostcredits('-', $tuidarray, 'post');
         }
         if ($ruidarray) {
             updatepostcredits('-', $ruidarray, 'reply');
         }
     }
     require_once libfile('function/delete');
     deletepost($tidsadd);
     deletethread($tidsadd);
     if ($_G['setting']['globalstick']) {
         updatecache('globalstick');
     }
     foreach (explode(',', $_G['gp_fids']) as $fid) {
         updateforumcount(intval($fid));
     }
     foreach ($_G['gp_tidarray'] as $tid) {
         my_thread_log('delete', array('tid' => $tid));
     }
     $cpmsg = cplang('threads_succeed');
 } elseif ($operation == 'deleteattach') {
     $query = DB::query("SELECT attachment, thumb, remote, aid FROM " . DB::table('forum_attachment') . " WHERE {$tidsadd}");
     while ($attach = DB::fetch($query)) {
         dunlink($attach);
     }
$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;
                }
            }
        }
        $op = dhtmlspecialchars($_G['gp_oldop']);
    }
    if ($op == 'search' && submitcheck('searchsubmit')) {
        $sql = '';
        if ($threadoption > 0 && $threadoption < 255) {
Beispiel #19
0
         manage_addnotify('verifyrecycle', $modpostsnum);
     } else {
         deletethread($tids, true, true);
         $updatemodlog = FALSE;
     }
     $forumstickthreads = $_G['setting']['forumstickthreads'];
     $forumstickthreads = !empty($forumstickthreads) ? unserialize($forumstickthreads) : array();
     $delkeys = array_keys($threadlist);
     foreach ($delkeys as $k) {
         unset($forumstickthreads[$k]);
     }
     $forumstickthreads = addslashes(serialize($forumstickthreads));
     DB::query("UPDATE " . DB::table('common_setting') . " SET svalue='{$forumstickthreads}' WHERE skey='forumstickthreads'");
     DB::delete('forum_forum_threadtable', "threads='0'");
     if (!empty($deleteredirect)) {
         deletethread($deleteredirect);
     }
     if (!empty($remarkclosed)) {
         DB::update('forum_thread', array('closed' => 0), "tid IN (" . dimplode($remarkclosed) . ")");
     }
     if ($_G['setting']['globalstick'] && $stickmodify) {
         require_once libfile('function/cache');
         updatecache('globalstick');
     }
     updateforumcount($_G['fid']);
 } elseif ($operation == 'close') {
     if (!$_G['group']['allowclosethread']) {
         showmessage('no_privilege_closethread');
     }
     $expiration = checkexpiration($_G['gp_expirationclose'], $operation);
     $modaction = $expiration ? 'ECL' : 'CLS';
Beispiel #20
0
 if ($pids = dimplode($_G['gp_delete'])) {
     $query = DB::query('SELECT fid, tid, pid, first, authorid FROM ' . DB::table(getposttable($posttableid)) . ' WHERE ' . "pid IN ({$pids}) {$fidadd}");
     while ($post = DB::fetch($query)) {
         $prune['forums'][] = $post['fid'];
         @$prune['thread'][$post['tid']]++;
         $pidsdelete[$post['pid']] = $post['pid'];
         if ($post['first']) {
             $tidsdelete[$post['tid']] = $post['tid'];
         }
     }
 }
 if ($pidsdelete) {
     require_once libfile('function/post');
     require_once libfile('function/delete');
     $deletedposts = deletepost($pidsdelete, 'pid', !getgpc('nocredit'), $posttableid);
     $deletedthreads = deletethread($tidsdelete, !getgpc('nocredit'));
     if (count($prune['thread']) < 50) {
         foreach ($prune['thread'] as $tid => $decrease) {
             updatethreadcount($tid);
         }
     } else {
         $repliesarray = array();
         foreach ($prune['thread'] as $tid => $decrease) {
             $repliesarray[$decrease][] = $tid;
         }
         foreach ($repliesarray as $decrease => $tidarray) {
             DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies-'{$decrease}' WHERE tid IN (" . implode(',', $tidarray) . ")");
         }
     }
     foreach (array_unique($prune['forums']) as $id) {
         updateforumcount($id);
Beispiel #21
0
 }
 if ($pidsdelete) {
     require_once libfile('function/post');
     require_once libfile('function/delete');
     $forums = array();
     $query = DB::query('SELECT fid, recyclebin FROM ' . DB::table('forum_forum') . " WHERE fid IN (" . dimplode($prune['forums']) . ")");
     while ($value = DB::fetch($query)) {
         $forums[$value['fid']] = $value;
     }
     foreach ($pidsdelete as $fid => $pids) {
         foreach ($pids as $pid) {
             if (!$tidsdelete[$pid]) {
                 $deletedposts = deletepost($pid, 'pid', !getgpc('nocredit'), $posttableid, $forums[$fid]['recyclebin']);
                 updatemodlog($pids_tids[$pid], 'DLP');
             } else {
                 $deletedthreads = deletethread($tidsdelete[$pid], false, !getgpc('nocredit'), $forums[$fid]['recyclebin']);
                 updatemodlog($tidsdelete[$pid], 'DEL');
             }
         }
     }
     if (count($prune['thread']) < 50) {
         foreach ($prune['thread'] as $tid => $decrease) {
             updatethreadcount($tid);
         }
     } else {
         $repliesarray = array();
         foreach ($prune['thread'] as $tid => $decrease) {
             $repliesarray[$decrease][] = $tid;
         }
         foreach ($repliesarray as $decrease => $tidarray) {
             DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies-'{$decrease}' WHERE tid IN (" . implode(',', $tidarray) . ")");
                }
            }
            if ($tuidarray) {
                foreach ($tuidarray as $fid => $uids) {
                    $_G['fid'] = $fid;
                    updatepostcredits('-', $uids, 'post');
                }
            }
            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') {
Beispiel #23
0
             $tuidarray[] = $post['authorid'];
         } else {
             $ruidarray[] = $post['authorid'];
         }
     }
     if ($tuidarray) {
         updatepostcredits('-', $tuidarray, 'post');
     }
     if ($ruidarray) {
         updatepostcredits('-', $ruidarray, 'reply');
     }
 }
 require_once libfile('function/delete');
 $deletedposts = deletepost("pid IN ({$pidsdelete})");
 $deletedposts += deletepost("tid IN ({$tidsdelete})");
 $deletedthreads = deletethread("tid IN ({$tidsdelete})");
 if (count($prune['thread']) < 50) {
     foreach ($prune['thread'] as $tid => $decrease) {
         updatethreadcount($tid);
     }
 } else {
     $repliesarray = array();
     foreach ($prune['thread'] as $tid => $decrease) {
         $repliesarray[$decrease][] = $tid;
     }
     foreach ($repliesarray as $decrease => $tidarray) {
         DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies-{$decrease} WHERE tid IN (" . implode(',', $tidarray) . ")");
     }
 }
 foreach (array_unique($prune['forums']) as $id) {
     updateforumcount($id);
Beispiel #24
0
     }
     foreach ($_G['gp_tidarray'] as $tid) {
         my_thread_log('move', array('tid' => $tid, 'otherid' => $_G['gp_toforum']));
     }
     $cpmsg = cplang('threads_succeed');
 } elseif ($optype == 'movesort') {
     if ($_G['gp_tosort'] != 0) {
         if (!DB::result_first("SELECT typeid FROM " . DB::table('forum_threadtype') . " WHERE typeid='{$_G['gp_tosort']}'")) {
             cpmsg('threads_move_invalid', '', 'error');
         }
     }
     DB::query("UPDATE " . DB::table('forum_thread') . " SET sortid='{$_G['gp_tosort']}' WHERE {$tidsadd}");
     $cpmsg = cplang('threads_succeed');
 } elseif ($optype == 'delete') {
     require_once libfile('function/delete');
     deletethread($tidsarray, !$_G['gp_donotupdatemember'], !$_G['gp_donotupdatemember']);
     if ($_G['setting']['globalstick']) {
         updatecache('globalstick');
     }
     foreach (explode(',', $_G['gp_fids']) as $fid) {
         updateforumcount(intval($fid));
     }
     foreach ($_G['gp_tidarray'] as $tid) {
         my_thread_log('delete', array('tid' => $tid));
     }
     $cpmsg = cplang('threads_succeed');
 } elseif ($optype == 'deleteattach') {
     require_once libfile('function/delete');
     deleteattach($tidsarray, 'tid');
     DB::query("UPDATE " . DB::table('forum_thread') . " SET attachment='0' WHERE {$tidsadd}");
     updatepost(array('attachment' => '0'), $tidsadd);
         loadcache('posttableids');
         $posttables = empty($_G['cache']['posttableids']) ? array(0) : $_G['cache']['posttableids'];
         foreach ($posttables as $posttableid) {
             $pidsdelete = array();
             $query = DB::query('SELECT pid, fid, tid, first FROM ' . DB::table(getposttable($posttableid)) . " WHERE authorid='{$member['uid']}'");
             while ($post = DB::fetch($query)) {
                 $prune['forums'][] = $post['fid'];
                 $prune['thread'][$post['tid']]++;
                 if ($post['first']) {
                     $tidsdelete[] = $post['tid'];
                 }
                 $pidsdelete[] = $post['pid'];
             }
             deletepost($pidsdelete, 'pid', false, $posttableid);
         }
         deletethread($tidsdelete);
         if (!empty($prune)) {
             foreach ($prune['thread'] as $tid => $decrease) {
                 updatethreadcount($tid);
             }
             foreach (array_unique($prune['forums']) as $fid) {
                 updateforumcount($fid);
             }
         }
         if ($_G['setting']['globalstick']) {
             updatecache('globalstick');
         }
     }
     $membercount['posts'] = 0;
 }
 if (in_array('blog', $_G['gp_clear'])) {
<?php

if (isset($_REQUEST['id'])) {
    include "dbconnection.php";
    $thread_id = mysql_real_escape_string($_REQUEST['id']);
    deletethread($thread_id);
    header("location:maverick-game-dicussion-forum");
}
Beispiel #27
0
 $fid = $_GET['fid'];
 $ajax = $_GET['ajax'];
 $confirmed = $_GET['confirmed'];
 $finished = $_GET['finished'];
 $total = intval($_GET['total']);
 $pp = intval($_GET['pp']);
 $currow = intval($_GET['currow']);
 if ($ajax && $_GET['formhash'] == formhash()) {
     ob_end_clean();
     require_once libfile('function/post');
     $tids = array();
     foreach (C::t('forum_thread')->fetch_all_by_fid($fid, $pp) as $thread) {
         $tids[] = $thread['tid'];
     }
     require_once libfile('function/delete');
     deletethread($tids);
     if ($currow + $pp > $total) {
         C::t('forum_forum')->delete_by_fid($fid);
         C::t('home_favorite')->delete_by_id_idtype($fid, 'gid');
         C::t('forum_moderator')->delete_by_fid($fid);
         C::t('forum_access')->delete_by_fid($fid);
         echo 'TRUE';
         exit;
     }
     echo 'GO';
     exit;
 } else {
     if ($finished) {
         updatecache('grouptype');
         cpmsg('grouptype_delete_succeed', 'action=group&operation=type', 'succeed');
     }
     $prune['thread'][$post['tid']]++;
     $pidsdelete[] = $post['pid'];
     if ($post['first']) {
         $tidsdelete[] = $post['tid'];
     }
     if ($post['first']) {
         my_thread_log('delete', array('tid' => $post['tid']));
     } else {
         my_post_log('delete', array('pid' => $post['pid']));
     }
 }
 if ($pidsdelete) {
     require_once libfile('function/post');
     require_once libfile('function/delete');
     $deletedposts = deletepost($pidsdelete, 'pid', !$_G['gp_donotupdatemember'], $posttable);
     $deletedthreads = deletethread($tidsdelete, !$_G['gp_donotupdatemember'], !$_G['gp_donotupdatemember']);
     if (count($prune['thread']) < 50) {
         foreach ($prune['thread'] as $tid => $decrease) {
             updatethreadcount($tid);
         }
     } else {
         $repliesarray = array();
         foreach ($prune['thread'] as $tid => $decrease) {
             $repliesarray[$decrease][] = $tid;
         }
         foreach ($repliesarray as $decrease => $tidarray) {
             DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies-{$decrease} WHERE tid IN (" . implode(',', $tidarray) . ")");
         }
     }
     if ($_G['setting']['globalstick']) {
         updatecache('globalstick');
    }
} elseif ($operation == 'clean') {
    if (!submitcheck('rbsubmit', 1)) {
        shownav('topic', 'nav_recyclebin');
        showsubmenu('nav_recyclebin', array(array('recyclebin_list', 'recyclebin', 0), array('search', 'recyclebin&operation=search', 0), array('clean', 'recyclebin&operation=clean', 1)));
        showformheader('recyclebin&operation=clean');
        showtableheader('recyclebin_clean');
        showsetting('recyclebin_clean_days', 'days', '30', 'text');
        showsubmit('rbsubmit');
        showtablefooter();
        showformfooter();
    } else {
        $deletetids = array();
        $timestamp = TIMESTAMP;
        $pernum = 500;
        $threadsdel = intval($_GET['threadsdel']);
        $days = intval($_GET['days']);
        foreach (C::t('forum_threadmod')->fetch_all_recyclebin_by_dateline($timestamp - $days * 86400, 0, $pernum) as $thread) {
            $deletetids[] = $thread['tid'];
        }
        if ($deletetids) {
            require_once libfile('function/delete');
            $delcount = deletethread($deletetids);
            $threadsdel += $delcount;
            $startlimit += $pernum;
            cpmsg('recyclebin_clean_next', 'action=recyclebin&operation=clean&rbsubmit=1&threadsdel=' . $threadsdel . '&days=' . $days, 'succeed', array('threadsdel' => $threadsdel));
        } else {
            cpmsg('recyclebin_succeed', 'action=recyclebin&operation=clean', 'succeed', array('threadsdel' => $threadsdel, 'threadsundel' => 0));
        }
    }
}
Beispiel #30
0
    } else {
        $size = "0";
    }
}
if (!isset($array["announce"])) {
    showmessage('torrent error6');
    exit;
}
$query = DB::query("SELECT tid FROM " . DB::table('xbtit_files') . " WHERE tid <> '{$tid}' AND info_hash='{$hash}' limit 1");
$row = DB::fetch($query);
if (!empty($row)) {
    $str = '该资源(' . $row['tid'] . ')已经被分享,<a href="forum.php?mod=viewthread&tid=' . $row['tid'] . '" target="_blank">查看这个资源</a>';
    require_once DISCUZ_ROOT . './source/function/function_delete.php';
    deletethread($tid);
    showmessage($str);
    //此处需要删除发布的帖子~
}
$status = DB::query("REPLACE INTO  " . DB::table('xbtit_files') . " (\n`info_hash` ,\n`tid` ,\n`filename` ,\n`url` ,\n`data` ,\n`size` ,\n`anonymous` ,\n`dlbytes` ,\n`seeds` ,\n`leechers` ,\n`finished` ,\n`lastactive`\n)\nVALUES ('{$hash}',{$tid},'{$filename}','{$url}','0000-00-00 00:00:00',{$size},'false',  '0',  '0',  '0',  '0',UNIX_TIMESTAMP()\n);");
if ($status) {
    $mf = @move_uploaded_file($_FILES["torrent"]["tmp_name"], $TORRENTSDIR . "/" . $hash . ".btf");
    if (!$mf) {
        DB::query("DELETE FROM " . DB::table('xbtit_files') . " WHERE info_hash=\"{$hash}\"");
    }
    @chmod($TORRENTSDIR . "/" . $hash . ".btf", 0766);
} else {
    unlink($_FILES["torrent"]["tmp_name"]);
    require_once DISCUZ_ROOT . './source/function/function_delete.php';
    deletethread($tid);
    showmessage('torrent error');
    //此处也是需要删除发布成功的帖子~
}