2.7.30411 升级补丁首页头部出现代码,请教高人!~

2016-07-07 15:13 来源:www.chinab4c.com 作者:ecshop专家

table('category')." where parent_id=".$cid." and is_show=1 ORDER BY sort_order ASC, cat_id ASC"; $res = $GLOBALS['db']->getAll($sql); foreach($res as $idx => $row) { $cat_arr[$idx]['id'] = $row['cat_id']; $cat_arr[$idx]['name'] = $row['cat_name']; $cat_arr[$idx]['url'] = build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']); $cat_arr[$idx]['children'] = get_clild_list($row['cat_id']); } return $cat_arr; } else { return false; } } function get_clild_list($pid) { $sql_sub = "select * from ".$GLOBALS['ecs']->table('category')." where parent_id=".$pid." and is_show=1 ORDER BY sort_order ASC, cat_id ASC"; $subres = $GLOBALS['db']->getAll($sql_sub); if($subres) { foreach ($subres as $sidx => $subrow) { $children[$sidx]['id']=$subrow['cat_id']; $children[$sidx]['name']=$subrow['cat_name']; $children[$sidx]['url']=build_uri('category', array('cid' => $subrow['cat_id']), $subrow['cat_name']); } } else { $children = null; } return $children; } // function get_brands1($url = 0, $app = 'brand') { preg_match("/\d+/i",$url,$matches); $cat = $matches[0]; $children = ($cat > 0) ? ' AND ' . get_children($cat) : ''; $sql = "SELECT b.brand_id, b.brand_name, b.brand_logo, b.brand_desc, COUNT(*) AS goods_num, IF(b.brand_logo > '', '1', '0') AS tag ". "FROM " . $GLOBALS['ecs']->table('brand') . "AS b, ". $GLOBALS['ecs']->table('goods') . " AS g ". "WHERE g.brand_id = b.brand_id $children AND is_show = 1 " . " AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ". "GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY tag DESC, b.sort_order ASC"; $row = $GLOBALS['db']->getAll($sql); foreach ($row AS $key => $val) { $row[$key]['url'] = build_uri($app, array('cid' => $cat, 'bid' => $val['brand_id']), $val['brand_name']); $row[$key]['brand_desc'] = htmlspecialchars($val['brand_desc'],ENT_QUOTES); } return $row; } // function get_promotion_info1($goods_id = '') { $snatch = array(); $group = array(); $auction = array(); $package = array(); $favourable = array(); $gmtime = gmtime(); $sql = 'SELECT act_id, act_name, act_type, start_time, end_time FROM ' . $GLOBALS['ecs']->table('goods_activity') . " WHERE is_finished=0 AND start_time <= '$gmtime' AND end_time >= '$gmtime'"; if(!empty($goods_id)) { $sql .= " AND goods_id = '$goods_id'"; } $res = $GLOBALS['db']->getAll($sql); foreach ($res as $data) { switch ($data['act_type']) { case GAT_SNATCH: //夺宝奇兵 $snatch[$data['act_id']]['act_name'] = $data['act_name']; $snatch[$data['act_id']]['url'] = build_uri('snatch', array('sid' => $data['act_id'])); $snatch[$data['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $data['start_time']), local_date('Y-m-d', $data['end_time'])); $snatch[$data['act_id']]['sort'] = $data['start_time']; $snatch[$data['act_id']]['type'] = 'snatch'; break; case GAT_GROUP_BUY: //团购 $group[$data['act_id']]['act_name'] = $data['act_name']; $group[$data['act_id']]['url'] = build_uri('group_buy', array('gbid' => $data['act_id'])); $group[$data['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $data['start_time']), local_date('Y-m-d', $data['end_time'])); $group[$data['act_id']]['sort'] = $data['start_time']; $group[$data['act_id']]['type'] = 'group_buy'; break; case GAT_AUCTION: //拍卖 $auction[$data['act_id']]['act_name'] = $data['act_name']; $auction[$data['act_id']]['url'] = build_uri('auction', array('auid' => $data['act_id'])); $auction[$data['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $data['start_time']), local_date('Y-m-d', $data['end_time'])); $auction[$data['act_id']]['sort'] = $data['start_time']; $auction[$data['act_id']]['type'] = 'auction'; break; case GAT_PACKAGE: //礼包 $package[$data['act_id']]['act_name'] = $data['act_name']; $package[$data['act_id']]['url'] = 'package.php#' . $data['act_id']; $package[$data['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $data['start_time']), local_date('Y-m-d', $data['end_time'])); $package[$data['act_id']]['sort'] = $data['start_time']; $package[$data['act_id']]['type'] = 'package'; break; } } $user_rank = ',' . $_SESSION['user_rank'] . ','; $favourable = array(); $sql = 'SELECT act_id, act_range, act_range_ext, act_name, start_time, end_time FROM ' . $GLOBALS['ecs']->table('favourable_activity') . " WHERE start_time <= '$gmtime' AND end_time >= '$gmtime'"; if(!empty($goods_id)) { $sql .= " AND CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'"; } $res = $GLOBALS['db']->getAll($sql); if(empty($goods_id)) { foreach ($res as $rows) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } } else { $sql = "SELECT cat_id, brand_id FROM " . $GLOBALS['ecs']->table('goods') . "WHERE goods_id = '$goods_id'"; $row = $GLOBALS['db']->getRow($sql); $category_id = $row['cat_id']; $brand_id = $row['brand_id']; foreach ($res as $rows) { if ($rows['act_range'] == FAR_ALL) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } elseif ($rows['act_range'] == FAR_CATEGORY) { /* 找出分类id的子分类id */ $id_list = array(); $raw_id_list = explode(',', $rows['act_range_ext']); foreach ($raw_id_list as $id) { $id_list = array_merge($id_list, array_keys(cat_list($id, 0, false))); } $ids = join(',', array_unique($id_list)); if (strpos(',' . $ids . ',', ',' . $category_id . ',') !== false) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } } elseif ($rows['act_range'] == FAR_BRAND) { if (strpos(',' . $rows['act_range_ext'] . ',', ',' . $brand_id . ',') !== false) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } } elseif ($rows['act_range'] == FAR_GOODS) { if (strpos(',' . $rows['act_range_ext'] . ',', ',' . $goods_id . ',') !== false) { $favourable[$rows['act_id']]['act_name'] = $rows['act_name']; $favourable[$rows['act_id']]['url'] = 'activity.php'; $favourable[$rows['act_id']]['time'] = sprintf($GLOBALS['_LANG']['promotion_time'], local_date('Y-m-d', $rows['start_time']), local_date('Y-m-d', $rows['end_time'])); $favourable[$rows['act_id']]['sort'] = $rows['start_time']; $favourable[$rows['act_id']]['type'] = 'favourable'; } } } } $sort_time = array(); $arr = array_merge($snatch, $group, $auction, $package, $favourable); foreach($arr as $key => $value) { $sort_time[] = $value['sort']; } array_multisort($sort_time, SORT_NUMERIC, SORT_DESC, $arr); return $arr; } $this->assign('promotion_info1', get_promotion_info1()); ?>

回答:
哈哈,没想到这么多人中招了,这个就是因为升级的原因。
因为最新补丁包文件 对模板里的PHP代码做了过滤。你需要修改 cls_template.php 文件 将那段过滤代码删除

受教了,谢谢

我也遇到这个问题,请问怎么解决啊?

过滤代码是哪段,高手还请提示下啊

不要升级其中一个文件就可以了!~蜀锦

学习了,