예제 #1
0
파일: deal.php 프로젝트: jechiy/xiu-cms
function edit_tailor_cat()
{
    global $smarty;
    $obj = new varia();
    $obj->set_where("var_name = 'tailor_data_cat'");
    $list = $obj->get_list();
    for ($i = 0; $i < count($_POST['varia_id']); $i++) {
        $varia_id = strict($_POST['varia_id'][$i]);
        $data_channel = strict($_POST['data_channel'][$i]);
        $data_cat = strict($_POST['data_cat'][$i]);
        for ($j = 0; $j < count($list); $j++) {
            if ($list[$j]['var_id'] == $varia_id) {
                $arr = explode('|', $list[$j]['var_value']);
                if ($arr[2] != $data_channel || $arr[3] != $data_cat) {
                    $val = $arr[0] . '|' . $arr[1] . '|' . $data_channel . '|' . $data_cat;
                    $obj = new varia();
                    $obj->set_value('var_value', $val);
                    $obj->set_where('var_id = ' . $varia_id);
                    $obj->edit();
                }
                break;
            }
        }
    }
    $smarty->assign('info_text', '修改分类设置成功');
    $smarty->assign('link_text', '返回上一页');
    $smarty->assign('link_href', url(array('channel' => 'data', 'mod' => 'tailor_set')));
}
예제 #2
0
파일: set.php 프로젝트: jechiy/xiu-cms
function module_set()
{
    global $global, $smarty;
    $smarty->assign('data_username', get_varia('data_username'));
    $smarty->assign('data_password', get_varia('data_password'));
    $obj = new channel();
    $channel = $obj->get_list();
    $smarty->assign('channel', $channel);
    $obj = new varia();
    $obj->set_where("var_name = 'data_cat'");
    $list = $obj->get_list();
    if (count($list)) {
        for ($i = 0; $i < count($list); $i++) {
            $arr = explode('|', $list[$i]['var_value']);
            $cat_setting[$i]['varia_id'] = $list[$i]['var_id'];
            $cat_setting[$i]['server_id'] = $arr[0];
            $cat_setting[$i]['server_name'] = $arr[1];
            $cat_setting[$i]['channel_id'] = $arr[2];
            $cat_setting[$i]['cat_id'] = $arr[3];
        }
    } else {
        $cat_setting = array();
    }
    $smarty->assign('cat_setting', $cat_setting);
    $cat_list = array();
    for ($i = 0; $i < count($cat_setting); $i++) {
        $obj = new cat_art();
        $obj->set_where('cat_channel_id = ' . $cat_setting[$i]['channel_id']);
        $arr = $obj->get_list();
        if (count($arr) > 0) {
            $cat_list[$cat_setting[$i]['server_id']] = $obj->set_cat_order($arr);
        }
    }
    $smarty->assign('cat_list', $cat_list);
}
예제 #3
0
파일: nav_add.php 프로젝트: jechiy/xiu-cms
function module_nav_add()
{
    global $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++) {
        if (substr($arr[$i]['var_name'], 4) == $global['type']) {
            $type_name = $arr[$i]['var_value'];
        }
    }
    $smarty->assign('type_name', $type_name);
}
예제 #4
0
function module_tailor_sheet()
{
    global $global, $smarty;
    $obj = new varia();
    $obj->set_where("var_name = 'tailor_data_cat'");
    $list = $obj->get_list();
    if (count($list)) {
        for ($i = 0; $i < count($list); $i++) {
            $arr = explode('|', $list[$i]['var_value']);
            $cat_list[$i]['server_id'] = $arr[0];
            $cat_list[$i]['server_name'] = $arr[1];
        }
    } else {
        $cat_list = array();
    }
    $smarty->assign('cat_list', $cat_list);
    $data_username = rawurlencode(get_varia('data_username'));
    $data_password = rawurlencode(get_varia('data_password'));
    $cat = get_global('cat');
    $page = get_global('page');
    $prefix = 'data/mod-tailor_sheet';
    $page_sum = 1;
    $sheet = array();
    if ($cat) {
        $prefix = $prefix . '/cat-' . $cat;
    }
    $url = S_SERVER_URL . 'tailor.php?/tailor/cat-' . $cat . '/page-' . $page . '/data_username-' . $data_username . '/data_password-' . $data_password . '/index.html';
    $str = file_get_contents($url);
    $result = json_decode(rawurldecode($str), true);
    if (is_array($result)) {
        if ($result['error'] == 'no') {
            $sheet = $result['sheet'];
            for ($i = 0; $i < count($sheet); $i++) {
                $obj = new article();
                $obj->set_where("art_title = '" . $sheet[$i]['art_title'] . "'");
                if ($obj->get_count()) {
                    $sheet[$i]['is_exist'] = 1;
                } else {
                    $sheet[$i]['is_exist'] = 0;
                }
            }
            $page_sum = $result['page_sum'];
        }
    }
    $smarty->assign('page_sum', $page_sum);
    $smarty->assign('prefix', $prefix);
    $smarty->assign('article', $sheet);
}
예제 #5
0
파일: nav_list.php 프로젝트: jechiy/xiu-cms
function module_nav_list()
{
    global $smarty;
    $obj = new varia();
    $obj->set_where("left(var_name,10) = 'nav_stage_'");
    $arr = $obj->get_list();
    for ($i = 0; $i < count($arr); $i++) {
        $name = substr($arr[$i]['var_name'], 10);
        $obj = new menu();
        $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);
}
예제 #6
0
function module_lang_lists()
{
    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_list', $list);
    $smarty->assign('S_LANG', S_LANG);
    $smarty->assign('pack', get_folder_list('languages'));
}
예제 #7
0
파일: sheet.php 프로젝트: jechiy/xiu-cms
function get_local_cat()
{
    $obj = new varia();
    $obj->set_where("var_name = 'data_cat'");
    $list = $obj->get_list();
    if (count($list)) {
        for ($i = 0; $i < count($list); $i++) {
            $arr = explode('|', $list[$i]['var_value']);
            $cat_list[$i]['varia_id'] = $list[$i]['var_id'];
            $cat_list[$i]['server_id'] = $arr[0];
            $cat_list[$i]['server_name'] = $arr[1];
            $cat_list[$i]['channel_id'] = $arr[2];
            $cat_list[$i]['cat_id'] = $arr[3];
        }
    } else {
        $cat_list = array();
    }
    return $cat_list;
}
예제 #8
0
파일: header.php 프로젝트: jechiy/xiu-cms
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_where("men_type = 'header'");
    $obj->set_field('men_name,men_url');
    $smarty->assign('nav', $obj->get_list());
}
예제 #9
0
파일: deal.php 프로젝트: jechiy/xiu-cms
function del_lang()
{
    $id = post('id');
    $obj = new varia();
    $obj->set_where('');
    $obj->set_where("var_id = {$id}");
    $one = $obj->get_one();
    if (count($one) > 0) {
        $arr = explode('{v}', $one['var_value']);
        $pack_name = $arr[0];
        $index_entrance = $arr[1];
        $admin_entrance = $arr[2];
        if ($index_entrance != 'index.php' && $admin_entrance != 'admin.php') {
            $obj->del();
            $table = array('article', 'att_art', 'att_goo', 'booking', 'cat_art', 'cat_goo', 'channel', 'comment', 'goods', 'link', 'menu', 'message', 'picture', 'research', 'varia');
            //以下表不处理:admin,safe,users
            for ($i = 0; $i < count($table); $i++) {
                $tab = substr($table[$i], 0, 3);
                $obj = new $table[$i]();
                $obj->set_where('');
                $obj->set_where($tab . "_lang = '{$pack_name}'");
                $obj->del();
            }
            if (file_exists($index_entrance)) {
                unlink($index_entrance);
            }
            if (file_exists($admin_entrance)) {
                unlink($admin_entrance);
            }
            if (file_exists('languages/' . $pack_name)) {
                del_dir('languages/' . $pack_name);
            }
            echo 1;
        }
    }
}
예제 #10
0
파일: footer.php 프로젝트: jechiy/xiu-cms
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);
}
예제 #11
0
function module_article_main()
{
    global $global, $smarty;
    if (!$global['id']) {
        $art_best = get_global('best');
        $prefix = get_data('channel', $global['channel_id'], 'cha_code');
        $list_len = get_varia('art_list_len');
        $obj = new article();
        $obj->set_where('art_channel_id = ' . $global['channel_id']);
        if ($global['cat']) {
            $family = implode(',', get_cat_family('cat_art', $global['cat']));
            $obj->set_where("art_cat_id in ({$family})");
            $prefix .= '/cat-' . $global['cat'];
        }
        if ($art_best) {
            $obj->set_where('art_best = 1');
            $prefix .= '/best-1';
        }
        $obj->set_page_size($list_len ? $list_len : 20);
        $obj->set_page_num($global['page']);
        $sheet = $obj->get_sheet();
        for ($i = 0; $i < count($sheet); $i++) {
            $sheet[$i]['short_title'] = cut_str($sheet[$i]['art_title'], 42);
        }
        set_link($obj->get_page_sum());
        $smarty->assign('show_sheet', 1);
        $smarty->assign('article', $sheet);
        $smarty->assign('prefix', $prefix);
    } else {
        $obj = new article();
        $obj->set_field('art_id,art_title,art_author,art_add_time,art_text');
        $obj->set_where('art_channel_id = ' . $global['channel_id']);
        $obj->set_where('art_id = ' . $global['id']);
        $one = $obj->get_one();
        $smarty->assign('article', $one);
        $obj = new article();
        $obj->set_field('art_id,art_title');
        $obj->set_where('art_channel_id = ' . $global['channel_id']);
        $obj->set_where('art_id < ' . $global['id']);
        $one = $obj->get_one();
        if (count($one)) {
            $smarty->assign('next_id', $one['art_id']);
            $smarty->assign('next_title', cut_str($one['art_title'], 15));
        } else {
            $smarty->assign('next_id', '');
            $smarty->assign('next_title', '');
        }
        $obj = new article();
        $obj->set_field('art_id,art_title');
        $obj->set_where('art_channel_id = ' . $global['channel_id']);
        $obj->set_where('art_id > ' . $global['id']);
        $obj->set_order('');
        $obj->set_order('art_top', 'asc');
        $obj->set_order('art_index', 'asc');
        $obj->set_order('art_id', 'asc');
        $one = $obj->get_one();
        if (count($one)) {
            $smarty->assign('prev_id', $one['art_id']);
            $smarty->assign('prev_title', cut_str($one['art_title'], 15));
        } else {
            $smarty->assign('prev_id', '');
            $smarty->assign('prev_title', '');
        }
        $obj = new varia();
        $smarty->assign('share_code', im_filter($obj->get_value('share_code', true)));
        $smarty->assign('show_sheet', 0);
    }
}
예제 #12
0
파일: deal.php 프로젝트: jechiy/xiu-cms
function save_sentmail()
{
    global $smarty, $lang;
    $smtp = post('smtp');
    $send = post('send');
    $password = post('password');
    $receive = post('receive');
    $obj = new varia();
    $obj->edit_var_value('sentmail_smtp', $smtp);
    $obj->edit_var_value('sentmail_send', $send);
    $obj->edit_var_value('sentmail_password', $password);
    $obj->edit_var_value('sentmail_receive', $receive);
    $smarty->assign('info_text', '修改邮件通知设置成功');
    $smarty->assign('link_text', '返回上一页');
    $smarty->assign('link_href', url(array('channel' => 'basic', 'mod' => 'other')));
}
예제 #13
0
파일: function.php 프로젝트: jechiy/xiu-cms
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;
}
예제 #14
0
function get_site_info()
{
    $site = array();
    $obj = new varia();
    $obj->set_where("(left(var_name,5) = 'site_' or var_name = 'statistical_code' or var_name = 'share_code')");
    $list = $obj->get_list();
    for ($i = 0; $i < count($list); $i++) {
        $val = $list[$i]['var_value'];
        switch ($list[$i]['var_name']) {
            case 'site_title':
                $site['title'] = $val;
                break;
            case 'site_admin_title':
                $site['admin_title'] = $val;
                break;
            case 'site_name':
                $site['name'] = $val;
                break;
            case 'site_domain':
                $site['domain'] = $val;
                break;
            case 'site_record':
                $site['record'] = $val;
                break;
            case 'site_record_url':
                $site['record_url'] = $val;
                break;
            case 'site_tech':
                $site['tech'] = $val;
                break;
            case 'site_tech_url':
                $site['tech_url'] = $val;
                break;
            case 'site_keywords':
                $site['keywords'] = $val;
                break;
            case 'site_description':
                $site['description'] = $val;
                break;
            case 'statistical_code':
                $site['statistical_code'] = im_filter($list[$i]['var_text']);
                break;
            case 'share_code':
                $site['share_code'] = im_filter($list[$i]['var_text']);
                break;
        }
    }
    return $site;
}
예제 #15
0
파일: deal.php 프로젝트: jechiy/xiu-cms
function do_gather_tailor()
{
    $id = post('id');
    $data_username = rawurlencode(get_varia('data_username'));
    $data_password = rawurlencode(get_varia('data_password'));
    $url = S_SERVER_URL . 'tailor.php?/tailor/id-' . $id . '/data_username-' . $data_username . '/data_password-' . $data_password . '/index.html';
    $str = file_get_contents($url);
    $result = json_decode(rawurldecode($str), true);
    if (is_array($result)) {
        if ($result['error'] == 'no') {
            $one = $result['one'];
            $local_channel_id = 0;
            $local_cat_id = 0;
            $obj = new varia();
            $obj->set_where("var_name = 'tailor_data_cat'");
            $list = $obj->get_list();
            for ($i = 0; $i < count($list); $i++) {
                $arr = explode('|', $list[$i]['var_value']);
                if ($arr[0] == $one['art_cat_id']) {
                    $local_channel_id = $arr[2];
                    $local_cat_id = $arr[3];
                    break;
                }
            }
            if ($local_channel_id != 0 && $local_cat_id != 0) {
                $site_keywords = get_varia('site_keywords');
                $site_description = get_varia('site_description');
                $obj = new article();
                $obj->set_value('art_title', $one['art_title']);
                $obj->set_value('art_channel_id', $local_channel_id);
                $obj->set_value('art_lang', S_LANG);
                $obj->set_value('art_cat_id', $local_cat_id);
                $obj->set_value('art_author', $one['art_author']);
                $obj->set_value('art_text', $one['art_text']);
                $obj->set_value('art_keywords', $site_keywords);
                $obj->set_value('art_description', $site_description);
                $obj->set_value('art_add_time', time());
                $obj->add();
                echo 1;
            } else {
                echo 2;
            }
        } else {
            echo $result['error'];
        }
    } else {
        echo 0;
    }
}
예제 #16
0
파일: function.php 프로젝트: jechiy/xiu-cms
function get_varia($var_name)
{
    $obj = new varia();
    return $obj->get_value($var_name);
}
예제 #17
0
function get_lang_info($name, $num)
{
    $len = strlen($name);
    $obj = new varia();
    $obj->set_where("var_name = 'languages'");
    $obj->set_where("left(var_value,{$len}) = '{$name}'");
    $one = $obj->get_one();
    if (count($one) > 0) {
        $arr = explode('{v}', $one['var_value']);
        return $arr[$num - 1];
    } else {
        return '';
    }
}