/** * 获得设置信息 * * @param array $groups 需要获得的设置组 * @param array $excludes 不需要获得的设置组 * * @return array */ function get_shop_header() { global $db, $ecs, $_LANG; create_shop_settiongs(); /* 取出全部数据:分组和变量 */ $sql = "SELECT * FROM " . $ecs->table('supplier_shop_config') . " WHERE supplier_id=" . $_SESSION['supplier_id'] . " AND code in('shop_header_color','shop_header_text')"; $item_list = $db->getAll($sql); //return $item_list; $group_list = array(); foreach ($item_list as $key => $item) { if (in_array($item['code'], array('shop_header_color', 'shop_header_text'))) { $group_list[$item['code']] = $item['value']; } } return $group_list; }
// safety_20150626 del_start /* 管理员登录后可在任何页面使用 act=phpinfo 显示 phpinfo() 信息 */ /*if ($_REQUEST['act'] == 'phpinfo' && function_exists('phpinfo')) { phpinfo(); exit; }*/ // safety_20150626 del_end //header('Cache-control: private'); header('content-type: text/html; charset=' . EC_CHARSET); header('Expires: Fri, 14 Mar 1980 20:53:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); if ((DEBUG_MODE & 1) == 1) { error_reporting(E_ALL); } else { error_reporting(E_ALL ^ E_NOTICE); } if ((DEBUG_MODE & 4) == 4) { include ROOT_PATH . 'includes/lib.debug.php'; } /* 判断是否支持gzip模式 */ if (gzip_enabled()) { ob_start('ob_gzhandler'); } else { ob_start(); } create_shop_settiongs();
/** * 获得设置信息 * * @param array $groups 需要获得的设置组 * @param array $excludes 不需要获得的设置组 * * @return array */ function get_settings($groups = null, $excludes = null) { global $db, $ecs, $_LANG; $config_groups = ''; $excludes_groups = ''; if (!empty($groups)) { foreach ($groups as $key => $val) { $config_groups .= " AND (id='{$val}' OR parent_id='{$val}')"; } } if (!empty($excludes)) { foreach ($excludes as $key => $val) { $excludes_groups .= " AND (parent_id<>'{$val}' AND id<>'{$val}')"; } } create_shop_settiongs(); /* 取出全部数据:分组和变量 */ $sql = "SELECT * FROM " . $ecs->table('supplier_shop_config') . " WHERE supplier_id=" . $_SESSION['supplier_id'] . " AND type<>'hidden' ORDER BY parent_id, sort_order, id"; $item_list = $db->getAll($sql); /* 整理数据 */ $group_list = array(); foreach ($item_list as $key => $item) { $pid = $item['parent_id']; $item['name'] = isset($_LANG['cfg_name'][$item['code']]) ? $_LANG['cfg_name'][$item['code']] : $item['code']; $item['desc'] = isset($_LANG['cfg_desc'][$item['code']]) ? $_LANG['cfg_desc'][$item['code']] : ''; if ($item['code'] == 'sms_shop_mobile') { $item['url'] = 1; } if ($pid == 0) { /* 分组 */ if ($item['type'] == 'group') { $group_list[$item['id']] = $item; } } else { /* 变量 */ if (isset($group_list[$pid])) { if ($item['store_range']) { $item['store_options'] = explode(',', $item['store_range']); foreach ($item['store_options'] as $k => $v) { $item['display_options'][$k] = isset($_LANG['cfg_range'][$item['code']][$v]) ? $_LANG['cfg_range'][$item['code']][$v] : $v; } } $group_list[$pid]['vars'][] = $item; } } } return $group_list; }