⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 magic_del.inc.php

📁 一个完整的论坛系统(包括后台管理和数据库)
💻 PHP
字号:
<?php

/*
	[Discuz!] (C)2001-2007 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$Id: magic_del.inc.php 10463 2007-09-03 01:23:37Z tiger $
*/

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

if(submitcheck('usesubmit')) {

	if(empty($pid)) {
		showmessage('magics_info_nonexistence');
	}

	$post = getpostinfo($pid, 'pid', array('t.tid', 't.fid', 't.authorid', 'first'));
	checkmagicperm($magicperm['forum'], $post['fid']);

	if($post['authorid'] != $discuz_uid) {
		showmessage('magics_operation_nopermission');
	}

	require_once DISCUZ_ROOT.'./include/post.func.php';

	if($post['first']) {
		foreach(array('threads', 'threadsmod', 'relatedthreads', 'posts', 'polls', 'polloptions', 'trades', 'activities', 'activityapplies', 'attachments', 'favorites', 'mythreads', 'myposts', 'subscriptions', 'debates', 'debateposts', 'typeoptionvars', 'forumrecommend') as $value) {
			$db->query("DELETE FROM {$tablepre}$value WHERE tid='$post[tid]'", 'UNBUFFERED');
		}

		$query = $db->query("SELECT uid, attachment, dateline, thumb, remote FROM {$tablepre}attachments WHERE tid='$post[tid]'");
		while($attach = $db->fetch_array($query)) {
			dunlink($attach['attachment'], $attach['thumb'], $attach['remote']);
		}
		updateforumcount($post['fid']);
	} else {
		$db->query("DELETE FROM {$tablepre}posts WHERE pid='$pid'", 'UNBUFFERED');
		$db->query("DELETE FROM {$tablepre}myposts WHERE pid='$pid'", 'UNBUFFERED');
		$db->query("DELETE FROM {$tablepre}attachments WHERE pid='$pid'", 'UNBUFFERED');
		$query = $db->query("SELECT uid, attachment, dateline, thumb, remote FROM {$tablepre}attachments WHERE pid='$pid'");
		while($attach = $db->fetch_array($query)) {
			dunlink($attach['attachment'], $attach['thumb'], $attach['remote']);
		}
		updatethreadcount($post['tid']);
	}

	usemagic($magicid, $magic['num']);
	updatemagiclog($magicid, '2', '1', '0', '0', $pid);
	showmessage('magics_operation_succeed', 'magic.php?action=user');

}

function showmagic() {
	global $pid, $lang;
	magicshowtype($lang['option'], 'top');
	magicshowsetting($lang['target_pid'], 'pid', $pid, 'text');
	magicshowtype('', 'bottom');
}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -