function module_comment_sheet() { global $global, $smarty; $obj = new comment(); $obj->set_page_size(10); $obj->set_page_num($global['page']); $sheet = $obj->get_sheet(); set_link($obj->get_page_sum()); for ($i = 0; $i < count($sheet); $i++) { $sheet[$i]['channel'] = ''; $sheet[$i]['title'] = ''; $obj = new channel(); $list = $obj->get_list(); for ($j = 0; $j < count($list); $j++) { if ($list[$j]['cha_id'] == $sheet[$i]['com_channel_id']) { $sheet[$i]['channel'] = $list[$j]['cha_code']; $original = $list[$j]['cha_code']; if ($list[$j]['cha_original'] != 0) { for ($k = 0; $k < count($list); $k++) { if ($list[$j]['cha_original'] == $list[$k]['cha_id']) { $original = $list[$k]['cha_code']; } } } if ($original == 'goods') { $table = 'goods'; } else { $table = 'article'; } $sheet[$i]['title'] = get_data($table, $sheet[$i]['com_page_id'], substr($table, 0, 3) . '_title'); } } } $smarty->assign('comment', $sheet); }
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); }
function module_comment_edit() { global $global, $smarty; $obj = new comment(); $obj->set_where('com_id = ' . $global['id']); $one = $obj->get_one(); $one['channel'] = ''; $one['title'] = ''; $obj = new channel(); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { if ($list[$i]['cha_id'] == $one['com_channel_id']) { $one['channel'] = $list[$i]['cha_code']; $original = $list[$i]['cha_code']; if ($list[$i]['cha_original'] != 0) { for ($j = 0; $j < count($list); $j++) { if ($list[$i]['cha_original'] == $list[$j]['cha_id']) { $original = $list[$j]['cha_code']; } } } if ($original == 'goods') { $table = 'goods'; } else { $table = 'article'; } $one['title'] = get_data($table, $one['com_page_id'], substr($table, 0, 3) . '_title'); } } $smarty->assign('comment', $one); }
function add_lang() { global $smarty, $lang; $chinese_name = post('chinese_name'); $foreign_name = post('foreign_name'); $pack_name = post('pack_name'); $short_name = post('short_name'); $index_entrance = post('index_entrance'); $admin_entrance = post('admin_entrance'); if ($chinese_name != '' && $foreign_name != '' && $pack_name != '' && $index_entrance != '' && $admin_entrance != '' && $index_entrance != 'index.php' && $admin_entrance != 'admin.php') { $var_value = $pack_name . '{v}' . $index_entrance . '{v}' . $admin_entrance . '{v}' . $chinese_name . '{v}' . $foreign_name; $obj = new varia(); $obj->add_var_value('languages', $var_value); $site = get_site_info(); $obj->add_var_value('site_title', $site['title'], $pack_name); $obj->add_var_value('site_name', $site['name'], $pack_name); $obj->add_var_value('site_record', $site['record'], $pack_name); $obj->add_var_value('site_tech', $site['tech'], $pack_name); $obj->add_var_value('site_keywords', $site['keywords'], $pack_name); $obj->add_var_value('site_description', $site['description'], $pack_name); $obj->add_var_value('notice', '', $pack_name, true); $obj->add_var_value('service_code', '', $pack_name, true); $obj->add_var_value('user_agreement', '', $pack_name, true); $obj = new channel(); $obj->set_where('cha_original = 0'); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { $obj->clear_value(); $obj->set_value('cha_lang', $pack_name); $obj->set_value('cha_code', $list[$i]['cha_code']); $obj->set_value('cha_name', $list[$i]['cha_name']); $obj->set_value('cha_original', $list[$i]['cha_original']); $obj->add(); } if (!file_exists('languages/' . $pack_name)) { copy_dir('languages/' . S_LANG, 'languages/' . $pack_name); } if (S_MULTILINGUAL) { $file = file_get_contents('admin/index.txt'); $file = str_replace('{$pack_name}', $pack_name, $file); $file = str_replace('{$index_entrance}', $index_entrance, $file); $file = str_replace('{$admin_entrance}', $admin_entrance, $file); file_put_contents($index_entrance, $file); $file = file_get_contents('admin/admin.txt'); $file = str_replace('{$pack_name}', $pack_name, $file); $file = str_replace('{$index_entrance}', $index_entrance, $file); $file = str_replace('{$admin_entrance}', $admin_entrance, $file); file_put_contents($admin_entrance, $file); } $info_text = '添加语言成功'; } else { $info_text = '的输入不合法,添加语言失败'; } $smarty->assign('info_text', $info_text); $smarty->assign('link_text', $lang['return_list']); $smarty->assign('link_href', url(array('channel' => 'file', 'mod' => 'lang_lists'))); }
function module_channel_add() { global $smarty; $obj = new channel(); $obj->set_where("cha_original = 0"); $smarty->assign('original', $obj->get_list()); $arr = array(); $obj = new channel(); $obj->set_where("cha_original <> 0"); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { $list[$i]['original'] = get_data('channel', $list[$i]['cha_original'], 'cha_code'); } $smarty->assign('channel', $list); }
function module_tailor_cat_add() { global $global, $smarty; $obj = new channel(); $channel = $obj->get_list(); $smarty->assign('channel', $channel); $cat_list = array(); $obj = new cat_art(); $obj->set_where('cat_channel_id = 1'); $arr = $obj->get_list(); if (count($arr) > 0) { $cat_list = $obj->set_cat_order($arr); } $smarty->assign('cat_list', $cat_list); }
function module_pic_lists() { global $smarty; $list_public = get_file_list('images'); $smarty->assign('list_public', $list_public); $list_editor = get_folder_list('images/editor'); $smarty->assign('list_editor', $list_editor); $k = 0; $lists = array(); $obj = new channel(); $list = $obj->get_list(); for ($i = 0; $i < count($list); $i++) { $arr = get_folder_list('images/' . $list[$i]['cha_code']); if (count($arr)) { $k++; $lists[$k]['channel'] = $list[$i]['cha_code']; $lists[$k]['name'] = $list[$i]['cha_name']; $lists[$k]['folder'] = $arr; } } $smarty->assign('lists', $lists); $smarty->assign('host', $_SERVER['HTTP_HOST']); }
function module_channel_name() { global $smarty; $obj = new channel(); $smarty->assign('channel', $obj->get_list()); }