コード例 #1
0
ファイル: do_deletetopic.php プロジェクト: shiyake/php-ihome
/*
     deletetopic.php删除话题
     Add by am@ihome.2012-10-19  10:00
*/
include_once '../iauth_verify_forward.php';
include_once '../../../common.php';
include_once S_ROOT . './uc_client/client.php';
@(include_once S_ROOT . './data/data_profield.php');
$userid = intval(iauth_verify());
//$userid = 96;
//$username = '******';
$tagid = intval($_POST['tagid']);
$pids = intval($_POST['pid']);
$tids = intval($_POST['topic_id']);
$dtreply = deleteposts($tagid, array($pid));
$delthreads = deletethreads($tagid, $tids);
if ($dtreply && $delthreads) {
    $arrs = array('flag' => 'success');
} else {
    $arrs = array('flag' => 'fail');
}
$result = json_encode($arrs);
$result = preg_replace("#\\\\u([0-9a-f]+)#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $result);
echo $result;
exit;
function deleteposts($tagid, $pids)
{
    global $_SGLOBAL;
    //整理
    $nums = renum($postnums);
    foreach ($nums[0] as $pnum) {
コード例 #2
0
function deleteinfo($ids)
{
    global $_SGLOBAL;
    include_once S_ROOT . './source/function_delete.php';
    $deltype = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('report') . " WHERE rid IN (" . simplode($ids) . ")");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $deltype[$value['idtype']][] = $value['id'];
    }
    $gid = getgroupid($_SGLOBAL['member']['credit'], $_SGLOBAL['member']['groupid']);
    //执行相应的删除操作
    foreach ($deltype as $key => $value) {
        switch ($key) {
            case 'blog':
                $_SGLOBAL['usergroup'][$gid]['manageblog'] = 1;
                deleteblogs($value);
                break;
            case 'picid':
                $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1;
                deletepics($value);
                break;
            case 'album':
                $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1;
                deletealbums($value);
                break;
            case 'thread':
                $_SGLOBAL['usergroup'][$gid]['managethread'] = 1;
                deletethreads(0, $value);
                break;
            case 'mtag':
                $_SGLOBAL['usergroup'][$gid]['managemtag'] = 1;
                deletemtag($value);
                break;
            case 'share':
                $_SGLOBAL['usergroup'][$gid]['manageshare'] = 1;
                deleteshares($value);
                break;
            case 'space':
                $_SGLOBAL['usergroup'][$gid]['managespace'] = 1;
                foreach ($value as $uid) {
                    deletespace($uid);
                }
                break;
        }
    }
}
コード例 #3
0
ファイル: function_delete.php プロジェクト: NaturalWill/UCQA
function deletespace($uid, $force = 0)
{
    global $_SGLOBAL, $_SC, $_SCONFIG;
    $delspace = array();
    $allowmanage = checkperm('managedelspace');
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE uid='{$uid}'");
    if ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($force || $allowmanage && $value['uid'] != $_SGLOBAL['supe_uid']) {
            $delspace = $value;
            //如果不是强制删除则入删除记录表
            if (!$force) {
                $setarr = array('uid' => $value['uid'], 'username' => saddslashes($value['username']), 'opuid' => $_SGLOBAL['supe_uid'], 'opusername' => $_SGLOBAL['supe_username'], 'flag' => '-1', 'dateline' => $_SGLOBAL['timestamp']);
                inserttable('spacelog', $setarr, 0, true);
            }
        }
    }
    if (empty($delspace)) {
        return array();
    }
    //履盖权限设置
    $_SGLOBAL['usergroup'][$_SGLOBAL['member']['groupid']]['managebatch'] = 1;
    //space
    $_SGLOBAL['db']->query("DELETE FROM " . tname('space') . " WHERE uid='{$uid}'");
    //spacefield
    $_SGLOBAL['db']->query("DELETE FROM " . tname('spacefield') . " WHERE uid='{$uid}'");
    //feed
    $_SGLOBAL['db']->query("DELETE FROM " . tname('feed') . " WHERE uid='{$uid}' OR (id='{$uid}' AND idtype='uid')");
    //记录
    $doids = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('doing') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $doids[$value['doid']] = $value['doid'];
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('doing') . " WHERE uid='{$uid}'");
    //删除记录回复
    $_SGLOBAL['db']->query("DELETE FROM " . tname('docomment') . " WHERE doid IN (" . simplode($doids) . ") OR uid='{$uid}'");
    //分享
    $_SGLOBAL['db']->query("DELETE FROM " . tname('share') . " WHERE uid='{$uid}'");
    //数据
    $_SGLOBAL['db']->query("DELETE FROM " . tname('album') . " WHERE uid='{$uid}'");
    //删除积分记录
    $_SGLOBAL['db']->query("DELETE FROM " . tname('creditlog') . " WHERE uid='{$uid}'");
    //删除通知
    $_SGLOBAL['db']->query("DELETE FROM " . tname('notification') . " WHERE (uid='{$uid}' OR authorid='{$uid}')");
    //删除打招呼
    $_SGLOBAL['db']->query("DELETE FROM " . tname('poke') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //删除他仓建的投票
    $pollid = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('poll') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pollid[$value['pid']] = $value['pid'];
    }
    deletepolls($pollid);
    //删除他参与的投票
    $pollid = array();
    $query = $_SGLOBAL['db']->query("SELECT pid FROM " . tname('polluser') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pollid[$value['pid']] = $value['pid'];
    }
    //扣除投票数
    if ($pollid) {
        $_SGLOBAL['db']->query("UPDATE " . tname('poll') . " SET voternum=voternum-1 WHERE pid IN (" . simplode($pollid) . ")");
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('polluser') . " WHERE uid='{$uid}'");
    //活动
    $ids = array();
    $query = $_SGLOBAL['db']->query('SELECT eventid FROM ' . tname('event') . " WHERE uid = '{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $ids[] = $value['eventid'];
    }
    deleteevents($ids);
    //删除他参加的活动
    $ids = $ids1 = $ids2 = array();
    $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('userevent') . " WHERE uid = '{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($value['status'] == 1) {
            $ids1[] = $value['eventid'];
            //关注
        } elseif ($value['status'] > 1) {
            $ids2[] = $value['eventid'];
            //参加
        }
        $ids[] = $value['eventid'];
    }
    if ($ids1) {
        $_SGLOBAL['db']->query('UPDATE ' . tname('event') . ' SET follownum = follownum - 1 WHERE eventid IN (' . simplode($ids1) . ')');
    }
    if ($ids2) {
        $_SGLOBAL['db']->query('UPDATE ' . tname('event') . ' SET membernum = membernum - 1 WHERE eventid IN (' . simplode($ids2) . ')');
        // to to: 最好还要检查并减去他携带的人数
    }
    if ($ids) {
        $_SGLOBAL['db']->query('DELETE FROM ' . tname('userevent') . ' WHERE eventid IN (' . simplode($ids) . ") AND uid = '{$uid}'");
    }
    //删除相关活动邀请
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('eventinvite') . " WHERE uid = '{$uid}' OR touid = '{$uid}'");
    //删除上传的活动图片
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('eventpic') . " WHERE picid = '{$uid}'");
    //to do: 最好同时更新活动图片数和活动话题数
    //道具
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('usermagic') . " WHERE uid = '{$uid}'");
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('magicinlog') . " WHERE uid = '{$uid}'");
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('magicuselog') . " WHERE uid = '{$uid}'");
    //pic
    //删除图片附件
    $pics = array();
    $query = $_SGLOBAL['db']->query("SELECT filepath FROM " . tname('pic') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pics[] = $value;
    }
    //数据
    $_SGLOBAL['db']->query("DELETE FROM " . tname('pic') . " WHERE uid='{$uid}'");
    //blog
    $blogids = array();
    $query = $_SGLOBAL['db']->query("SELECT blogid FROM " . tname('blog') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $blogids[$value['blogid']] = $value['blogid'];
        //tag
        $tags = array();
        $subquery = $_SGLOBAL['db']->query("SELECT tagid, blogid FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        while ($tag = $_SGLOBAL['db']->fetch_array($subquery)) {
            $tags[$tag['tagid']] = $tag['tagid'];
        }
        if ($tags) {
            $_SGLOBAL['db']->query("UPDATE " . tname('tag') . " SET blognum=blognum-1 WHERE tagid IN (" . simplode($tags) . ")");
            $_SGLOBAL['db']->query("DELETE FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        }
    }
    //数据删除
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blog') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blogfield') . " WHERE uid='{$uid}'");
    //bwzt
    $bwztids = array();
    $query = $_SGLOBAL['db']->query("SELECT bwztid FROM " . tname('bwzt') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $bwztids[$value['bwztid']] = $value['bwztid'];
        //tag
        $tags = array();
        $subquery = $_SGLOBAL['db']->query("SELECT tagid, bwztid FROM " . tname('tagbwzt') . " WHERE bwztid='{$value['bwztid']}'");
        while ($tag = $_SGLOBAL['db']->fetch_array($subquery)) {
            $tags[$tag['tagid']] = $tag['tagid'];
        }
        if ($tags) {
            $_SGLOBAL['db']->query("UPDATE " . tname('tag') . " SET bwztnum=bwztnum-1 WHERE tagid IN (" . simplode($tags) . ")");
            $_SGLOBAL['db']->query("DELETE FROM " . tname('tagbwzt') . " WHERE bwztid='{$value['bwztid']}'");
        }
    }
    //数据删除
    $_SGLOBAL['db']->query("DELETE FROM " . tname('bwzt') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('bwztfield') . " WHERE uid='{$uid}'");
    //评论
    $_SGLOBAL['db']->query("DELETE FROM " . tname('comment') . " WHERE (uid='{$uid}' OR authorid='{$uid}' OR (id='{$uid}' AND idtype='uid'))");
    //访客
    $_SGLOBAL['db']->query("DELETE FROM " . tname('visitor') . " WHERE (uid='{$uid}' OR vuid='{$uid}')");
    //删除任务记录
    $_SGLOBAL['db']->query("DELETE FROM " . tname('usertask') . " WHERE uid='{$uid}'");
    //class
    $_SGLOBAL['db']->query("DELETE FROM " . tname('class') . " WHERE uid='{$uid}'");
    //friend
    //好友
    $_SGLOBAL['db']->query("DELETE FROM " . tname('friend') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //member
    $_SGLOBAL['db']->query("DELETE FROM " . tname('member') . " WHERE uid='{$uid}'");
    //删除脚印
    $_SGLOBAL['db']->query("DELETE FROM " . tname('clickuser') . " WHERE uid='{$uid}'");
    //删除黑名单
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blacklist') . " WHERE (uid='{$uid}' OR buid='{$uid}')");
    //删除邀请记录
    $_SGLOBAL['db']->query("DELETE FROM " . tname('invite') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //删除邮件队列
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mailcron') . ", " . tname('mailqueue') . " USING " . tname('mailcron') . ", " . tname('mailqueue') . " WHERE " . tname('mailcron') . ".touid='{$uid}' AND " . tname('mailcron') . ".cid=" . tname('mailqueue') . ".cid");
    //漫游邀请
    $_SGLOBAL['db']->query("DELETE FROM " . tname('myinvite') . " WHERE (touid='{$uid}' OR fromuid='{$uid}')");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('userapp') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('userappfield') . " WHERE uid='{$uid}'");
    //mtag
    //thread
    $tids = array();
    $query = $_SGLOBAL['db']->query("SELECT tid, tagid FROM " . tname('thread') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $tids[$value['tagid']][] = $value['tid'];
    }
    foreach ($tids as $tagid => $v_tids) {
        deletethreads($tagid, $v_tids);
    }
    //post
    $pids = array();
    $query = $_SGLOBAL['db']->query("SELECT pid, tagid FROM " . tname('post') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pids[$value['tagid']][] = $value['pid'];
    }
    foreach ($pids as $tagid => $v_pids) {
        deleteposts($tagid, $v_pids);
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('thread') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('post') . " WHERE uid='{$uid}'");
    //session
    $_SGLOBAL['db']->query("DELETE FROM " . tname('session') . " WHERE uid='{$uid}'");
    //排行榜
    $_SGLOBAL['db']->query("DELETE FROM " . tname('show') . " WHERE uid='{$uid}'");
    //群组
    $mtagids = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $mtagids[$value['tagid']] = $value['tagid'];
    }
    if ($mtagids) {
        $_SGLOBAL['db']->query("UPDATE " . tname('mtag') . " SET membernum=membernum-1 WHERE tagid IN (" . simplode($mtagids) . ")");
        $_SGLOBAL['db']->query("DELETE FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mtaginvite') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //删除图片
    deletepicfiles($pics);
    //删除图片
    //删除举报
    $_SGLOBAL['db']->query("DELETE FROM " . tname('report') . " WHERE id='{$uid}' AND idtype='uid'");
    //变更记录
    if ($_SCONFIG['my_status']) {
        inserttable('userlog', array('uid' => $uid, 'action' => 'delete', 'dateline' => $_SGLOBAL['timestamp']), 0, true);
    }
    return $delspace;
}
コード例 #4
0
        $moderation = array('delete' => array(), 'undelete' => array(), 'ignore' => array());
        if (is_array($mod)) {
            foreach ($mod as $tid => $action) {
                $moderation[$action][] = intval($tid);
            }
        }
        $threadsdel = deletethreads($moderation['delete']);
        $threadsundel = undeletethreads($moderation['undelete']);
        cpmsg('recyclebin_succeed', $BASESCRIPT . '?action=recyclebin&operation=', 'succeed');
    }
} elseif ($operation == 'clean') {
    if (!submitcheck('rbsubmit')) {
        shownav('topic', 'nav_recyclebin');
        showsubmenu('nav_recyclebin', array(array('search', 'recyclebin', 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();
        $query = $db->query("SELECT tm.tid FROM {$tablepre}threadsmod tm, {$tablepre}threads t\r\n\t\t\tWHERE tm.dateline<{$timestamp}-'{$days}'*86400 AND tm.action='DEL' AND t.tid=tm.tid AND t.displayorder='-1'");
        while ($thread = $db->fetch_array($query)) {
            $deletetids[] = $thread['tid'];
        }
        $threadsdel = deletethreads($deletetids);
        $threadsundel = 0;
        cpmsg('recyclebin_succeed', $BASESCRIPT . '?action=recyclebin&operation=clean', 'succeed');
    }
}
コード例 #5
0
ファイル: admincp_thread.php プロジェクト: v998/discuzx-en
<?php

/*
	[UCenter Home] (C) 2007-2008 Comsenz Inc.
	$Id: admincp_thread.php 12568 2009-07-08 07:38:01Z zhengqingpeng $
*/
if (!defined('IN_UCHOME') || !defined('IN_ADMINCP')) {
    exit('Access Denied');
}
$tagid = empty($_GET['tagid']) ? 0 : intval($_GET['tagid']);
if (submitcheck('opsubmit')) {
    if ($_POST['optype'] == 'delete') {
        include_once S_ROOT . './source/function_delete.php';
        if (!empty($_POST['ids']) && deletethreads($tagid, $_POST['ids'])) {
            cpmessage('do_success', $_POST['mpurl']);
        } else {
            cpmessage('choose_to_delete_the_topic', $_POST['mpurl']);
        }
    } elseif ($_POST['optype'] == 'digest') {
        include_once S_ROOT . './source/function_op.php';
        if (!empty($_POST['ids']) && digestthreads($tagid, $_POST['ids'], $_POST['digestv'])) {
            cpmessage('do_success', $_POST['mpurl']);
        } else {
            cpmessage('choosing_to_operate_the_topic', $_POST['mpurl']);
        }
    } elseif ($_POST['optype'] == 'top') {
        include_once S_ROOT . './source/function_op.php';
        if (!empty($_POST['ids']) && topthreads($tagid, $_POST['ids'], $_POST['topv'])) {
            cpmessage('do_success', $_POST['mpurl']);
        } else {
            cpmessage('choosing_to_operate_the_topic', $_POST['mpurl']);
コード例 #6
0
ファイル: admincp_report.php プロジェクト: v998/discuzx-en
function deleteinfo($ids)
{
    global $_SGLOBAL;
    include_once S_ROOT . './source/function_delete.php';
    $deltype = array();
    $reportuser = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('report') . " WHERE rid IN (" . simplode($ids) . ")");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $value['user'] = unserialize($value['uids']);
        $reportuser[] = array_shift(array_flip($value['user']));
        $deltype[$value['idtype']][] = $value['id'];
    }
    $gid = getgroupid($_SGLOBAL['member']['experience'], $_SGLOBAL['member']['groupid']);
    //Perform the corresponding delete operations
    $i = 0;
    $_SGLOBAL['usergroup'][$gid]['managebatch'] = 1;
    foreach ($deltype as $key => $value) {
        switch ($key) {
            case 'blogid':
                $_SGLOBAL['usergroup'][$gid]['manageblog'] = 1;
                deleteblogs($value);
                break;
            case 'picid':
                $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1;
                deletepics($value);
                break;
            case 'albumid':
                $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1;
                deletealbums($value);
                break;
            case 'tid':
                $_SGLOBAL['usergroup'][$gid]['managethread'] = 1;
                deletethreads(0, $value);
                break;
            case 'tagid':
                $_SGLOBAL['usergroup'][$gid]['managemtag'] = 1;
                deletemtag($value);
                break;
            case 'sid':
                $_SGLOBAL['usergroup'][$gid]['manageshare'] = 1;
                deleteshares($value);
                break;
            case 'uid':
                $_SGLOBAL['usergroup'][$gid]['managedelspace'] = 1;
                foreach ($value as $uid) {
                    deletespace($uid);
                }
                break;
            case 'eventid':
                $_SGLOBAL['usergroup'][$gid]['manageevent'] = 1;
                deleteevents($value);
                break;
            case 'pid':
                $_SGLOBAL['usergroup'][$gid]['managepoll'] = 1;
                deletepolls($value);
                break;
            case 'comment':
                $_SGLOBAL['usergroup'][$gid]['managecomment'] = 1;
                deletecomments($value);
                break;
            case 'post':
                $_SGLOBAL['usergroup'][$gid]['managethread'] = 1;
                deleteposts(0, $value);
                break;
        }
        //The first reporter award
        getreward('report', 1, $reportuser[$i], '', 0);
        $i++;
    }
}
コード例 #7
0
$postlist = array();
$total = $multipage = '';
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) {
                require_once libfile('function/post');
                $op == 'delete' && deletethreads($tidarray);
                $op == 'restore' && 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) {
            $sql .= " AND special='{$threadoption}'";
        } elseif ($threadoption == 999) {
            $sql .= " AND digest in(1,2,3)";
        } elseif ($threadoption == 888) {
コード例 #8
0
ファイル: modcp_recyclebin.php プロジェクト: v998/discuzx-en
$postlist = array();
$total = $multipage = '';
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) {
                require_once libfile('function/post');
                $op == 'delete' && $_G['group']['allowclearrecycle'] && deletethreads($tidarray);
                $op == 'restore' && 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) {
            $sql .= " AND special='{$threadoption}'";
        } elseif ($threadoption == 999) {
            $sql .= " AND digest in(1,2,3)";
        } elseif ($threadoption == 888) {
コード例 #9
0
function deletespace($uid, $force = 0)
{
    global $_SGLOBAL, $_SC, $_SCONFIG;
    $delspace = array();
    $allowmanage = checkperm('managespace');
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE uid='{$uid}'");
    if ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($force || $allowmanage && $value['uid'] != $_SGLOBAL['supe_uid']) {
            $delspace = $value;
            //如果不是强制删除则入删除记录表
            if (!$force) {
                $setarr = array('uid' => $value['uid'], 'username' => saddslashes($value['username']), 'opuid' => $_SGLOBAL['supe_uid'], 'opusername' => $_SGLOBAL['supe_username'], 'flag' => '-1', 'dateline' => $_SGLOBAL['timestamp']);
                inserttable('spacelog', $setarr, 0, true);
            }
        }
    }
    if (empty($delspace)) {
        return array();
    }
    //space
    $_SGLOBAL['db']->query("DELETE FROM " . tname('space') . " WHERE uid='{$uid}'");
    //spacefield
    $_SGLOBAL['db']->query("DELETE FROM " . tname('spacefield') . " WHERE uid='{$uid}'");
    //feed
    $_SGLOBAL['db']->query("DELETE FROM " . tname('feed') . " WHERE uid='{$uid}'");
    //记录
    $_SGLOBAL['db']->query("DELETE FROM " . tname('doing') . " WHERE uid='{$uid}'");
    //删除记录回复
    $_SGLOBAL['db']->query("DELETE FROM " . tname('docomment') . " WHERE uid='{$uid}'");
    //分享
    $_SGLOBAL['db']->query("DELETE FROM " . tname('share') . " WHERE uid='{$uid}'");
    //数据
    $_SGLOBAL['db']->query("DELETE FROM " . tname('album') . " WHERE uid='{$uid}'");
    //删除通知
    $_SGLOBAL['db']->query("DELETE FROM " . tname('notification') . " WHERE (uid='{$uid}' OR authorid='{$uid}')");
    //删除打招呼
    $_SGLOBAL['db']->query("DELETE FROM " . tname('poke') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //pic
    //删除图片附件
    $pics = array();
    $query = $_SGLOBAL['db']->query("SELECT filepath FROM " . tname('pic') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pics[] = $value;
    }
    //数据
    $_SGLOBAL['db']->query("DELETE FROM " . tname('pic') . " WHERE uid='{$uid}'");
    //blog
    $blogids = array();
    $query = $_SGLOBAL['db']->query("SELECT blogid FROM " . tname('blog') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $blogids[$value['blogid']] = $value['blogid'];
        //tag
        $tags = array();
        $subquery = $_SGLOBAL['db']->query("SELECT tagid, blogid FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        while ($tag = $_SGLOBAL['db']->fetch_array($subquery)) {
            $tags[$tag['tagid']] = $tag['tagid'];
        }
        if ($tags) {
            $_SGLOBAL['db']->query("UPDATE " . tname('tag') . " SET blognum=blognum-1 WHERE tagid IN (" . simplode($tags) . ")");
            $_SGLOBAL['db']->query("DELETE FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        }
    }
    //数据删除
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blog') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blogfield') . " WHERE uid='{$uid}'");
    //评论
    $_SGLOBAL['db']->query("DELETE FROM " . tname('comment') . " WHERE (uid='{$uid}' OR authorid='{$uid}' OR (id='{$uid}' AND idtype='uid'))");
    //访客
    $_SGLOBAL['db']->query("DELETE FROM " . tname('visitor') . " WHERE (uid='{$uid}' OR vuid='{$uid}')");
    //删除活动记录
    $_SGLOBAL['db']->query("DELETE FROM " . tname('usertask') . " WHERE uid='{$uid}'");
    //class
    $_SGLOBAL['db']->query("DELETE FROM " . tname('class') . " WHERE uid='{$uid}'");
    //friend
    //好友
    $_SGLOBAL['db']->query("DELETE FROM " . tname('friend') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //member
    $_SGLOBAL['db']->query("DELETE FROM " . tname('member') . " WHERE uid='{$uid}'");
    //删除脚印
    $_SGLOBAL['db']->query("DELETE FROM " . tname('trace') . " WHERE uid='{$uid}'");
    //删除黑名单
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blacklist') . " WHERE (uid='{$uid}' OR buid='{$uid}')");
    //删除邀请记录
    $_SGLOBAL['db']->query("DELETE FROM " . tname('invite') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //删除邮件队列
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mailcron') . ", " . tname('mailqueue') . " USING " . tname('mailcron') . ", " . tname('mailqueue') . " WHERE " . tname('mailcron') . ".touid='{$uid}' AND " . tname('mailcron') . ".cid=" . tname('mailqueue') . ".cid");
    //漫游邀请
    $_SGLOBAL['db']->query("DELETE FROM " . tname('myinvite') . " WHERE (touid='{$uid}' OR fromuid='{$uid}')");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('userapp') . " WHERE uid='{$uid}'");
    //mtag
    //thread
    $tids = array();
    $query = $_SGLOBAL['db']->query("SELECT tid, tagid FROM " . tname('thread') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $tids[$value['tagid']][] = $value['tid'];
    }
    foreach ($tids as $tagid => $v_tids) {
        deletethreads($tagid, $v_tids);
    }
    //post
    $pids = array();
    $query = $_SGLOBAL['db']->query("SELECT pid, tagid FROM " . tname('post') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pids[$value['tagid']][] = $value['pid'];
    }
    foreach ($pids as $tagid => $v_pids) {
        deleteposts($tagid, $v_pids);
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('thread') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('post') . " WHERE uid='{$uid}'");
    //session
    $_SGLOBAL['db']->query("DELETE FROM " . tname('session') . " WHERE uid='{$uid}'");
    //排行榜
    $_SGLOBAL['db']->query("DELETE FROM " . tname('show') . " WHERE uid='{$uid}'");
    //群组
    $mtagids = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $mtagids[$value['tagid']] = $value['tagid'];
    }
    if ($mtagids) {
        $_SGLOBAL['db']->query("UPDATE " . tname('mtag') . " SET membernum=membernum-1 WHERE tagid IN (" . simplode($mtagids) . ")");
        $_SGLOBAL['db']->query("DELETE FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mtaginvite') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //删除图片
    deletepicfiles($pics);
    //删除图片
    //删除举报
    $_SGLOBAL['db']->query("DELETE FROM " . tname('report') . " WHERE id='{$uid}' AND idtype='space'");
    //变更记录
    if ($_SCONFIG['my_status']) {
        inserttable('userlog', array('uid' => $uid, 'action' => 'delete', 'dateline' => $_SGLOBAL['timestamp']), 0, true);
    }
    return $delspace;
}
コード例 #10
0
ファイル: function_delete.php プロジェクト: shiyake/php-ihome
function deletespace($uid, $force = 0)
{
    global $_SGLOBAL, $_SC, $_SCONFIG;
    $delspace = array();
    $allowmanage = checkperm('managedelspace');
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE uid='{$uid}'");
    if ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($force || $allowmanage && $value['uid'] != $_SGLOBAL['supe_uid']) {
            $delspace = $value;
            //Èç¹û²»ÊÇÇ¿ÖÆɾ³ýÔòÈëɾ³ý¼Ç¼±í
            if (!$force) {
                $setarr = array('uid' => $value['uid'], 'username' => saddslashes($value['username']), 'opuid' => $_SGLOBAL['supe_uid'], 'opusername' => $_SGLOBAL['supe_username'], 'flag' => '-1', 'dateline' => $_SGLOBAL['timestamp']);
                inserttable('spacelog', $setarr, 0, true);
            }
        }
    }
    if (empty($delspace)) {
        return array();
    }
    //ÂĸÇȨÏÞÉèÖÃ
    $_SGLOBAL['usergroup'][$_SGLOBAL['member']['groupid']]['managebatch'] = 1;
    //space
    $_SGLOBAL['db']->query("DELETE FROM " . tname('space') . " WHERE uid='{$uid}'");
    //spacefield
    $_SGLOBAL['db']->query("DELETE FROM " . tname('spacefield') . " WHERE uid='{$uid}'");
    //feed
    $_SGLOBAL['db']->query("DELETE FROM " . tname('feed') . " WHERE uid='{$uid}' OR (id='{$uid}' AND idtype='uid')");
    //¼Ç¼
    $doids = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('doing') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $doids[$value['doid']] = $value['doid'];
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('doing') . " WHERE uid='{$uid}'");
    //ɾ³ý¼Ç¼»Ø¸´
    $_SGLOBAL['db']->query("DELETE FROM " . tname('docomment') . " WHERE doid IN (" . simplode($doids) . ") OR uid='{$uid}'");
    //·ÖÏí
    $_SGLOBAL['db']->query("DELETE FROM " . tname('share') . " WHERE uid='{$uid}'");
    //Êý¾Ý
    $_SGLOBAL['db']->query("DELETE FROM " . tname('album') . " WHERE uid='{$uid}'");
    //ɾ³ý»ý·Ö¼Ç¼
    $_SGLOBAL['db']->query("DELETE FROM " . tname('creditlog') . " WHERE uid='{$uid}'");
    //ɾ³ý֪ͨ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('notification') . " WHERE (uid='{$uid}' OR authorid='{$uid}')");
    //ɾ³ý´òÕкô
    $_SGLOBAL['db']->query("DELETE FROM " . tname('poke') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //ɾ³ýËû²Ö½¨µÄͶƱ
    $pollid = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('poll') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pollid[$value['pid']] = $value['pid'];
    }
    deletepolls($pollid);
    //ɾ³ýËû²ÎÓëµÄͶƱ
    $pollid = array();
    $query = $_SGLOBAL['db']->query("SELECT pid FROM " . tname('polluser') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pollid[$value['pid']] = $value['pid'];
    }
    //¿Û³ýͶƱÊý
    if ($pollid) {
        $_SGLOBAL['db']->query("UPDATE " . tname('poll') . " SET voternum=voternum-1 WHERE pid IN (" . simplode($pollid) . ")");
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('polluser') . " WHERE uid='{$uid}'");
    //»î¶¯
    $ids = array();
    $query = $_SGLOBAL['db']->query('SELECT eventid FROM ' . tname('event') . " WHERE uid = '{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $ids[] = $value['eventid'];
    }
    deleteevents($ids);
    //ɾ³ýËû²Î¼ÓµÄ»î¶¯
    $ids = $ids1 = $ids2 = array();
    $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('userevent') . " WHERE uid = '{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($value['status'] == 1) {
            $ids1[] = $value['eventid'];
            //¹Ø×¢
        } elseif ($value['status'] > 1) {
            $ids2[] = $value['eventid'];
            //²Î¼Ó
        }
        $ids[] = $value['eventid'];
    }
    if ($ids1) {
        $_SGLOBAL['db']->query('UPDATE ' . tname('event') . ' SET follownum = follownum - 1 WHERE eventid IN (' . simplode($ids1) . ')');
    }
    if ($ids2) {
        $_SGLOBAL['db']->query('UPDATE ' . tname('event') . ' SET membernum = membernum - 1 WHERE eventid IN (' . simplode($ids2) . ')');
        // to to: ×îºÃ»¹Òª¼ì²é²¢¼õÈ¥ËûЯ´øµÄÈËÊý
    }
    if ($ids) {
        $_SGLOBAL['db']->query('DELETE FROM ' . tname('userevent') . ' WHERE eventid IN (' . simplode($ids) . ") AND uid = '{$uid}'");
    }
    //ɾ³ýÏà¹Ø»î¶¯ÑûÇë
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('eventinvite') . " WHERE uid = '{$uid}' OR touid = '{$uid}'");
    //ɾ³ýÉÏ´«µÄ»î¶¯Í¼Æ¬
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('eventpic') . " WHERE picid = '{$uid}'");
    //to do: ×îºÃͬʱ¸üлͼƬÊýºÍ»î¶¯»°ÌâÊý
    //µÀ¾ß
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('usermagic') . " WHERE uid = '{$uid}'");
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('magicinlog') . " WHERE uid = '{$uid}'");
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('magicuselog') . " WHERE uid = '{$uid}'");
    //pic
    //ɾ³ýͼƬ¸½¼þ
    $pics = array();
    $query = $_SGLOBAL['db']->query("SELECT filepath FROM " . tname('pic') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pics[] = $value;
    }
    //Êý¾Ý
    $_SGLOBAL['db']->query("DELETE FROM " . tname('pic') . " WHERE uid='{$uid}'");
    //blog
    $blogids = array();
    $query = $_SGLOBAL['db']->query("SELECT blogid FROM " . tname('blog') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $blogids[$value['blogid']] = $value['blogid'];
        //tag
        $tags = array();
        $subquery = $_SGLOBAL['db']->query("SELECT tagid, blogid FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        while ($tag = $_SGLOBAL['db']->fetch_array($subquery)) {
            $tags[$tag['tagid']] = $tag['tagid'];
        }
        if ($tags) {
            $_SGLOBAL['db']->query("UPDATE " . tname('tag') . " SET blognum=blognum-1 WHERE tagid IN (" . simplode($tags) . ")");
            $_SGLOBAL['db']->query("DELETE FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        }
    }
    //Êý¾Ýɾ³ý
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blog') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blogfield') . " WHERE uid='{$uid}'");
    //ÆÀÂÛ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('comment') . " WHERE (uid='{$uid}' OR authorid='{$uid}' OR (id='{$uid}' AND idtype='uid'))");
    //·Ã¿Í
    $_SGLOBAL['db']->query("DELETE FROM " . tname('visitor') . " WHERE (uid='{$uid}' OR vuid='{$uid}')");
    //ɾ³ýÈÎÎñ¼Ç¼
    $_SGLOBAL['db']->query("DELETE FROM " . tname('usertask') . " WHERE uid='{$uid}'");
    //class
    $_SGLOBAL['db']->query("DELETE FROM " . tname('class') . " WHERE uid='{$uid}'");
    //friend
    //ºÃÓÑ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('friend') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //member
    $_SGLOBAL['db']->query("DELETE FROM " . tname('member') . " WHERE uid='{$uid}'");
    //ɾ³ý½ÅÓ¡
    $_SGLOBAL['db']->query("DELETE FROM " . tname('clickuser') . " WHERE uid='{$uid}'");
    //ɾ³ýºÚÃûµ¥
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blacklist') . " WHERE (uid='{$uid}' OR buid='{$uid}')");
    //ɾ³ýÑûÇë¼Ç¼
    $_SGLOBAL['db']->query("DELETE FROM " . tname('invite') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //ɾ³ýÓʼþ¶ÓÁÐ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mailcron') . ", " . tname('mailqueue') . " USING " . tname('mailcron') . ", " . tname('mailqueue') . " WHERE " . tname('mailcron') . ".touid='{$uid}' AND " . tname('mailcron') . ".cid=" . tname('mailqueue') . ".cid");
    //ÂþÓÎÑûÇë
    $_SGLOBAL['db']->query("DELETE FROM " . tname('myinvite') . " WHERE (touid='{$uid}' OR fromuid='{$uid}')");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('userapp') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('userappfield') . " WHERE uid='{$uid}'");
    //mtag
    //thread
    $tids = array();
    $query = $_SGLOBAL['db']->query("SELECT tid, tagid FROM " . tname('thread') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $tids[$value['tagid']][] = $value['tid'];
    }
    foreach ($tids as $tagid => $v_tids) {
        deletethreads($tagid, $v_tids);
    }
    //post
    $pids = array();
    $query = $_SGLOBAL['db']->query("SELECT pid, tagid FROM " . tname('post') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pids[$value['tagid']][] = $value['pid'];
    }
    foreach ($pids as $tagid => $v_pids) {
        deleteposts($tagid, $v_pids);
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('thread') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('post') . " WHERE uid='{$uid}'");
    //session
    $_SGLOBAL['db']->query("DELETE FROM " . tname('session') . " WHERE uid='{$uid}'");
    //ÅÅÐаñ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('show') . " WHERE uid='{$uid}'");
    //Ⱥ×é
    $mtagids = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $mtagids[$value['tagid']] = $value['tagid'];
    }
    if ($mtagids) {
        $_SGLOBAL['db']->query("UPDATE " . tname('mtag') . " SET membernum=membernum-1 WHERE tagid IN (" . simplode($mtagids) . ")");
        $_SGLOBAL['db']->query("DELETE FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mtaginvite') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //ɾ³ýͼƬ
    deletepicfiles($pics);
    //ɾ³ýͼƬ
    //ɾ³ý¾Ù±¨
    $_SGLOBAL['db']->query("DELETE FROM " . tname('report') . " WHERE id='{$uid}' AND idtype='uid'");
    //±ä¸ü¼Ç¼
    if ($_SCONFIG['my_status']) {
        inserttable('userlog', array('uid' => $uid, 'action' => 'delete', 'dateline' => $_SGLOBAL['timestamp']), 0, true);
    }
    return $delspace;
}