if (move_upload_file($_FILES['img_file_src']['tmp_name'], $target)) { $src = saestor(DATA_DIR . '/afficheimg/' . $name); } } else { if (!empty($_POST['img_src'])) { $src = $_POST['img_src']; if (strstr($src, 'http') && !strstr($src, $_SERVER['SERVER_NAME'])) { $src = get_url_image($src); } } else { $links[] = array('text' => $_LANG['return_edit'], 'href' => 'flashplay.php?act=edit&id=' . $id); sys_msg($_LANG['src_empty'], 0, $links); } } if (strpos($rt['src'], 'http') === false && $rt['src'] != $src) { unlink(sae_repalce_imgpath($rt['src'])); } $flashdb[$id] = array('src' => $src, 'url' => $_POST['img_url'], 'text' => $_POST['img_text'], 'sort' => $_POST['img_sort']); // 实现排序 $flashdb_sort = array(); $_flashdb = array(); foreach ($flashdb as $key => $value) { $flashdb_sort[$key] = $value['sort']; } asort($flashdb_sort, SORT_NUMERIC); foreach ($flashdb_sort as $key => $value) { $_flashdb[] = $flashdb[$key]; } unset($flashdb, $flashdb_sort); put_flash_xml($_flashdb); set_flash_data($_CFG['flash_theme'], $error_msg = '');
/** * 获取品牌列表 * * @access public * @return array */ function get_brandlist() { $result = get_filter(); if ($result === false) { /* 分页大小 */ $filter = array(); /* 记录总数以及页数 */ if (isset($_POST['brand_name'])) { $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('brand') . ' WHERE brand_name = \'' . $_POST['brand_name'] . '\''; } else { $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('brand'); } $filter['record_count'] = $GLOBALS['db']->getOne($sql); $filter = page_and_size($filter); /* 查询记录 */ if (isset($_POST['brand_name'])) { if (strtoupper(EC_CHARSET) == 'GBK') { $keyword = iconv("UTF-8", "gb2312", $_POST['brand_name']); } else { $keyword = $_POST['brand_name']; } $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('brand') . " WHERE brand_name like '%{$keyword}%' ORDER BY sort_order ASC"; } else { $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('brand') . " ORDER BY sort_order ASC"; } set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']); $arr = array(); while ($rows = $GLOBALS['db']->fetchRow($res)) { //$brand_logo = empty($rows['brand_logo']) ? '' : '<a href="../' . DATA_DIR . '/brandlogo/' . $rows['brand_logo'] . '" target="_brank"><img src="images/picflag.gif" width="16" height="16" border="0" alt=' . $GLOBALS['_LANG']['brand_logo'] . ' /></a>'; // for sae $brand_logo = empty($rows['brand_logo']) ? '' : '<a href="' . sae_repalce_imgpath($rows['brand_logo']) . '" target="_brank"><img src="images/picflag.gif" width="16" height="16" border="0" alt=' . $GLOBALS['_LANG']['brand_logo'] . ' /></a>'; $site_url = empty($rows['site_url']) ? 'N/A' : '<a href="' . $rows['site_url'] . '" target="_brank">' . $rows['site_url'] . '</a>'; $rows['brand_logo'] = $brand_logo; $rows['site_url'] = $site_url; $arr[] = $rows; } return array('brand' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); }
if ($_CFG['index_ad'] == 'cus') { $sql = 'SELECT ad_type, content, url FROM ' . $ecs->table("ad_custom") . ' WHERE ad_status = 1'; $ad = $db->getRow($sql, true); $smarty->assign('ad', $ad); } else { // for sae $flashdb = array(); if (file_exists(saestor(DATA_DIR . '/flash_data.xml'))) { // 兼容v2.7.0及以前版本 if (!preg_match_all('/item_url="([^"]+)"\\slink="([^"]+)"\\stext="([^"]*)"\\ssort="([^"]*)"/', file_get_contents(saestor(DATA_DIR . '/flash_data.xml')), $t, PREG_SET_ORDER)) { preg_match_all('/item_url="([^"]+)"\\slink="([^"]+)"\\stext="([^"]*)"/', file_get_contents(saestor(DATA_DIR . '/flash_data.xml')), $t, PREG_SET_ORDER); } if (!empty($t)) { foreach ($t as $key => $val) { $val[4] = isset($val[4]) ? $val[4] : 0; $flashdb[] = array('src' => sae_repalce_imgpath($val[1]), 'url' => $val[2], 'text' => $val[3], 'sort' => $val[4]); } } } $ads = $flashdb; $smarty->assign('ads', $ads); } /* links */ $links = index_get_links(); $smarty->assign('img_links', $links['img']); $smarty->assign('txt_links', $links['txt']); $smarty->assign('data_dir', DATA_DIR); // 数据目录 /* 首页推荐分类 */ $cat_recommend_res = $db->getAll("SELECT c.cat_id, c.cat_name, cr.recommend_type FROM " . $ecs->table("cat_recommend") . " AS cr INNER JOIN " . $ecs->table("category") . " AS c ON cr.cat_id=c.cat_id"); if (!empty($cat_recommend_res)) {
$goods['goods_thumb'] = get_image_path($_REQUEST['goods_id'], $goods['goods_thumb'], true); } /* 图片列表 */ $sql = "SELECT * FROM " . $ecs->table('goods_gallery') . " WHERE goods_id = '{$goods['goods_id']}'"; $img_list = $db->getAll($sql); /* 格式化相册图片路径 */ if (isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 0) { foreach ($img_list as $key => $gallery_img) { $gallery_img[$key]['img_url'] = get_image_path($gallery_img['goods_id'], $gallery_img['img_original'], false, 'gallery'); $gallery_img[$key]['thumb_url'] = get_image_path($gallery_img['goods_id'], $gallery_img['img_original'], true, 'gallery'); } } else { foreach ($img_list as $key => $gallery_img) { $gallery_img[$key]['thumb_url'] = empty($gallery_img['thumb_url']) ? $gallery_img['img_url'] : $gallery_img['thumb_url']; } $img_list = sae_repalce_imgpath($img_list); } } /* 拆分商品名称样式 */ $goods_name_style = explode('+', empty($goods['goods_name_style']) ? '+' : $goods['goods_name_style']); /* 创建 html editor */ create_html_editor('goods_desc', $goods['goods_desc']); /* 模板赋值 */ $smarty->assign('code', $code); $smarty->assign('ur_here', $is_add ? empty($code) ? $_LANG['02_goods_add'] : $_LANG['51_virtual_card_add'] : ($_REQUEST['act'] == 'edit' ? $_LANG['edit_goods'] : $_LANG['copy_goods'])); $smarty->assign('action_link', list_link($is_add, $code)); $smarty->assign('goods', $goods); $smarty->assign('goods_name_color', $goods_name_style[0]); $smarty->assign('goods_name_style', $goods_name_style[1]); $smarty->assign('cat_list', cat_list(0, $goods['cat_id'])); $smarty->assign('brand_list', get_brand_list());