예제 #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
파일: sheet.php 프로젝트: jechiy/xiu-cms
function module_sheet()
{
    global $global, $smarty;
    $cat = get_global('cat');
    $page = get_global('page');
    $prefix = 'data/mod-sheet';
    if ($cat) {
        $prefix = $prefix . '/cat-' . $cat;
    }
    $url = S_SERVER_URL . '?/data/cat-' . $cat . '/page-' . $page . '/index.html';
    $str = file_get_contents($url);
    $result = json_decode(rawurldecode($str), true);
    if (is_array($result)) {
        $server_cat_list = $result['cat_list'];
        $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;
            }
        }
        $smarty->assign('page_sum', $result['page_sum']);
        $smarty->assign('prefix', $prefix);
    } else {
        $server_cat_list = array();
        $sheet = array();
    }
    $smarty->assign('article', $sheet);
    $cat_list = get_local_cat();
    if (count($cat_list) < count($server_cat_list)) {
        for ($i = 0; $i < count($server_cat_list); $i++) {
            $flag = false;
            for ($j = 0; $j < count($cat_list); $j++) {
                if ($server_cat_list[$i]['cat_id'] == $cat_list[$j]['server_id']) {
                    $flag = true;
                    if ($server_cat_list[$i]['cat_name'] != $cat_list[$j]['server_name']) {
                        $val = $server_cat_list[$i]['cat_id'] . '|' . $server_cat_list[$i]['cat_name'] . '|' . $cat_list[$i]['channel_id'] . '|' . $cat_list[$i]['cat_id'];
                        $obj = new varia();
                        $obj->set_value('var_value', $val);
                        $obj->set_where('var_id = ' . $cat_list[$i]['varia_id']);
                        $obj->edit();
                    }
                    break;
                }
            }
            if (!$flag) {
                $val = $server_cat_list[$i]['cat_id'] . '|' . $server_cat_list[$i]['cat_name'] . '|0|0';
                $obj = new varia();
                $obj->set_value('var_name', 'data_cat');
                $obj->set_value('var_value', $val);
                $obj->add();
            }
        }
        $cat_list = get_local_cat();
    }
    $smarty->assign('cat_list', $cat_list);
}
예제 #3
0
파일: deal.php 프로젝트: jechiy/xiu-cms
function edit_contact()
{
    global $smarty, $lang;
    $obj = new varia();
    for ($i = 0; $i < count($_POST['id']); $i++) {
        $cue = strict($_POST['cue'][$i]);
        $content = strict($_POST['content'][$i]);
        $id = strict($_POST['id'][$i]);
        $val = $cue . '{v}' . $content;
        $obj->set_value('var_value', $val);
        $obj->set_where('');
        $obj->set_where("var_id = {$id}");
        $obj->edit();
    }
    $smarty->assign('info_text', '修改联系方式成功');
    $smarty->assign('link_text', '返回上一页');
    $smarty->assign('link_href', url(array('channel' => 'basic', 'mod' => 'contact_list')));
}