public function actionList_edit() { //配置列表 $model = new Shop_config(); //处理表单提交 if (\Yii::$app->request->isPost) { $model->postDataHandle(\Yii::$app->request->post()); } $settingList = $model->get_settings(null, [5]); //可选语言 $language = new Language(); $lang_list = $language->get_lang_list(); //rewrite_confirm if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'iis') !== false) { $rewrite_confirm = $this->_lang['rewrite_confirm_iis']; } else { $rewrite_confirm = $this->_lang['rewrite_confirm_apache']; } // if ($this->_cfg['shop_country'] > 0) { $this->viewBag['provinces'] = get_regions(1, $this->_cfg['shop_country']); if ($this->_cfg['shop_province']) { $this->viewBag['cities'] = get_regions(2, $this->_cfg['shop_province']); } } $this->viewBag['cfg'] = $this->_cfg; $this->viewBag['lang_list'] = $lang_list; $this->viewBag['ur_here'] = $this->_lang['01_shop_config']; $this->viewBag['group_list'] = $settingList; $this->viewBag['rewrite_confirm'] = $rewrite_confirm; $this->viewBag['countries'] = get_regions(); assign_query_info(); return $this->render('list_edit', ['viewBag' => $this->viewBag]); }
function sys_msgn($msg_detail, $msg_type = 0, $links = array(), $auto_redirect = false) { if (count($links) == 0) { $links[0]['text'] = $GLOBALS['_LANG']['go_back']; $links[0]['href'] = 'javascript:history.go(-1)'; } assign_query_info(); $GLOBALS['smarty']->assign('ur_here', $GLOBALS['_LANG']['system_message']); $GLOBALS['smarty']->assign('msg_detail', $msg_detail); $GLOBALS['smarty']->assign('msg_type', $msg_type); $GLOBALS['smarty']->assign('links', $links); $GLOBALS['smarty']->assign('default_url', $links[0]['href']); $GLOBALS['smarty']->assign('auto_redirect', $auto_redirect); $GLOBALS['smarty']->display('message.htm'); exit; }
/** * 聊天服务器设置页面 */ function action_default() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; $chat_keys = $GLOBALS['chat_keys']; // 检查shop_config $sql = "select * from " . $ecs->table("shop_config") . " where code = 'chat'"; $row = $db->getRow($sql, true); if ($row == false) { $sql = "select max(parent_id) from " . $ecs->table("shop_config") . ""; $parent_id = $db->getOne($sql) + 1; $chat = array("id" => $parent_id, "code" => "chat", "parent_id" => 0, "type" => "group", "value" => ""); $db->autoExecute($ecs->table('shop_config'), $chat, 'INSERT'); } else { $parent_id = $row['id']; } $chat = array("chat_server_ip" => "", "chat_server_port" => "", "chat_http_bind_port" => "7070", "chat_server_admin_username" => "", "chat_server_admin_password" => ""); $sql = "select * from " . $ecs->table("shop_config") . " where parent_id = '" . $parent_id . "'"; $rows = $db->getAll($sql); foreach ($rows as $row) { $code = $row['code']; if (isset($chat[$code])) { $chat[$code] = $row['value']; } } if (empty($chat['chat_server_admin_password'])) { $smarty->assign('password_empty', 1); } else { $smarty->assign('password_empty', 0); } $smarty->assign('chat', $chat); /* 显示客服列表页面 */ assign_query_info(); $smarty->display('shop_config_chat_settings.htm'); }
} } /*------------------------------------------------------ */ //-- 批量转移商品分类页面 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'move') { /* 权限检查 */ admin_priv('cat_drop'); $cat_id = !empty($_REQUEST['cat_id']) ? intval($_REQUEST['cat_id']) : 0; /* 模板赋值 */ $smarty->assign('ur_here', $_LANG['move_goods']); $smarty->assign('action_link', array('href' => 'category.php?act=list', 'text' => $_LANG['03_category_list'])); $smarty->assign('cat_select', cat_list(0, $cat_id, true)); $smarty->assign('form_act', 'move_cat'); /* 显示页面 */ assign_query_info(); $smarty->display('category_move.htm'); } /*------------------------------------------------------ */ //-- 处理批量转移商品分类的处理程序 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'move_cat') { /* 权限检查 */ admin_priv('cat_drop'); $cat_id = !empty($_POST['cat_id']) ? intval($_POST['cat_id']) : 0; $target_cat_id = !empty($_POST['target_cat_id']) ? intval($_POST['target_cat_id']) : 0; /* 商品分类不允许为空 */ if ($cat_id == 0 || $target_cat_id == 0) { $link[] = array('text' => $_LANG['go_back'], 'href' => 'category.php?act=move'); sys_msg($_LANG['cat_move_empty'], 0, $link); }
/** * 添加/编辑客服信息的提交 */ function action_insert_update() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; $user_id = intval($_POST['user_id']); /* 取得客服id */ $cus_id = intval($_POST['cus_id']); $customer = array('supp_id' => -1, 'user_id' => $_POST['user_id'], 'of_username' => $_POST['of_username'], 'cus_name' => $_POST['cus_name'], 'cus_password' => $_POST['cus_password'], 'cus_type' => $_POST['cus_type'], 'cus_enable' => $_POST['cus_enable'], 'cus_desc' => $_POST['cus_desc']); // 判断密码是否为空 if (empty($customer['of_username'])) { sys_msg($_LANG['error_of_username_empty']); } // 判断客服名称是否为空 if (empty($customer['cus_name'])) { sys_msg($_LANG['error_cus_name_empty']); } // 检查聊天系统用户名是否已经绑定了其他管理员账户 if (check_of_username_binding($customer['of_username'], $customer['user_id'])) { sys_msg($_LANG['error_of_username_binding']); } else { // 用户不存在则需要判断密码是否为空 if (!check_of_username_exist($customer['of_username'])) { // 判断密码是否为空 if (empty($customer['cus_password'])) { sys_msg($_LANG['error_password_empty']); } } // 创建活更新聊天系统用户 $create_success = create_of_user($customer['of_username'], $customer['cus_password'], $customer['cus_name'], null, 10, -1); if (!$create_success) { sys_msg($_LANG['error_create_of_user']); } } if (empty($_POST['cus_id'])) { // 检查管理员账户是否存在 if (check_user_id_exist($user_id)) { sys_msg($_LANG['error_user_id_exist']); } $customer['add_time'] = gmtime(); /* insert */ $db->autoExecute($ecs->table('chat_customer'), $customer, 'INSERT'); /* log */ admin_log(addslashes($customer['of_username']), 'add', 'chat_customer'); /* 提示信息 */ $links = array(array('href' => 'customer.php?act=add', 'text' => $_LANG['continue_add']), array('href' => 'customer.php?act=list', 'text' => $_LANG['back_list'])); sys_msg($_LANG['add_success'], 0, $links); } else { // 检查管理员账户是否存在 if (check_user_id_exist($user_id, $cus_id)) { sys_msg($_LANG['error_user_id_exist']); } /* update */ $db->autoExecute($ecs->table('chat_customer'), $customer, 'UPDATE', "cus_id = '{$cus_id}'"); /* log */ admin_log(addslashes($customer['of_username']) . '[' . $cus_id . ']', 'edit', 'chat_customer'); /* 提示信息 */ $links = array(array('href' => 'customer.php?act=list&' . list_link_postfix(), 'text' => $_LANG['back_list'])); sys_msg($_LANG['edit_success'], 0, $links); } /* 显示客服列表页面 */ assign_query_info(); $smarty->display('customer_info.htm'); }
/** * 编辑预售活动 */ function action_edit() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; $pre_sale_id = intval($_REQUEST['id']); if ($pre_sale_id <= 0) { die('invalid param'); } $pre_sale = pre_sale_info($pre_sale_id); $smarty->assign('pre_sale', $pre_sale); /* 模板赋值 */ $smarty->assign('ur_here', $_LANG['add_pre_sale']); $smarty->assign('action_link', list_link($action == 'add')); $smarty->assign('cat_list', cat_list()); $smarty->assign('brand_list', get_brand_list()); /* 显示模板 */ assign_query_info(); $smarty->display('pre_sale_info.htm'); }
function init() { global $smarty,$_LANG,$ecs; @$data = file_get_contents('proxyserver.conf'); if (!$data) { $links[] = array('text' => $_LANG['customiz_app'], 'href' => 'index.php'); sys_msg( $_LANG['plugin_error'], 0 ,$links,false); } $arr = json_decode($data,true); if(!isset($arr['zywxemail'])) { assign_query_info(); $iframe_url = ZYWX_PROXY .'/index.php?m=curl&a=toLogin&callback_uri='.$ecs->url() .'success.php'; $smarty->assign('iframe_url',$iframe_url); $smarty->assign('repeatCreateApp','false'); $smarty->assign('ur_here', $_LANG['check_email']); $smarty->display('email_set.html'); exit; } }
function action_aff_list() { // 全局变量 $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; /* 检查权限 */ admin_priv('users_manage'); $smarty->assign('ur_here', $_LANG['03_users_list']); $auid = $_GET['auid']; $user_list['user_list'] = array(); $affiliate = unserialize($GLOBALS['_CFG']['affiliate']); $smarty->assign('affiliate', $affiliate); empty($affiliate) && ($affiliate = array()); $num = count($affiliate['item']); $up_uid = "'{$auid}'"; $all_count = 0; for ($i = 1; $i <= $num; $i++) { $count = 0; if ($up_uid) { $sql = "SELECT user_id FROM " . $ecs->table('users') . " WHERE parent_id IN({$up_uid})"; $query = $db->query($sql); $up_uid = ''; while ($rt = $db->fetch_array($query)) { $up_uid .= $up_uid ? ",'{$rt['user_id']}'" : "'{$rt['user_id']}'"; $count++; } } $all_count += $count; if ($count) { $sql = "SELECT user_id, user_name, '{$i}' AS level, email, is_validated, user_money, frozen_money, rank_points, pay_points, reg_time " . " FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id IN({$up_uid})" . " ORDER by level, user_id"; $user_list['user_list'] = array_merge($user_list['user_list'], $db->getAll($sql)); } } $temp_count = count($user_list['user_list']); for ($i = 0; $i < $temp_count; $i++) { $user_list['user_list'][$i]['reg_time'] = local_date($_CFG['date_format'], $user_list['user_list'][$i]['reg_time']); } $user_list['record_count'] = $all_count; $smarty->assign('user_list', $user_list['user_list']); $smarty->assign('record_count', $user_list['record_count']); $smarty->assign('full_page', 1); $smarty->assign('action_link', array('text' => $_LANG['back_note'], 'href' => "users.php?act=edit&id={$auid}")); assign_query_info(); $smarty->display('affiliate_list.htm'); }
function action_allot() { // 全局变量 // $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; include_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/supplier_priv_action.php'; admin_priv('allot_priv'); if ($_SESSION['supplier_user_id'] == $_GET['id']) { admin_priv('all'); } /* 获得该管理员的权限 */ $priv_str = $db->getOne("SELECT action_list FROM " . $ecs->table('supplier_admin_user') . " WHERE user_id = '{$_GET['id']}' AND supplier_id = '{$_SESSION['supplier_id']}'"); /* 如果被编辑的管理员拥有了all这个权限,将不能编辑 */ if ($priv_str == 'all') { $link[] = array('text' => $_LANG['back_admin_list'], 'href' => 'privilege.php?act=list'); sys_msg($_LANG['edit_admininfo_cannot'], 0, $link); } /* 获取权限的分组数据 */ $sql_query = "SELECT action_id, parent_id, action_code,relevance FROM " . $ecs->table('supplier_admin_action') . " WHERE parent_id = 0"; $res = $db->query($sql_query); while ($rows = $db->FetchRow($res)) { $priv_arr[$rows['action_id']] = $rows; } /* 按权限组查询底级的权限名称 */ $sql = "SELECT action_id, parent_id, action_code,relevance FROM " . $ecs->table('supplier_admin_action') . " WHERE parent_id " . db_create_in(array_keys($priv_arr)); $result = $db->query($sql); while ($priv = $db->FetchRow($result)) { $priv_arr[$priv["parent_id"]]["priv"][$priv["action_code"]] = $priv; } // 将同一组的权限使用 "," 连接起来,供JS全选 foreach ($priv_arr as $action_id => $action_group) { $priv_arr[$action_id]['priv_list'] = join(',', @array_keys($action_group['priv'])); foreach ($action_group['priv'] as $key => $val) { $priv_arr[$action_id]['priv'][$key]['cando'] = strpos($priv_str, $val['action_code']) !== false || $priv_str == 'all' ? 1 : 0; } } /* 赋值 */ $smarty->assign('lang', $_LANG); $smarty->assign('ur_here', $_LANG['allot_priv'] . ' [ ' . $_GET['user'] . ' ] '); $smarty->assign('action_link', array('href' => 'privilege.php?act=list', 'text' => $_LANG['admin_list'])); $smarty->assign('priv_arr', $priv_arr); $smarty->assign('form_act', 'update_allot'); $smarty->assign('user_id', $_GET['id']); /* 显示页面 */ assign_query_info(); $smarty->display('privilege_allot.htm'); }