-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct.php
67 lines (56 loc) · 2.82 KB
/
product.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* DouPHP
* --------------------------------------------------------------------------------------------------
* 版权所有 2013-2015 漳州豆壳网络科技有限公司,并保留所有权利。
* 网站地址: http://www.douco.com
* --------------------------------------------------------------------------------------------------
* 这不是一个自由软件!您只能在遵守授权协议前提下对程序代码进行修改和使用;不允许对程序代码以任何形式任何目的的再发布。
* 授权协议:http://www.douco.com/license.html
* --------------------------------------------------------------------------------------------------
* Author: DouCo
* Release Date: 2015-10-16
*/
define('IN_DOUCO', true);
require (dirname(__FILE__) . '/include/init.php');
// 验证并获取合法的ID,如果不合法将其设定为-1
$id = $firewall->get_legal_id('product', $_REQUEST['id'], $_REQUEST['unique_id']);
$cat_id = $dou->get_one("SELECT cat_id FROM " . $dou->table('product') . " WHERE id = '$id'");
$parent_id = $dou->get_one("SELECT parent_id FROM " . $dou->table('product_category') . " WHERE cat_id = '" . $cat_id . "'");
if ($id == -1)
$dou->dou_msg($GLOBALS['_LANG']['page_wrong'], ROOT_URL);
/* 获取产品信息 */
$query = $dou->select($dou->table('product'), '*', '`id` = \'' . $id . '\'');
$product = $dou->fetch_array($query);
// 格式化数据
$product['price'] = $product['price'] > 0 ? $dou->price_format($product['price']) : $_LANG['price_discuss'];
$product['add_time'] = date("Y-m-d", $product['add_time']);
// 生成缩略图的文件名
$image = explode(".", $product['image']);
$product['thumb'] = ROOT_URL . $image[0] . "_thumb." . $image[1];
$product['image'] = ROOT_URL . $product['image'];
// 格式化自定义参数
foreach (explode(',', $product['defined']) as $row) {
$row = explode(':', str_replace(":", ":", $row));
if ($row['1']) {
$defined[] = array (
"arr" => $row['0'],
"value" => $row['1']
);
}
}
// 赋值给模板-meta和title信息
$smarty->assign('page_title', $dou->page_title('product_category', $cat_id, $product['name']));
$smarty->assign('keywords', $product['keywords']);
$smarty->assign('description', $product['description']);
// 赋值给模板-导航栏
$smarty->assign('nav_top_list', $dou->get_nav('top'));
$smarty->assign('nav_middle_list', $dou->get_nav('middle', '0', 'product_category', $cat_id, $parent_id));
$smarty->assign('nav_bottom_list', $dou->get_nav('bottom'));
// 赋值给模板-数据
$smarty->assign('ur_here', $dou->ur_here('product_category', $cat_id, $product['name']));
$smarty->assign('product_category', $dou->get_category('product_category', 0, $cat_id));
$smarty->assign('product', $product);
$smarty->assign('defined', $defined);
$smarty->display('product.dwt');
?>