Beispiel #1
0
         $archive = 0;
         foreach ($threadtables as $tableid) {
             C::t('forum_thread')->count_posts_by_fid($targetgroup, $tableid);
             $threads += $data['threads'];
             $posts += $data['posts'];
             if ($data['threads'] > 0 && $tableid != 0) {
                 $archive = 1;
             }
         }
         C::t('forum_forum')->update($targetgroup, array('archive' => $archive));
         C::t('forum_forum')->update_forum_counter($targetgroup, $threads, $posts);
         delete_groupimg($fidarray);
         C::t('forum_forum')->delete_by_fid($fidarray);
         C::t('home_favorite')->delete_by_id_idtype($fidarray, 'gid');
         require_once libfile('function/delete');
         deletedomain($fidarray, 'group');
         if ($updaterecommend) {
             cacherecommend($fidstr, false);
         }
         updatecache(array('setting', 'grouptype'));
         cpmsg('group_mergegroup_succeed', 'action=group&operation=manage', 'succeed');
     }
 }
 if (empty($optype) || !in_array($optype, array('delete', 'changetype', 'mergegroup'))) {
     cpmsg('group_optype_no_choice', '', 'error');
 }
 if ($optype == 'changetype' && empty($newtypeid)) {
     cpmsg('group_newtypeid_no_choice', '', 'error');
 }
 if ($optype == 'mergegroup' && empty($targetgroup)) {
     cpmsg('group_targetgroup_no_choice', '', 'error');
Beispiel #2
0
function deleteportalcategory($ids)
{
    global $_G;
    if (empty($ids)) {
        return false;
    }
    if (!is_array($ids) && $_G['cache']['portalcategory'][$ids]['upid'] == 0) {
        @(require_once libfile('function/delete'));
        deletedomain(intval($ids), 'channel');
    }
    if (!is_array($ids)) {
        $ids = array($ids);
    }
    require_once libfile('class/blockpermission');
    require_once libfile('class/portalcategory');
    $tplpermission =& template_permission::instance();
    $templates = array();
    foreach ($ids as $id) {
        $templates[] = 'portal/list_' . $id;
        $templates[] = 'portal/view_' . $id;
    }
    $tplpermission->delete_allperm_by_tplname($templates);
    $categorypermission =& portal_category::instance();
    $categorypermission->delete_allperm_by_catid($ids);
    C::t('portal_category')->delete($ids);
    C::t('common_nav')->delete_by_type_identifier(4, $ids);
    $tpls = $defaultindex = array();
    foreach ($ids as $id) {
        $defaultindex[] = $_G['cache']['portalcategory'][$id]['caturl'];
        $tpls[] = 'portal/list_' . $id;
        $tpls[] = 'portal/view_' . $id;
    }
    if (in_array($_G['setting']['defaultindex'], $defaultindex)) {
        C::t('common_setting')->update('defaultindex', '');
    }
    C::t('common_diy_data')->delete($tpls, NULL);
    C::t('common_template_block')->delete_by_targettplname($tpls);
}
function updatetopic($topic = '')
{
    global $_G;
    $topicid = empty($topic) ? '' : $topic['topicid'];
    include_once libfile('function/home');
    $_POST['title'] = getstr(trim($_POST['title']), 255, 1, 1);
    $_POST['name'] = getstr(trim($_POST['name']), 255, 1, 1);
    $_POST['domain'] = getstr(trim($_POST['domain']), 255, 1, 1);
    if (empty($_POST['title'])) {
        return 'topic_title_cannot_be_empty';
    }
    if (empty($_POST['name'])) {
        $_POST['name'] = $_POST['title'];
    }
    if (!$topicid || $_POST['name'] != $topic['name']) {
        $value = DB::fetch_first('SELECT * FROM ' . DB::table('portal_topic') . " WHERE name = '{$_POST['name']}' LIMIT 1");
        if ($value) {
            return 'topic_name_duplicated';
        }
    }
    if ($topicid && !empty($topic['domain'])) {
        require_once libfile('function/delete');
        deletedomain($topicid, 'topic');
    }
    if (!empty($_POST['domain'])) {
        require_once libfile('function/domain');
        domaincheck($_POST['domain'], $_G['setting']['domain']['root']['topic'], 1);
    }
    $setarr = array('title' => $_POST['title'], 'name' => $_POST['name'], 'domain' => $_POST['domain'], 'summary' => getstr($_POST['summary'], '', 1, 1), 'keyword' => getstr($_POST['keyword'], '', 1, 1), 'useheader' => $_POST['useheader'] ? '1' : '0', 'usefooter' => $_POST['usefooter'] ? '1' : '0', 'allowcomment' => $_POST['allowcomment'] ? 1 : 0, 'closed' => $_POST['closed'] ? 0 : 1);
    if ($_POST['deletecover'] && $topic['cover']) {
        if ($topic['picflag'] != '0') {
            pic_delete(str_replace('portal/', '', $topic['cover']), 'portal', 0, $topic['picflag'] == '2' ? '1' : '0');
        }
        $setarr['cover'] = '';
    } else {
        if ($_FILES['cover']['tmp_name']) {
            if ($topic['cover'] && $topic['picflag'] != '0') {
                pic_delete(str_replace('portal/', '', $topic['cover']), 'portal', 0, $topic['picflag'] == '2' ? '1' : '0');
            }
            $pic = pic_upload($_FILES['cover'], 'portal');
            if ($pic) {
                $setarr['cover'] = 'portal/' . $pic['pic'];
                $setarr['picflag'] = $pic['remote'] ? '2' : '1';
            }
        } else {
            if (!empty($_POST['cover']) && $_POST['cover'] != $topic['cover']) {
                if ($topic['cover'] && $topic['picflag'] != '0') {
                    pic_delete(str_replace('portal/', '', $topic['cover']), 'portal', 0, $topic['picflag'] == '2' ? '1' : '0');
                }
                $setarr['cover'] = $_POST['cover'];
                $setarr['picflag'] = '0';
            }
        }
    }
    $primaltplname = '';
    if (empty($topicid) || empty($topic['primaltplname']) || $topic['primaltplname'] && $topic['primaltplname'] != 'portal/' . $_POST['primaltplname']) {
        $primaltplname = 'portal/' . $_POST['primaltplname'];
        $checktpl = checkprimaltpl($primaltplname);
        if ($checktpl !== true) {
            return $checktpl;
        }
        $setarr['primaltplname'] = $primaltplname;
    }
    if ($topicid) {
        DB::update('portal_topic', $setarr, array('topicid' => $topicid));
        DB::update('common_diy_data', array('name' => $setarr['title']), array('targettplname' => 'portal/portal_topic_content_' . $topicid));
    } else {
        $setarr['uid'] = $_G['uid'];
        $setarr['username'] = $_G['username'];
        $setarr['dateline'] = $_G['timestamp'];
        $setarr['closed'] = '1';
        $topicid = addtopic($setarr);
        if (!$topicid) {
            return 'topic_created_failed';
        }
    }
    if (!empty($_POST['domain'])) {
        DB::insert('common_domain', array('domain' => $_POST['domain'], 'domainroot' => addslashes($_G['setting']['domain']['root']['topic']), 'id' => $topicid, 'idtype' => 'topic'));
    }
    if ($topic['primaltplname'] != $primaltplname) {
        $targettplname = 'portal/portal_topic_content_' . $topicid;
        DB::update('common_diy_data', array('primaltplname' => $primaltplname), array('targettplname' => $targettplname));
        updatediytemplate($targettplname);
    }
    if ($primaltplname && empty($topic['primaltplname'])) {
        $content = file_get_contents(DISCUZ_ROOT . './template/default/' . $primaltplname . '.htm');
        $tplfile = DISCUZ_ROOT . './data/diy/portal/portal_topic_content_' . $topicid . '.htm';
        $tplpath = dirname($tplfile);
        if (!is_dir($tplpath)) {
            dmkdir($tplpath);
        }
        file_put_contents($tplfile, $content);
    }
    include_once libfile('function/cache');
    updatecache(array('diytemplatename', 'setting'));
    return $topicid;
}
Beispiel #4
0
function updatetopic($topic = '')
{
    global $_G;
    $topicid = empty($topic) ? '' : $topic['topicid'];
    include_once libfile('function/home');
    $_POST['title'] = getstr(trim($_POST['title']), 255);
    $_POST['name'] = getstr(trim($_POST['name']), 255);
    $_POST['domain'] = getstr(trim($_POST['domain']), 255);
    if (empty($_POST['title'])) {
        return 'topic_title_cannot_be_empty';
    }
    if (empty($_POST['name'])) {
        $_POST['name'] = $_POST['title'];
    }
    if (!$topicid || $_POST['name'] != $topic['name']) {
        if ($value = C::t('portal_topic')->fetch_by_name($_POST['name'])) {
            return 'topic_name_duplicated';
        }
    }
    if ($topicid && !empty($topic['domain'])) {
        require_once libfile('function/delete');
        deletedomain($topicid, 'topic');
    }
    if (!empty($_POST['domain'])) {
        require_once libfile('function/domain');
        domaincheck($_POST['domain'], $_G['setting']['domain']['root']['topic'], 1);
    }
    $setarr = array('title' => $_POST['title'], 'name' => $_POST['name'], 'domain' => $_POST['domain'], 'summary' => getstr($_POST['summary']), 'keyword' => getstr($_POST['keyword']), 'useheader' => $_POST['useheader'] ? '1' : '0', 'usefooter' => $_POST['usefooter'] ? '1' : '0', 'allowcomment' => $_POST['allowcomment'] ? 1 : 0, 'closed' => $_POST['closed'] ? 0 : 1);
    if ($_POST['deletecover'] && $topic['cover']) {
        if ($topic['picflag'] != '0') {
            pic_delete(str_replace('portal/', '', $topic['cover']), 'portal', 0, $topic['picflag'] == '2' ? '1' : '0');
        }
        $setarr['cover'] = '';
    } else {
        if ($_FILES['cover']['tmp_name']) {
            if ($topic['cover'] && $topic['picflag'] != '0') {
                pic_delete(str_replace('portal/', '', $topic['cover']), 'portal', 0, $topic['picflag'] == '2' ? '1' : '0');
            }
            $pic = pic_upload($_FILES['cover'], 'portal');
            if ($pic) {
                $setarr['cover'] = 'portal/' . $pic['pic'];
                $setarr['picflag'] = $pic['remote'] ? '2' : '1';
            }
        } else {
            if (!empty($_POST['cover']) && $_POST['cover'] != $topic['cover']) {
                if ($topic['cover'] && $topic['picflag'] != '0') {
                    pic_delete(str_replace('portal/', '', $topic['cover']), 'portal', 0, $topic['picflag'] == '2' ? '1' : '0');
                }
                $setarr['cover'] = $_POST['cover'];
                $setarr['picflag'] = '0';
            }
        }
    }
    $primaltplname = '';
    if (empty($topicid) || empty($topic['primaltplname']) || $topic['primaltplname'] && $topic['primaltplname'] != $_POST['primaltplname']) {
        $primaltplname = $_POST['primaltplname'];
        if (!isset($_POST['signs'][dsign($primaltplname)])) {
            return 'diy_sign_invalid';
        }
        $checktpl = checkprimaltpl($primaltplname);
        if ($checktpl !== true) {
            return $checktpl;
        }
        $setarr['primaltplname'] = $primaltplname;
    }
    if ($topicid) {
        C::t('portal_topic')->update($topicid, $setarr);
        C::t('common_diy_data')->update('portal/portal_topic_content_' . $topicid, getdiydirectory($topic['primaltplname']), array('name' => $setarr['title']));
    } else {
        $setarr['uid'] = $_G['uid'];
        $setarr['username'] = $_G['username'];
        $setarr['dateline'] = $_G['timestamp'];
        $setarr['closed'] = '1';
        $topicid = addtopic($setarr);
        if (!$topicid) {
            return 'topic_created_failed';
        }
    }
    if (!empty($_POST['domain'])) {
        C::t('common_domain')->insert(array('domain' => $_POST['domain'], 'domainroot' => $_G['setting']['domain']['root']['topic'], 'id' => $topicid, 'idtype' => 'topic'));
    }
    $tpldirectory = '';
    if ($primaltplname && $topic['primaltplname'] != $primaltplname) {
        $targettplname = 'portal/portal_topic_content_' . $topicid;
        if (strpos($primaltplname, ':') !== false) {
            list($tpldirectory, $primaltplname) = explode(':', $primaltplname);
        }
        C::t('common_diy_data')->update($targettplname, getdiydirectory($topic['primaltplname']), array('primaltplname' => $primaltplname, 'tpldirectory' => $tpldirectory));
        updatediytemplate($targettplname);
    }
    if ($primaltplname && empty($topic['primaltplname'])) {
        $tpldirectory = $tpldirectory ? $tpldirectory : $_G['cache']['style_default']['tpldir'];
        $content = file_get_contents(DISCUZ_ROOT . $tpldirectory . '/' . $primaltplname . '.htm');
        $tplfile = DISCUZ_ROOT . './data/diy/' . $tpldirectory . '/portal/portal_topic_content_' . $topicid . '.htm';
        $tplpath = dirname($tplfile);
        if (!is_dir($tplpath)) {
            dmkdir($tplpath);
        }
        file_put_contents($tplfile, $content);
    }
    include_once libfile('function/cache');
    updatecache(array('diytemplatename', 'setting'));
    return $topicid;
}
Beispiel #5
0
function deleteportaltopic($dels)
{
    if (empty($dels)) {
        return false;
    }
    $targettplname = array();
    foreach ((array) $dels as $key => $value) {
        $targettplname[] = 'portal/portal_topic_content_' . $value;
    }
    C::t('common_diy_data')->delete($targettplname, null);
    require_once libfile('class/blockpermission');
    $tplpermission =& template_permission::instance();
    $templates = array();
    $tplpermission->delete_allperm_by_tplname($targettplname);
    deletedomain($dels, 'topic');
    C::t('common_template_block')->delete_by_targettplname($targettplname);
    require_once libfile('function/home');
    $picids = array();
    foreach (C::t('portal_topic')->fetch_all($dels) as $value) {
        if ($value['picflag'] != '0') {
            pic_delete(str_replace('portal/', '', $value['cover']), 'portal', 0, $value['picflag'] == '2' ? '1' : '0');
        }
    }
    $picids = array();
    foreach (C::t('portal_topic_pic')->fetch_all($dels) as $value) {
        $picids[] = $value['picid'];
        pic_delete($value['filepath'], 'portal', $value['thumb'], $value['remote']);
    }
    if (!empty($picids)) {
        C::t('portal_topic_pic')->delete($picids, true);
    }
    C::t('portal_topic')->delete($dels);
    C::t('portal_comment')->delete_by_id_idtype($dels, 'topicid');
    C::t('common_moderate')->delete($dels, 'topicid_cid');
    include_once libfile('function/block');
    block_clear();
    include_once libfile('function/cache');
    updatecache('diytemplatename');
}
Beispiel #6
0
 if ($_G['gp_op'] == 'group') {
     $domainlength = checkperm('domainlength');
     if (submitcheck('groupmanage')) {
         $forumarr = array();
         if (isset($_G['gp_domain']) && $_G['forum']['domain'] != $_G['gp_domain']) {
             $domain = strtolower(trim($_G['gp_domain']));
             if ($_G['setting']['allowgroupdomain'] && !empty($_G['setting']['domain']['root']['group']) && $domainlength) {
                 checklowerlimit('modifydomain');
             }
             if (empty($domainlength) || empty($domain)) {
                 $domain = '';
             } else {
                 require_once libfile('function/domain');
                 if (domaincheck($domain, $_G['setting']['domain']['root']['group'], $domainlength)) {
                     require_once libfile('function/delete');
                     deletedomain($_G['fid'], 'group');
                     DB::insert('common_domain', array('domain' => $domain, 'domainroot' => addslashes($_G['setting']['domain']['root']['group']), 'id' => $_G['fid'], 'idtype' => 'group'));
                 }
             }
             $forumarr['domain'] = $domain;
             updatecreditbyaction('modifydomain');
         }
         if ($_G['gp_name'] && !empty($specialswitch['allowchangename']) || $_G['gp_fup'] && !empty($specialswitch['allowchangetype'])) {
             if ($_G['uid'] != $_G['forum']['founderuid'] && $_G['adminid'] != 1) {
                 showmessage('group_edit_only_founder');
             }
             if (isset($_G['gp_name'])) {
                 $_G['gp_name'] = censor(addslashes(dhtmlspecialchars(cutstr(stripslashes(trim($_G['gp_name'])), 20, ''))));
                 if (empty($_G['gp_name'])) {
                     showmessage('group_name_empty');
                 }
Beispiel #7
0
 $ajax = $_GET['ajax'];
 $confirmed = $_GET['confirmed'];
 $finished = $_GET['finished'];
 $total = intval($_GET['total']);
 $pp = intval($_GET['pp']);
 $currow = intval($_GET['currow']);
 if ($_GET['ajax']) {
     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);
     deletedomain($fid, 'forum');
     deletedomain($fid, 'subarea');
     if ($currow + $pp > $total) {
         $log_handler = Cloud::loadClass('Cloud_Service_SearchHelper');
         $log_handler->myThreadLog('delforum', array('fid' => $fid));
         C::t('forum_forum')->delete_by_fid($fid);
         C::t('common_nav')->delete_by_type_identifier(5, $fid);
         C::t('home_favorite')->delete_by_id_idtype($fid, 'fid');
         C::t('forum_moderator')->delete_by_fid($fid);
         C::t('common_member_forum_buylog')->delete_by_fid($fid);
         C::t('forum_access')->delete_by_fid($fid);
         echo 'TRUE';
         exit;
     }
     echo 'GO';
     exit;
 } else {
function deleteportaltopic($dels)
{
    if (empty($dels)) {
        return false;
    }
    $targettplname = array();
    foreach ((array) $dels as $key => $value) {
        $targettplname[] = 'portal/portal_topic_content_' . $value;
    }
    DB::delete('common_diy_data', "targettplname IN (" . dimplode($targettplname) . ")", 0, true);
    require_once libfile('class/blockpermission');
    $tplpermission =& template_permission::instance();
    $templates = array();
    $tplpermission->delete_allperm_by_tplname($targettplname);
    deletedomain($dels, 'topic');
    DB::delete('common_template_block', 'targettplname IN (' . dimplode($targettplname) . ')', 0, true);
    require_once libfile('function/home');
    $picids = array();
    $query = DB::query('SELECT * FROM ' . DB::table('portal_topic') . ' WHERE topicid IN (' . dimplode($dels) . ')');
    while ($value = DB::fetch($query)) {
        if ($value['picflag'] != '0') {
            pic_delete(str_replace('portal/', '', $value['cover']), 'portal', 0, $value['picflag'] == '2' ? '1' : '0');
        }
    }
    $picids = array();
    $query = DB::query('SELECT * FROM ' . DB::table('portal_topic_pic') . ' WHERE topicid IN (' . dimplode($dels) . ')');
    while ($value = DB::fetch($query)) {
        $picids[] = $value['picid'];
        pic_delete($value['filepath'], 'portal', $value['thumb'], $value['remote']);
    }
    if (!empty($picids)) {
        DB::delete('portal_topic_pic', 'picid IN (' . dimplode($picids) . ')', 0, true);
    }
    foreach ($targettplname as $key => $value) {
        @unlink(DISCUZ_ROOT . './data/diy/' . $value . '.htm');
        @unlink(DISCUZ_ROOT . './data/diy/' . $value . '.htm.bak');
        @unlink(DISCUZ_ROOT . './data/diy/' . $value . '_preview.htm');
    }
    DB::delete('portal_topic', 'topicid IN (' . dimplode($dels) . ')');
    DB::delete('portal_comment', "id IN(" . dimplode($dels) . ") AND idtype='topicid'");
    DB::delete('common_moderate', "id IN (" . dimplode($dels) . ") AND idtype='topicid_cid'");
    include_once libfile('function/block');
    block_clear();
    include_once libfile('function/cache');
    updatecache('diytemplatename');
}
function deleteportalcategory($ids)
{
    global $_G;
    if (empty($ids)) {
        return false;
    }
    if (!is_array($ids) && $_G['cache']['portalcategory'][$ids]['upid'] == 0) {
        @(require_once libfile('function/delete'));
        deletedomain(intval($ids), 'channel');
    }
    if (!is_array($ids)) {
        $ids = array($ids);
    }
    require_once libfile('class/blockpermission');
    require_once libfile('class/portalcategory');
    $tplpermission =& template_permission::instance();
    $templates = array();
    foreach ($ids as $id) {
        $templates[] = 'portal/list_' . $id;
    }
    $tplpermission->delete_allperm_by_tplname($templates);
    $categorypermission =& portal_category::instance();
    $categorypermission->delete_allperm_by_catid($ids);
    DB::delete('portal_category', "catid IN (" . dimplode($ids) . ")");
    DB::delete('common_nav', "`type`='4' AND identifier IN (" . dimplode($ids) . ")");
    $tpls = $defaultindex = array();
    foreach ($ids as $id) {
        $defaultindex[] = $_G['cache']['portalcategory'][$id]['caturl'];
        $tpls[] = 'portal/list_' . $id;
        @unlink(DISCUZ_ROOT . './data/diy/portal/list_' . $id . '.htm');
        @unlink(DISCUZ_ROOT . './data/diy/portal/list_' . $id . '.htm.bak');
        @unlink(DISCUZ_ROOT . './data/diy/portal/list_' . $id . '_diy_preview.htm');
    }
    if (in_array($_G['setting']['defaultindex'], $defaultindex)) {
        DB::insert('common_setting', array('skey' => 'defaultindex', 'svalue' => ''), 0, 1);
    }
    $wheresql = "targettplname IN (" . dimplode($tpls) . ")";
    DB::delete('common_diy_data', $wheresql);
    DB::delete('common_template_block', $wheresql);
}
    $setarr = array();
    $_POST['domain'] = strtolower(trim($_POST['domain']));
    if ($_POST['domain'] != $space['domain']) {
        if (empty($domainlength) || empty($_POST['domain'])) {
            $setarr['domain'] = '';
        } else {
            require_once libfile('function/domain');
            if (domaincheck($_POST['domain'], $_G['setting']['domain']['root']['home'], $domainlength)) {
                $setarr['domain'] = $_POST['domain'];
            }
        }
    }
    if ($setarr) {
        updatecreditbyaction('modifydomain');
        DB::update('common_member_field_home', $setarr, array('uid' => $_G['uid']));
        require_once libfile('function/delete');
        deletedomain($_G['uid'], 'home');
        if (!empty($setarr['domain'])) {
            DB::insert('common_domain', array('domain' => $setarr['domain'], 'domainroot' => addslashes($_G['setting']['domain']['root']['home']), 'id' => $_G['uid'], 'idtype' => 'home'));
        }
    }
    showmessage('domain_succeed', 'home.php?mod=spacecp&ac=domain');
}
$result = DB::fetch_first("SELECT * FROM " . DB::table('common_setting') . " WHERE skey='profilegroup'");
$defaultop = '';
if (!empty($result['svalue'])) {
    $profilegroup = unserialize($result['svalue']);
}
$actives = array('profile' => ' class="a"');
$opactives = array('domain' => ' class="a"');
include_once template("home/spacecp_domain");
Beispiel #11
0
function deleteportaltopic($dels)
{
    if (empty($dels)) {
        return false;
    }
    $targettplname = array();
    foreach ((array) $dels as $key => $value) {
        $targettplname[] = 'portal/portal_topic_content_' . $value;
    }
    DB::delete('common_diy_data', "targettplname IN (" . dimplode($targettplname) . ")", 0, true);
    deletedomain($dels, 'topic');
    DB::delete('common_template_permission', "targettplname IN (" . dimplode($targettplname) . ")", 0, true);
    $bids = array();
    $query = DB::query('SELECT bid FROM ' . DB::table('common_template_block') . ' WHERE targettplname IN (' . dimplode($targettplname) . ')');
    while ($value = DB::fetch($query)) {
        $bids[] = $value['bid'];
    }
    $bids = dimplode($bids);
    if (!empty($bids)) {
        DB::query('DELETE FROM ' . DB::table('common_block') . ' WHERE bid IN (' . $bids . ')', 'UNBUFFERED');
        DB::query('DELETE FROM ' . DB::table('common_block_permission') . ' WHERE bid IN (' . $bids . ')', 'UNBUFFERED');
    }
    DB::delete('common_template_block', 'targettplname IN (' . dimplode($targettplname) . ')', 0, true);
    require_once libfile('function/home');
    $picids = array();
    $query = DB::query('SELECT * FROM ' . DB::table('portal_topic') . ' WHERE topicid IN (' . dimplode($dels) . ')');
    while ($value = DB::fetch($query)) {
        if ($value['picflag'] != '0') {
            pic_delete(str_replace('portal/', '', $value['cover']), 'portal', 0, $value['picflag'] == '2' ? '1' : '0');
        }
    }
    $picids = array();
    $query = DB::query('SELECT * FROM ' . DB::table('portal_topic_pic') . ' WHERE topicid IN (' . dimplode($dels) . ')');
    while ($value = DB::fetch($query)) {
        $picids[] = $value['picid'];
        pic_delete($value['filepath'], 'portal', $value['thumb'], $value['remote']);
    }
    if (!empty($picids)) {
        DB::delete('portal_topic_pic', 'picid IN (' . dimplode($picids) . ')', 0, true);
    }
    foreach ($targettplname as $key => $value) {
        @unlink(DISCUZ_ROOT . './data/diy/' . $value . '.htm');
        @unlink(DISCUZ_ROOT . './data/diy/' . $value . '.htm.bak');
    }
    DB::delete('portal_topic', 'topicid IN (' . dimplode($dels) . ')', 0, true);
    include_once libfile('function/cache');
    updatecache('diytemplatename');
}