Exemple #1
0
function check_power()
{
    global $global;
    $flag = 0;
    if ($global['admin_id']) {
        $obj = new admin();
        $obj->set_where('adm_id = ' . $global['admin_id']);
        $one = $obj->get_one();
        if ($one['adm_power'] == 'all') {
            $flag = 1;
        } elseif ($one['adm_power'] != '') {
            $val = $global['channel'] . '/mod-' . $global['mod'];
            $urls = explode('|', $one['adm_power']);
            for ($i = 0; $i < count($urls); $i++) {
                if ($urls[$i] == '/' . $val . '/') {
                    $flag = 1;
                    break;
                }
            }
            if ($flag == 0) {
                $obj = new menu();
                $obj->set_where('');
                $obj->set_where("men_url like '%" . $val . "%'");
                if ($obj->get_count() == 0) {
                    $flag = 1;
                }
            }
        }
    }
    return $flag;
}
Exemple #2
0
function get_power_arr()
{
    $arr = array();
    $obj = new menu();
    $obj->set_where('');
    $obj->set_where("left(men_type,6) = 'admin_'");
    $list = $obj->get_list();
    for ($i = 0; $i < count($list); $i++) {
        $arr[$i]['name'] = $list[$i]['men_name'];
        $arr[$i]['url'] = '/' . $list[$i]['men_url'];
        $arr[$i]['set'] = 0;
    }
    return $arr;
}
Exemple #3
0
function module_left()
{
    global $global, $smarty;
    if ($global['channel'] == 'about' || $global['channel'] == 'recruit' || $global['channel'] == 'download') {
        $type = 'article';
    } else {
        $type = $global['channel'];
    }
    $obj = new menu();
    $obj->set_field('men_name,men_url');
    $obj->set_where('');
    $obj->set_where("men_lang = 'none'");
    $obj->set_where("men_type = 'admin_" . $type . "'");
    $obj->set_where("men_show = 1");
    $smarty->assign('nav_left', $obj->get_list());
}
Exemple #4
0
function edit_nav()
{
    global $smarty, $lang;
    for ($i = 0; $i < count($_POST['id']); $i++) {
        $word = strict($_POST['word'][$i]);
        $link = strict($_POST['link'][$i]);
        $id = strict($_POST['id'][$i]);
        $obj = new menu();
        $obj->set_value('men_name', $word);
        $obj->set_value('men_url', $link);
        $obj->set_where('');
        $obj->set_where("men_id = {$id}");
        $obj->edit();
    }
    $smarty->assign('info_text', '修改导航成功');
    $smarty->assign('link_text', '返回上一页');
    $smarty->assign('link_href', url(array('channel' => 'super', 'mod' => 'nav_list')));
}
Exemple #5
0
function module_nav_list()
{
    global $smarty;
    $obj = new varia();
    $obj->set_where("left(var_name,10) = 'nav_admin_'");
    $arr = $obj->get_list();
    for ($i = 0; $i < count($arr); $i++) {
        $name = substr($arr[$i]['var_name'], 4);
        $obj = new menu();
        $obj->set_where('');
        $obj->set_where("men_type = '{$name}'");
        $list[$name] = $obj->get_list();
        $nav[$i]['type'] = $name;
        $nav[$i]['name'] = $arr[$i]['var_value'];
    }
    $smarty->assign('nav', $nav);
    $smarty->assign('list', $list);
}
Exemple #6
0
function module_header()
{
    global $smarty;
    $obj = new varia();
    $obj->set_where("var_name = 'languages'");
    $list = $obj->get_list();
    for ($i = 0; $i < count($list); $i++) {
        $arr = explode('{v}', $list[$i]['var_value']);
        $list[$i]['pack_name'] = $arr[0];
        $list[$i]['index_entrance'] = $arr[1];
        $list[$i]['admin_entrance'] = $arr[2];
        $list[$i]['chinese_name'] = $arr[3];
        $list[$i]['foreign_name'] = $arr[4];
    }
    $smarty->assign('lang_pack', $list);
    $obj = new menu();
    $obj->set_field('men_name,men_url');
    $obj->set_where('');
    $obj->set_where("men_lang = 'none'");
    $obj->set_where("men_type = 'admin_header'");
    $obj->set_where("men_show = 1");
    $smarty->assign('nav_header', $obj->get_list());
}
Exemple #7
0
function module_footer()
{
    global $smarty;
    $obj = new menu();
    $obj->set_where("men_type = 'footer'");
    $smarty->assign('footer_nav', $obj->get_list());
    $obj = new varia();
    $site['domain'] = $obj->get_value('site_domain');
    $site['record'] = $obj->get_value('site_record');
    $site['record_url'] = $obj->get_value('site_record_url');
    $site['tech'] = $obj->get_value('site_tech');
    $site['tech_url'] = $obj->get_value('site_tech_url');
    $site['statistical_code'] = im_filter($obj->get_value('statistical_code', true));
    $smarty->assign('site', $site);
}
Exemple #8
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;
}