include 'template/admin_field_import.html';
} elseif ($action == 'save_import') {
    if (!check_purview('field_del')) {
        msg('<span style="color:red">操作失败,你的权限不足!</span>');
    }
    $channel_id = intval($_POST['channel_id']);
    if (empty($channel_id)) {
        msg('参数发生错误!请重新操作!');
    }
    $sql = "select field_name,use_name,field_type,field_value,field_length,field_info,is_disable,is_del,field_order from " . DB_PRE . "auto_fields where channel_id = " . $channel_id;
    $rel = $GLOBALS['mysql']->fetch_asc($sql);
    if (!empty($rel)) {
        $arr_str = "<?php\n\$field_arr = " . var_export($rel, true) . ";\n?>";
    }
    $file = DATA_PATH . 'backup/' . 'field_arr_' . $channel_id . '.php';
    creat_inc($file, $arr_str);
    msg('字段field_arr.php导出完成!请到data/backup目录下下载导出文件!', '?action=channel');
} elseif ($action == 'backup') {
    if (!check_purview('field_del')) {
        msg('<span style="color:red">操作失败,你的权限不足!</span>');
    }
    $channel_id = intval($_GET['id']);
    if (empty($channel_id)) {
        msg('参数发生错误');
    }
    include 'template/admin_field_backup.html';
} elseif ($action == 'save_backup') {
    if (!check_purview('field_del')) {
        msg('<span style="color:red">操作失败,你的权限不足!</span>');
    }
    $channel_id = intval($_POST['channel_id']);
    if (file_exists(DATA_PATH . $lang . '_info.php')) {
        include DATA_PATH . $lang . '_info.php';
    }
    unset($_POST['action'], $_POST['submit'], $_POST['lang']);
    foreach ($_POST as $k => $v) {
        //if(in_array($k,array('web_powerby','web_beian','web_yinxiao'))){$v=htmlspecialchars($v);}
        if (is_array($v)) {
            $info[$k] = $v[0];
        } else {
            $info[$k] = $v;
        }
    }
    //更换模板清除现有配置
    $web_template = $_POST['web_template'];
    if ($web_template != $_confing['web_template']) {
        //清除缓存编译文件
        $GLOBALS['tpl']->del_cache();
    }
    if ($GLOBALS['mysql']->fetch_rows("select id from " . DB_PRE . "cmsinfo where lang_tag='" . $lang . "' and info_tag='info'")) {
        $sql = "update " . DB_PRE . "cmsinfo set info_array='" . addslashes(var_export($info, 'true')) . "' where lang_tag='" . $lang . "' and info_tag='info'";
    } else {
        $sql = "insert into " . DB_PRE . "cmsinfo (info_tag,info_array,info_name,lang_tag) values ('info','" . addslashes(var_export($info, true)) . "','网站配置','" . $lang . "')";
    }
    $GLOBALS['mysql']->query($sql);
    if (!empty($info)) {
        $s = "<?php\n\$_confing=" . var_export($info, true) . ";\n?>";
    }
    $file = DATA_PATH . $lang . '_info.php';
    creat_inc($file, $s);
    msg('网站配置成功', '?lang=' . $lang . '&' . $nav_query);
}
     return false;
 }
 $id = intval($_REQUEST['id']);
 $table = $_REQUEST['table'];
 $field = $_REQUEST['field'];
 $order = $_REQUEST['order'];
 $value = empty($value) ? 1 : 0;
 $sql = "update " . DB_PRE . "{$table} set {$field}=" . intval($value) . " where id={$id}";
 $GLOBALS['mysql']->query($sql);
 //更新缓存
 if ($table == "channel") {
     $sql = "select*from " . DB_PRE . "{$table} order by {$order} desc";
     $rel = $GLOBALS['mysql']->fetch_asc($sql);
     $cache_file = DATA_PATH . 'cache_channel/cache_channel_all.php';
     $str = "<?php\n\$channel=" . var_export($rel, true) . ";\n?>";
     creat_inc($cache_file, $str);
 } elseif ($table == 'form') {
     $form_file = DATA_PATH . 'cache_form/form.php';
     $rel = $GLOBALS['mysql']->fetch_asc("select*from " . DB_PRE . "form order by id desc");
     $cache_str = "<?php\n\$form=" . var_export($rel, true) . ";\n?>";
     cache_write($form_file, $cache_str);
 }
 if (empty($value)) {
     $class = "qi_yes";
     $title = "开启";
 } else {
     $class = "qi_no";
     $title = "关闭";
 }
 $data = "<span onclick=\"click_show(this,'{$value}','{$id}','channel','is_disable','{$lang}','channel_order');\" class=\"{$class}\" title=\"{$title}\">&nbsp;</span>";
 die($data);
 * 您只能在不用于商业目的的前提下对程序代码进行修改和使用;
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/
define('IN_CMS', 'true');
include 'init.php';
$action = isset($_REQUEST['action']) ? fl_html(fl_value($_REQUEST['action'])) : 'sys';
//系统设置页
if ($action == 'sys') {
    if (file_exists(DATA_PATH . 'sys_info.php')) {
        include DATA_PATH . 'sys_info.php';
    }
    include 'template/admin_sys.html';
} elseif ($action == 'add_sys') {
    if (!check_purview('sys_info')) {
        msg('<span style="color:red">操作失败,你的权限不足!</span>');
    }
    if (!isset($_POST['submit'])) {
        msg('<span style="color:red">请从表单提交</span>');
    }
    unset($_POST['action'], $_POST['submit']);
    foreach ($_POST as $k => $v) {
        $info[$k] = $v;
    }
    $sql = "update " . DB_PRE . "cmsinfo set info_array='" . addslashes(var_export($info, 'true')) . "' where id=1 and info_tag='sys'";
    $GLOBALS['mysql']->query($sql);
    $file = DATA_PATH . 'sys_info.php';
    $str = "<?php\n\$_sys=" . var_export($info, true) . ";\n?>";
    creat_inc($file, $str);
    msg('系统信息配置成功', '?' . $nav_query);
}
Beispiel #5
0
function create_nav_xml($lang)
{
    if (empty($lang)) {
        return;
    }
    $str = '<?xml version="1.0" encoding="utf-8"?' . ">\r\n";
    $str .= "<root>\r\n";
    if (file_exists(DATA_PATH . 'cache_cate/cate_list_' . $lang . '.php')) {
        include DATA_PATH . 'cache_cate/cate_list_' . $lang . '.php';
    }
    if (file_exists(DATA_PATH . $lang . '_info.php')) {
        include DATA_PATH . $lang . '_info.php';
    }
    $path = CMS_SELF;
    if (!empty($cate_list)) {
        foreach ($cate_list as $k => $v) {
            $is_nav = 0;
            if (!empty($v['cate_nav'])) {
                $cate_nav = explode(',', $v['cate_nav']);
                $is_nav = in_array('2', $cate_nav) ? 1 : 0;
            }
            if ($is_nav) {
                $url = $v['cate_html'] && $_confing['web_html'][0] ? $path . 'htm/' . $v['cate_fold_name'] : $path . 'show_list.php?id=' . $v['id'];
                if ($v['cate_tpl'] == 3) {
                    $url = $v['cate_html'] && $_confing['web_html'][0] ? $path . 'htm/' . $v['cate_fold_name'] . '/index_' . $lang . '.html' : $path . 'show_list.php?id=' . $v['id'];
                }
                $str .= "<nav";
                $str .= " name=\"" . $v['cate_name'] . "\"";
                $str .= " url=\"" . $url . "\">\r\n";
                if ($v['haschild']) {
                    foreach ($cate_list as $key => $value) {
                        if ($value['cate_parent'] == $v['id']) {
                            $url2 = $value['cate_html'] && $_confing['web_html'][0] ? $path . 'htm/' . $value['cate_fold_name'] : $path . 'show_list.php?id=' . $value['id'];
                            if ($value['cate_tpl'] == 3) {
                                $url2 = $value['cate_html'] && $_confing['web_html'][0] ? $path . 'htm/' . $value['cate_fold_name'] . '/index_' . $lang . '.html' : $path . 'show_list.php?id=' . $value['id'];
                            }
                            $str .= "<nav_child";
                            $str .= " name=\"" . $value['cate_name'] . "\"";
                            $str .= " url=\"" . $url2 . "\"";
                            $str .= "/>\r\n";
                        }
                    }
                }
                //二级结束
                $str .= "</nav>\r\n";
            }
        }
    }
    //处理结束
    $str .= "</root>";
    creat_inc(DATA_PATH . $lang . '_nav.xml', $str);
}
        foreach ($rel as $k => $v) {
            $language[$v['lang_tag']] = $v['lang_value'];
        }
    }
    $lang_file = LANG_PATH . 'lang_' . $lang . '.php';
    $str = "<?php\n\$language=" . var_export($language, true) . ";\n?>";
    creat_inc($lang_file, $str);
    msg('语言变量修改完成', '?action=edit&lang=' . $lang);
} elseif ($action == 'del_lang_lang') {
    if (!check_purview('lang_lang')) {
        msg('<span style="color:red">操作失败,你的权限不足!</span>');
    }
    $id = $_GET['id'];
    if (empty($lang) || empty($id)) {
        msg('<span style="color:red">参数发生错误,请重新操作</span>');
    }
    $GLOBALS['mysql']->query("delete from " . DB_PRE . "lang_lang where id=" . intval($id));
    //写入缓存
    $sql = "select lang_tag,lang_value from " . DB_PRE . "lang_lang where lang='{$lang}' order by id desc";
    $rel = $GLOBALS['mysql']->fetch_asc($sql);
    $language = array();
    if (!empty($rel)) {
        foreach ($rel as $k => $v) {
            $language[$v['lang_tag']] = $v['lang_value'];
        }
    }
    $lang_file = LANG_PATH . 'lang_' . $lang . '.php';
    $str = "<?php\n\$language=" . var_export($language, true) . ";\n?>";
    creat_inc($lang_file, $str);
    msg('语言变量删除完成', '?action=edit&lang=' . $lang);
}