Ejemplo n.º 1
0
    $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);
    /*add by hg for date 2014-04-23 代理商列表 begin*/
    $smarty->assign('agency_list', agency_list());
    $smarty->assign('admin_agency_id', $admin_agency_id);
    $action_list = if_agency() ? 'all' : '';
    $smarty->assign('all', $action_list);
    /*end*/
    /* 重写预览链接 */
    $goods_url = and_agency_url() ? 'http://' . and_agency_url() : 'http://' . agency_url();
    $smarty->assign('url', $goods_url);
    /* 显示商品列表页面 */
    assign_query_info();
    $smarty->display('goods_special_list.htm');
} elseif ($_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit' || $_REQUEST['act'] == 'special_edit' || $_REQUEST['act'] == 'copy') {
    //echo $_REQUEST['act'];
    include_once ROOT_PATH . 'includes/fckeditor/fckeditor.php';
    // 包含 html editor 类文件
    $smarty->assign('act', $_REQUEST['act']);
    /*add by hg for date 2014-03-26 判断代理商是否非法操作商品*/
    if ($_REQUEST['act'] == 'edit' || $_REQUEST['act'] == 'special_edit') {
        static_goods($_REQUEST['goods_id']);
        $smarty->assign('edit', 1);
    }
    /*end*/
Ejemplo n.º 2
0
/**
* 说明:优化网站用得图片地址
* add by hg for 2014-08-12
**/
function img_url()
{
    /* 获取配置图片地址 在init配置*/
    $img_arr = $GLOBALS['_CFG']['o2o_img_url'];
    $num = mt_rand(0, count($img_arr) - 1);
    if (is_array($img_arr)) {
        $url_img = $img_arr[$num];
    }
    return $url_img ? $url_img . '/' : 'http://' . agency_url() . '/';
}
Ejemplo n.º 3
0
function get_newadslist()
{
    /* 过滤查询 */
    $ad_name = !empty($_REQUEST['ad_name']) ? (string) $_REQUEST['ad_name'] : '';
    $filter = array();
    $filter['ad_name'] = $ad_name;
    $filter['admin_agency_id'] = !empty($_REQUEST['admin_agency_id']) ? (int) $_REQUEST['admin_agency_id'] : '0';
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'ad_name' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
    $where = 'WHERE 1 ';
    $admin_agency_id = admin_agency_id();
    if ($ad_name) {
        $where .= ' AND ad_name like \'%' . $ad_name . '%\'';
    }
    if ($filter['admin_agency_id']) {
        $where .= " AND admin_agency_id = {$filter['admin_agency_id']} ";
    } else {
        $where .= " AND admin_agency_id = {$admin_agency_id} ";
    }
    /* 获得总记录数据 */
    $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('ad_new') . ' AS ad ' . $where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    $filter = page_and_size($filter);
    /* 获得广告数据 */
    $arr = array();
    $sql = 'SELECT ad.id,po.id as position_id,position_name,keyword,particulars,url,img,width,height,admin_agency_id,file,ad_name,start FROM ' . $GLOBALS['ecs']->table('ad_new') . ' AS ad left join ' . $GLOBALS['ecs']->table('ad_new_position') . ' as po on po.id = ad.position_id ' . $where . 'ORDER by ' . $filter['sort_by'] . ' ' . $filter['sort_order'];
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        if (strpos($rows['img'], 'http://') === false) {
            $rows['img'] = 'http://' . agency_url() . '/' . $rows['img'];
        }
        if ($rows['start'] == 1) {
            $rows['start'] = '是';
        } else {
            $rows['start'] = 'NO';
        }
        $arr[] = $rows;
    }
    return array('ads' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Ejemplo n.º 4
0
Archivo: init.php Proyecto: dlpc/ecshop
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.dwt');
/* 载入系统参数 */
$_CFG = load_config();
#####   配置信息(放至所有配置网站一些信息)   #####################
$_CFG['o2o_img_url'] = 'http://' . ($code_url = agency_url());
define('TMUSER', 'o2o');
/*配置天猫过来的用户名前缀*/
/* 网站图片地址 */
$img_arr = array('http://img1.txd168.com', 'http://img2.txd168.com', 'http://img3.txd168.com');
##### end ####################################
/* 判断是够是外网 */
if (strpos(agency_url(), 'txd168.com') !== false) {
    $_CFG['o2o_img_url'] = $img_arr;
}
/* add by hg for date 2014-05-04 重写$_CFG*/
agency_shop_config();
/* 载入语言文件 */
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php';
if ($_CFG['shop_closed'] == 1) {
    /* 商店关闭了,输出关闭的消息 */
    header('Content-type: text/html; charset=' . EC_CHARSET);
    die('<div style="margin: 150px; text-align: center; font-size: 14px"><p>' . $_LANG['shop_closed'] . '</p><p>' . $_CFG['close_comment'] . '</p></div>');
}
if (is_spider()) {
    /* 如果是蜘蛛的访问,那么默认为访客方式,并且不记录到日志中 */
    if (!defined('INIT_NO_USERS')) {
        define('INIT_NO_USERS', true);
Ejemplo n.º 5
0
Archivo: init.php Proyecto: dlpc/ecshop
}
/* 创建  对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.dwt');
/* 载入系统参数 */
$_CFG = load_config();
/* 当前网站地址 */
$present_url = agency_url();
#####   配置信息(放至所有配置网站一些信息)   #####################
$_CFG['o2o_img_url'] = 'http://' . $present_url;
//.'/o2o/'
define('TMUSER', 'o2o');
/*配置天猫过来的用户名前缀*/
/* 网站图片地址 */
$img_arr = array('http://img1.txd168.com', 'http://img2.txd168.com', 'http://img3.txd168.com');
##### end ####################################
/* 判断是够是外网 */
if (strpos($present_url, 'txd168.com') !== false) {
    $_CFG['o2o_img_url'] = $img_arr;
}
/* add by hg for date 2014-05-04 重写$_CFG*/
agency_shop_config();
/* 载入语言文件 */
Ejemplo n.º 6
0
/* 记录浏览历史 */
if (!empty($_COOKIE['ECS']['history'])) {
    $history = explode(',', $_COOKIE['ECS']['history']);
    array_unshift($history, $goods_id);
    $history = array_unique($history);
    while (count($history) > $_CFG['history_number']) {
        array_pop($history);
    }
    setcookie('ECS[history]', implode(',', $history), gmtime() + 3600 * 24 * 30);
} else {
    setcookie('ECS[history]', $goods_id, gmtime() + 3600 * 24 * 30);
}
/* 更新点击次数 */
$db->query('UPDATE ' . $ecs->table('goods') . " SET click_count = click_count + 1 WHERE goods_id = '{$_REQUEST['id']}'");
/*二维码信息*/
$codeUrl = agency_url();
$codeUrl = 'http://' . $codeUrl . '/codeImg.php?url=http://' . $codeUrl . '/mobile/goods.php?id=' . $goods_id . '&goods_id=' . $goods_id;
$smarty->assign('codeUrl', $codeUrl);
$smarty->assign('now_time', gmtime());
// 当前系统时间
$smarty->display('goods.dwt', $cache_id);
/*------------------------------------------------------ */
//-- PRIVATE FUNCTION
/*------------------------------------------------------ */
/**
 * 获得指定商品的关联商品
 *
 * @access  public
 * @param   integer     $goods_id
 * @return  array
 */