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'); }
cpmsg('block_perm_update_succeed', "action=block&operation=perm&bid={$bid}", 'succeed'); } } else { if (submitcheck('deletesubmit')) { if ($_POST['ids']) { $_POST['ids'] = daddslashes($_POST['ids']); DB::query('DELETE FROM ' . DB::table('common_block_item') . " WHERE bid IN (" . dimplode($_POST['ids']) . ")"); DB::query('DELETE FROM ' . DB::table('common_block') . " WHERE bid IN (" . dimplode($_POST['ids']) . ")"); DB::delete('common_block_permission', 'bid IN (' . dimplode($_POST['ids']) . ')'); cpmsg('block_delete_succeed', 'action=block&operation=jscall', 'succeed'); } else { cpmsg('block_choose_at_least_one_block', 'action=block&operation=jscall', 'error'); } } elseif (submitcheck('clearsubmit')) { include_once libfile('function/block'); block_clear(); cpmsg('block_clear_unused_succeed', 'action=block', 'succeed'); } else { loadcache(array('diytemplatename')); $searchctrl = '<span style="float: right; padding-right: 40px;">' . '<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'\';$(\'a_search_show\').style.display=\'none\';$(\'a_search_hide\').style.display=\'\';" id="a_search_show" style="display:none">' . cplang('show_search') . '</a>' . '<a href="javascript:;" onclick="$(\'tb_search\').style.display=\'none\';$(\'a_search_show\').style.display=\'\';$(\'a_search_hide\').style.display=\'none\';" id="a_search_hide">' . cplang('hide_search') . '</a>' . '</span>'; showsubmenu('block', array(array('block_list', 'block', $operation == 'list'), array('block_jscall', 'block&operation=jscall', $operation == 'jscall')), $searchctrl); $mpurl = ADMINSCRIPT . '?action=block&operation=' . $operation; $intkeys = array('bid'); $strkeys = array('blockclass'); $strkeys[] = 'targettplname'; $randkeys = array(); $likekeys = array('name'); $results = getwheres($intkeys, $strkeys, $randkeys, $likekeys); foreach ($likekeys as $k) { $_GET[$k] = htmlspecialchars(stripslashes($_GET[$k])); }
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'); }