function do_del_channel($channel_id) { //判断频道是否已存在 $obj = new channel(); $obj->set_where(''); $obj->set_where("cha_id = {$channel_id}"); $channel = $obj->get_one(); if (count($channel)) { $cha_code = $channel['cha_code']; $obj->del(); } else { return 0; } //删除前台导航(导航管理) $obj = new varia(); $obj->set_where("var_name = 'nav_stage_" . $cha_code . "'"); $obj->del(); //删除后台导航(导航管理) $obj->set_where(''); $obj->set_where("var_name = 'nav_admin_" . $cha_code . "'"); $obj->del(); //删除后台导航菜单 $obj = new menu(); $obj->set_where("men_type = '{$cha_code}'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_header'"); $obj->set_where("men_url = '" . $cha_code . "/mod-sheet/'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_" . $cha_code . "'"); $obj->set_where("men_url = '" . $cha_code . "/mod-sheet/'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_" . $cha_code . "'"); $obj->set_where("men_url = '" . $cha_code . "/mod-add/'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_" . $cha_code . "'"); $obj->set_where("men_url = '" . $cha_code . "/mod-cat_list/'"); $obj->del(); $obj->set_where(''); $obj->set_where("men_type = 'admin_" . $cha_code . "'"); $obj->set_where("men_url = '" . $cha_code . "/mod-att_list/'"); $obj->del(); //删除前台导航菜单 $obj = new menu(); $obj->set_where("men_type = 'header'"); $obj->set_where("men_url = '" . $cha_code . "/'"); $obj->del(); //删除分类 $obj = new cat_art(); $obj->set_where(''); $obj->set_where("cat_channel_id = {$channel_id}"); $obj->del(); //删除内容 $obj = new article(); $obj->set_where(''); $obj->set_where("art_channel_id = {$channel_id}"); $obj->del(); //删除属性 $obj = new att_art(); $obj->set_where(''); $obj->set_where("att_channel_id = {$channel_id}"); $obj->del(); //删除语言包 $path = 'languages/' . S_LANG . '/admin/' . $cha_code . '.txt'; if (file_exists($path)) { unlink($path); } $path = 'languages/' . S_LANG . '/index/' . $cha_code . '.txt'; if (file_exists($path)) { unlink($path); } //修改伪静态文件 $path = 'admin/module/basic/htaccess.txt'; if (file_exists($path)) { $str = file_get_contents($path); $rule = "\n" . 'RewriteRule ^' . $cha_code . '/(.*)$ index.php?/' . $cha_code . '/$1'; $str = str_replace($rule, '', $str); file_put_contents($path, $str); } return 1; }