영카트 5.4 버전 내용 적용

This commit is contained in:
thisgun
2019-12-02 10:29:31 +09:00
parent 8517e1e31e
commit 9b0078350d
840 changed files with 36442 additions and 28088 deletions

View File

@ -83,6 +83,7 @@ class item_list
protected $view_it_cust_price = false; // 소비자가
protected $view_it_icon = false; // 아이콘
protected $view_sns = false; // SNS
protected $view_star = false; // 별점
// 몇번째 class 호출인지를 저장합니다.
protected $count = 0;
@ -99,7 +100,6 @@ class item_list
// 외부에서 쿼리문을 넘겨줄 경우에 담아두는 변수
protected $query = "";
// $type : 상품유형 (기본으로 1~5까지 사용)
// $list_skin : 상품리스트를 노출할 스킨을 설정합니다. 스킨위치는 skin/shop/쇼핑몰설정스킨/type??.skin.php
// $list_mod : 1줄에 몇개의 상품을 노출할지를 설정합니다.
@ -254,6 +254,8 @@ class item_list
function run() {
global $g5, $config, $member, $default;
$list = array();
if ($this->query) {
@ -309,7 +311,21 @@ class item_list
$row2 = sql_fetch($sql2);
$this->total_count = $row2['cnt'];
}
}
if( isset($result) && $result ){
while ($row=sql_fetch_array($result)) {
if( isset($row['it_seo_title']) && ! $row['it_seo_title'] ){
shop_seo_title_update($row['it_id']);
}
$list[] = $row;
}
if(function_exists('sql_data_seek')){
sql_data_seek($result, 0);
}
}
$file = $this->list_skin;
@ -329,7 +345,6 @@ class item_list
}
}
// 장바구니 건수 검사
function get_cart_count($cart_id)
{
@ -389,12 +404,13 @@ function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='', $img
if(!$it_id || !$width)
return '';
$sql = " select it_id, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10 from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
$row = sql_fetch($sql);
$row = get_shop_item($it_id, true);
if(!$row['it_id'])
return '';
$filename = $thumb = $img = '';
for($i=1;$i<=10; $i++) {
$file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];
if(is_file($file) && $row['it_img'.$i]) {
@ -435,17 +451,20 @@ function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='', $img
$img .= '>';
if($anchor)
$img = '<a href="'.G5_SHOP_URL.'/item.php?it_id='.$it_id.'">'.$img.'</a>';
$img = $img = '<a href="'.shop_item_url($it_id).'">'.$img.'</a>';
return $img;
return run_replace('get_it_image_tag', $img, $thumb, $it_id, $width, $height, $anchor, $img_id, $img_alt, $is_crop);
}
// 상품이미지 썸네일 생성
function get_it_thumbnail($img, $width, $height=0, $id='', $is_crop=false)
{
$str = '';
if ( $replace_tag = run_replace('get_it_thumbnail_tag', $str, $img, $width, $height, $id, $is_crop) ){
return $replace_tag;
}
$file = G5_DATA_PATH.'/item/'.$img;
if(is_file($file))
$size = @getimagesize($file);
@ -481,10 +500,7 @@ function get_it_imageurl($it_id)
{
global $g5;
$sql = " select it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10
from {$g5['g5_shop_item_table']}
where it_id = '$it_id' ";
$row = sql_fetch($sql);
$row = get_shop_item($it_id, true);
$filepath = '';
for($i=1; $i<=10; $i++) {
@ -921,7 +937,6 @@ function title_sort($col, $type=0)
return "{$_SERVER['SCRIPT_NAME']}?$q1&amp;$q2&amp;page=$page";
}
// 세션값을 체크하여 이쪽에서 온것이 아니면 메인으로
function session_check()
{
@ -931,9 +946,8 @@ function session_check()
gotourl(G5_SHOP_URL);
}
// 상품 선택옵션
function get_item_options($it_id, $subject, $is_div='')
function get_item_options($it_id, $subject, $is_div='', $is_first_option_title='')
{
global $g5;
@ -977,14 +991,17 @@ function get_item_options($it_id, $subject, $is_div='')
if($is_div === 'div') {
$str .= '<div class="get_item_options">'.PHP_EOL;
$str .= '<label for="it_option_'.$seq.'">'.$subj[$i].'</label>'.PHP_EOL;
$str .= '<label for="it_option_'.$seq.'" class="label-title">'.$subj[$i].'</label>'.PHP_EOL;
} else {
$str .= '<tr>'.PHP_EOL;
$str .= '<th><label for="it_option_'.$seq.'">'.$subj[$i].'</label></th>'.PHP_EOL;
$str .= '<th><label for="it_option_'.$seq.'" class="label-title">'.$subj[$i].'</label></th>'.PHP_EOL;
}
$select = '<select id="it_option_'.$seq.'" class="it_option"'.$disabled.'>'.PHP_EOL;
$select .= '<option value="">선택</option>'.PHP_EOL;
$first_option_title = $is_first_option_title ? $subj[$i] : '선택';
$select .= '<option value="">'.$first_option_title.'</option>'.PHP_EOL;
for($k=0; $k<$opt_count; $k++) {
$opt_val = $opt[$k];
if(strlen($opt_val)) {
@ -1041,9 +1058,8 @@ function get_item_options($it_id, $subject, $is_div='')
return $str;
}
// 상품 추가옵션
function get_item_supply($it_id, $subject, $is_div='')
function get_item_supply($it_id, $subject, $is_div='', $is_first_option_title='')
{
global $g5;
@ -1092,14 +1108,16 @@ function get_item_supply($it_id, $subject, $is_div='')
$seq = $i + 1;
if($is_div === 'div') {
$str .= '<div class="get_item_supply">'.PHP_EOL;
$str .= '<label for="it_supply_'.$seq.'">'.$subj[$i].'</label>'.PHP_EOL;
$str .= '<label for="it_supply_'.$seq.'" class="label-title">'.$subj[$i].'</label>'.PHP_EOL;
} else {
$str .= '<tr>'.PHP_EOL;
$str .= '<th><label for="it_supply_'.$seq.'">'.$subj[$i].'</label></th>'.PHP_EOL;
}
$first_option_title = $is_first_option_title ? $subj[$i] : '선택';
$select = '<select id="it_supply_'.$seq.'" class="it_supply">'.PHP_EOL;
$select .= '<option value="">선택</option>'.PHP_EOL;
$select .= '<option value="">'.$first_option_title.'</option>'.PHP_EOL;
for($k=0; $k<$opt_count; $k++) {
$opt_val = $opt[$k];
if($opt_val) {
@ -1121,7 +1139,6 @@ function get_item_supply($it_id, $subject, $is_div='')
return $str;
}
function print_item_options($it_id, $cart_id)
{
global $g5;
@ -1430,7 +1447,7 @@ function relation_item($it_id, $width, $height, $rows=3)
$img = get_it_image($row['it_id'], $width, $height);
$str .= '<li class="sct_rel_li"><a href="'.G5_SHOP_URL.'/item.php?it_id='.$row['it_id'].'" class="sct_rel_a">'.$img.'</a></li>';
$str .= '<li class="sct_rel_li"><a href="'.get_pretty_url('shop', $row['it_id']).'" class="sct_rel_a">'.$img.'</a></li>';
}
if($i > 0)
@ -1457,7 +1474,7 @@ function item_icon($it)
$icon .= '<span class="shop_icon shop_icon_3">최신</span>';
if ($it['it_type4'])
$icon .= '<span class="shop_icon shop_icon_4">BEST</span>';
$icon .= '<span class="shop_icon shop_icon_4">인기</span>';
if ($it['it_type5'])
$icon .= '<span class="shop_icon shop_icon_5">할인</span>';
@ -1477,10 +1494,6 @@ function item_icon($it)
if($row['cnt'])
$icon .= '<span class="shop_icon shop_icon_coupon">쿠폰</span>';
// 품절
if (is_soldout($it['it_id']))
$icon .= '<br><span class="shop_icon_soldout">Sold Out</span>';
$icon .= '</span>';
return $icon;
@ -1911,13 +1924,21 @@ function is_used_coupon($mb_id, $cp_id)
}
// 품절상품인지 체크
function is_soldout($it_id)
function is_soldout($it_id, $is_cache=false)
{
global $g5;
static $cache = array();
$it_id = preg_replace('/[^a-z0-9_]/i', '', $it_id);
$key = md5($it_id);
if( $is_cache && isset($cache[$key]) ){
return $cache[$key];
}
// 상품정보
$sql = " select it_soldout, it_stock_qty from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
$it = sql_fetch($sql);
$it = get_shop_item($it_id, $is_cache);
if($it['it_soldout'] || $it['it_stock_qty'] <= 0)
return true;
@ -1955,6 +1976,8 @@ function is_soldout($it_id)
if($stock_qty <= 0)
$soldout = true;
}
$cache[$key] = $soldout;
return $soldout;
}
@ -1994,8 +2017,7 @@ function shop_member_cert_check($id, $type)
switch($type)
{
case 'item':
$sql = " select ca_id, ca_id2, ca_id3 from {$g5['g5_shop_item_table']} where it_id = '$id' ";
$it = sql_fetch($sql);
$it = get_shop_item($id, true);
$seq = '';
for($i=0; $i<3; $i++) {
@ -2131,7 +2153,7 @@ function get_view_today_items($is_cache=false)
$tv_it_idx = $tv_idx - ($i - 1);
$tv_it_id = get_session("ss_tv[$tv_it_idx]");
$rowx = sql_fetch(" select * from {$g5['g5_shop_item_table']} where it_id = '$tv_it_id' ");
$rowx = get_shop_item($tv_it_id, true);
if(!$rowx['it_id'])
continue;
@ -2205,6 +2227,7 @@ function get_wishlist_datas($mb_id, $is_cache=false)
return $cache[$mb_id];
}
$cache[$mb_id] = array();
$sql = " select a.it_id, b.it_name from {$g5['g5_shop_wish_table']} a, {$g5['g5_shop_item_table']} b ";
$sql .= " where a.mb_id = '".$mb_id."' and a.it_id = b.it_id order by a.wi_id desc ";
$result = sql_query($sql);
@ -2342,48 +2365,60 @@ function get_delivery_company($company)
}
// 사용후기 썸네일 생성
function get_itemuse_thumb($contents, $thumb_width, $thumb_height, $is_create=false, $is_crop=true, $crop_mode='center', $is_sharpen=true, $um_value='80/0.5/3'){
global $config;
$img = $filename = $alt = "";
$matches = get_editor_image($contents, false);
for($i=0; $i<count($matches[1]); $i++)
{
// 이미지 path 구함
$p = parse_url($matches[1][$i]);
if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)
$data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);
else
$data_path = $p['path'];
$srcfile = G5_PATH.$data_path;
if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
$size = @getimagesize($srcfile);
if(empty($size))
continue;
$filename = basename($srcfile);
$filepath = dirname($srcfile);
preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);
$alt = get_text($malt[1]);
break;
}
}
if($filename) {
$thumb = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value);
if($thumb) {
$src = G5_URL.str_replace($filename, $thumb, $data_path);
$img = '<img src="'.$src.'" width="'.$thumb_width.'" height="'.$thumb_height.'" alt="'.$alt.'">';
}
}
return $img;
}
// 사용후기에서 후기에 이미지가 있으면 썸네일을 리턴하며 후기에 이미지가 없으면 상품이미지를 리턴합니다.
function get_itemuselist_thumbnail($it_id, $contents, $thumb_width, $thumb_height, $is_create=false, $is_crop=true, $crop_mode='center', $is_sharpen=true, $um_value='80/0.5/3')
{
global $g5, $config;
$img = $filename = $alt = "";
if($contents) {
$matches = get_editor_image($contents, false);
for($i=0; $i<count($matches[1]); $i++)
{
// 이미지 path 구함
$p = parse_url($matches[1][$i]);
if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)
$data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);
else
$data_path = $p['path'];
$srcfile = G5_PATH.$data_path;
if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
$size = @getimagesize($srcfile);
if(empty($size))
continue;
$filename = basename($srcfile);
$filepath = dirname($srcfile);
preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);
$alt = get_text($malt[1]);
break;
}
}
if($filename) {
$thumb = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value);
if($thumb) {
$src = G5_URL.str_replace($filename, $thumb, $data_path);
$img = '<img src="'.$src.'" width="'.$thumb_width.'" height="'.$thumb_height.'" alt="'.$alt.'">';
}
}
$img = get_itemuse_thumb($contents, $thumb_width, $thumb_height);
}
if(!$img)
@ -2458,7 +2493,6 @@ function cart_item_clean()
sql_query($sql);
}
// 임시주문 데이터로 주문 필드 생성
function make_order_field($data, $exclude)
{
@ -2480,6 +2514,47 @@ function make_order_field($data, $exclude)
return $field;
}
// 주문요청기록 로그를 남깁니다.
function add_order_post_log($msg='', $code='error'){
global $g5, $member;
if( empty($_POST) ) return;
$post_data = base64_encode(serialize($_POST));
$od_id = get_session('ss_order_id');
if( $code === 'delete' ){
sql_query(" delete from {$g5['g5_shop_post_log_table']} where (oid = '$od_id' and mb_id = '{$member['mb_id']}') OR ol_datetime < '".date('Y-m-d H:i:s', strtotime('-15 day', G5_SERVER_TIME))."' ", false);
return;
}
$sql = "insert into `{$g5['g5_shop_post_log_table']}`
set oid = '$od_id',
mb_id = '{$member['mb_id']}',
post_data = '$post_data',
ol_code = '$code',
ol_msg = '$msg',
ol_datetime = '".G5_TIME_YMDHIS."',
ol_ip = '{$_SERVER['REMOTE_ADDR']}'";
if( $result = sql_query($sql, false) ){
sql_query(" delete from {$g5['g5_shop_post_log_table']} where ol_datetime < '".date('Y-m-d H:i:s', strtotime('-15 day', G5_SERVER_TIME))."' ", false);
} else {
if(!sql_query(" DESC {$g5['g5_shop_post_log_table']} ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_post_log_table']}` (
`oid` bigint(20) unsigned NOT NULL,
`mb_id` varchar(255) NOT NULL DEFAULT '',
`post_data` text NOT NULL,
`ol_code` varchar(255) NOT NULL DEFAULT '',
`ol_msg` varchar(255) NOT NULL DEFAULT '',
`ol_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ol_ip` varchar(25) NOT NULL DEFAULT '',
PRIMARY KEY (`oid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ", false);
}
}
}
//이니시스의 삼성페이 또는 L.pay 결제가 활성화 되어 있는지 체크합니다.
function is_inicis_simple_pay(){
global $default;
@ -2513,6 +2588,29 @@ function is_inicis_order_pay($type){
return false;
}
function get_item_images_info($it, $size=array(), $image_width, $image_height){
if( !(is_array($it) && $it) ) return array();
$images = array();
for($i=1; $i<=10; $i++) {
if(!$it['it_img'.$i]) continue;
$file = G5_DATA_PATH.'/item/'.$it['it_img'.$i];
if( $is_exists = run_replace('is_exists_item_file', is_file($file), $it, $i) ){
$thumb = get_it_thumbnail($it['it_img'.$i], $image_width, $image_height);
$attr = (isset($size[0]) && isset($size[1]) && $size[0] && $size[1]) ? 'width="'.$size[0].'" height="'.$size[1].'" ' : '';
$imageurl = G5_DATA_URL.'/item/'.$it['it_img'.$i];
$infos = array(
'thumb'=>$thumb,
'imageurl'=>$imageurl,
'imagehtml'=>'<img src="'.$imageurl.'" '.$attr.' alt="'.get_text($it['it_name']).'" id="largeimage_'.$i.'">',
);
$images[$i] = run_replace('get_image_by_item', $infos, $it, $i, $size);
}
}
return $images;
}
//결제방식 이름을 체크하여 치환 대상인 문자열은 따로 리턴합니다.
function check_pay_name_replace($payname){