代码拉取完成,页面将自动刷新
同步操作将从 Admin/汽配商城 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
/**
* ECSHOP 文章内容
* ============================================================================
* * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecshop.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: liubo $
* $Id: article.php 17217 2011-01-19 06:29:08Z liubo $
*/
/*------------------------------------------------------ */
//-- INPUT
/*------------------------------------------------------ */
$_REQUEST['id'] = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$article_id = $_REQUEST['id'];
/*------------------------------------------------------ */
//-- PROCESSOR
/*------------------------------------------------------ */
$cache_id = sprintf('%X', crc32($_REQUEST['id'] . '-' . $_CFG['lang']));
if (!$smarty->is_cached('article_pro.dwt', $cache_id))
{
assign_template();
/* 文章详情 */
$article = get_article_info($article_id);
if (empty($article))
{
ecs_header("Location: ./\n");
exit;
}
/*
if (!empty($article['link']) && $article['link'] != 'http://' && $article['link'] != 'https://')
{
ecs_header("location:$article[link]\n");
exit;
}*/
$slogo = (isset($_CFG['shop_logo']) && !empty($_CFG['shop_logo'])) ? basename($_CFG['shop_logo']) : 'logo.gif';
$smarty->assign('keywords', htmlspecialchars($_CFG['shop_keywords']));
$smarty->assign('description', htmlspecialchars($_CFG['shop_desc']));
$smarty->assign('s_logo', $slogo); // 商店logo
$smarty->assign('flash_theme', $_CFG['flash_theme']); // Flash轮播图片模板
$smarty->assign('categories', get_categories_tree_supplier()); // 分类树
$smarty->assign('feed_url', ($_CFG['rewrite'] == 1) ? 'feed.xml' : 'feed.php'); // RSS URL
$smarty->assign('id', $article_id);
$smarty->assign('username', $_SESSION['user_name']);
$smarty->assign('email', $_SESSION['email']);
$smarty->assign('type', '1');
/* 验证码相关设置 */
if ((intval($_CFG['captcha']) & CAPTCHA_COMMENT) && gd_version() > 0)
{
$smarty->assign('enabled_captcha', 1);
$smarty->assign('rand', mt_rand());
}
$smarty->assign('article', $article);
$smarty->assign('keywords', htmlspecialchars($article['keywords']));
$smarty->assign('description', htmlspecialchars($article['description']));
$position = assign_ur_here($article['cat_id'], $article['title']);
$smarty->assign('page_title', $position['title']); // 页面标题
$smarty->assign('ur_here', $position['ur_here']); // 当前位置
$smarty->assign('comment_type', 1);
assign_template_supplier();
/* 上一篇下一篇文章 */
$next_article = $db->getRow("SELECT article_id, title FROM " .$ecs->table('supplier_article'). " WHERE article_id > $article_id AND cat_id=$article[cat_id] AND is_open=1 AND supplier_id=".$_GET['suppId']." LIMIT 1");
if (!empty($next_article))
{
$next_article['url'] = build_uri('supplier', array('go'=>'article','suppid'=>$_GET['suppId'],'aid'=>$next_article['supplier_article']), $next_article['title']);
$smarty->assign('next_article', $next_article);
}
$prev_aid = $db->getOne("SELECT max(article_id) FROM " . $ecs->table('supplier_article') . " WHERE article_id < $article_id AND cat_id=$article[cat_id] AND is_open=1 AND supplier_id=".$_GET['suppId']);
if (!empty($prev_aid))
{
$prev_article = $db->getRow("SELECT article_id, title FROM " .$ecs->table('supplier_article'). " WHERE article_id = $prev_aid");
$prev_article['url'] = build_uri('supplier', array('go'=>'article','suppid'=>$_GET['suppId'],'aid'=>$prev_article['article_id']), $prev_article['title']);
$smarty->assign('prev_article', $prev_article);
}
assign_dynamic('article_pro');
}
//if(isset($article) && $article['cat_id'] > 2)
//{
// $smarty->display('article.dwt', $cache_id);
//}
//else
//{
$smarty->display('article_pro.dwt', $cache_id);
//}
/*------------------------------------------------------ */
//-- PRIVATE FUNCTION
/*------------------------------------------------------ */
/**
* 获得指定的文章的详细信息
*
* @access private
* @param integer $article_id
* @return array
*/
function get_article_info($article_id)
{
/* 获得文章的信息 */
$sql = "SELECT a.*".
"FROM " .$GLOBALS['ecs']->table('supplier_article'). " AS a ".
"WHERE a.is_open = 1 AND a.article_id = '$article_id' AND supplier_id=".$_GET['suppId'];
$row = $GLOBALS['db']->getRow($sql);
if ($row !== false)
{
$row['comment_rank'] = ceil($row['comment_rank']); // 用户评论级别取整
$row['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']); // 修正添加时间显示
/* 作者信息如果为空,则用网站名称替换 */
if (empty($row['author']) || $row['author'] == '_SHOPHELP')
{
$row['author'] = $GLOBALS['_CFG']['shop_name'];
}
}
return $row;
}
/**
* 获得文章关联的商品
*
* @access public
* @param integer $id
* @return array
*/
function article_related_goods($id)
{
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_thumb, g.goods_img, g.shop_price AS org_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
'g.market_price, g.promote_price, g.promote_start_date, g.promote_end_date ' .
'FROM ' . $GLOBALS['ecs']->table('goods_article') . ' ga ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = ga.goods_id ' .
"LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
"WHERE ga.article_id = '$id' AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0";
$res = $GLOBALS['db']->query($sql);
$arr = array();
while ($row = $GLOBALS['db']->fetchRow($res))
{
$arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
$arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
$arr[$row['goods_id']]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ?
sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);
$arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
$arr[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
if ($row['promote_price'] > 0)
{
$arr[$row['goods_id']]['promote_price'] = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
$arr[$row['goods_id']]['formated_promote_price'] = price_format($arr[$row['goods_id']]['promote_price']);
}
else
{
$arr[$row['goods_id']]['promote_price'] = 0;
}
}
return $arr;
}
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。