Example #1
0
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;
}
Example #2
0
$smarty->assign("tpl_title", "Artikelverwaltung");
$smarty->assign('tpl_nav', 'settings');
$smarty->assign('tpl_subnav', 'editarticle');
$newperiod = 'false';
if ($request->GetVar('frm_period', 'post') !== $request->undefined) {
    $theperiod = $request->GetVar('frm_period', 'post');
} else {
    $actPeriod = $article->getactPeriod();
    $theperiod = $actPeriod['periodid'];
}
if ($request->GetVar('frm_action', 'post') == 'edit') {
    $smarty->assign('tpl_editid', $request->GetVar('frm_articleid', 'post'));
} elseif ($request->GetVar('frm_action', 'post') == 'addnew') {
    $smarty->assign('tpl_addnew', 'true');
} elseif ($request->GetVar('frm_action', 'post') == 'del') {
    $article->del($request->GetVar('frm_articleid', 'post'));
} elseif ($request->GetVar('frm_action', 'post') == 'new') {
    $check = $article->saveupdate();
} elseif ($request->GetVar('frm_action', 'post') == 'changeperiod') {
} elseif ($request->GetVar('frm_action', 'post') == 'saveupdatePeriod') {
    $theperiod = $article->saveupdatePeriod();
} elseif ($request->GetVar('frm_action', 'post') == 'newPeriod') {
    $theperiod = -1;
    $newperiod = 'true';
}
if ($request->GetVar('frm_thecat', 'post') !== $request->undefined) {
    $thecat = $request->GetVar('frm_thecat', 'post');
} else {
    $thecat = -1;
}
$smarty->assign('tpl_thecat', $thecat);