예제 #1
0
function deletecollection($ctid)
{
    $tids = array();
    $threadlist = C::t('forum_collectionthread')->fetch_all_by_ctid($ctid);
    $tids = array_keys($threadlist);
    deleterelatedtid($tids, $ctid);
    $collectionteamworker = C::t('forum_collectionteamworker')->fetch_all_by_ctid($ctid);
    foreach ($collectionteamworker as $worker) {
        notification_add($worker['uid'], "system", 'collection_removed', array('ctid' => $collectiondata['ctid'], 'collectionname' => $collectiondata['name']), 1);
    }
    C::t('forum_collectionthread')->delete_by_ctid($ctid);
    C::t('forum_collectionfollow')->delete_by_ctid($ctid);
    C::t('forum_collectioncomment')->delete_by_ctid($ctid);
    C::t('forum_collectionteamworker')->delete_by_ctid($ctid);
    C::t('forum_collectioninvite')->delete_by_ctid($ctid);
    C::t('forum_collection')->delete($ctid, true);
}
예제 #2
0
            }
        }
        showmessage('collection_collect_succ', dreferer(), array(), array('alert' => 'right', 'closetime' => true, 'locationtime' => true, 'showdialog' => 1));
    }
} elseif ($op == 'delthread') {
    if ($_GET['formhash'] != FORMHASH) {
        showmessage('undefined_action', NULL);
    }
    if (!$ctid || count($_GET['delthread']) == 0) {
        showmessage('collection_no_thread');
    }
    if (!$_G['collection']['ctid'] || !checkcollectionperm($_G['collection'], $_G['uid'])) {
        showmessage('collection_permission_deny');
    }
    require_once libfile('function/delete');
    deleterelatedtid($_GET['delthread'], $_G['collection']['ctid']);
    $decthread = C::t('forum_collectionthread')->delete_by_ctid_tid($ctid, $_GET['delthread']);
    $lastpost = null;
    if (in_array($_G['collection']['lastpost'], $_GET['delthread']) && $_G['collection']['threadnum'] - $decthread > 0) {
        $collection_thread = C::t('forum_collectionthread')->fetch_by_ctid_dateline($ctid);
        if ($collection_thread) {
            $thread = C::t('forum_thread')->fetch($collection_thread['tid']);
            $lastpost = array('lastpost' => $thread['tid'], 'lastsubject' => $thread['subject'], 'lastposttime' => $thread['dateline'], 'lastposter' => $thread['authorid']);
        }
    }
    C::t('forum_collection')->update_by_ctid($ctid, -$decthread, 0, 0, 0, 0, 0, $lastpost);
    showmessage('collection_remove_thread', 'forum.php?mod=collection&action=view&ctid=' . $ctid);
} elseif ($op == 'invite') {
    if (!$ctid) {
        showmessage('undefined_action', NULL);
    }