/** * 获得指定文章分类下所有底层分类的ID * * @access public * @param integer $cat 指定的分类ID * * @return void */ function get_article_children($cat = 0) { return db_create_in(array_unique(array_merge(array($cat), array_keys(article_cat_list($cat, 0, false)))), 'cat_id'); }
function get_sysnav() { global $_LANG; $sysmain = array(array($_LANG['view_cart'], 'flow.php'), array($_LANG['pick_out'], 'pick_out.php'), array($_LANG['group_buy_goods'], 'group_buy.php'), array($_LANG['snatch'], 'snatch.php'), array($_LANG['tag_cloud'], 'tag_cloud.php'), array($_LANG['user_center'], 'user.php'), array($_LANG['wholesale'], 'wholesale.php'), array($_LANG['activity'], 'activity.php'), array($_LANG['myship'], 'myship.php'), array($_LANG['message_board'], 'message.php'), array($_LANG['quotation'], 'quotation.php')); $sysmain[] = array('-', '-'); $catlist = array_merge(cat_list(0, 0, false), array('-'), article_cat_list(0, 0, false)); foreach ($catlist as $key => $val) { $val['view_name'] = $val['cat_name']; for ($i = 0; $i < $val['level']; $i++) { $val['view_name'] = ' ' . $val['view_name']; } $val['url'] = str_replace('&', '&', $val['url']); $val['url'] = str_replace('&', '&', $val['url']); $sysmain[] = array($val['cat_name'], $val['url'], $val['view_name']); } return $sysmain; }
if ($_REQUEST['act'] == 'edit') { /* 权限判断 */ admin_priv('article_manage'); /* 取文章数据 */ $sql = "SELECT * FROM " . $ecs->table('article') . " WHERE article_id='{$_REQUEST['id']}'"; $article = $db->GetRow($sql); /* 创建 html editor */ create_html_editor('FCKeditor1', $article['content']); /* 取得分类、品牌 */ $smarty->assign('goods_cat_list', cat_list()); $smarty->assign('brand_list', get_brand_list()); /* 取得关联商品 */ $goods_list = get_article_goods($_REQUEST['id']); $smarty->assign('goods_list', $goods_list); $smarty->assign('article', $article); $smarty->assign('cat_select', article_cat_list(0, $article['cat_id'])); $smarty->assign('ur_here', $_LANG['article_edit']); $smarty->assign('action_link', array('text' => $_LANG['03_article_list'], 'href' => 'article.php?act=list&' . list_link_postfix())); $smarty->assign('form_action', 'update'); assign_query_info(); $smarty->display('article_info.htm'); } if ($_REQUEST['act'] == 'update') { /* 权限判断 */ admin_priv('article_manage'); /*检查文章名是否相同*/ $is_only = $exc->is_only('title', $_POST['title'], $_POST['id'], "cat_id = '{$_POST['article_cat']}'"); if (!$is_only) { sys_msg(sprintf($_LANG['title_exist'], stripslashes($_POST['title'])), 1); } if (empty($_POST['cat_id'])) {
$ad_positions[] = array('region' => $val['region'], 'sort_order' => $val['sort_order'], 'number' => 0, 'ad_pos' => 0); } } } assign_query_info(); $smarty->assign('ur_here', $_LANG['03_template_setup']); $smarty->assign('curr_template_file', $curr_template); $smarty->assign('temp_options', $temp_options); $smarty->assign('temp_regions', $temp_regions); $smarty->assign('cate_goods', $cate_goods); $smarty->assign('brand_goods', $brand_goods); $smarty->assign('cat_articles', $cat_articles); $smarty->assign('ad_positions', $ad_positions); $smarty->assign('arr_cates', cat_list(0, 0, true)); $smarty->assign('arr_brands', get_brand_list()); $smarty->assign('arr_article_cats', article_cat_list(0, 0, true)); $smarty->assign('arr_ad_positions', get_position_list()); $smarty->display('template_setup.htm'); } /*------------------------------------------------------ */ //-- 提交模板内容设置 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'setting') { admin_priv('template_setup'); $curr_template = $_CFG['template']; $db->query("DELETE FROM " . $ecs->table('template') . " WHERE remarks = '' AND filename = '{$_POST['template_file']}' AND theme = '{$curr_template}'"); /* 先处理固定内容 */ foreach ($_POST['regions'] as $key => $val) { $number = isset($_POST['number'][$key]) ? intval($_POST['number'][$key]) : 0; if (!in_array($key, $GLOBALS['dyna_libs']) and (isset($_POST['display'][$key]) and $_POST['display'][$key] == 1 or $number > 0)) { $sql = "INSERT INTO " . $ecs->table('template') . "(theme, filename, region, library, sort_order, number)" . " VALUES " . "('{$curr_template}', '{$_POST['template_file']}', '{$val}', '" . $_POST['map'][$key] . "', '" . @$_POST['sort_order'][$key] . "', '{$number}')";
clear_cache_files(); admin_log($_POST['title'], 'add', 'shophelp'); sys_msg($_LANG['articleadd_succeed'], 0, $link); } /*------------------------------------------------------ */ //-- 编辑文章 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit') { /* 权限判断 */ admin_priv('shophelp_manage'); /* 取文章数据 */ $sql = "SELECT article_id,title, cat_id, article_type, is_open, author, author_email, keywords, content FROM " . $ecs->table('article') . " WHERE article_id='{$_REQUEST['id']}'"; $article = $db->GetRow($sql); /* 创建 html editor */ create_html_editor('FCKeditor1', $article['content']); $smarty->assign('cat_list', article_cat_list($article['cat_id'], true, 'cat_id', 0)); $smarty->assign('ur_here', $_LANG['article_add']); $smarty->assign('action_link', array('text' => $_LANG['article_list'], 'href' => 'shophelp.php?act=list_article&cat_id=' . $article['cat_id'])); $smarty->assign('article', $article); $smarty->assign('form_action', 'update'); assign_query_info(); $smarty->display('shophelp_info.htm'); } if ($_REQUEST['act'] == 'update') { /* 权限判断 */ admin_priv('shophelp_manage'); /* 检查重名 */ if ($_POST['title'] != $_POST['old_title']) { $exc_article->is_only('title', $_POST['title'], $_LANG['articlename_exist'], $_POST['id']); } /* 更新 */
if ($_POST['cat_name'] != $_POST['old_catname']) { $is_only = $exc->is_only('cat_name', $_POST['cat_name'], $_POST['id']); if (!$is_only) { sys_msg(sprintf($_LANG['catname_exist'], stripslashes($_POST['cat_name'])), 1); } } if (!isset($_POST['parent_id'])) { $_POST['parent_id'] = 0; } $row = $db->getRow("SELECT cat_type, parent_id FROM " . $ecs->table('article_cat') . " WHERE cat_id='{$_POST['id']}'"); $cat_type = $row['cat_type']; if ($cat_type == 3 || $cat_type == 4) { $_POST['parent_id'] = $row['parent_id']; } /* 检查设定的分类的父分类是否合法 */ $child_cat = article_cat_list($_POST['id'], 0, false); if (!empty($child_cat)) { foreach ($child_cat as $child_data) { $catid_array[] = $child_data['cat_id']; } } if (in_array($_POST['parent_id'], $catid_array)) { sys_msg(sprintf($_LANG['parent_id_err'], stripslashes($_POST['cat_name'])), 1); } if ($cat_type == 1 || $cat_type == 5) { 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 == 4) { $cat_type = 5; } else {
<?php /** * ECSHOP 文章内容 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: article.php 17069 2010-03-26 05:28:01Z liuhui $ */ //define('IN_ECS', true); //require(dirname(__FILE__) . '/includes/init.php'); if (!defined('IN_CTRL')) { die('Hacking attempt'); } //require(ROOT_PATH . 'includes/lib_common.php'); include 'includes/cls_json.php'; $json = new JSON(); $articlecat = article_cat_list(0, 0, false, 4); file_put_contents('1.txt', var_export($articlecat, true)); $smarty->assign('articlecat', $articlecat); $content = $smarty->fetch('article_cat.dwt'); make_json_result($content);
$ur_here = $_REQUEST['act'] == 'list' ? $goods_ur[$code] : $_LANG['11_goods_trash']; $smarty->assign('ur_here', $ur_here); $smarty->assign('code', $code); $smarty->assign('cat_list', cat_list(0, $cat_id)); $smarty->assign('brand_list', get_brand_list()); $smarty->assign('intro_list', get_intro_list()); $smarty->assign('lang', $_LANG); $smarty->assign('list_type', $_REQUEST['act'] == 'list' ? 'goods' : 'trash'); $smarty->assign('use_storage', empty($_CFG['use_storage']) ? 0 : 1); $suppliers_list = suppliers_list_info(' is_check = 1 '); $suppliers_list_count = count($suppliers_list); $smarty->assign('suppliers_list', $suppliers_list_count == 0 ? 0 : $suppliers_list); // 取供货商列表 $goods_list = goods_list($_REQUEST['act'] == 'list' ? 0 : 1, $_REQUEST['act'] == 'list' ? $code == '' ? 1 : 0 : -1); $smarty->assign('goods_list', $goods_list['goods']); $smarty->assign('cat_select', article_cat_list(0)); $smarty->assign('filter', $goods_list['filter']); $smarty->assign('record_count', $goods_list['record_count']); $smarty->assign('page_count', $goods_list['page_count']); $smarty->assign('full_page', 1); /* 排序标记 */ $sort_flag = sort_flag($goods_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); /* 获取商品类型存在规格的类型 */ $specifications = get_goods_type_specifications(); $smarty->assign('specifications', $specifications); $sql = "update " . $GLOBALS['ecs']->table('goods') . " AS g set goods_name_zh=goods_name where goods_name_zh=''"; $GLOBALS['db']->query($sql); /* 显示商品列表页面 */ assign_query_info(); switch ($_REQUEST['act']) {