/* 权限判断 */ admin_priv('store_inout_type'); $in_out = !empty($_REQUEST['in_out']) ? intval($_REQUEST['in_out']) : 0; $smarty->assign('ur_here', $_LANG['type_out_add' . $in_out]); $smarty->assign('action_link', array('text' => $_LANG['store_inout_type' . $in_out], 'href' => 'store_inout_type.php?act=list&in_out=' . $in_out)); $smarty->assign('form_action', 'insert'); $smarty->assign('in_out', $in_out); assign_query_info(); $smarty->assign('type', array('is_valid' => 1)); $smarty->display('store_inout_type_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { /*检查类型名是否重复*/ admin_priv('store_inout_type'); $is_valid = isset($_REQUEST['is_valid']) ? intval($_REQUEST['is_valid']) : 0; $in_out = isset($_REQUEST['in_out']) ? intval($_REQUEST['in_out']) : 0; $is_only = $exc->is_only('type_name', $_POST['type_name'], 0, "in_out=" . $in_out . " and supplier_id=" . $_SESSION['supplier_id']); if (!$is_only) { sys_msg(sprintf($_LANG['typename_exist'], stripslashes($_POST['type_name'])), 1); } /*插入数据*/ $sql = "INSERT INTO " . $ecs->table('store_inout_type') . "(type_name, is_valid, in_out, supplier_id, store_type_id) " . "VALUES ('{$_POST['type_name']}', '{$is_valid}' , '{$in_out}', '{$_SESSION['supplier_id']}', '{$_REQUEST['storetypeid']}')"; $db->query($sql); /* 清除缓存 */ clear_cache_files(); $link[0]['text'] = $_LANG['continue_add']; $link[0]['href'] = 'store_inout_type.php?act=add&in_out=' . $in_out; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'store_inout_type.php?act=list&in_out=' . $in_out; sys_msg($_LANG['typeadd_succed'], 0, $link); } elseif ($_REQUEST['act'] == 'edit') { /* 权限判断 */
$rank['discount'] = 100; $form_action = 'insert'; $smarty->assign('rank', $rank); $smarty->assign('ur_here', $_LANG['add_user_rank']); $smarty->assign('action_link', array('text' => $_LANG['05_user_rank_list'], 'href' => 'user_rank.php?act=list')); $smarty->assign('ur_here', $_LANG['add_user_rank']); $smarty->assign('form_action', $form_action); assign_query_info(); $smarty->display('user_rank_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { admin_priv('user_rank'); $special_rank = isset($_POST['special_rank']) ? intval($_POST['special_rank']) : 0; $_POST['min_points'] = empty($_POST['min_points']) ? 0 : intval($_POST['min_points']); $_POST['max_points'] = empty($_POST['max_points']) ? 0 : intval($_POST['max_points']); /* 检查是否存在重名的会员等级 */ if (!$exc->is_only('rank_name', trim($_POST['rank_name']))) { sys_msg(sprintf($_LANG['rank_name_exists'], trim($_POST['rank_name'])), 1); } /* 非特殊会员组检查积分的上下限是否合理 */ if ($_POST['min_points'] >= $_POST['max_points'] && $special_rank == 0) { sys_msg($_LANG['js_languages']['integral_max_small'], 1); } /* 特殊等级会员组不判断积分限制 */ if ($special_rank == 0) { /* 检查下限制有无重复 */ if (!$exc->is_only('min_points', intval($_POST['min_points']))) { sys_msg(sprintf($_LANG['integral_min_exists'], intval($_POST['min_points']))); } } /* 特殊等级会员组不判断积分限制 */ if ($special_rank == 0) {
$smarty->assign('article', $article); $smarty->assign('cat_select', article_cat_list(0)); $smarty->assign('ur_here', $_LANG['article_add']); $smarty->assign('action_link', array('text' => $_LANG['03_article_list'], 'href' => 'article.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->display('article_info.htm'); } /*------------------------------------------------------ */ //-- 添加文章 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('article_manage'); /*检查是否重复*/ $is_only = $exc->is_only('title', $_POST['title'], 0, " cat_id ='{$_POST['article_cat']}'"); if (!$is_only) { sys_msg(sprintf($_LANG['title_exist'], stripslashes($_POST['title'])), 1); } /* 取得文件地址 */ $file_url = ''; if (isset($_FILES['file']['error']) && $_FILES['file']['error'] == 0 || !isset($_FILES['file']['error']) && isset($_FILES['file']['tmp_name']) && $_FILES['file']['tmp_name'] != 'none') { // 检查文件格式 if (!check_file_type($_FILES['file']['tmp_name'], $_FILES['file']['name'], $allow_file_types)) { sys_msg($_LANG['invalid_file']); } // 复制文件 $res = upload_article_file($_FILES['file']); if ($res != false) { $file_url = $res; }
$goods['option'] = '<option value="0">' . $_LANG['make_option'] . '</option>'; $smarty->assign('goods', $goods); $smarty->assign('ur_here', $_LANG['exchange_goods_add']); $smarty->assign('action_link', array('text' => $_LANG['15_exchange_goods_list'], 'href' => 'exchange_goods.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->display('exchange_goods_info.htm'); } /*------------------------------------------------------ */ //-- 添加商品 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('exchange_goods'); /*检查是否重复*/ $is_only = $exc->is_only('goods_id', $_POST['goods_id'], 0, " goods_id ='{$_POST['goods_id']}'"); if (!$is_only) { sys_msg($_LANG['goods_exist'], 1); } /*插入数据*/ $add_time = gmtime(); if (empty($_POST['goods_id'])) { $_POST['goods_id'] = 0; } $sql = "INSERT INTO " . $ecs->table('exchange_goods') . "(goods_id, exchange_integral, is_exchange, is_hot) " . "VALUES ('{$_POST['goods_id']}', '{$_POST['exchange_integral']}', '{$_POST['is_exchange']}', '{$_POST['is_hot']}')"; $db->query($sql); $link[0]['text'] = $_LANG['continue_add']; $link[0]['href'] = 'exchange_goods.php?act=add'; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'exchange_goods.php?act=list'; admin_log($_POST['goods_id'], 'add', 'exchange_goods');
assign_query_info(); $smarty->display('brand_list.htm'); } elseif ($_REQUEST['act'] == 'add') { /* 权限判断 */ admin_priv('brand_manage'); $smarty->assign('ur_here', $_LANG['07_brand_add']); $smarty->assign('action_link', array('text' => $_LANG['06_goods_brand_list'], 'href' => 'brand.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->assign('brand', array('sort_order' => 50, 'is_show' => 1)); $smarty->display('brand_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { /*检查品牌名是否重复*/ admin_priv('brand_manage'); $is_show = isset($_REQUEST['is_show']) ? intval($_REQUEST['is_show']) : 0; $is_only = $exc->is_only('brand_name', $_POST['brand_name']); if (!$is_only) { sys_msg(sprintf($_LANG['brandname_exist'], stripslashes($_POST['brand_name'])), 1); } /*对描述处理*/ if (!empty($_POST['brand_desc'])) { $_POST['brand_desc'] = $_POST['brand_desc']; } /*处理图片*/ $img_name = basename($image->upload_image($_FILES['brand_logo'], 'brandlogo')); /*处理URL*/ $site_url = sanitize_url($_POST['site_url']); /*插入数据*/ $sql = "INSERT INTO " . $ecs->table('brand') . "(brand_name, site_url, brand_desc, brand_logo, is_show, sort_order) " . "VALUES ('{$_POST['brand_name']}', '{$site_url}', '{$_POST['brand_desc']}', '{$img_name}', '{$is_show}', '{$_POST['sort_order']}')"; $db->query($sql); admin_log($_POST['brand_name'], 'add', 'brand');
/* 检查权限 */ admin_priv('admin_manage'); /* 模板赋值 */ $smarty->assign('ur_here', $_LANG['admin_add']); $smarty->assign('action_link', array('href' => 'privilege.php?act=list', 'text' => $_LANG['admin_list'])); $smarty->assign('form_act', 'insert'); $smarty->assign('action', 'add'); $smarty->assign('select_role', get_role_list()); /* 显示页面 */ assign_query_info(); $smarty->display('privilege_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { admin_priv('admin_manage'); /* 判断管理员是否已经存在 */ if (!empty($_POST['user_name'])) { $is_only = $exc->is_only('user_name', stripslashes($_POST['user_name'])); if (!$is_only) { sys_msg(sprintf($_LANG['user_name_exist'], stripslashes($_POST['user_name'])), 1); } } /* Email地址是否有重复 */ if (!empty($_POST['email'])) { $is_only = $exc->is_only('email', stripslashes($_POST['email'])); if (!$is_only) { sys_msg(sprintf($_LANG['email_exist'], stripslashes($_POST['email'])), 1); } } /* 获取添加日期及密码 */ $add_time = gmtime(); $password = md5($_POST['password']); $role_id = '';
} else { $selected = $_REQUEST['cat_id']; } $cat_list = article_cat_list($selected, true, 'cat_id', 0); $cat_list = str_replace('select please', $_LANG['select_plz'], $cat_list); $smarty->assign('cat_list', $cat_list); $smarty->assign('ur_here', $_LANG['article_add']); $smarty->assign('action_link', array('text' => $_LANG['cat_list'], 'href' => 'shophelp.php?act=list_cat')); $smarty->assign('form_action', 'insert'); $smarty->display('shophelp_info.htm'); } if ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('shophelp_manage'); /* 判断是否重名 */ $exc_article->is_only('title', $_POST['title'], $_LANG['title_exist']); /* 插入数据 */ $add_time = gmtime(); $sql = "INSERT INTO " . $ecs->table('article') . "(title, cat_id, article_type, content, add_time, author) VALUES('{$_POST['title']}', '{$_POST['cat_id']}', '{$_POST['article_type']}','{$_POST['FCKeditor1']}','{$add_time}', '_SHOPHELP' )"; $db->query($sql); $link[0]['text'] = $_LANG['back_list']; $link[0]['href'] = 'shophelp.php?act=list_article&cat_id=' . $_POST['cat_id']; $link[1]['text'] = $_LANG['continue_add']; $link[1]['href'] = 'shophelp.php?act=add&cat_id=' . $_POST['cat_id']; /* 清除缓存 */ clear_cache_files(); admin_log($_POST['title'], 'add', 'shophelp'); sys_msg($_LANG['articleadd_succeed'], 0, $link); } /*------------------------------------------------------ */ //-- 编辑文章
admin_priv('shopinfo_manage'); /* 创建 html editor */ create_html_editor('FCKeditor1'); /* 初始化 */ $article['article_type'] = 0; $smarty->assign('ur_here', $_LANG['shopinfo_add']); $smarty->assign('action_link', array('text' => $_LANG['shopinfo_list'], 'href' => 'shopinfo.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->display('shopinfo_info.htm'); } if ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('shopinfo_manage'); /* 判断是否重名 */ $is_only = $exc->is_only('title', $_POST['title']); if (!$is_only) { sys_msg(sprintf($_LANG['title_exist'], stripslashes($_POST['title'])), 1); } /* 插入数据 */ $add_time = gmtime(); $sql = "INSERT INTO " . $ecs->table('article') . "(title, cat_id, content, add_time) VALUES('{$_POST['title']}', '0', '{$_POST['FCKeditor1']}','{$add_time}' )"; $db->query($sql); $link[0]['text'] = $_LANG['continue_add']; $link[0]['href'] = 'shopinfo.php?act=add'; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'shopinfo.php?act=list'; /* 清除缓存 */ clear_cache_files(); admin_log($_POST['title'], 'add', 'shopinfo'); sys_msg($_LANG['articleadd_succeed'], 0, $link);
/* 记录日志 */ admin_log($_REQUEST['code'], 'uninstall', 'payment'); $link[] = array('text' => $_LANG['back_list'], 'href' => 'payment.php?act=list'); sys_msg($_LANG['uninstall_ok'], 0, $link); } elseif ($_REQUEST['act'] == 'edit_name') { /* 检查权限 */ check_authz_json('payment'); /* 取得参数 */ $code = json_str_iconv(trim($_POST['id'])); $name = json_str_iconv(trim($_POST['val'])); /* 检查名称是否为空 */ if (empty($name)) { make_json_error($_LANG['name_is_null']); } /* 检查名称是否重复 */ if (!$exc->is_only('pay_name', $name, $code)) { make_json_error($_LANG['name_exists']); } /* 更新支付方式名称 */ $exc->edit("pay_name = '{$name}'", $code); make_json_result(stripcslashes($name)); } elseif ($_REQUEST['act'] == 'edit_desc') { /* 检查权限 */ check_authz_json('payment'); /* 取得参数 */ $code = json_str_iconv(trim($_POST['id'])); $desc = json_str_iconv(trim($_POST['val'])); /* 更新描述 */ $exc->edit("pay_desc = '{$desc}'", $code); make_json_result(stripcslashes($desc)); } elseif ($_REQUEST['act'] == 'edit_order') {
/* 权限判断 */ admin_priv('store_inout_type'); $in_out = !empty($_REQUEST['in_out']) ? intval($_REQUEST['in_out']) : 0; $smarty->assign('ur_here', $_LANG['type_out_add' . $in_out]); $smarty->assign('action_link', array('text' => $_LANG['store_inout_type' . $in_out], 'href' => 'store_inout_type.php?act=list&in_out=' . $in_out)); $smarty->assign('form_action', 'insert'); $smarty->assign('in_out', $in_out); assign_query_info(); $smarty->assign('type', array('is_valid' => 1)); $smarty->display('store_inout_type_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { /*检查类型名是否重复*/ admin_priv('store_inout_type'); $is_valid = isset($_REQUEST['is_valid']) ? intval($_REQUEST['is_valid']) : 0; $in_out = isset($_REQUEST['in_out']) ? intval($_REQUEST['in_out']) : 0; $is_only = $exc->is_only('type_name', $_POST['type_name'], 0, "in_out=" . $in_out . " and store_type_id=0"); if (!$is_only) { sys_msg(sprintf($_LANG['typename_exist'], stripslashes($_POST['type_name'])), 1); } /*插入数据*/ $sql = "INSERT INTO " . $ecs->table('store_inout_type') . "(type_name, is_valid, in_out) " . "VALUES ('{$_POST['type_name']}', '{$is_valid}' , '{$in_out}')"; $db->query($sql); /* 清除缓存 */ clear_cache_files(); $link[0]['text'] = $_LANG['continue_add']; $link[0]['href'] = 'store_inout_type.php?act=add&in_out=' . $in_out; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'store_inout_type.php?act=list&in_out=' . $in_out; sys_msg($_LANG['typeadd_succed'], 0, $link); } elseif ($_REQUEST['act'] == 'edit') { /* 权限判断 */
$smarty->assign('action_link', array('href' => 'store_manage.php?act=list_sub&pid=' . $parent_id, 'text' => $_LANG['list_sub'])); $smarty->assign('provinces', get_regions(1, '1')); $sql = "select user_id,user_name from " . $ecs->table('supplier_admin_user') . " where supplier_id=" . $_SESSION[supplier_id] . " order by user_id asc"; $admin_list = $db->getAll($sql); $smarty->assign('admin_list', $admin_list); $smarty->assign('form_action', 'save_sub'); $smarty->assign('store', array('parent_id' => $parent_id)); assign_query_info(); $smarty->display('store_sub_info.htm'); } /* 保存仓储 */ if ($_REQUEST['act'] == 'save_sub') { admin_priv('store_manage'); $parent_id = $_REQUEST['parent_id'] ? intval($_REQUEST['parent_id']) : 0; $store_name = $_REQUEST['store_name'] ? trim($_REQUEST['store_name']) : ''; $is_only = $exc->is_only('store_name', $store_name, 0, "supplier_id=" . $_SESSION[supplier_id] . " and parent_id = '{$parent_id}'"); if (!$is_only) { sys_msg(sprintf($_LANG['subname_exist'], stripslashes($_REQUEST['store_name'])), 1); } $sql = "INSERT INTO " . $ecs->table('store_main') . " (parent_id, store_name, province, city, district, mianji, supplier_id, store_type_id) " . "VALUES ('{$parent_id}', '{$store_name}', '{$_REQUEST['province']}', '{$_REQUEST['city']}', '{$_REQUEST['district']}', '{$_REQUEST['mianji']}', '{$_SESSION['supplier_id']}', '{$_REQUEST['storetypeid']}')"; $db->query($sql); $store_id = $db->insert_id(); $admin_list = $_REQUEST['admin_id']; if (is_array($admin_list)) { foreach ($admin_list as $admin_item) { $mobile = $_REQUEST['mobile_' . $admin_item]; $tel = $_REQUEST['tel_' . $admin_item]; $admin_name = trim($_REQUEST['adminname_' . $admin_item]); $sql = "INSERT INTO " . $ecs->table('store_adminer') . " (store_id, admin_id, admin_name, mobile, tel, supplier_id, store_type_id) " . "VALUES ('{$store_id}', '{$admin_item}', '{$admin_name}', '{$mobile}', '{$tel}', '{$_SESSION['supplier_id']}', '{$_REQUEST['storetypeid']}')"; $db->query($sql); }
$smarty->assign('ur_here', $_LANG['add_user_card']); $smarty->assign('form_action', $form_action); assign_query_info(); $smarty->display('user_card_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { admin_priv('user_card'); $arr = array(); if ($_POST['user_name'] != '') { $_POST['user_name'] = trim($_POST['user_name']); $arr['user_id'] = $db->getOne(' select user_id from ' . $ecs->table('users') . " where user_name ='{$_POST['user_name']}'"); if (!$arr['user_id']) { sys_msg(sprintf($_LANG['bind_user_name_not_exists'], $_POST['user_name']), 1); } } /* 检查是否存在重名的会员等级 */ if (!$exc->is_only('card_no', trim($_POST['card_no']))) { sys_msg(sprintf($_LANG['card_no_exists'], trim($_POST['card_no'])), 1); } $arr['ct_id'] = intval($_POST['ct_id']); $arr['card_no'] = trim($_POST['card_no']); $arr['card_level'] = trim($_POST['card_level']); $arr['card_pass'] = trim($_POST['card_pass']); $arr['card_status'] = $arr['user_id'] > 0 ? 1 : 0; $arr['user_money'] = floatval($_POST['user_money']); $arr['pay_points'] = intval($_POST['pay_points']); $arr['rank_points'] = intval($_POST['rank_points']); $arr['true_name'] = trim($_POST['true_name']); $arr['address'] = trim($_POST['address']); $arr['mobile'] = trim($_POST['mobile']); $arr['email'] = trim($_POST['email']); $arr['is_show'] = intval($_POST['is_show']);
$exc = new exchange($weixinkeywordstable, $db, 'id', 'keyword'); if ($_REQUEST['act'] == 'list') { $smarty->display('wxch_keywords.html'); } elseif ($_REQUEST['act'] == 'add') { if ($_POST) { $image = new cls_image($_CFG['bgcolor']); $path = $image->upload_image($_FILES['path']); $name = $_POST['name']; $keyword = $_POST['keyword']; $type = $_POST['type']; $contents = $_POST['contents']; $pic_tit = $_POST['pic_tit']; $desc = $_POST['desc']; $pic_url = $_POST['pic_url']; /*检查关键词是否重复*/ $is_only = $exc->is_only('keyword', $keyword); if (!$is_only) { sys_msg(sprintf($keyword . " 关键词已经存在!", stripslashes($keyword)), 1); } if ($keyword == 'new' or $keyword == 'best' or $keyword == 'hot' or $keyword == 'promote' or $keyword == 'cxbd' or $keyword == 'quit' or $keyword == 'member') { sys_msg(sprintf($keyword . " 系统保留关键词,不能占用!", stripslashes($keyword)), 1); } if ($type == 1) { $contents = $contents; $db->query("INSERT INTO " . $weixinkeywordstable . " (`name`, `keyword`, `type`, `contents`, `count`, `status`) VALUES ('{$name}', '{$keyword}', {$type}, '{$contents}', 0, 1);"); } elseif ($type == 2) { $img_name = basename($image->upload_image($_FILES['pic'], 'weixin')); $db->query("INSERT INTO " . $weixinkeywordstable . " (`name`, `keyword`, `type`, `pic`, `pic_tit`, `desc`, `pic_url`, `count`, `status`) VALUES ('{$name}', '{$keyword}', {$type}, '{$img_name}', '{$pic_tit}', '{$desc}', '{$pic_url}', 0, 1);"); } $link[] = array('href' => 'wxch.php?act=keywords', 'text' => '关键词自动回复'); sys_msg('添加成功', 0, $link);
$smarty->assign('action_link', array('href' => 'store_manage.php?act=list_sub&pid=' . $parent_id, 'text' => $_LANG['list_sub'])); $smarty->assign('provinces', get_regions(1, '1')); $sql = "select user_id,user_name from " . $ecs->table('admin_user') . " order by user_id asc"; $admin_list = $db->getAll($sql); $smarty->assign('admin_list', $admin_list); $smarty->assign('form_action', 'save_sub'); $smarty->assign('store', array('parent_id' => $parent_id)); assign_query_info(); $smarty->display('store_sub_info.htm'); } /* 保存仓储 */ if ($_REQUEST['act'] == 'save_sub') { admin_priv('store_manage'); $parent_id = $_REQUEST['parent_id'] ? intval($_REQUEST['parent_id']) : 0; $store_name = $_REQUEST['store_name'] ? trim($_REQUEST['store_name']) : ''; $is_only = $exc->is_only('store_name', $store_name, 0, "parent_id = '{$parent_id}'"); if (!$is_only) { sys_msg(sprintf($_LANG['subname_exist'], stripslashes($_REQUEST['store_name'])), 1); } $sql = "INSERT INTO " . $ecs->table('store_main') . " (parent_id, store_name, province, city, district, mianji) " . "VALUES ('{$parent_id}', '{$store_name}', '{$_REQUEST['province']}', '{$_REQUEST['city']}', '{$_REQUEST['district']}', '{$_REQUEST['mianji']}')"; $db->query($sql); $store_id = $db->insert_id(); $admin_list = $_REQUEST['admin_id']; if (is_array($admin_list)) { foreach ($admin_list as $admin_item) { $mobile = $_REQUEST['mobile_' . $admin_item]; $tel = $_REQUEST['tel_' . $admin_item]; $admin_name = trim($_REQUEST['adminname_' . $admin_item]); $sql = "INSERT INTO " . $ecs->table('store_adminer') . " (store_id, admin_id, admin_name, mobile, tel) " . "VALUES ('{$store_id}', '{$admin_item}', '{$admin_name}', '{$mobile}', '{$tel}')"; $db->query($sql); }
/* 权限判断 */ admin_priv('card_manage'); /*初始化显示*/ $card['card_fee'] = 0; $card['free_money'] = 0; $smarty->assign('card', $card); $smarty->assign('ur_here', $_LANG['card_add']); $smarty->assign('action_link', array('text' => $_LANG['07_card_list'], 'href' => 'card.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->display('card_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('card_manage'); /*检查包装名是否重复*/ $is_only = $exc->is_only('card_name', $_POST['card_name']); if (!$is_only) { sys_msg(sprintf($_LANG['cardname_exist'], stripslashes($_POST['card_name'])), 1); } /*处理图片*/ $img_name = basename($image->upload_image($_FILES['card_img'], "cardimg")); /*插入数据*/ $sql = "INSERT INTO " . $ecs->table('card') . "(card_name, card_fee, free_money, card_desc, card_img)\r\n VALUES ('{$_POST['card_name']}', '{$_POST['card_fee']}', '{$_POST['free_money']}', '{$_POST['card_desc']}', '{$img_name}')"; $db->query($sql); admin_log($_POST['card_name'], 'add', 'card'); /*添加链接*/ $link[0]['text'] = $_LANG['continue_add']; $link[0]['href'] = 'card.php?act=add'; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'card.php?act=list'; sys_msg($_POST['card_name'] . $_LANG['cardadd_succeed'], 0, $link);
function API_EditBrand($post) { /* 加载后台主操作函数 */ require_once ROOT_PATH . ADMIN_PATH . '/includes/lib_main.php'; require_once ROOT_PATH . ADMIN_PATH . '/includes/cls_exchange.php'; require_once ROOT_PATH . 'includes/cls_image.php'; /* 检查权限 */ admin_privilege('brand_manage'); $is_show = isset($_POST['is_show']) ? 1 : 0; $brand_id = !empty($_POST['brand_id']) ? intval($_POST['brand_id']) : 0; /*检查品牌名是否重复*/ $exc = new exchange($GLOBALS['ecs']->table("brand"), $GLOBALS['db'], 'brand_id', 'brand_name'); $is_only = $exc->is_only('brand_name', $_POST['brand_name'], '', ''); if (!$is_only) { client_show_message(301); } $param = "brand_name = '{$_POST['brand_name']}', site_url='{$_POST['site_url']}', brand_desc='{$_POST['brand_desc']}', is_show='{$is_show}', sort_order='{$_POST['sort_order']}' "; /* 处理图片 */ $img_name = upload_image($_POST['brand_logo'], 'brandlogo'); if ($img_name !== false) { $param .= " ,brand_logo = '" . basename($img_name) . "' "; } /* 更新数据 */ if ($exc->edit($param, $brand_id, '')) { /* 清除缓存 */ clear_cache_files(); admin_log($_POST['brand_name'], 'edit', 'brand'); client_show_message(0, true); } else { client_show_message(302); } }
} $href = 'favourable.php?act=list'; if (!$is_add) { $href .= '&' . list_link_postfix(); } $smarty->assign('action_link', array('href' => $href, 'text' => $_LANG['favourable_list'])); assign_query_info(); $smarty->display('favourable_info.htm'); } elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update') { /* 检查权限 */ admin_priv('favourable'); /* 是否添加 */ $is_add = $_REQUEST['act'] == 'insert'; /* 检查名称是否重复 */ $act_name = sub_str($_POST['act_name'], 255, false); if (!$exc->is_only('act_name', $act_name, intval($_POST['id']))) { sys_msg($_LANG['act_name_exists']); } /* 检查享受优惠的会员等级 */ if (!isset($_POST['user_rank'])) { sys_msg($_LANG['pls_set_user_rank']); } /* 检查优惠范围扩展信息 */ if (intval($_POST['act_range']) > 0 && !isset($_POST['act_range_ext'])) { sys_msg($_LANG['pls_set_act_range']); } /* 检查金额上下限 */ $min_amount = floatval($_POST['min_amount']) >= 0 ? floatval($_POST['min_amount']) : 0; $max_amount = floatval($_POST['max_amount']) >= 0 ? floatval($_POST['max_amount']) : 0; if ($max_amount > 0 && $min_amount > $max_amount) { sys_msg($_LANG['amount_error']);
$smarty->assign('articlecat', $articlecat); make_json_result($smarty->fetch('articlecat_list.htm')); } elseif ($_REQUEST['act'] == 'add') { /* 权限判断 */ admin_priv('article_cat'); $smarty->assign('cat_select', article_cat_list(0)); $smarty->assign('ur_here', $_LANG['articlecat_add']); $smarty->assign('action_link', array('text' => $_LANG['02_articlecat_list'], 'href' => 'articlecat.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->display('articlecat_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('article_cat'); /*检查分类名是否重复*/ $is_only = $exc->is_only('cat_name', $_POST['cat_name']); if (!$is_only) { sys_msg(sprintf($_LANG['catname_exist'], stripslashes($_POST['cat_name'])), 1); } $cat_type = 1; if ($_POST['parent_id'] > 0) { $sql = "SELECT cat_type FROM " . $ecs->table('article_cat') . " WHERE cat_id = '{$_POST['parent_id']}'"; $p_cat_type = $db->getOne($sql); if ($p_cat_type == 2 || $p_cat_type == 3 || $p_cat_type == 5) { sys_msg($_LANG['not_allow_add'], 0); } else { if ($p_cat_type == 4) { $cat_type = 5; } } }
admin_priv('supplier_rank'); $rank['rank_id'] = 0; $rank['rank_special'] = 0; $rank['sort_order'] = 50; $form_action = 'insert'; $smarty->assign('rank', $rank); $smarty->assign('ur_here', $_LANG['add_supplier_rank']); $smarty->assign('action_link', array('text' => $_LANG['supplier_rank_list'], 'href' => 'supplier_rank.php?act=list')); $smarty->assign('ur_here', $_LANG['add_supplier_rank']); $smarty->assign('form_action', $form_action); assign_query_info(); $smarty->display('supplier_rank_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { admin_priv('supplier_rank'); /* 检查是否存在重名的会员等级 */ if (!$exc->is_only('rank_name', trim($_POST['rank_name']))) { sys_msg(sprintf($_LANG['rank_name_exists'], trim($_POST['rank_name'])), 1); } $sql = "INSERT INTO " . $ecs->table('supplier_rank') . "( " . "rank_name, sort_order" . ") VALUES (" . "'{$_POST['rank_name']}', '" . intval($_POST['sort_order']) . "')"; $db->query($sql); /* 管理员日志 */ clear_cache_files(); $lnk[] = array('text' => $_LANG['back_list'], 'href' => 'supplier_rank.php?act=list'); $lnk[] = array('text' => $_LANG['add_continue'], 'href' => 'supplier_rank.php?act=add'); sys_msg($_LANG['add_rank_success'], 0, $lnk); } elseif ($_REQUEST['act'] == 'remove') { check_authz_json('supplier_rank'); $rank_id = intval($_GET['id']); if ($exc->drop($rank_id)) { /* 更新会员表的等级字段 */ //$exc_user->edit("user_rank = 0", $rank_id);
/* 记录管理员操作 */ admin_log(addslashes($_POST['shipping_name']), 'edit', 'shipping'); $lnk[] = array('text' => $_LANG['go_back'], 'href' => 'shipping.php?act=list'); sys_msg($_LANG['edit_template_success'], 0, $lnk); } elseif ($_REQUEST['act'] == 'edit_name') { /* 检查权限 */ check_authz_json('ship_manage'); /* 取得参数 */ $id = json_str_iconv(trim($_POST['id'])); $val = json_str_iconv(trim($_POST['val'])); /* 检查名称是否为空 */ if (empty($val)) { make_json_error($_LANG['no_shipping_name']); } /* 检查名称是否重复 */ if (!$exc->is_only('shipping_name', $val, $id)) { make_json_error($_LANG['repeat_shipping_name']); } /* 更新支付方式名称 */ $exc->edit("shipping_name = '{$val}'", $id); make_json_result(stripcslashes($val)); } elseif ($_REQUEST['act'] == 'edit_desc') { /* 检查权限 */ check_authz_json('ship_manage'); /* 取得参数 */ $id = json_str_iconv(trim($_POST['id'])); $val = json_str_iconv(trim($_POST['val'])); /* 更新描述 */ $exc->edit("shipping_desc = '{$val}'", $id); make_json_result(stripcslashes($val)); } elseif ($_REQUEST['act'] == 'edit_insure') {
/* 取得商品分类列表 */ $smarty->assign('goods_type_list', goods_type_list($attr['cat_id'])); /* 模板赋值 */ $smarty->assign('ur_here', $is_add ? $_LANG['10_attribute_add'] : $_LANG['52_attribute_add']); $smarty->assign('action_link', array('href' => 'attribute.php?act=list', 'text' => $_LANG['09_attribute_list'])); /* 显示模板 */ assign_query_info(); $smarty->display('attribute_info.htm'); } elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update') { /* 检查权限 */ admin_priv('attr_manage'); /* 插入还是更新的标识 */ $is_insert = $_REQUEST['act'] == 'insert'; /* 检查名称是否重复 */ $exclude = empty($_POST['attr_id']) ? 0 : intval($_POST['attr_id']); if (!$exc->is_only('attr_name', $_POST['attr_name'], $exclude, " cat_id = '{$_POST['cat_id']}'")) { sys_msg($_LANG['name_exist'], 1); } $cat_id = $_REQUEST['cat_id']; /* 取得属性信息 */ $attr = array('cat_id' => $_POST['cat_id'], 'attr_name' => $_POST['attr_name'], 'attr_index' => $_POST['attr_index'], 'attr_input_type' => $_POST['attr_input_type'], 'is_linked' => $_POST['is_linked'], 'attr_values' => isset($_POST['attr_values']) ? $_POST['attr_values'] : '', 'attr_type' => empty($_POST['attr_type']) ? '0' : intval($_POST['attr_type']), 'attr_group' => isset($_POST['attr_group']) ? intval($_POST['attr_group']) : 0); /* 入库、记录日志、提示信息 */ if ($is_insert) { $db->autoExecute($ecs->table('attribute'), $attr, 'INSERT'); admin_log($_POST['attr_name'], 'add', 'attribute'); $links = array(array('text' => $_LANG['add_next'], 'href' => '?act=add&goods_type=' . $_POST['cat_id']), array('text' => $_LANG['back_list'], 'href' => '?act=list')); sys_msg(sprintf($_LANG['add_ok'], $attr['attr_name']), 0, $links); } else { $db->autoExecute($ecs->table('attribute'), $attr, 'UPDATE', "attr_id = '{$_POST['attr_id']}'"); admin_log($_POST['attr_name'], 'edit', 'attribute'); $links = array(array('text' => $_LANG['back_list'], 'href' => '?act=list&goods_type=' . $_POST['cat_id'] . ''));
$smarty->assign('good_in_type', $good_in_type); $smarty->assign('action_link', array('text' => $_LANG['new_goods_type'], 'href' => 'goods_type.php?act=add')); $smarty->display('goods_type.htm'); } elseif ($_REQUEST['act'] == 'query') { $good_type_list = get_goodstype(); $smarty->assign('goods_type_arr', $good_type_list['type']); $smarty->assign('filter', $good_type_list['filter']); $smarty->assign('record_count', $good_type_list['record_count']); $smarty->assign('page_count', $good_type_list['page_count']); make_json_result($smarty->fetch('goods_type.htm'), '', array('filter' => $good_type_list['filter'], 'page_count' => $good_type_list['page_count'])); } elseif ($_REQUEST['act'] == 'edit_type_name') { check_authz_json('goods_type'); $type_id = !empty($_POST['id']) ? intval($_POST['id']) : 0; $type_name = !empty($_POST['val']) ? json_str_iconv(trim($_POST['val'])) : ''; /* 检查名称是否重复 */ $is_only = $exc->is_only('cat_name', $type_name, $type_id); if ($is_only) { $exc->edit("cat_name='{$type_name}'", $type_id); admin_log($type_name, 'edit', 'goods_type'); make_json_result(stripslashes($type_name)); } else { make_json_error($_LANG['repeat_type_name']); } } elseif ($_REQUEST['act'] == 'toggle_enabled') { check_authz_json('goods_type'); $id = intval($_POST['id']); $val = intval($_POST['val']); $exc->edit("enabled='{$val}'", $id); make_json_result($val); } elseif ($_REQUEST['act'] == 'add') { admin_priv('goods_type');
/* 记录管理员操作 */ admin_log('', 'batch_remove', 'shipping_area'); } /* 返回 */ $links[0] = array('href' => 'shipping_area.php?act=list&shipping=' . intval($_REQUEST['shipping']), 'text' => $_LANG['go_back']); sys_msg($_LANG['remove_success'], 0, $links); } elseif ($_REQUEST['act'] == 'edit_area') { /* 检查权限 */ check_authz_json('shiparea_manage'); /* 取得参数 */ $id = intval($_POST['id']); $val = json_str_iconv(trim($_POST['val'])); /* 取得该区域所属的配送id */ $shipping_id = $exc->get_name($id, 'shipping_id'); /* 检查是否有重复的配送区域名称 */ if (!$exc->is_only('shipping_area_name', $val, $id, "shipping_id = '{$shipping_id}'")) { make_json_error($_LANG['repeat_area_name']); } /* 更新名称 */ $exc->edit("shipping_area_name = '{$val}'", $id); /* 记录日志 */ admin_log($val, 'edit', 'shipping_area'); /* 返回 */ make_json_result(stripcslashes($val)); } elseif ($_REQUEST['act'] == 'remove_area') { check_authz_json('shiparea_manage'); $id = intval($_GET['id']); $name = $exc->get_name($id); $shipping_id = $exc->get_name($id, 'shipping_id'); $exc->drop($id); $db->query('DELETE FROM ' . $ecs->table('area_region') . ' WHERE shipping_area_id=' . $id);
$href = 'agency.php?act=list'; } else { $href = 'agency.php?act=list&' . list_link_postfix(); } $smarty->assign('action_link', array('href' => $href, 'text' => $_LANG['agency_list'])); assign_query_info(); $smarty->display('agency_info.htm'); } elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update') { /* 检查权限 */ admin_priv('agency_manage'); /* 是否添加 */ $is_add = $_REQUEST['act'] == 'insert'; /* 提交值 */ $agency = array('agency_id' => intval($_POST['id']), 'agency_name' => sub_str($_POST['agency_name'], 255, false), 'agency_desc' => $_POST['agency_desc']); /* 判断名称是否重复 */ if (!$exc->is_only('agency_name', $agency['agency_name'], $agency['agency_id'])) { sys_msg($_LANG['agency_name_exist']); } /* 检查是否选择了地区 */ if (empty($_POST['regions'])) { sys_msg($_LANG['no_regions']); } /* 保存办事处信息 */ if ($is_add) { $db->autoExecute($ecs->table('agency'), $agency, 'INSERT'); $agency['agency_id'] = $db->insert_id(); } else { $db->autoExecute($ecs->table('agency'), $agency, 'UPDATE', "agency_id = '{$agency['agency_id']}'"); } /* 更新管理员表和地区表 */ if (!$is_add) {
foreach ($host_arr as $v => $k) { $exc->edit("goods_name = '{$goods_name}', last_update=" . gmtime(), $k['goods_id']); } } } /*end*/ if ($exc->edit("goods_name = '{$goods_name}', last_update=" . gmtime(), $goods_id)) { clear_cache_files(); make_json_result(stripslashes($goods_name)); } } elseif ($_REQUEST['act'] == 'edit_goods_sn') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $goods_sn = json_str_iconv(trim($_POST['val'])); /* 检查是否重复 */ if (!$exc->is_only('goods_sn', $goods_sn, $goods_id)) { make_json_error($_LANG['goods_sn_exists']); } $sql = "SELECT goods_id FROM " . $ecs->table('products') . "WHERE product_sn='{$goods_sn}'"; if ($db->getOne($sql)) { make_json_error($_LANG['goods_sn_exists']); } if ($exc->edit("goods_sn = '{$goods_sn}', last_update=" . gmtime(), $goods_id)) { clear_cache_files(); make_json_result(stripslashes($goods_sn)); } } elseif ($_REQUEST['act'] == 'check_goods_sn') { check_authz_json('goods_manage'); $goods_id = intval($_REQUEST['goods_id']); $goods_sn = htmlspecialchars(json_str_iconv(trim($_REQUEST['goods_sn']))); /* 检查是否重复 */
/* 权限判断 */ admin_priv('pack'); $pack['pack_fee'] = 0; $pack['free_money'] = 0; $smarty->assign('pack', $pack); $smarty->assign('ur_here', $_LANG['pack_add']); $smarty->assign('form_action', 'insert'); $smarty->assign('action_link', array('text' => $_LANG['06_pack_list'], 'href' => 'pack.php?act=list')); assign_query_info(); $smarty->display('pack_info.htm'); } if ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('pack'); /*检查包装名是否重复*/ $is_only = $exc->is_only('pack_name', $_POST['pack_name']); if (!$is_only) { sys_msg(sprintf($_LANG['packname_exist'], stripslashes($_POST['pack_name'])), 1); } /* 处理图片 */ if (!empty($_FILES['pack_img'])) { $upload_img = $image->upload_image($_FILES['pack_img'], "packimg", $_POST['old_packimg']); if ($upload_img == false) { sys_msg($image->error_msg); } $img_name = basename($upload_img); } else { $img_name = ''; } /*插入数据*/ $sql = "INSERT INTO " . $ecs->table('pack') . "(pack_name, pack_fee, free_money, pack_desc, pack_img)\r\n VALUES ('{$_POST['pack_name']}', '{$_POST['pack_fee']}', '{$_POST['free_money']}', '{$_POST['pack_desc']}', '{$img_name}')";
} elseif ($_REQUEST['act'] == 'add') { admin_priv('reg_fields'); $form_action = 'insert'; $reg_field['reg_field_order'] = 100; $reg_field['reg_field_display'] = 1; $reg_field['reg_field_need'] = 1; $smarty->assign('reg_field', $reg_field); $smarty->assign('ur_here', $_LANG['add_reg_field']); $smarty->assign('action_link', array('text' => $_LANG['021_reg_fields'], 'href' => 'reg_fields.php?act=list')); $smarty->assign('form_action', $form_action); assign_query_info(); $smarty->display('reg_field_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { admin_priv('reg_fields'); /* 检查是否存在重名的会员注册项 */ if (!$exc->is_only('reg_field_name', trim($_POST['reg_field_name']))) { sys_msg(sprintf($_LANG['field_name_exist'], trim($_POST['reg_field_name'])), 1); } $sql = "INSERT INTO " . $ecs->table('reg_fields') . "( " . "reg_field_name, dis_order, display, is_need" . ") VALUES (" . "'{$_POST['reg_field_name']}', '{$_POST['reg_field_order']}', '{$_POST['reg_field_display']}', '{$_POST['reg_field_need']}')"; $db->query($sql); /* 管理员日志 */ admin_log(trim($_POST['reg_field_name']), 'add', 'reg_fields'); clear_cache_files(); $lnk[] = array('text' => $_LANG['back_list'], 'href' => 'reg_fields.php?act=list'); $lnk[] = array('text' => $_LANG['add_continue'], 'href' => 'reg_fields.php?act=add'); sys_msg($_LANG['add_field_success'], 0, $lnk); } elseif ($_REQUEST['act'] == 'edit') { admin_priv('reg_fields'); $form_action = 'update'; $sql = "SELECT id AS reg_field_id, reg_field_name, dis_order AS reg_field_order, display AS reg_field_display, is_need AS reg_field_need FROM " . $ecs->table('reg_fields') . " WHERE id='{$_REQUEST['id']}'"; $reg_field = $db->GetRow($sql);
$smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('bonus_type.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count'])); } /*------------------------------------------------------ */ //-- 编辑红包类型名称 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit_type_name') { check_authz_json('bonus_manage'); $id = intval($_POST['id']); $val = json_str_iconv(trim($_POST['val'])); /* 检查红包类型名称是否重复 */ if (!$exc->is_only('type_name', $id, $val)) { make_json_error($_LANG['type_name_exist']); } else { $exc->edit("type_name='{$val}'", $id); make_json_result(stripslashes($val)); } } /*------------------------------------------------------ */ //-- 编辑红包金额 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit_type_money') { check_authz_json('bonus_manage'); $id = intval($_POST['id']); $val = floatval($_POST['val']); /* 检查红包类型名称是否重复 */ if ($val <= 0) {
$smarty->assign('action_link', $action_link); /* 赋值模板显示 */ $smarty->assign('ur_here', $_LANG['05_area_list']); $smarty->assign('full_page', 1); assign_query_info(); $smarty->display('area_list.htm'); } elseif ($_REQUEST['act'] == 'add_area') { check_authz_json('area_manage'); $parent_id = intval($_POST['parent_id']); $region_name = json_str_iconv(trim($_POST['region_name'])); $region_type = intval($_POST['region_type']); if (empty($region_name)) { make_json_error($_LANG['region_name_empty']); } /* 查看区域是否重复 */ if (!$exc->is_only('region_name', $region_name, 0, "parent_id = '{$parent_id}'")) { make_json_error($_LANG['region_name_exist']); } $sql = "INSERT INTO " . $ecs->table('region') . " (parent_id, region_name, region_type) " . "VALUES ('{$parent_id}', '{$region_name}', '{$region_type}')"; if ($GLOBALS['db']->query($sql, 'SILENT')) { admin_log($region_name, 'add', 'area'); /* 获取地区列表 */ $region_arr = area_list($parent_id); $smarty->assign('region_arr', $region_arr); $smarty->assign('region_type', $region_type); make_json_result($smarty->fetch('area_list.htm')); } else { make_json_error($_LANG['add_area_error']); } } elseif ($_REQUEST['act'] == 'edit_area_name') { check_authz_json('area_manage');
} elseif ($_REQUEST['act'] == 'add_service_type') { /* 检查权限 */ admin_priv('service_type'); //TODO $smarty->assign('ur_here', $_LANG['02_add_service_type']); $smarty->assign('action_link', array('text' => $_LANG['01_service_type'], 'href' => 'aftermarket_type.php?act=service_type')); $smarty->assign('form_action', 'insert_service_type'); $smarty->assign('service_type_list', $GLOBALS['_LANG']['st']); assign_query_info(); $smarty->display('aftermarket_info.htm'); } elseif ($_REQUEST['act'] == 'insert_service_type') { /* 检查权限 */ admin_priv('service_type'); //TODO /* 检查服务类型名称是否相同 */ $is_only = $exc->is_only('service_type', $_POST['service_type_name'], $_POST['id']); $_POST['service_name'] = $GLOBALS['_LANG']['st'][$_POST['service_type_name']]; //服务类型 if (!$is_only) { sys_msg(sprintf($_LANG['servicetypename_exist'], stripslashes($_POST['service_name'])), 1); } $is_show = isset($_REQUEST['is_show']) ? intval($_REQUEST['is_show']) : 0; /* 对描述处理 */ if (!empty($_POST['service_desc'])) { $_POST['service_desc'] = $_POST['service_desc']; } /* 插入数据 */ $sql = "INSERT INTO " . $ecs->table('service_type') . "(service_name, service_desc,received_days, unreceived_days, is_show, sort_order,service_type) " . "VALUES ('{$_POST['service_name']}', '{$_POST['service_desc']}', '{$_POST['received_days']}','{$_POST['unreceived_days']}','{$is_show}', '{$_POST['sort_order']}','{$_POST['service_type_name']}')"; $db->query($sql); admin_log($_POST['service_type_name'], 'add', 'aftermarket'); /* 清除缓存 */