first commit 2
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
include_once('../common.php');
|
||||
|
||||
if (isset($_REQUEST['sort']) && !preg_match("/(--|#|\/\*|\*\/)/", $_REQUEST['sort'])) {
|
||||
$sort = trim($_REQUEST['sort']);
|
||||
$sort = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\s]/", "", $sort);
|
||||
} else {
|
||||
$sort = '';
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['sortodr'])) {
|
||||
$sortodr = preg_match("/^(asc|desc)$/i", $sortodr) ? $sortodr : '';
|
||||
} else {
|
||||
$sortodr = '';
|
||||
}
|
||||
|
||||
if (!defined('G5_USE_SHOP') || !G5_USE_SHOP)
|
||||
die('<p>쇼핑몰 설치 후 이용해 주십시오.</p>');
|
||||
|
||||
define('_SHOP_', true);
|
||||
define('_SHOP_COMMON_', true); // 모바일 페이지의 직접 접근을 막는 경우에 사용
|
||||
?>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if(G5_IS_MOBILE)
|
||||
include_once(G5_MSHOP_PATH.'/shop.head.php');
|
||||
else
|
||||
include_once(G5_SHOP_PATH.'/shop.head.php');
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if(G5_IS_MOBILE)
|
||||
include_once(G5_MSHOP_PATH.'/shop.tail.php');
|
||||
else
|
||||
include_once(G5_SHOP_PATH.'/shop.tail.php');
|
||||
@@ -0,0 +1,353 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$action = isset($_REQUEST['action']) ? preg_replace('/[^a-z0-9_]/i', '', $_REQUEST['action']) : '';
|
||||
|
||||
switch ($action) {
|
||||
case 'refresh_cart' :
|
||||
|
||||
// 보관기간이 지난 상품 삭제
|
||||
cart_item_clean();
|
||||
|
||||
$s_cart_id = preg_replace('/[^a-z0-9_\-]/i', '', get_session('ss_cart_id'));
|
||||
|
||||
// 선택필드 초기화
|
||||
if( $s_cart_id ){
|
||||
$sql = " update {$g5['g5_shop_cart_table']} set ct_select = '0' where od_id = '$s_cart_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_SKIN_PATH.'/boxcart.skin.php'); // 장바구니
|
||||
break;
|
||||
|
||||
case 'refresh_wish' :
|
||||
|
||||
if( !$is_member ){
|
||||
die('');
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_SKIN_PATH.'/boxwish.skin.php'); // 위시리스트
|
||||
break;
|
||||
|
||||
case 'cart_delete' :
|
||||
|
||||
// 보관기간이 지난 상품 삭제
|
||||
cart_item_clean();
|
||||
|
||||
$s_cart_id = get_session('ss_cart_id');
|
||||
$it_id = isset($_POST['it_id']) ? safe_replace_regex($_POST['it_id'], 'it_id') : '';
|
||||
|
||||
// 장바구니 상품삭제
|
||||
$sql = " delete from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '".$s_cart_id."'
|
||||
and it_id = '{$it_id}' ";
|
||||
sql_query($sql);
|
||||
|
||||
die(json_encode(array('error' => '')));
|
||||
|
||||
break;
|
||||
case 'cart_update' :
|
||||
|
||||
// 보관기간이 지난 상품 삭제
|
||||
cart_item_clean();
|
||||
|
||||
// cart id 설정
|
||||
set_cart_id($sw_direct);
|
||||
|
||||
if($sw_direct)
|
||||
$tmp_cart_id = get_session('ss_cart_direct');
|
||||
else
|
||||
$tmp_cart_id = get_session('ss_cart_id');
|
||||
|
||||
// 브라우저에서 쿠키를 허용하지 않은 경우라고 볼 수 있음.
|
||||
if (!$tmp_cart_id)
|
||||
{
|
||||
die(json_encode(array('error' => '더 이상 작업을 진행할 수 없습니다.\n\n브라우저의 쿠키 허용을 사용하지 않음으로 설정한것 같습니다.\n\n브라우저의 인터넷 옵션에서 쿠키 허용을 사용으로 설정해 주십시오.\n\n그래도 진행이 되지 않는다면 쇼핑몰 운영자에게 문의 바랍니다.')));
|
||||
}
|
||||
|
||||
$tmp_cart_id = preg_replace('/[^a-z0-9_\-]/i', '', $tmp_cart_id);
|
||||
|
||||
// 레벨(권한)이 상품구입 권한보다 작다면 상품을 구입할 수 없음.
|
||||
if ($member['mb_level'] < $default['de_level_sell'])
|
||||
{
|
||||
die(json_encode(array('error' => '상품을 구입할 수 있는 권한이 없습니다.')));
|
||||
}
|
||||
|
||||
$count = (isset($_POST['it_id']) && is_array($_POST['it_id'])) ? count($_POST['it_id']) : 0;
|
||||
|
||||
if ($count < 1)
|
||||
die(json_encode(array('error' => '장바구니에 담을 상품을 선택하여 주십시오.')));
|
||||
|
||||
$ct_count = 0;
|
||||
for($i=0; $i<$count; $i++) {
|
||||
$it_id = isset($_POST['it_id'][$i]) ? safe_replace_regex($_POST['it_id'][$i], 'it_id') : '';
|
||||
$opt_count = (isset($_POST['io_id'][$it_id]) && is_array($_POST['io_id'][$it_id])) ? count($_POST['io_id'][$it_id]) : 0;
|
||||
|
||||
// 상품정보
|
||||
$it = get_shop_item($it_id, false);
|
||||
if(!$it['it_id'])
|
||||
die(json_encode(array('error' => '상품정보가 존재하지 않습니다.')));
|
||||
|
||||
// 옵션정보를 얻어서 배열에 저장
|
||||
$opt_list = array();
|
||||
$sql = " select * from {$g5['g5_shop_item_option_table']} where it_id = '$it_id' order by io_no asc ";
|
||||
$result = sql_query($sql);
|
||||
$lst_count = 0;
|
||||
for($k=0; $row=sql_fetch_array($result); $k++) {
|
||||
$opt_list[$row['io_type']][$row['io_id']]['id'] = $row['io_id'];
|
||||
$opt_list[$row['io_type']][$row['io_id']]['use'] = $row['io_use'];
|
||||
$opt_list[$row['io_type']][$row['io_id']]['price'] = $row['io_price'];
|
||||
$opt_list[$row['io_type']][$row['io_id']]['stock'] = $row['io_stock_qty'];
|
||||
|
||||
// 선택옵션 개수
|
||||
if(!$row['io_type'])
|
||||
$lst_count++;
|
||||
}
|
||||
|
||||
if($lst_count > 0 && !trim($_POST['io_id'][$it_id][$i]) && $_POST['io_type'][$it_id][$i] == 0)
|
||||
die(json_encode(array('error' => '상품의 선택옵션을 선택해 주십시오.')));
|
||||
|
||||
for($k=0; $k<$opt_count; $k++) {
|
||||
$post_ct_qty = isset($_POST['ct_qty'][$it_id][$k]) ? (int) $_POST['ct_qty'][$it_id][$k] : 0;
|
||||
if ($post_ct_qty < 1)
|
||||
die(json_encode(array('error' => '수량은 1 이상 입력해 주십시오.')));
|
||||
}
|
||||
|
||||
// 바로구매에 있던 장바구니 자료를 지운다.
|
||||
if($i == 0 && $sw_direct)
|
||||
sql_query(" delete from {$g5['g5_shop_cart_table']} where od_id = '$tmp_cart_id' and ct_direct = 1 ", false);
|
||||
|
||||
// 최소, 최대 수량 체크
|
||||
if($it['it_buy_min_qty'] || $it['it_buy_max_qty']) {
|
||||
$sum_qty = 0;
|
||||
for($k=0; $k<$opt_count; $k++) {
|
||||
if(isset($_POST['io_type'][$it_id][$k]) && $_POST['io_type'][$it_id][$k] == 0){
|
||||
$post_ct_qty = isset($_POST['ct_qty'][$it_id][$k]) ? (int) $_POST['ct_qty'][$it_id][$k] : 0;
|
||||
$sum_qty += $post_ct_qty;
|
||||
}
|
||||
}
|
||||
|
||||
if($it['it_buy_min_qty'] > 0 && $sum_qty < $it['it_buy_min_qty'])
|
||||
die(json_encode(array('error' => $it['it_name'].'의 선택옵션 개수 총합 '.number_format($it['it_buy_min_qty']).'개 이상 주문해 주십시오.')));
|
||||
|
||||
if($it['it_buy_max_qty'] > 0 && $sum_qty > $it['it_buy_max_qty'])
|
||||
die(json_encode(array('error' => $it['it_name'].'의 선택옵션 개수 총합 '.number_format($it['it_buy_max_qty']).'개 이하로 주문해 주십시오.')));
|
||||
|
||||
// 기존에 장바구니에 담긴 상품이 있는 경우에 최대 구매수량 체크
|
||||
if($it['it_buy_max_qty'] > 0) {
|
||||
$sql4 = " select sum(ct_qty) as ct_sum
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and it_id = '$it_id'
|
||||
and io_type = '0'
|
||||
and ct_status = '쇼핑' ";
|
||||
$row4 = sql_fetch($sql4);
|
||||
|
||||
if(($sum_qty + $row4['ct_sum']) > $it['it_buy_max_qty'])
|
||||
die(json_encode(array('error' => $it['it_name'].'의 선택옵션 개수 총합 '.number_format($it['it_buy_max_qty']).'개 이하로 주문해 주십시오.', './cart.php')));
|
||||
}
|
||||
}
|
||||
|
||||
// 장바구니에 Insert
|
||||
// 바로구매일 경우 장바구니가 체크된것으로 강제 설정
|
||||
$ct_select = 0;
|
||||
$ct_select_time = '0000-00-00 00:00:00';
|
||||
|
||||
// 장바구니에 Insert
|
||||
$comma = '';
|
||||
$sql = " INSERT INTO {$g5['g5_shop_cart_table']}
|
||||
( od_id, mb_id, it_id, it_name, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_notax, io_id, io_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select, ct_select_time )
|
||||
VALUES ";
|
||||
|
||||
for($k=0; $k<$opt_count; $k++) {
|
||||
$io_id = isset($_POST['io_id'][$it_id][$k]) ? preg_replace(G5_OPTION_ID_FILTER, '', $_POST['io_id'][$it_id][$k]) : '';
|
||||
$io_type = isset($_POST['io_type'][$it_id][$k]) ? preg_replace('#[^01]#', '', $_POST['io_type'][$it_id][$k]) : '';
|
||||
$io_value = isset($_POST['io_value'][$it_id][$k]) ? $_POST['io_value'][$it_id][$k] : '';
|
||||
|
||||
// 선택옵션정보가 존재하는데 선택된 옵션이 없으면 건너뜀
|
||||
if($lst_count && $io_id == '')
|
||||
continue;
|
||||
|
||||
$opt_list_type_id_use = isset($opt_list[$io_type][$io_id]['use']) ? $opt_list[$io_type][$io_id]['use'] : '';
|
||||
// 구매할 수 없는 옵션은 건너뜀
|
||||
if($io_id && ! $opt_list_type_id_use)
|
||||
continue;
|
||||
|
||||
$io_price = isset($opt_list[$io_type][$io_id]['price']) ? $opt_list[$io_type][$io_id]['price'] : 0;
|
||||
$ct_qty = isset($_POST['ct_qty'][$it_id][$k]) ? (int) $_POST['ct_qty'][$it_id][$k] : 0;
|
||||
|
||||
// 구매가격이 음수인지 체크
|
||||
if($io_type) {
|
||||
if((int)$io_price < 0)
|
||||
die(json_encode(array('error' => '구매금액이 음수인 상품은 구매할 수 없습니다.')));
|
||||
} else {
|
||||
if((int)$it['it_price'] + (int)$io_price < 0)
|
||||
die(json_encode(array('error' => '구매금액이 음수인 상품은 구매할 수 없습니다.')));
|
||||
}
|
||||
|
||||
// 동일옵션의 상품이 있으면 수량 더함
|
||||
$sql2 = " select ct_id, io_type, ct_qty
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and it_id = '$it_id'
|
||||
and io_id = '$io_id'
|
||||
and ct_status = '쇼핑' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
if(isset($row2['ct_id']) && $row2['ct_id']) {
|
||||
// 재고체크
|
||||
$tmp_ct_qty = $row2['ct_qty'];
|
||||
if(!$io_id)
|
||||
$tmp_it_stock_qty = get_it_stock_qty($it_id);
|
||||
else
|
||||
$tmp_it_stock_qty = get_option_stock_qty($it_id, $io_id, $row2['io_type']);
|
||||
|
||||
if ($tmp_ct_qty + $ct_qty > $tmp_it_stock_qty)
|
||||
{
|
||||
die(json_encode(array('error' => $io_value." 의 재고수량이 부족합니다.\n\n현재 재고수량 : " . number_format($tmp_it_stock_qty) . " 개")));
|
||||
}
|
||||
|
||||
$sql3 = " update {$g5['g5_shop_cart_table']}
|
||||
set ct_qty = ct_qty + '$ct_qty'
|
||||
where ct_id = '{$row2['ct_id']}' ";
|
||||
sql_query($sql3);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 포인트
|
||||
$point = 0;
|
||||
if($config['cf_use_point']) {
|
||||
if($io_type == 0) {
|
||||
$point = get_item_point($it, $io_id);
|
||||
} else {
|
||||
$point = $it['it_supply_point'];
|
||||
}
|
||||
|
||||
if($point < 0)
|
||||
$point = 0;
|
||||
}
|
||||
|
||||
$ct_send_cost = 0;
|
||||
|
||||
// 배송비결제
|
||||
if($it['it_sc_type'] == 1)
|
||||
$ct_send_cost = 2; // 무료
|
||||
else if($it['it_sc_type'] > 1 && $it['it_sc_method'] == 1)
|
||||
$ct_send_cost = 1; // 착불
|
||||
|
||||
$io_value = sql_real_escape_string(strip_tags($io_value));
|
||||
|
||||
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '".$_SERVER['REMOTE_ADDR']."', '$ct_send_cost', '$sw_direct', '$ct_select', '$ct_select_time' )";
|
||||
$comma = ' , ';
|
||||
$ct_count++;
|
||||
}
|
||||
|
||||
if($ct_count > 0)
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
die(json_encode(array('error' => '')));
|
||||
break;
|
||||
|
||||
case 'get_item_option' :
|
||||
|
||||
$it = get_shop_item($it_id, true);
|
||||
|
||||
if(!$it['it_id'])
|
||||
die(json_encode(array('error' => '상품정보가 존재하지 않습니다.')));
|
||||
|
||||
// 상품품절체크
|
||||
$is_soldout = is_soldout($it['it_id']);
|
||||
|
||||
// 주문가능체크
|
||||
$is_orderable = true;
|
||||
if(!$it['it_use'] || $it['it_tel_inq'] || $is_soldout)
|
||||
die(json_encode(array('error' => '상품을 구매할 수 없습니다.')));
|
||||
|
||||
$item_ct_qty = 1;
|
||||
if($it['it_buy_min_qty'] > 1)
|
||||
$item_ct_qty = $it['it_buy_min_qty'];
|
||||
|
||||
$action_url = G5_SHOP_URL.'/ajax.action.php';
|
||||
|
||||
$is_option = 0;
|
||||
$option_item = get_shop_item_options($it['it_id'], $it['it_option_subject'], 0);
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div class="sct_cartop_wr">
|
||||
<form name="fcart" method="post" action="<?php echo $action_url; ?>">
|
||||
<input type="hidden" name="action" value="cart_update">
|
||||
<input type="hidden" name="it_id[]" value="<?php echo $it['it_id']; ?>">
|
||||
<input type="hidden" name="it_name[]" value="<?php echo stripslashes($it['it_name']); ?>">
|
||||
<input type="hidden" name="it_price[]" value="<?php echo get_price($it); ?>">
|
||||
<input type="hidden" name="it_stock[]" value="<?php echo get_it_stock_qty($it['it_id']); ?>">
|
||||
<input type="hidden" name="io_type[<?php echo $it['it_id']; ?>][]" value="0">
|
||||
<input type="hidden" name="io_id[<?php echo $it['it_id']; ?>][]" value="">
|
||||
<input type="hidden" name="io_value[<?php echo $it['it_id']; ?>][]" value="">
|
||||
<input type="hidden" name="io_price[<?php echo $it['it_id']; ?>][]" value="">
|
||||
<input type="hidden" name="ct_qty[<?php echo $it['it_id']; ?>][]" value="<?php echo $item_ct_qty; ?>">
|
||||
<input type="hidden" name="sw_direct" value="0">
|
||||
<?php
|
||||
if($option_item) {
|
||||
$is_option = 1;
|
||||
?>
|
||||
|
||||
<?php // 선택옵션
|
||||
echo $option_item;
|
||||
?>
|
||||
|
||||
<button type="button" class="cartopt_cart_btn">장바구니 담기</button>
|
||||
<button type="button" class="cartopt_close_btn">닫기</button>
|
||||
|
||||
<?php } ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$result = array(
|
||||
'error' => '',
|
||||
'option' => $is_option,
|
||||
'html' => $content
|
||||
);
|
||||
|
||||
die(json_encode($result));
|
||||
|
||||
break;
|
||||
case 'wish_update' :
|
||||
|
||||
$it_id = isset($_POST['it_id']) ? safe_replace_regex($_POST['it_id'], 'it_id') : '';
|
||||
|
||||
if (!$is_member)
|
||||
die('회원 전용 서비스 입니다.');
|
||||
|
||||
if(!$it_id)
|
||||
die('상품 코드가 올바르지 않습니다.');
|
||||
|
||||
// 상품정보 체크
|
||||
$row = get_shop_item($it_id, true);
|
||||
|
||||
if(! (isset($row['it_id']) && $row['it_id']))
|
||||
die('상품정보가 존재하지 않습니다.');
|
||||
|
||||
$sql = " select wi_id from {$g5['g5_shop_wish_table']}
|
||||
where mb_id = '{$member['mb_id']}' and it_id = '$it_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if (! (isset($row['wi_id']) && $row['wi_id'])) {
|
||||
$sql = " insert {$g5['g5_shop_wish_table']}
|
||||
set mb_id = '{$member['mb_id']}',
|
||||
it_id = '$it_id',
|
||||
wi_time = '".G5_TIME_YMDHIS."',
|
||||
wi_ip = '".$_SERVER['REMOTE_ADDR']."' ";
|
||||
sql_query($sql);
|
||||
|
||||
die('OK');
|
||||
} else {
|
||||
die('위시리스트에 이미 등록된 상품입니다.');
|
||||
}
|
||||
|
||||
break;
|
||||
default :
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if(!$member['mb_id'])
|
||||
die(json_encode(array('error' => '회원 로그인 후 이용해 주십시오.')));
|
||||
|
||||
$cz_id = isset($_GET['cz_id']) ? preg_replace('#[^0-9]#', '', $_GET['cz_id']) : 0;
|
||||
|
||||
if(!$cz_id)
|
||||
die(json_encode(array('error' => '올바른 방법으로 이용해 주십시오.')));
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_coupon_zone_table']} where cz_id = '$cz_id' ";
|
||||
$cp = sql_fetch($sql);
|
||||
|
||||
if(!$cp['cz_id'])
|
||||
die(json_encode(array('error' => '쿠폰정보가 존재하지 않습니다.')));
|
||||
|
||||
if(!($cp['cz_start'] <= G5_TIME_YMD && $cp['cz_end'] >= G5_TIME_YMD))
|
||||
die(json_encode(array('error' => '다운로드할 수 없는 쿠폰입니다.')));
|
||||
|
||||
// 발급여부
|
||||
if(is_coupon_downloaded($member['mb_id'], $cp['cz_id']))
|
||||
die(json_encode(array('error' => '이미 다운로드하신 쿠폰입니다.')));
|
||||
|
||||
// 포인트 쿠폰은 회원포인트 체크
|
||||
if($cp['cz_type'] && ($member['mb_point'] - $cp['cz_point']) < 0)
|
||||
die(json_encode(array('error' => '보유하신 포인트가 부족하여 쿠폰을 다운로드할 수 없습니다.')));
|
||||
|
||||
// 쿠폰발급
|
||||
$j = 0;
|
||||
do {
|
||||
$cp_id = get_coupon_id();
|
||||
|
||||
$sql3 = " select count(*) as cnt from {$g5['g5_shop_coupon_table']} where cp_id = '$cp_id' ";
|
||||
$row3 = sql_fetch($sql3);
|
||||
|
||||
if(!$row3['cnt'])
|
||||
break;
|
||||
else {
|
||||
if($j > 20)
|
||||
die(json_encode(array('error' => 'Coupon ID Error')));
|
||||
}
|
||||
$j++;
|
||||
} while(1);
|
||||
|
||||
$cp = array_map('addslashes', $cp);
|
||||
$cp_start = G5_TIME_YMD;
|
||||
$period = $cp['cz_period'] - 1;
|
||||
if($period < 0)
|
||||
$period = 0;
|
||||
$cp_end = date('Y-m-d', strtotime("+{$period} days", G5_SERVER_TIME));
|
||||
$result = false;
|
||||
|
||||
$sql = " INSERT INTO {$g5['g5_shop_coupon_table']}
|
||||
( cp_id, cp_subject, cp_method, cp_target, mb_id, cz_id, cp_start, cp_end, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum, cp_datetime )
|
||||
VALUES
|
||||
( '$cp_id', '{$cp['cz_subject']}', '{$cp['cp_method']}', '{$cp['cp_target']}', '{$member['mb_id']}', '$cz_id', '$cp_start', '$cp_end', '{$cp['cp_type']}', '{$cp['cp_price']}', '{$cp['cp_trunc']}', '{$cp['cp_minimum']}', '{$cp['cp_maximum']}', '".G5_TIME_YMDHIS."' ) ";
|
||||
|
||||
$result = sql_query($sql);
|
||||
|
||||
// 포인트 쿠폰이면 포인트 차감
|
||||
if($result && $cp['cz_type'])
|
||||
insert_point($member['mb_id'], (-1) * $cp['cz_point'], "쿠폰 $cp_id 발급");
|
||||
|
||||
// 다운로드 증가
|
||||
sql_query(" update {$g5['g5_shop_coupon_zone_table']} set cz_download = cz_download + 1 where cz_id = '$cz_id' ");
|
||||
|
||||
die(json_encode(array('error' => '')));
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
define('G5_IS_SHOP_AJAX_LIST', true);
|
||||
|
||||
$ca_id = isset($_REQUEST['ca_id']) ? safe_replace_regex($_REQUEST['ca_id'], 'ca_id') : '';
|
||||
|
||||
$data = array();
|
||||
|
||||
$sql = " select *
|
||||
from {$g5['g5_shop_category_table']}
|
||||
where ca_id = '$ca_id'
|
||||
and ca_use = '1' ";
|
||||
$ca = sql_fetch($sql);
|
||||
if (!$ca['ca_id'])
|
||||
die(json_encode($data['error'] = '등록된 분류가 없습니다.'));
|
||||
|
||||
// 스킨경로
|
||||
$skin_dir = G5_MSHOP_SKIN_PATH;
|
||||
|
||||
if($ca['ca_mobile_skin_dir']) {
|
||||
$skin_dir = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/shop/'.$ca['ca_mobile_skin_dir'];
|
||||
|
||||
if(is_dir($skin_dir)) {
|
||||
$skin_file = $skin_dir.'/'.$ca['ca_mobile_skin'];
|
||||
|
||||
if(!is_file($skin_file))
|
||||
$skin_dir = G5_MSHOP_SKIN_PATH;
|
||||
} else {
|
||||
$skin_dir = G5_MSHOP_SKIN_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
$skin_file = $skin_dir.'/'.$ca['ca_mobile_skin'];
|
||||
|
||||
// 상품 출력순서가 있다면
|
||||
if ($sort != "")
|
||||
$order_by = $sort.' '.$sortodr.' , it_order, it_id desc';
|
||||
else
|
||||
$order_by = 'it_order, it_id desc';
|
||||
|
||||
// 총몇개
|
||||
$items = $ca['ca_mobile_list_mod'] * $ca['ca_mobile_list_row'];
|
||||
// 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
if ($page < 1) $page = 1;
|
||||
|
||||
$page++;
|
||||
|
||||
// 시작 레코드 구함
|
||||
$from_record = ($page - 1) * $items;
|
||||
|
||||
ob_start();
|
||||
|
||||
$list = new item_list($skin_file, $ca['ca_mobile_list_mod'], $ca['ca_mobile_list_row'], $ca['ca_mobile_img_width'], $ca['ca_mobile_img_height']);
|
||||
$list->set_category($ca['ca_id'], 1);
|
||||
$list->set_category($ca['ca_id'], 2);
|
||||
$list->set_category($ca['ca_id'], 3);
|
||||
$list->set_is_page(true);
|
||||
$list->set_mobile(true);
|
||||
$list->set_order_by($order_by);
|
||||
$list->set_from_record($from_record);
|
||||
$list->set_view('it_img', true);
|
||||
$list->set_view('it_id', false);
|
||||
$list->set_view('it_name', true);
|
||||
$list->set_view('it_price', true);
|
||||
if(isset($use_sns) && $use_sns){
|
||||
$list->set_view('sns', true);
|
||||
}
|
||||
echo $list->run();
|
||||
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$data['item'] = $content;
|
||||
$data['error'] = '';
|
||||
$data['page'] = $page;
|
||||
|
||||
die(json_encode($data));
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if(empty($_POST))
|
||||
die('정보가 넘어오지 않았습니다.');
|
||||
|
||||
// 일정 기간이 경과된 임시 데이터 삭제
|
||||
/*
|
||||
$limit_time = date("Y-m-d H:i:s", (G5_SERVER_TIME - 86400 * 1));
|
||||
$sql = " delete from {$g5['g5_shop_order_data_table']} where dt_type = '1' and dt_time < '$limit_time' ";
|
||||
sql_query($sql);
|
||||
*/
|
||||
|
||||
$od_settle_case = isset($_POST['od_settle_case']) ? clean_xss_tags($_POST['od_settle_case'], 1, 1) : '';
|
||||
|
||||
if(isset($_POST['pp_id']) && $_POST['pp_id']) {
|
||||
$od_id = get_session('ss_personalpay_id');
|
||||
$cart_id = 0;
|
||||
|
||||
$sql = "select pp_use, pp_tno from {$g5['g5_shop_personalpay_table']} where pp_id = '$od_id' ";
|
||||
$pp_row = sql_fetch($sql);
|
||||
|
||||
if( $pp_row['pp_tno'] ){
|
||||
die('해당 개인결제는 이미 결제되었습니다.');
|
||||
} else if( ! $pp_row['pp_use'] ){
|
||||
die('해당 개인결제는 사용이 금지되어 있습니다.');
|
||||
}
|
||||
|
||||
} else {
|
||||
$od_id = get_session('ss_order_id');
|
||||
$_POST['sw_direct'] = get_session('ss_direct');
|
||||
$_POST['od_test'] = $default['de_card_test'];
|
||||
$_POST['od_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
if ($_POST['sw_direct']) {
|
||||
$cart_id = get_session('ss_cart_direct');
|
||||
}
|
||||
else {
|
||||
$cart_id = get_session('ss_cart_id');
|
||||
}
|
||||
|
||||
if( G5_IS_MOBILE && $default['de_pg_service'] == 'inicis' ){
|
||||
$_POST['post_cart_id'] = $cart_id;
|
||||
}
|
||||
}
|
||||
|
||||
$dt_data = base64_encode(serialize($_POST));
|
||||
|
||||
// 동일한 주문번호가 있는지 체크
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
if($row['cnt'])
|
||||
sql_query(" delete from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' ");
|
||||
|
||||
$default_pg = $default['de_pg_service'];
|
||||
|
||||
if( $od_settle_case == '삼성페이' ){ //현재 삼성페이인 경우에는 pg를 inicis로 처리
|
||||
$default_pg = 'inicis';
|
||||
}
|
||||
|
||||
$sql = " insert into {$g5['g5_shop_order_data_table']}
|
||||
set od_id = '$od_id',
|
||||
cart_id = '$cart_id',
|
||||
mb_id = '{$member['mb_id']}',
|
||||
dt_pg = '$default_pg',
|
||||
dt_data = '$dt_data',
|
||||
dt_time = '".G5_TIME_YMDHIS."' ";
|
||||
sql_query($sql);
|
||||
|
||||
die('');
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (get_session('ss_direct'))
|
||||
$tmp_cart_id = get_session('ss_cart_direct');
|
||||
else
|
||||
$tmp_cart_id = get_session('ss_cart_id');
|
||||
|
||||
if (get_cart_count($tmp_cart_id) == 0)// 장바구니에 담기
|
||||
die("장바구니가 비어 있습니다.\n\n이미 주문하셨거나 장바구니에 담긴 상품이 없는 경우입니다.");
|
||||
|
||||
$keep_term = $default['de_cart_keep_term'];
|
||||
if(!$keep_term)
|
||||
$keep_term = 15; // 기본값 15일
|
||||
|
||||
if(defined('G5_CART_STOCK_LIMIT'))
|
||||
$cart_stock_limit = G5_CART_STOCK_LIMIT;
|
||||
else
|
||||
$cart_stock_limit = 3;
|
||||
|
||||
// 기준 시간을 초과한 경우 체크
|
||||
if($cart_stock_limit > 0) {
|
||||
if($cart_stock_limit > $keep_term * 24)
|
||||
$cart_stock_limit = $keep_term * 24;
|
||||
|
||||
$stocktime = G5_SERVER_TIME - (3600 * $cart_stock_limit);
|
||||
|
||||
$sql = " select count(*) as cnt
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and ct_status = '쇼핑'
|
||||
and ct_select = '1'
|
||||
and UNIX_TIMESTAMP(ct_select_time) > '$stocktime' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if(!$row['cnt'])
|
||||
die("주문 요청 때까지 ".$cart_stock_limit."시간 이상 경과되어 주문 상품이 초기화 됐습니다.\n\n 장바구니에서 주문하실 상품을 다시 확인해 주십시오.");
|
||||
}
|
||||
|
||||
if (function_exists('before_check_cart_price')) {
|
||||
if(! before_check_cart_price($tmp_cart_id) ) die("장바구니 금액에 변동사항이 있습니다.\n장바구니를 다시 확인해 주세요.");
|
||||
}
|
||||
|
||||
// 재고체크
|
||||
$sql = " select *, sum(ct_qty) as sum_ct_qty
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and ct_select = '1'
|
||||
and ct_status = '쇼핑' GROUP BY od_id, it_id, it_name, ct_option, io_id, io_type ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$ct_qty = $row['sum_ct_qty'];
|
||||
|
||||
// 해당 상품이 품절 또는 판매중지 상태인지 체크합니다.
|
||||
$sql = " select it_soldout, it_use, ca_id, ca_id2, ca_id3 from {$g5['g5_shop_item_table']} where it_id = '".$row['it_id']."' ";
|
||||
$item = sql_fetch($sql);
|
||||
|
||||
$category_str = '';
|
||||
|
||||
// 분류에서 판매가능한지 체크합니다.
|
||||
if( $item['it_use'] && ($item['ca_id'] || $item['ca_id2'] || $item['ca_id3']) ){
|
||||
$sql = " select ca_use from {$g5['g5_shop_category_table']} where (ca_id = '".$item['ca_id']."' or ca_id = '".$item['ca_id2']."' or ca_id = '".$item['ca_id3']."') ";
|
||||
$result2 = sql_query($sql);
|
||||
|
||||
while($ca=sql_fetch_array($result2)){
|
||||
if ( ! $ca['ca_use']) {
|
||||
$item['it_use'] = false;
|
||||
$category_str = '분류에서 ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 해당 상품이 품절 상태 또는 판매중지이면
|
||||
if( $item['it_soldout'] || !$item['it_use'] ){
|
||||
|
||||
$soldout_txt = $item['it_soldout'] ? '품절' : $category_str.'판매중지';
|
||||
$item_option = $row['it_name'];
|
||||
if($row['io_id'])
|
||||
$item_option .= '('.$row['ct_option'].')';
|
||||
|
||||
die( $item_option." 상품이 ".$soldout_txt." 되었습니다.\n\n장바구니에서 해당 상품을 삭제후 다시 주문해 주세요." );
|
||||
}
|
||||
|
||||
if(!$row['io_id'])
|
||||
$it_stock_qty = get_it_stock_qty($row['it_id']);
|
||||
else
|
||||
$it_stock_qty = get_option_stock_qty($row['it_id'], $row['io_id'], $row['io_type']);
|
||||
|
||||
if ($ct_qty > $it_stock_qty)
|
||||
{
|
||||
$item_option = $row['it_name'];
|
||||
if($row['io_id'])
|
||||
$item_option .= '('.$row['ct_option'].')';
|
||||
|
||||
die($item_option." 의 재고수량이 부족합니다.\n\n현재 재고수량 : " . number_format($it_stock_qty) . " 개");
|
||||
}
|
||||
}
|
||||
|
||||
die("");
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
include_once("./_common.php");
|
||||
|
||||
$bn_id = isset($_GET['bn_id']) ? (int) $_GET['bn_id'] : 0;
|
||||
|
||||
$sql = " select bn_id, bn_url from {$g5['g5_shop_banner_table']} where bn_id = '$bn_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if( ! $row['bn_id'] ){
|
||||
alert('해당 배너가 존재하지 않습니다.', G5_SHOP_URL);
|
||||
}
|
||||
|
||||
if ($_COOKIE['ck_bn_id'] != $bn_id)
|
||||
{
|
||||
$sql = " update {$g5['g5_shop_banner_table']} set bn_hit = bn_hit + 1 where bn_id = '$bn_id' ";
|
||||
sql_query($sql);
|
||||
// 하루 동안
|
||||
set_cookie("ck_bn_id", $bn_id, 60*60*24);
|
||||
}
|
||||
|
||||
$url = clean_xss_tags($row['bn_url']);
|
||||
|
||||
goto_url($url);
|
||||
@@ -0,0 +1,316 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
$naverpay_button_js = '';
|
||||
include_once(G5_SHOP_PATH.'/settle_naverpay.inc.php');
|
||||
|
||||
// 보관기간이 지난 상품 삭제
|
||||
cart_item_clean();
|
||||
|
||||
$sw_direct = isset($_REQUEST['sw_direct']) ? (int) $_REQUEST['sw_direct'] : 0;
|
||||
|
||||
// cart id 설정
|
||||
set_cart_id($sw_direct);
|
||||
|
||||
$s_cart_id = get_session('ss_cart_id');
|
||||
// 선택필드 초기화
|
||||
$sql = " update {$g5['g5_shop_cart_table']} set ct_select = '0' where od_id = '$s_cart_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
$cart_action_url = G5_SHOP_URL.'/cartupdate.php';
|
||||
|
||||
if(function_exists('before_check_cart_price')) {
|
||||
before_check_cart_price($s_cart_id, true, true, true);
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/cart.php');
|
||||
return;
|
||||
}
|
||||
|
||||
// 테마에 cart.php 있으면 include
|
||||
if(defined('G5_THEME_SHOP_PATH')) {
|
||||
$theme_cart_file = G5_THEME_SHOP_PATH.'/cart.php';
|
||||
if(is_file($theme_cart_file)) {
|
||||
include_once($theme_cart_file);
|
||||
return;
|
||||
unset($theme_cart_file);
|
||||
}
|
||||
}
|
||||
|
||||
$g5['title'] = '장바구니';
|
||||
include_once('./_head.php');
|
||||
?>
|
||||
|
||||
<!-- 장바구니 시작 { -->
|
||||
<script src="<?php echo G5_JS_URL; ?>/shop.js?ver=<?php echo G5_JS_VER; ?>"></script>
|
||||
<script src="<?php echo G5_JS_URL; ?>/shop.override.js?ver=<?php echo G5_JS_VER; ?>"></script>
|
||||
|
||||
<div id="sod_bsk" class="od_prd_list">
|
||||
|
||||
<form name="frmcartlist" id="sod_bsk_list" class="2017_renewal_itemform" method="post" action="<?php echo $cart_action_url; ?>">
|
||||
<div class="tbl_head03 tbl_wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="chk_box">
|
||||
<input type="checkbox" name="ct_all" value="1" id="ct_all" checked="checked" class="selec_chk">
|
||||
<label for="ct_all"><span></span><b class="sound_only">상품 전체</b></label>
|
||||
</th>
|
||||
<th scope="col">상품명</th>
|
||||
<th scope="col">총수량</th>
|
||||
<th scope="col">판매가</th>
|
||||
<th scope="col">포인트</th>
|
||||
<th scope="col">배송비</th>
|
||||
<th scope="col">소계</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$tot_point = 0;
|
||||
$tot_sell_price = 0;
|
||||
$send_cost = 0;
|
||||
|
||||
// $s_cart_id 로 현재 장바구니 자료 쿼리
|
||||
$sql = " select a.ct_id,
|
||||
a.it_id,
|
||||
a.it_name,
|
||||
a.ct_price,
|
||||
a.ct_point,
|
||||
a.ct_qty,
|
||||
a.ct_status,
|
||||
a.ct_send_cost,
|
||||
a.it_sc_type,
|
||||
b.ca_id,
|
||||
b.ca_id2,
|
||||
b.ca_id3
|
||||
from {$g5['g5_shop_cart_table']} a left join {$g5['g5_shop_item_table']} b on ( a.it_id = b.it_id )
|
||||
where a.od_id = '$s_cart_id' ";
|
||||
$sql .= " group by a.it_id ";
|
||||
$sql .= " order by a.ct_id ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$it_send_cost = 0;
|
||||
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
// 합계금액 계산
|
||||
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
|
||||
SUM(ct_point * ct_qty) as point,
|
||||
SUM(ct_qty) as qty
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where it_id = '{$row['it_id']}'
|
||||
and od_id = '$s_cart_id' ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
if ($i==0) { // 계속쇼핑
|
||||
$continue_ca_id = $row['ca_id'];
|
||||
}
|
||||
|
||||
$a1 = '<a href="'.shop_item_url($row['it_id']).'" class="prd_name"><b>';
|
||||
$a2 = '</b></a>';
|
||||
$image = get_it_image($row['it_id'], 80, 80);
|
||||
|
||||
$it_name = $a1 . stripslashes($row['it_name']) . $a2;
|
||||
$it_options = print_item_options($row['it_id'], $s_cart_id);
|
||||
if($it_options) {
|
||||
$mod_options = '<div class="sod_option_btn"><button type="button" class="mod_options">선택사항수정</button></div>';
|
||||
$it_name .= '<div class="sod_opt">'.$it_options.'</div>';
|
||||
}
|
||||
|
||||
// 배송비
|
||||
switch($row['ct_send_cost'])
|
||||
{
|
||||
case 1:
|
||||
$ct_send_cost = '착불';
|
||||
break;
|
||||
case 2:
|
||||
$ct_send_cost = '무료';
|
||||
break;
|
||||
default:
|
||||
$ct_send_cost = '선불';
|
||||
break;
|
||||
}
|
||||
|
||||
// 조건부무료
|
||||
if($row['it_sc_type'] == 2) {
|
||||
$sendcost = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $s_cart_id);
|
||||
|
||||
if($sendcost == 0)
|
||||
$ct_send_cost = '무료';
|
||||
}
|
||||
|
||||
$point = $sum['point'];
|
||||
$sell_price = $sum['price'];
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td class="td_chk chk_box">
|
||||
<input type="checkbox" name="ct_chk[<?php echo $i; ?>]" value="1" id="ct_chk_<?php echo $i; ?>" checked="checked" class="selec_chk">
|
||||
<label for="ct_chk_<?php echo $i; ?>"><span></span><b class="sound_only">상품</b></label>
|
||||
</td>
|
||||
|
||||
<td class="td_prd">
|
||||
<div class="sod_img"><a href="<?php echo shop_item_url($row['it_id']); ?>"><?php echo $image; ?></a></div>
|
||||
<div class="sod_name">
|
||||
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
|
||||
<input type="hidden" name="it_name[<?php echo $i; ?>]" value="<?php echo get_text($row['it_name']); ?>">
|
||||
<?php echo $it_name.$mod_options; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="td_num"><?php echo number_format($sum['qty']); ?></td>
|
||||
<td class="td_numbig"><?php echo number_format($row['ct_price']); ?></td>
|
||||
<td class="td_numbig"><?php echo number_format($point); ?></td>
|
||||
<td class="td_dvr"><?php echo $ct_send_cost; ?></td>
|
||||
<td class="td_numbig text_right"><span id="sell_price_<?php echo $i; ?>" class="total_prc"><?php echo number_format($sell_price); ?></span></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$tot_point += $point;
|
||||
$tot_sell_price += $sell_price;
|
||||
} // for 끝
|
||||
|
||||
if ($i == 0) {
|
||||
echo '<tr><td colspan="7" class="empty_table">장바구니에 담긴 상품이 없습니다.</td></tr>';
|
||||
} else {
|
||||
// 배송비 계산
|
||||
$send_cost = get_sendcost($s_cart_id, 0);
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="btn_cart_del">
|
||||
<button type="button" onclick="return form_check('seldelete');">선택삭제</button>
|
||||
<button type="button" onclick="return form_check('alldelete');">비우기</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$tot_price = $tot_sell_price + $send_cost; // 총계 = 주문상품금액합계 + 배송비
|
||||
if ($tot_price > 0 || $send_cost > 0) {
|
||||
?>
|
||||
<div id="sod_bsk_tot">
|
||||
<ul>
|
||||
<li class="sod_bsk_dvr">
|
||||
<span>배송비</span>
|
||||
<strong><?php echo number_format($send_cost); ?></strong> 원
|
||||
</li>
|
||||
|
||||
<li class="sod_bsk_pt">
|
||||
<span>포인트</span>
|
||||
<strong><?php echo number_format($tot_point); ?></strong> 점
|
||||
</li>
|
||||
|
||||
<li class="sod_bsk_cnt">
|
||||
<span>총계 가격</span>
|
||||
<strong><?php echo number_format($tot_price); ?></strong> 원
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div id="sod_bsk_act">
|
||||
<?php if ($i == 0) { ?>
|
||||
<a href="<?php echo G5_SHOP_URL; ?>/" class="btn01">쇼핑 계속하기</a>
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="url" value="./orderform.php">
|
||||
<input type="hidden" name="records" value="<?php echo $i; ?>">
|
||||
<input type="hidden" name="act" value="">
|
||||
<a href="<?php echo shop_category_url($continue_ca_id); ?>" class="btn01">쇼핑 계속하기</a>
|
||||
<button type="button" onclick="return form_check('buy');" class="btn_submit">주문하기</button>
|
||||
|
||||
<?php if ($naverpay_button_js) { ?>
|
||||
<div class="cart-naverpay"><?php echo $naverpay_request_js.$naverpay_button_js; ?></div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
var close_btn_idx;
|
||||
|
||||
// 선택사항수정
|
||||
$(".mod_options").click(function() {
|
||||
var it_id = $(this).closest("tr").find("input[name^=it_id]").val();
|
||||
var $this = $(this);
|
||||
close_btn_idx = $(".mod_options").index($(this));
|
||||
|
||||
$.post(
|
||||
"./cartoption.php",
|
||||
{ it_id: it_id },
|
||||
function(data) {
|
||||
$("#mod_option_frm").remove();
|
||||
$this.after("<div id=\"mod_option_frm\"></div><div class=\"mod_option_bg\"></div>");
|
||||
$("#mod_option_frm").html(data);
|
||||
price_calculate();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// 모두선택
|
||||
$("input[name=ct_all]").click(function() {
|
||||
if($(this).is(":checked"))
|
||||
$("input[name^=ct_chk]").attr("checked", true);
|
||||
else
|
||||
$("input[name^=ct_chk]").attr("checked", false);
|
||||
});
|
||||
|
||||
// 옵션수정 닫기
|
||||
$(document).on("click", "#mod_option_close", function() {
|
||||
$("#mod_option_frm, .mod_option_bg").remove();
|
||||
$(".mod_options").eq(close_btn_idx).focus();
|
||||
});
|
||||
$("#win_mask").click(function () {
|
||||
$("#mod_option_frm").remove();
|
||||
$(".mod_options").eq(close_btn_idx).focus();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function fsubmit_check(f) {
|
||||
if($("input[name^=ct_chk]:checked").length < 1) {
|
||||
alert("구매하실 상품을 하나이상 선택해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function form_check(act) {
|
||||
var f = document.frmcartlist;
|
||||
var cnt = f.records.value;
|
||||
|
||||
if (act == "buy")
|
||||
{
|
||||
if($("input[name^=ct_chk]:checked").length < 1) {
|
||||
alert("주문하실 상품을 하나이상 선택해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
f.act.value = act;
|
||||
f.submit();
|
||||
}
|
||||
else if (act == "alldelete")
|
||||
{
|
||||
f.act.value = act;
|
||||
f.submit();
|
||||
}
|
||||
else if (act == "seldelete")
|
||||
{
|
||||
if($("input[name^=ct_chk]:checked").length < 1) {
|
||||
alert("삭제하실 상품을 하나이상 선택해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
f.act.value = act;
|
||||
f.submit();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
<!-- } 장바구니 끝 -->
|
||||
|
||||
<?php
|
||||
include_once('./_tail.php');
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$pattern = '#[/\'\"%=*\#\(\)\|\+\&\!\$~\{\}\[\]`;:\?\^\,]#';
|
||||
$it_id = isset($_POST['it_id']) ? preg_replace($pattern, '', $_POST['it_id']) : '';
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_item_table']} where it_id = '$it_id' and it_use = '1' ";
|
||||
$it = sql_fetch($sql);
|
||||
$it_point = get_item_point($it);
|
||||
|
||||
if(!$it['it_id'])
|
||||
die('no-item');
|
||||
|
||||
// 장바구니 자료
|
||||
$cart_id = get_session('ss_cart_id');
|
||||
$sql = " select * from {$g5['g5_shop_cart_table']} where od_id = '$cart_id' and it_id = '$it_id' order by io_type asc, ct_id asc ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
// 판매가격
|
||||
$sql2 = " select ct_price, it_name, ct_send_cost from {$g5['g5_shop_cart_table']} where od_id = '$cart_id' and it_id = '$it_id' order by ct_id asc limit 1 ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
|
||||
if(!sql_num_rows($result))
|
||||
die('no-cart');
|
||||
?>
|
||||
|
||||
<h2>상품옵션수정</h2>
|
||||
<!-- 장바구니 옵션 시작 { -->
|
||||
<form name="foption" method="post" action="<?php echo G5_SHOP_URL; ?>/cartupdate.php" onsubmit="return formcheck(this);">
|
||||
<input type="hidden" name="act" value="optionmod">
|
||||
<input type="hidden" name="it_id[]" value="<?php echo $it['it_id']; ?>">
|
||||
<input type="hidden" id="it_price" value="<?php echo $row2['ct_price']; ?>">
|
||||
<input type="hidden" name="ct_send_cost" value="<?php echo $row2['ct_send_cost']; ?>">
|
||||
<input type="hidden" name="sw_direct">
|
||||
<?php
|
||||
if(defined('G5_THEME_USE_OPTIONS_TRTD') && G5_THEME_USE_OPTIONS_TRTD){
|
||||
$option_1 = get_item_options($it['it_id'], $it['it_option_subject'], '');
|
||||
} else {
|
||||
// 선택 옵션 ( 기존의 tr td 태그로 가져오려면 'div' 를 '' 로 바꾸거나 또는 지워주세요 )
|
||||
$option_1 = get_item_options($it['it_id'], $it['it_option_subject'], 'div');
|
||||
}
|
||||
if($option_1) {
|
||||
?>
|
||||
<section class="option_wr">
|
||||
<h3>선택옵션</h3>
|
||||
|
||||
<?php // 선택옵션
|
||||
echo $option_1;
|
||||
?>
|
||||
|
||||
</section>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(defined('G5_THEME_USE_OPTIONS_TRTD') && G5_THEME_USE_OPTIONS_TRTD){
|
||||
$option_2 = get_item_supply($it['it_id'], $it['it_supply_subject'], '');
|
||||
} else {
|
||||
// 추가 옵션 ( 기존의 tr td 태그로 가져오려면 'div' 를 '' 로 바꾸거나 또는 지워주세요 )
|
||||
$option_2 = get_item_supply($it['it_id'], $it['it_supply_subject'], 'div');
|
||||
}
|
||||
if($option_2) {
|
||||
?>
|
||||
<section class="option_wr">
|
||||
<h3>추가옵션</h3>
|
||||
|
||||
<?php // 추가옵션
|
||||
echo $option_2;
|
||||
?>
|
||||
|
||||
</section>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="sit_sel_option">
|
||||
<h3>선택옵션</h3>
|
||||
<ul id="sit_opt_added">
|
||||
<?php
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
if(!$row['io_id'])
|
||||
$it_stock_qty = get_it_stock_qty($row['it_id']);
|
||||
else
|
||||
$it_stock_qty = get_option_stock_qty($row['it_id'], $row['io_id'], $row['io_type']);
|
||||
|
||||
if($row['io_price'] < 0)
|
||||
$io_price = '('.number_format($row['io_price']).'원)';
|
||||
else
|
||||
$io_price = '(+'.number_format($row['io_price']).'원)';
|
||||
|
||||
$cls = 'opt';
|
||||
if($row['io_type'])
|
||||
$cls = 'spl';
|
||||
?>
|
||||
<li class="sit_<?php echo $cls; ?>_list">
|
||||
<input type="hidden" name="io_type[<?php echo $it['it_id']; ?>][]" value="<?php echo $row['io_type']; ?>">
|
||||
<input type="hidden" name="io_id[<?php echo $it['it_id']; ?>][]" value="<?php echo $row['io_id']; ?>">
|
||||
<input type="hidden" name="io_value[<?php echo $it['it_id']; ?>][]" value="<?php echo $row['ct_option']; ?>">
|
||||
<input type="hidden" class="io_price" value="<?php echo $row['io_price']; ?>">
|
||||
<input type="hidden" class="io_stock" value="<?php echo $it_stock_qty; ?>">
|
||||
<div class="opt_name">
|
||||
<span class="sit_opt_subj"><?php echo $row['ct_option']; ?></span>
|
||||
</div>
|
||||
<div class="opt_count">
|
||||
<button type="button" class="sit_qty_minus btn_frmline"><i class="fa fa-minus" aria-hidden="true"></i><span class="sound_only">감소</span></button>
|
||||
<label for="ct_qty_<?php echo $i; ?>" class="sound_only">수량</label>
|
||||
<input type="text" name="ct_qty[<?php echo $it['it_id']; ?>][]" value="<?php echo $row['ct_qty']; ?>" id="ct_qty_<?php echo $i; ?>" class="num_input" size="5">
|
||||
<button type="button" class="sit_qty_plus btn_frmline"><i class="fa fa-plus" aria-hidden="true"></i><span class="sound_only">증가</span></button>
|
||||
<span class="sit_opt_prc"><?php echo $io_price; ?></span>
|
||||
<button type="button" class="sit_opt_del"><i class="fa fa-times" aria-hidden="true"></i><span class="sound_only">삭제</span></button>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="sit_tot_price"></div>
|
||||
|
||||
<div class="btn_confirm">
|
||||
<button type="submit" class="btn_submit">확인</button>
|
||||
<button type="button" id="mod_option_close" class="btn_close"><i class="fa fa-times" aria-hidden="true"></i><span class="sound_only">닫기</span></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function formcheck(f)
|
||||
{
|
||||
var val, io_type, result = true;
|
||||
var sum_qty = 0;
|
||||
var min_qty = parseInt(<?php echo $it['it_buy_min_qty']; ?>);
|
||||
var max_qty = parseInt(<?php echo $it['it_buy_max_qty']; ?>);
|
||||
var $el_type = $("input[name^=io_type]");
|
||||
|
||||
$("input[name^=ct_qty]").each(function(index) {
|
||||
val = $(this).val();
|
||||
|
||||
if(val.length < 1) {
|
||||
alert("수량을 입력해 주십시오.");
|
||||
result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(val.replace(/[0-9]/g, "").length > 0) {
|
||||
alert("수량은 숫자로 입력해 주십시오.");
|
||||
result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(parseInt(val.replace(/[^0-9]/g, "")) < 1) {
|
||||
alert("수량은 1이상 입력해 주십시오.");
|
||||
result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
io_type = $el_type.eq(index).val();
|
||||
if(io_type == "0")
|
||||
sum_qty += parseInt(val);
|
||||
});
|
||||
|
||||
if(!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(min_qty > 0 && sum_qty < min_qty) {
|
||||
alert("선택옵션 개수 총합 "+number_format(String(min_qty))+"개 이상 주문해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(max_qty > 0 && sum_qty > max_qty) {
|
||||
alert("선택옵션 개수 총합 "+number_format(String(max_qty))+"개 이하로 주문해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
<!-- } 장바구니 옵션 끝 -->
|
||||
@@ -0,0 +1,410 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// print_r2($_POST); exit;
|
||||
|
||||
// 보관기간이 지난 상품 삭제
|
||||
cart_item_clean();
|
||||
|
||||
$sw_direct = (isset($_REQUEST['sw_direct']) && $_REQUEST['sw_direct']) ? 1 : 0;
|
||||
|
||||
// cart id 설정
|
||||
set_cart_id($sw_direct);
|
||||
|
||||
if($sw_direct)
|
||||
$tmp_cart_id = get_session('ss_cart_direct');
|
||||
else
|
||||
$tmp_cart_id = get_session('ss_cart_id');
|
||||
|
||||
// 브라우저에서 쿠키를 허용하지 않은 경우라고 볼 수 있음.
|
||||
if (!$tmp_cart_id)
|
||||
{
|
||||
alert('더 이상 작업을 진행할 수 없습니다.\\n\\n브라우저의 쿠키 허용을 사용하지 않음으로 설정한것 같습니다.\\n\\n브라우저의 인터넷 옵션에서 쿠키 허용을 사용으로 설정해 주십시오.\\n\\n그래도 진행이 되지 않는다면 쇼핑몰 운영자에게 문의 바랍니다.');
|
||||
}
|
||||
|
||||
$tmp_cart_id = preg_replace('/[^a-z0-9_\-]/i', '', $tmp_cart_id);
|
||||
$act = isset($_POST['act']) ? clean_xss_tags($_POST['act'], 1, 1) : '';
|
||||
$post_ct_chk = (isset($_POST['ct_chk']) && is_array($_POST['ct_chk'])) ? $_POST['ct_chk'] : array();
|
||||
$post_it_ids = (isset($_POST['it_id']) && is_array($_POST['it_id'])) ? $_POST['it_id'] : array();
|
||||
|
||||
// 레벨(권한)이 상품구입 권한보다 작다면 상품을 구입할 수 없음.
|
||||
if ($member['mb_level'] < $default['de_level_sell'])
|
||||
{
|
||||
alert('상품을 구입할 수 있는 권한이 없습니다.');
|
||||
}
|
||||
|
||||
if($act == "buy")
|
||||
{
|
||||
if(!count($post_ct_chk))
|
||||
alert("주문하실 상품을 하나이상 선택해 주십시오.");
|
||||
|
||||
// 선택필드 초기화
|
||||
$sql = " update {$g5['g5_shop_cart_table']} set ct_select = '0' where od_id = '$tmp_cart_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
$fldcnt = count($post_it_ids);
|
||||
for($i=0; $i<$fldcnt; $i++) {
|
||||
$ct_chk = isset($post_ct_chk[$i]) ? 1 : 0;
|
||||
if($ct_chk) {
|
||||
$it_id = isset($post_it_ids[$i]) ? safe_replace_regex($post_it_ids[$i], 'it_id') : '';
|
||||
|
||||
if( !$it_id ) continue;
|
||||
|
||||
// 본인인증, 성인인증체크
|
||||
if(!$is_admin) {
|
||||
$msg = shop_member_cert_check($it_id, 'item');
|
||||
if($msg)
|
||||
alert($msg, G5_SHOP_URL);
|
||||
}
|
||||
|
||||
// 주문 상품의 재고체크
|
||||
// 동일 상품 옵션이 레코드에 있는 경우 재고를 제대로 체크하지 못하는 오류가 있음
|
||||
// $sql = " select ct_qty, it_name, ct_option, io_id, io_type from {$g5['g5_shop_cart_table']} where od_id = '$tmp_cart_id' and it_id = '$it_id' ";
|
||||
|
||||
$sql = " select sum(ct_qty) as ct_qty, it_name, ct_option, io_id, io_type
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and it_id = '$it_id' GROUP BY od_id, it_id, it_name, ct_option, io_id, io_type ";
|
||||
|
||||
$result = sql_query($sql);
|
||||
|
||||
for($k=0; $row=sql_fetch_array($result); $k++) {
|
||||
$sql = " select SUM(ct_qty) as cnt from {$g5['g5_shop_cart_table']}
|
||||
where od_id <> '$tmp_cart_id'
|
||||
and it_id = '$it_id'
|
||||
and io_id = '{$row['io_id']}'
|
||||
and io_type = '{$row['io_type']}'
|
||||
and ct_stock_use = 0
|
||||
and ct_status = '쇼핑'
|
||||
and ct_select = '1' ";
|
||||
|
||||
$sum = sql_fetch($sql);
|
||||
// $sum['cnt'] 가 null 일때 재고 반영이 제대로 안되는 오류 수정 (그누위즈님,210614)
|
||||
// $sum_qty = $sum['cnt'];
|
||||
$sum_qty = isset($sum['cnt']) ? (int) $sum['cnt'] : 0;
|
||||
|
||||
// 재고 구함
|
||||
$ct_qty = $row['ct_qty'];
|
||||
if(!$row['io_id'])
|
||||
$it_stock_qty = get_it_stock_qty($it_id);
|
||||
else
|
||||
$it_stock_qty = get_option_stock_qty($it_id, $row['io_id'], $row['io_type']);
|
||||
|
||||
if ($ct_qty + $sum_qty > $it_stock_qty)
|
||||
{
|
||||
$item_option = $row['it_name'];
|
||||
if($row['io_id'])
|
||||
$item_option .= '('.$row['ct_option'].')';
|
||||
|
||||
alert($item_option." 의 재고수량이 부족합니다.\\n\\n현재 재고수량 : " . number_format($it_stock_qty - $sum_qty) . " 개");
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " update {$g5['g5_shop_cart_table']}
|
||||
set ct_select = '1',
|
||||
ct_select_time = '".G5_TIME_YMDHIS."'
|
||||
where od_id = '$tmp_cart_id'
|
||||
and it_id = '$it_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_member) // 회원인 경우
|
||||
goto_url(G5_SHOP_URL.'/orderform.php');
|
||||
else
|
||||
goto_url(G5_BBS_URL.'/login.php?url='.urlencode(G5_SHOP_URL.'/orderform.php'));
|
||||
}
|
||||
else if ($act == "alldelete") // 모두 삭제이면
|
||||
{
|
||||
$sql = " delete from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
else if ($act == "seldelete") // 선택삭제
|
||||
{
|
||||
if(!count($post_ct_chk))
|
||||
alert("삭제하실 상품을 하나이상 선택해 주십시오.");
|
||||
|
||||
$fldcnt = count($post_it_ids);
|
||||
for($i=0; $i<$fldcnt; $i++) {
|
||||
$ct_chk = isset($post_ct_chk[$i]) ? 1 : 0;
|
||||
if($ct_chk) {
|
||||
$it_id = isset($post_it_ids[$i]) ? safe_replace_regex($post_it_ids[$i], 'it_id') : '';
|
||||
if( $it_id ){
|
||||
$sql = " delete from {$g5['g5_shop_cart_table']} where it_id = '$it_id' and od_id = '$tmp_cart_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // 장바구니에 담기
|
||||
{
|
||||
$count = count($post_it_ids);
|
||||
if ($count < 1)
|
||||
alert('장바구니에 담을 상품을 선택하여 주십시오.');
|
||||
|
||||
$ct_count = 0;
|
||||
$post_chk_it_id = (isset($_POST['chk_it_id']) && is_array($_POST['chk_it_id'])) ? $_POST['chk_it_id'] : array();
|
||||
$post_io_ids = (isset($_POST['io_id']) && is_array($_POST['io_id'])) ? $_POST['io_id'] : array();
|
||||
$post_io_types = (isset($_POST['io_type']) && is_array($_POST['io_type'])) ? $_POST['io_type'] : array();
|
||||
$post_ct_qtys = (isset($_POST['ct_qty']) && is_array($_POST['ct_qty'])) ? $_POST['ct_qty'] : array();
|
||||
|
||||
if ($count && $sw_direct) {
|
||||
// 바로구매에 있던 장바구니 자료를 지운다.
|
||||
sql_query(" delete from {$g5['g5_shop_cart_table']} where od_id = '$tmp_cart_id' and ct_direct = 1 ", false);
|
||||
}
|
||||
|
||||
for($i=0; $i<$count; $i++) {
|
||||
// 보관함의 상품을 담을 때 체크되지 않은 상품 건너뜀
|
||||
if($act == 'multi' && ! (isset($post_chk_it_id[$i]) && $post_chk_it_id[$i]))
|
||||
continue;
|
||||
|
||||
$it_id = isset($post_it_ids[$i]) ? safe_replace_regex($post_it_ids[$i], 'it_id') : '';
|
||||
|
||||
if( !$it_id ) continue;
|
||||
|
||||
$opt_count = (isset($post_io_ids[$it_id]) && is_array($post_io_ids[$it_id])) ? count($post_io_ids[$it_id]) : 0;
|
||||
|
||||
if($opt_count && isset($post_io_types[$it_id][0]) && $post_io_types[$it_id][0] != 0)
|
||||
alert('상품의 선택옵션을 선택해 주십시오.');
|
||||
|
||||
for($k=0; $k<$opt_count; $k++) {
|
||||
if (isset($post_ct_qtys[$it_id][$k]) && $post_ct_qtys[$it_id][$k] < 1)
|
||||
alert('수량은 1 이상 입력해 주십시오.');
|
||||
}
|
||||
|
||||
// 본인인증, 성인인증체크
|
||||
if(!$is_admin) {
|
||||
$msg = shop_member_cert_check($it_id, 'item');
|
||||
if($msg)
|
||||
alert($msg, G5_SHOP_URL);
|
||||
}
|
||||
|
||||
// 상품정보
|
||||
$it = get_shop_item($it_id, false);
|
||||
if(!$it['it_id'])
|
||||
alert('상품정보가 존재하지 않습니다.');
|
||||
|
||||
|
||||
// 최소, 최대 수량 체크
|
||||
if($it['it_buy_min_qty'] || $it['it_buy_max_qty']) {
|
||||
$sum_qty = 0;
|
||||
for($k=0; $k<$opt_count; $k++) {
|
||||
if($_POST['io_type'][$it_id][$k] == 0)
|
||||
$sum_qty += (int) $_POST['ct_qty'][$it_id][$k];
|
||||
}
|
||||
|
||||
if($it['it_buy_min_qty'] > 0 && $sum_qty < $it['it_buy_min_qty'])
|
||||
alert($it['it_name'].'의 선택옵션 개수 총합 '.number_format($it['it_buy_min_qty']).'개 이상 주문해 주십시오.');
|
||||
|
||||
if($it['it_buy_max_qty'] > 0 && $sum_qty > $it['it_buy_max_qty'])
|
||||
alert($it['it_name'].'의 선택옵션 개수 총합 '.number_format($it['it_buy_max_qty']).'개 이하로 주문해 주십시오.');
|
||||
|
||||
// 기존에 장바구니에 담긴 상품이 있는 경우에 최대 구매수량 체크
|
||||
if($it['it_buy_max_qty'] > 0) {
|
||||
$sql4 = " select sum(ct_qty) as ct_sum
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and it_id = '$it_id'
|
||||
and io_type = '0'
|
||||
and ct_status = '쇼핑' ";
|
||||
$row4 = sql_fetch($sql4);
|
||||
|
||||
$option_sum_qty = ( $act === 'optionmod' ) ? $sum_qty : $sum_qty + $row4['ct_sum'];
|
||||
|
||||
if(($option_sum_qty) > $it['it_buy_max_qty'])
|
||||
alert($it['it_name'].'의 선택옵션 개수 총합 '.number_format($it['it_buy_max_qty']).'개 이하로 주문해 주십시오.', './cart.php');
|
||||
}
|
||||
}
|
||||
|
||||
// 옵션정보를 얻어서 배열에 저장
|
||||
$opt_list = array();
|
||||
$sql = " select * from {$g5['g5_shop_item_option_table']} where it_id = '$it_id' and io_use = 1 order by io_no asc ";
|
||||
$result = sql_query($sql);
|
||||
$lst_count = 0;
|
||||
for($k=0; $row=sql_fetch_array($result); $k++) {
|
||||
$opt_list[$row['io_type']][$row['io_id']]['id'] = $row['io_id'];
|
||||
$opt_list[$row['io_type']][$row['io_id']]['use'] = $row['io_use'];
|
||||
$opt_list[$row['io_type']][$row['io_id']]['price'] = $row['io_price'];
|
||||
$opt_list[$row['io_type']][$row['io_id']]['stock'] = $row['io_stock_qty'];
|
||||
|
||||
// 선택옵션 개수
|
||||
if(!$row['io_type'])
|
||||
$lst_count++;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
// 재고 검사, 바로구매일 때만 체크
|
||||
//--------------------------------------------------------
|
||||
// 이미 주문폼에 있는 같은 상품의 수량합계를 구한다.
|
||||
if($sw_direct) {
|
||||
for($k=0; $k<$opt_count; $k++) {
|
||||
$io_id = isset($_POST['io_id'][$it_id][$k]) ? preg_replace(G5_OPTION_ID_FILTER, '', $_POST['io_id'][$it_id][$k]) : '';
|
||||
$io_type = isset($_POST['io_type'][$it_id][$k]) ? preg_replace('#[^01]#', '', $_POST['io_type'][$it_id][$k]) : '';
|
||||
$io_value = isset($_POST['io_value'][$it_id][$k]) ? $_POST['io_value'][$it_id][$k] : '';
|
||||
|
||||
$sql = " select SUM(ct_qty) as cnt from {$g5['g5_shop_cart_table']}
|
||||
where od_id <> '$tmp_cart_id'
|
||||
and it_id = '$it_id'
|
||||
and io_id = '$io_id'
|
||||
and io_type = '$io_type'
|
||||
and ct_stock_use = 0
|
||||
and ct_status = '쇼핑'
|
||||
and ct_select = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
$sum_qty = $row['cnt'];
|
||||
|
||||
// 재고 구함
|
||||
$ct_qty = isset($_POST['ct_qty'][$it_id][$k]) ? (int) $_POST['ct_qty'][$it_id][$k] : 0;
|
||||
if(!$io_id)
|
||||
$it_stock_qty = get_it_stock_qty($it_id);
|
||||
else
|
||||
$it_stock_qty = get_option_stock_qty($it_id, $io_id, $io_type);
|
||||
|
||||
if ($ct_qty + $sum_qty > $it_stock_qty)
|
||||
{
|
||||
alert($io_value." 의 재고수량이 부족합니다.\\n\\n현재 재고수량 : " . number_format($it_stock_qty - $sum_qty) . " 개");
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------
|
||||
|
||||
// 옵션수정일 때 기존 장바구니 자료를 먼저 삭제
|
||||
if($act == 'optionmod')
|
||||
sql_query(" delete from {$g5['g5_shop_cart_table']} where od_id = '$tmp_cart_id' and it_id = '$it_id' ");
|
||||
|
||||
// 장바구니에 Insert
|
||||
// 바로구매일 경우 장바구니가 체크된것으로 강제 설정
|
||||
if($sw_direct) {
|
||||
$ct_select = 1;
|
||||
$ct_select_time = G5_TIME_YMDHIS;
|
||||
} else {
|
||||
$ct_select = 0;
|
||||
$ct_select_time = '0000-00-00 00:00:00';
|
||||
}
|
||||
|
||||
// 장바구니에 Insert
|
||||
$comma = '';
|
||||
|
||||
/* 코어수정 리빌더 20241014 { */
|
||||
if(isset($it['it_partner']) && $it['it_partner']) {
|
||||
$sql = " INSERT INTO {$g5['g5_shop_cart_table']}
|
||||
( od_id, mb_id, it_id, it_name, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_notax, io_id, io_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select, ct_select_time, ct_partner )
|
||||
VALUES ";
|
||||
} else {
|
||||
$sql = " INSERT INTO {$g5['g5_shop_cart_table']}
|
||||
( od_id, mb_id, it_id, it_name, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_notax, io_id, io_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select, ct_select_time )
|
||||
VALUES ";
|
||||
}
|
||||
/* } */
|
||||
|
||||
for($k=0; $k<$opt_count; $k++) {
|
||||
$io_id = isset($_POST['io_id'][$it_id][$k]) ? preg_replace(G5_OPTION_ID_FILTER, '', $_POST['io_id'][$it_id][$k]) : '';
|
||||
$io_type = isset($_POST['io_type'][$it_id][$k]) ? preg_replace('#[^01]#', '', $_POST['io_type'][$it_id][$k]) : '';
|
||||
$io_value = isset($_POST['io_value'][$it_id][$k]) ? $_POST['io_value'][$it_id][$k] : '';
|
||||
|
||||
// 선택옵션정보가 존재하는데 선택된 옵션이 없으면 건너뜀
|
||||
if($lst_count && $io_id == '')
|
||||
continue;
|
||||
|
||||
// 구매할 수 없는 옵션은 건너뜀
|
||||
if($io_id && !$opt_list[$io_type][$io_id]['use'])
|
||||
continue;
|
||||
|
||||
$io_price = isset($opt_list[$io_type][$io_id]['price']) ? $opt_list[$io_type][$io_id]['price'] : 0;
|
||||
$ct_qty = isset($_POST['ct_qty'][$it_id][$k]) ? (int) $_POST['ct_qty'][$it_id][$k] : 0;
|
||||
|
||||
// 구매가격이 음수인지 체크
|
||||
if($io_type) {
|
||||
if((int)$io_price < 0)
|
||||
alert('구매금액이 음수인 상품은 구매할 수 없습니다.');
|
||||
} else {
|
||||
if((int)$it['it_price'] + (int)$io_price < 0)
|
||||
alert('구매금액이 음수인 상품은 구매할 수 없습니다.');
|
||||
}
|
||||
|
||||
// 동일옵션의 상품이 있으면 수량 더함
|
||||
$sql2 = " select ct_id, io_type, ct_qty
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and it_id = '$it_id'
|
||||
and io_id = '$io_id'
|
||||
and ct_status = '쇼핑' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
if(isset($row2['ct_id']) && $row2['ct_id']) {
|
||||
// 재고체크
|
||||
$tmp_ct_qty = $row2['ct_qty'];
|
||||
if(!$io_id)
|
||||
$tmp_it_stock_qty = get_it_stock_qty($it_id);
|
||||
else
|
||||
$tmp_it_stock_qty = get_option_stock_qty($it_id, $io_id, $row2['io_type']);
|
||||
|
||||
if ($tmp_ct_qty + $ct_qty > $tmp_it_stock_qty)
|
||||
{
|
||||
alert($io_value." 의 재고수량이 부족합니다.\\n\\n현재 재고수량 : " . number_format($tmp_it_stock_qty) . " 개");
|
||||
}
|
||||
|
||||
$sql3 = " update {$g5['g5_shop_cart_table']}
|
||||
set ct_qty = ct_qty + '$ct_qty'
|
||||
where ct_id = '{$row2['ct_id']}' ";
|
||||
sql_query($sql3);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 포인트
|
||||
$point = 0;
|
||||
if($config['cf_use_point']) {
|
||||
if($io_type == 0) {
|
||||
$point = get_item_point($it, $io_id);
|
||||
} else {
|
||||
$point = $it['it_supply_point'];
|
||||
}
|
||||
|
||||
if($point < 0)
|
||||
$point = 0;
|
||||
}
|
||||
|
||||
$ct_send_cost = isset($_REQUEST['ct_send_cost']) ? (int) $_REQUEST['ct_send_cost'] : 0;
|
||||
|
||||
// 배송비결제
|
||||
if($it['it_sc_type'] == 1)
|
||||
$ct_send_cost = 2; // 무료
|
||||
else if($it['it_sc_type'] > 1 && $it['it_sc_method'] == 1)
|
||||
$ct_send_cost = 1; // 착불
|
||||
|
||||
$io_value = sql_real_escape_string(strip_tags($io_value));
|
||||
$remote_addr = get_real_client_ip();
|
||||
|
||||
/* 코어수정 리빌더 20241014 { */
|
||||
if(isset($it['it_partner']) && $it['it_partner']) {
|
||||
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$remote_addr', '$ct_send_cost', '$sw_direct', '$ct_select', '$ct_select_time', '{$it['it_partner']}' )";
|
||||
} else {
|
||||
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$remote_addr', '$ct_send_cost', '$sw_direct', '$ct_select', '$ct_select_time' )";
|
||||
}
|
||||
/* } */
|
||||
|
||||
$comma = ' , ';
|
||||
$ct_count++;
|
||||
}
|
||||
|
||||
if($ct_count > 0)
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
// 바로 구매일 경우
|
||||
if ($sw_direct)
|
||||
{
|
||||
if ($is_member)
|
||||
{
|
||||
goto_url(G5_SHOP_URL."/orderform.php?sw_direct=$sw_direct");
|
||||
}
|
||||
else
|
||||
{
|
||||
goto_url(G5_BBS_URL."/login.php?url=".urlencode(G5_SHOP_URL."/orderform.php?sw_direct=$sw_direct"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
goto_url(G5_SHOP_URL.'/cart.php');
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
function get_mshop_category($ca_id, $len)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
$sql = " select ca_id, ca_name from {$g5['g5_shop_category_table']}
|
||||
where ca_use = '1' ";
|
||||
if($ca_id)
|
||||
$sql .= " and ca_id like '$ca_id%' ";
|
||||
$sql .= " and length(ca_id) = '$len' order by ca_order, ca_id ";
|
||||
|
||||
return $sql;
|
||||
}
|
||||
?>
|
||||
<div id="category">
|
||||
<button type="button" class="close_btn"><i class="fa fa-times" aria-hidden="true"></i> 카테고리<span class="sound_only">닫기</span></button>
|
||||
|
||||
<div class="ct_wr">
|
||||
<?php
|
||||
$mshop_ca_res1 = sql_query(get_mshop_category('', 2));
|
||||
for($i=0; $mshop_ca_row1=sql_fetch_array($mshop_ca_res1); $i++) {
|
||||
if($i == 0)
|
||||
echo '<ul class="cate">'.PHP_EOL;
|
||||
?>
|
||||
<li class="cate_li_1">
|
||||
<a href="<?php echo shop_category_url($mshop_ca_row1['ca_id']); ?>" class="cate_li_1_a"><?php echo get_text($mshop_ca_row1['ca_name']); ?></a>
|
||||
<?php
|
||||
$mshop_ca_res2 = sql_query(get_mshop_category($mshop_ca_row1['ca_id'], 4));
|
||||
|
||||
for($j=0; $mshop_ca_row2=sql_fetch_array($mshop_ca_res2); $j++) {
|
||||
if($j == 0)
|
||||
echo '<ul class="sub_cate sub_cate1">'.PHP_EOL;
|
||||
?>
|
||||
<li class="cate_li_2">
|
||||
<a href="<?php echo shop_category_url($mshop_ca_row2['ca_id']); ?>"><?php echo get_text($mshop_ca_row2['ca_name']); ?></a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
if($j > 0)
|
||||
echo '</ul>'.PHP_EOL;
|
||||
?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
if($i > 0)
|
||||
echo '</ul>'.PHP_EOL;
|
||||
else
|
||||
echo '<p class="no-cate">등록된 분류가 없습니다.</p>'.PHP_EOL;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function (){
|
||||
var $category = $("#category");
|
||||
|
||||
$("#menu_open").on("click", function() {
|
||||
$category.css("display","block");
|
||||
});
|
||||
|
||||
$("#category .close_btn").on("click", function(){
|
||||
$category.css("display","none");
|
||||
});
|
||||
});
|
||||
$(document).mouseup(function (e){
|
||||
var container = $("#category");
|
||||
if( container.has(e.target).length === 0)
|
||||
container.hide();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/coupon.php');
|
||||
return;
|
||||
}
|
||||
|
||||
// 테마에 coupon.php 있으면 include
|
||||
if(defined('G5_THEME_SHOP_PATH')) {
|
||||
$theme_coupon_file = G5_THEME_SHOP_PATH.'/coupon.php';
|
||||
if(is_file($theme_coupon_file)) {
|
||||
include_once($theme_coupon_file);
|
||||
return;
|
||||
unset($theme_coupon_file);
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_guest)
|
||||
alert_close('회원만 조회하실 수 있습니다.');
|
||||
|
||||
$g5['title'] = $member['mb_nick'].' 님의 쿠폰 내역';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$sql = " select cp_id, cp_subject, cp_method, cp_target, cp_start, cp_end, cp_type, cp_price
|
||||
from {$g5['g5_shop_coupon_table']}
|
||||
where mb_id IN ( '{$member['mb_id']}', '전체회원' )
|
||||
and cp_start <= '".G5_TIME_YMD."'
|
||||
and cp_end >= '".G5_TIME_YMD."'
|
||||
order by cp_no ";
|
||||
$result = sql_query($sql);
|
||||
?>
|
||||
|
||||
<!-- 쿠폰 내역 시작 { -->
|
||||
<div id="coupon" class="new_win">
|
||||
<h1 id="win_title"><?php echo $g5['title'] ?></h1>
|
||||
<ul>
|
||||
<?php
|
||||
$cp_count = 0;
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
if(is_used_coupon($member['mb_id'], $row['cp_id']))
|
||||
continue;
|
||||
|
||||
if($row['cp_method'] == 1) {
|
||||
$sql = " select ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
|
||||
$ca = sql_fetch($sql);
|
||||
$cp_target = $ca['ca_name'].'의 상품할인';
|
||||
} else if($row['cp_method'] == 2) {
|
||||
$cp_target = '결제금액 할인';
|
||||
} else if($row['cp_method'] == 3) {
|
||||
$cp_target = '배송비 할인';
|
||||
} else {
|
||||
$it = get_shop_item($row['cp_target'], true);
|
||||
//$cp_target = $it['it_name'].' 상품할인';
|
||||
$cp_target = isset($it['it_name']) ? $it['it_name'].' 상품할인' : '상품할인';
|
||||
}
|
||||
|
||||
if($row['cp_type'])
|
||||
$cp_price = $row['cp_price'].'%';
|
||||
else
|
||||
$cp_price = number_format($row['cp_price']).'원';
|
||||
|
||||
$cp_count++;
|
||||
?>
|
||||
<li>
|
||||
<div class="cou_top">
|
||||
<span class="cou_tit"><?php echo $row['cp_subject']; ?></span>
|
||||
<span class="cou_pri"><?php echo $cp_price; ?></span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="cou_target"><?php echo $cp_target; ?> <i class="fa fa-angle-right" aria-hidden="true"></i></span>
|
||||
<span class="cou_date"><i class="fa fa-clock-o" aria-hidden="true"></i> <?php echo substr($row['cp_start'], 2, 8); ?> ~ <?php echo substr($row['cp_end'], 2, 8); ?></span>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
if(!$cp_count)
|
||||
echo '<li class="empty_li">사용할 수 있는 쿠폰이 없습니다.</li>';
|
||||
?>
|
||||
</ul>
|
||||
<button type="button" onclick="window.close();" class="btn_close">창닫기</button>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_coupon_zone_table']}
|
||||
where cz_start <= '".G5_TIME_YMD."'
|
||||
and cz_end >= '".G5_TIME_YMD."' ";
|
||||
|
||||
$sql_order = " order by cz_id desc ";
|
||||
|
||||
add_javascript('<script src="'.G5_JS_URL.'/shop.couponzone.js"></script>', 100);
|
||||
|
||||
$g5['title'] = '쿠폰존';
|
||||
include_once(G5_SHOP_PATH.'/_head.php');
|
||||
|
||||
if (!G5_IS_MOBILE && $is_admin)
|
||||
echo '<div class="sct_admin"><a href="'.G5_ADMIN_URL.'/shop_admin/couponzonelist.php" class="btn_admin btn"><span class="sound_only">쿠폰존 관리</span><i class="fa fa-cog fa-spin fa-fw"></i></a></div>';
|
||||
|
||||
if(G5_IS_MOBILE) {
|
||||
define('G5_SHOP_CSS_URL', G5_MSHOP_SKIN_URL);
|
||||
$skin_file = G5_MSHOP_SKIN_PATH.'/couponzone.10.skin.php';
|
||||
} else {
|
||||
define('G5_SHOP_CSS_URL', G5_SHOP_SKIN_URL);
|
||||
$skin_file = G5_SHOP_SKIN_PATH.'/couponzone.10.skin.php';
|
||||
}
|
||||
|
||||
if (is_file($skin_file)) {
|
||||
include_once($skin_file);
|
||||
|
||||
} else {
|
||||
echo '<div class="sct_nofile">'.str_replace(G5_PATH.'/', '', $skin_file).' 파일을 찾을 수 없습니다.<br>관리자에게 알려주시면 감사하겠습니다.</div>';
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/_tail.php');
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$ev_id = isset($_GET['ev_id']) ? (int) $_GET['ev_id'] : 0;
|
||||
$skin = isset($_GET['skin']) ? clean_xss_tags($_GET['skin'], 1, 1) : '';
|
||||
$ca_id = isset($_GET['ca_id']) ? clean_xss_tags($_GET['ca_id'], 1, 1) : '';
|
||||
|
||||
// 상품 리스트에서 다른 필드로 정렬을 하려면 아래의 배열 코드에서 해당 필드를 추가하세요.
|
||||
if( isset($sort) && ! in_array($sort, array('it_name', 'it_sum_qty', 'it_price', 'it_use_avg', 'it_use_cnt', 'it_update_time')) ){
|
||||
$sort='';
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/event.php');
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_event_table']}
|
||||
where ev_id = '$ev_id'
|
||||
and ev_use = 1 ";
|
||||
$ev = sql_fetch($sql);
|
||||
if (! (isset($ev['ev_id']) && $ev['ev_id']))
|
||||
alert('등록된 이벤트가 없습니다.');
|
||||
|
||||
$g5['title'] = $ev['ev_subject'];
|
||||
include_once('./_head.php');
|
||||
|
||||
if ($is_admin)
|
||||
echo '<div class="sev_admin"><a href="'.G5_ADMIN_URL.'/shop_admin/itemeventform.php?w=u&ev_id='.$ev['ev_id'].'" class="btn_admin btn"><span class="sound_only">이벤트 관리</span><i class="fa fa-cog fa-spin fa-fw"></i></a></div>';
|
||||
?>
|
||||
|
||||
<script>
|
||||
var itemlist_ca_id = "<?php echo $ev_id; ?>";
|
||||
</script>
|
||||
<script src="<?php echo G5_JS_URL; ?>/shop.list.js"></script>
|
||||
|
||||
<!-- 이벤트 시작 { -->
|
||||
<?php
|
||||
$himg = G5_DATA_PATH.'/event/'.$ev_id.'_h';
|
||||
if (file_exists($himg))
|
||||
echo '<div id="sev_himg" class="sev_img"><img src="'.G5_DATA_URL.'/event/'.$ev_id.'_h" alt=""></div>';
|
||||
|
||||
// 상단 HTML
|
||||
echo '<div id="sev_hhtml">'.conv_content($ev['ev_head_html'], 1).'</div>';
|
||||
|
||||
// 상품 출력순서가 있다면
|
||||
if ($sort != "")
|
||||
$order_by = $sort.' '.$sortodr.' , b.it_order, b.it_id desc';
|
||||
else
|
||||
$order_by = 'b.it_order, b.it_id desc';
|
||||
|
||||
if ($skin) {
|
||||
$skin = preg_replace(array('#\.+(\/|\\\)#', '#[\'\"]#'), array('', ''), $skin);
|
||||
$ev['ev_skin'] = $skin;
|
||||
}
|
||||
|
||||
define('G5_SHOP_CSS_URL', G5_SHOP_SKIN_URL);
|
||||
|
||||
// 리스트 유형별로 출력
|
||||
$list_file = G5_SHOP_SKIN_PATH."/{$ev['ev_skin']}";
|
||||
if (file_exists($list_file))
|
||||
{
|
||||
|
||||
echo '<div id="sct_sortlst">';
|
||||
include G5_SHOP_SKIN_PATH.'/list.sort.skin.php';
|
||||
|
||||
// 상품 보기 타입 변경 버튼
|
||||
include G5_SHOP_SKIN_PATH.'/list.sub.skin.php';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
// 총몇개 = 한줄에 몇개 * 몇줄
|
||||
$items = $ev['ev_list_mod'] * $ev['ev_list_row'];
|
||||
// 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
if ($page < 1) $page = 1;
|
||||
// 시작 레코드 구함
|
||||
$from_record = ($page - 1) * $items;
|
||||
|
||||
$list = new item_list(G5_SHOP_SKIN_PATH.'/'.$ev['ev_skin'], $ev['ev_list_mod'], $ev['ev_list_row'], $ev['ev_img_width'], $ev['ev_img_height']);
|
||||
$list->set_event($ev['ev_id']);
|
||||
$list->set_is_page(true);
|
||||
$list->set_order_by($order_by);
|
||||
$list->set_from_record($from_record);
|
||||
$list->set_view('it_img', true);
|
||||
$list->set_view('it_id', false);
|
||||
$list->set_view('it_name', true);
|
||||
$list->set_view('it_cust_price', false);
|
||||
$list->set_view('it_price', true);
|
||||
$list->set_view('it_icon', true);
|
||||
$list->set_view('sns', true);
|
||||
echo $list->run();
|
||||
|
||||
// where 된 전체 상품수
|
||||
$total_count = $list->total_count;
|
||||
// 전체 페이지 계산
|
||||
$total_page = ceil($total_count / $items);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<div align="center">'.$ev['ev_skin'].' 파일을 찾을 수 없습니다.<br>관리자에게 알려주시면 감사하겠습니다.</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$qstr .= 'skin='.$skin.'&ev_id='.$ev_id.'&sort='.$sort.'&sortodr='.$sortodr;
|
||||
echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&page=");
|
||||
?>
|
||||
|
||||
<?php
|
||||
// 하단 HTML
|
||||
echo '<div id="sev_thtml">'.conv_content($ev['ev_tail_html'], 1).'</div>';
|
||||
|
||||
$timg = G5_DATA_PATH.'/event/'.$ev_id.'_t';
|
||||
if (file_exists($timg))
|
||||
echo '<div id="sev_timg" class="sev_img"><img src="'.G5_DATA_URL.'/event/'.$ev_id.'_t" alt=""></div>';
|
||||
?>
|
||||
<!-- } 이벤트 끝 -->
|
||||
|
||||
<?php
|
||||
include_once('./_tail.php');
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 56 B |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 696 B |
|
After Width: | Height: | Size: 256 B |
|
After Width: | Height: | Size: 314 B |
|
After Width: | Height: | Size: 210 B |
|
After Width: | Height: | Size: 72 B |
|
After Width: | Height: | Size: 94 B |
|
After Width: | Height: | Size: 71 B |
|
After Width: | Height: | Size: 83 B |
|
After Width: | Height: | Size: 76 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 205 B |
|
After Width: | Height: | Size: 219 B |
|
After Width: | Height: | Size: 244 B |
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if(defined('G5_THEME_PATH')) {
|
||||
require_once(G5_THEME_SHOP_PATH.'/index.php');
|
||||
return;
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/index.php');
|
||||
return;
|
||||
}
|
||||
|
||||
define("_INDEX_", TRUE);
|
||||
|
||||
include_once(G5_SHOP_PATH.'/shop.head.php');
|
||||
?>
|
||||
|
||||
<!-- 메인이미지 시작 { -->
|
||||
<?php echo display_banner('메인', 'mainbanner.10.skin.php'); ?>
|
||||
<!-- } 메인이미지 끝 -->
|
||||
|
||||
|
||||
|
||||
<?php if($default['de_type1_list_use']) { ?>
|
||||
<!-- 히트상품 시작 { -->
|
||||
<section id="idx_hit" class="sct_wrap">
|
||||
<header>
|
||||
<h2><a href="<?php echo shop_type_url('1'); ?>">히트상품</a></h2>
|
||||
</header>
|
||||
<?php
|
||||
$list = new item_list();
|
||||
$list->set_type(1);
|
||||
$list->set_view('it_img', true);
|
||||
$list->set_view('it_id', false);
|
||||
$list->set_view('it_name', true);
|
||||
$list->set_view('it_basic', true);
|
||||
$list->set_view('it_cust_price', true);
|
||||
$list->set_view('it_price', true);
|
||||
$list->set_view('it_icon', true);
|
||||
$list->set_view('sns', true);
|
||||
$list->set_view('star', true);
|
||||
echo $list->run();
|
||||
?>
|
||||
</section>
|
||||
<!-- } 히트상품 끝 -->
|
||||
<script>
|
||||
//히트상품
|
||||
$(function(){
|
||||
var hit_smt_val = parseInt($('#idx_hit .smt_40').attr("data-value"));
|
||||
|
||||
if(! hit_smt_val){
|
||||
hit_smt_val = 5;
|
||||
}
|
||||
|
||||
$('#idx_hit .smt_40').owlCarousel({
|
||||
loop:true,
|
||||
nav:true,
|
||||
autoplay:true,
|
||||
autoplayHoverPause:true,
|
||||
responsive:{
|
||||
1000:{items:5}
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($default['de_type3_list_use']) { ?>
|
||||
<!-- 최신상품 시작 { -->
|
||||
<section class="sct_wrap">
|
||||
<header>
|
||||
<h2><a href="<?php echo shop_type_url('3'); ?>">최신상품</a></h2>
|
||||
</header>
|
||||
<?php
|
||||
$list = new item_list();
|
||||
$list->set_type(3);
|
||||
$list->set_view('it_id', false);
|
||||
$list->set_view('it_name', true);
|
||||
$list->set_view('it_basic', true);
|
||||
$list->set_view('it_cust_price', true);
|
||||
$list->set_view('it_price', true);
|
||||
$list->set_view('it_icon', true);
|
||||
$list->set_view('sns', true);
|
||||
$list->set_view('star', true);
|
||||
echo $list->run();
|
||||
?>
|
||||
</section>
|
||||
<!-- } 최신상품 끝 -->
|
||||
<?php } ?>
|
||||
|
||||
<?php if($default['de_type2_list_use']) { ?>
|
||||
<!-- 추천상품 시작 { -->
|
||||
<section class="sct_wrap">
|
||||
<header>
|
||||
<h2><a href="<?php echo shop_type_url('2'); ?>">추천상품</a></h2>
|
||||
</header>
|
||||
<?php
|
||||
$list = new item_list();
|
||||
$list->set_type(2);
|
||||
$list->set_view('it_id', false);
|
||||
$list->set_view('it_name', true);
|
||||
$list->set_view('it_basic', true);
|
||||
$list->set_view('it_cust_price', true);
|
||||
$list->set_view('it_price', true);
|
||||
$list->set_view('it_icon', true);
|
||||
$list->set_view('sns', true);
|
||||
$list->set_view('star', true);
|
||||
echo $list->run();
|
||||
?>
|
||||
</section>
|
||||
<!-- } 추천상품 끝 -->
|
||||
<?php } ?>
|
||||
|
||||
<?php include_once(G5_SHOP_SKIN_PATH.'/boxevent.skin.php'); // 이벤트 ?>
|
||||
|
||||
<?php if($default['de_type5_list_use']) { ?>
|
||||
<!-- 할인상품 시작 { -->
|
||||
<section class="sct_wrap">
|
||||
<header>
|
||||
<h2><a href="<?php echo shop_type_url('5'); ?>">할인상품</a></h2>
|
||||
</header>
|
||||
<?php
|
||||
$list = new item_list();
|
||||
$list->set_type(5);
|
||||
$list->set_view('it_id', false);
|
||||
$list->set_view('it_name', true);
|
||||
$list->set_view('it_basic', true);
|
||||
$list->set_view('it_cust_price', true);
|
||||
$list->set_view('it_price', true);
|
||||
$list->set_view('it_icon', true);
|
||||
$list->set_view('sns', true);
|
||||
$list->set_view('star', true);
|
||||
echo $list->run();
|
||||
?>
|
||||
</section>
|
||||
<!-- } 할인상품 끝 -->
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
include_once(G5_SHOP_PATH.'/shop.tail.php');
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
include_once('../../common.php');
|
||||
@@ -0,0 +1 @@
|
||||
<script language="javascript" type="text/javascript" src="https://stgstdpay.inicis.com/stdjs/INIStdPay_close.js" charset="UTF-8"></script>
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if($od['od_pg'] != 'inicis') return;
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
// 택배회사 코드, https://manual.inicis.com/iniweb/code.html 에서 조회
|
||||
$exCode = array(
|
||||
'대한통운' => 'korex',
|
||||
'아주택배' => 'ajutb',
|
||||
'KT로지스' => 'ktlogistics',
|
||||
'롯데택배(구.현대)' => 'hyundai',
|
||||
'CJ대한통운' => 'cjgls',
|
||||
'한진택배' => 'hanjin',
|
||||
'트라넷' => 'tranet',
|
||||
'하나로택배' => 'Hanaro',
|
||||
'사가와익스프레스' => 'Sagawa',
|
||||
'SEDEX' => 'sedex',
|
||||
'KGB택배' => 'kgbls',
|
||||
'로젠택배' => 'kgb',
|
||||
'KG옐로우캡택배' => 'yellow',
|
||||
'삼성HTH' => 'hth',
|
||||
'동부택배' => 'dongbu',
|
||||
'우체국' => 'EPOST',
|
||||
'우편등기' => 'registpost',
|
||||
'경동택배' => 'kdexp',
|
||||
'천일택배' => 'chunil',
|
||||
'대신택배' => 'daesin',
|
||||
'일양로지스' => 'ilyang',
|
||||
'호남택배' => 'honam',
|
||||
'편의점택배' => 'cvsnet',
|
||||
'합동택배' => 'hdexp',
|
||||
'기타택배' => '9999'
|
||||
);
|
||||
|
||||
//step1. 요청을 위한 파라미터 설정
|
||||
// 가맹점관리자 > 상점정보 > 계약정보 > 부가정보 > INIAPI key 생성조회
|
||||
if (function_exists('get_inicis_iniapi_key')) {
|
||||
$key = get_inicis_iniapi_key();
|
||||
} else {
|
||||
$key = ! $default['de_card_test'] ? $default['de_inicis_iniapi_key'] : "ItEQKi3rY7uvDS8l";
|
||||
}
|
||||
|
||||
$dlv_exName = $escrow_corp;
|
||||
$type = "Dlv"; //"Dlv" 고정
|
||||
$mid = $default['de_inicis_mid'];
|
||||
$clientIp = $_SERVER['SERVER_ADDR']; // 가맹점 요청 서버IP, 상점 임의 설정 가능 (상점측 서버 구분을 위함)
|
||||
$timestamp = date("YmdHis");
|
||||
$tid = $escrow_tno; //에스크로 결제 승인TID
|
||||
$oid = $od['od_id'];
|
||||
$price = $od['od_receipt_price'];
|
||||
$report = "I"; //에스크로 등록형태 ["I":등록, "U":변경]
|
||||
$invoice = $escrow_numb; //운송장번호
|
||||
$registName = $member['mb_id'];
|
||||
$exCode = isset($exCode[$dlv_exName]) ? $exCode[$dlv_exName] : ''; //택배사코드 참고(https://manual.inicis.com/code/#gls)
|
||||
$exName = $dlv_exName;
|
||||
$charge = "SH"; //배송비 지급형태 ("SH":판매자부담, "BH":구매자부담)
|
||||
$invoiceDay = G5_TIME_YMDHIS; //배송등록 확인일자 (String 으로 timestamp 사용 가능)
|
||||
$sendName = $od['od_name'];
|
||||
$sendTel = $od['od_tel'];
|
||||
$sendPost = $od['od_zip1'].$od['od_zip2'];
|
||||
$sendAddr1 = $od['od_addr1'].' '.$od['od_addr2'];
|
||||
$recvName = $od['od_b_name'];
|
||||
$recvTel = $od['od_b_tel'];
|
||||
$recvPost = $od['od_b_zip1'].$od['od_b_zip2'];
|
||||
$recvAddr = $od['od_b_addr1'].($od['od_b_addr2'] ? ' ' : '').$od['od_b_addr2'];
|
||||
|
||||
if(!$exCode)
|
||||
$exCode = '9999';
|
||||
|
||||
// hash => INIAPIKey + type + timestamp + clientIp + mid + oid + tid + price
|
||||
$plainText = (string)$key.(string)$type.(string)$timestamp.(string)$clientIp.(string)$mid.(string)$oid.(string)$tid.(string)$price;
|
||||
|
||||
// hash 암호화
|
||||
$hashData = hash("sha512", $plainText);
|
||||
|
||||
//step2. key=value 로 post 요청
|
||||
|
||||
$data = array(
|
||||
'type' => $type,
|
||||
'mid' => $mid,
|
||||
'clientIp' => $clientIp,
|
||||
'timestamp' => $timestamp,
|
||||
'tid' => $tid,
|
||||
'oid' => $oid,
|
||||
'price' => $price,
|
||||
'report' => $report,
|
||||
'invoice' => $invoice,
|
||||
'registName' => $registName,
|
||||
'exCode' => $exCode,
|
||||
'exName' => $exName,
|
||||
'charge' => $charge,
|
||||
'invoiceDay' => $invoiceDay,
|
||||
'sendName' => $sendName,
|
||||
'sendTel' => $sendTel,
|
||||
'sendPost' => $sendPost,
|
||||
'sendAddr1' => $sendAddr1,
|
||||
'recvName' => $recvName,
|
||||
'recvTel' => $recvTel,
|
||||
'recvPost' => $recvPost,
|
||||
'recvAddr' => $recvAddr,
|
||||
'hashData'=> $hashData
|
||||
);
|
||||
|
||||
// Request URL
|
||||
$url = "https://iniapi.inicis.com/api/v1/escrow";
|
||||
|
||||
$ch = curl_init(); // curl 초기화
|
||||
curl_setopt($ch, CURLOPT_URL, $url); // 전송 URL 지정하기
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 요청 결과를 문자열로 반환
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); // connection timeout 10초
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); // POST data
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // (※ 로컬 테스트에서만 사용) 원격 서버의 인증서가 유효한지 검사 안함
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=utf-8')); // 전송헤더 설정
|
||||
curl_setopt($ch, CURLOPT_POST, 1); // post 전송
|
||||
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
//step3. 요청 결과
|
||||
$ini_result = json_decode($response, true);
|
||||
|
||||
|
||||
/**********************
|
||||
* 4. 배송 등록 결과 *
|
||||
**********************/
|
||||
|
||||
$resultCode = $ini_result['resultCode']; // 결과코드 ("00"이면 지불 성공)
|
||||
$resultMsg = $ini_result['resultMsg']; // 결과내용 (지불결과에 대한 설명)
|
||||
$dlv_date = $ini_result['resultDate'];
|
||||
$dlv_time = $ini_result['resultTime'];
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
/*******************************************************************
|
||||
* 7. DB연동 실패 시 강제취소 *
|
||||
* *
|
||||
* 지불 결과를 DB 등에 저장하거나 기타 작업을 수행하다가 실패하는 *
|
||||
* 경우, 아래의 코드를 참조하여 이미 지불된 거래를 취소하는 코드를 *
|
||||
* 작성합니다. *
|
||||
*******************************************************************/
|
||||
|
||||
$cancelFlag = "true";
|
||||
|
||||
// $cancelFlag를 "true"로 변경하는 condition 판단은 개별적으로
|
||||
// 수행하여 주십시오.
|
||||
|
||||
if($cancelFlag == "true")
|
||||
{
|
||||
|
||||
if( isset($is_noti_pay) && $is_noti_pay ){
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
if( get_session('ss_order_id') && $tno ){
|
||||
|
||||
$ini_oid = preg_replace('/[^a-z0-9_\-]/i', '', get_session('ss_order_id'));
|
||||
$tno = preg_replace('/[^a-z0-9_\-]/i', '', $tno);
|
||||
|
||||
$sql = "select oid from {$g5['g5_shop_inicis_log_table']} where oid = '$ini_oid' and P_TID = '$tno' ";
|
||||
|
||||
$exists_log = sql_fetch($sql);
|
||||
|
||||
if( $exists_log['oid'] ){
|
||||
$sql = " update {$g5['g5_shop_inicis_log_table']}
|
||||
set P_STATUS = 'cancel',
|
||||
P_AUTH_DT = '".preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS)."' where oid = '$ini_oid' and P_TID = '$tno' ";
|
||||
} else {
|
||||
$sql = " insert into {$g5['g5_shop_inicis_log_table']}
|
||||
set oid = '$ini_oid',
|
||||
P_TID = '$tno',
|
||||
P_STATUS = 'cancel',
|
||||
P_AUTH_DT = '".preg_replace('/[^0-9]/', '', G5_TIME_YMDHIS)."' ";
|
||||
}
|
||||
|
||||
sql_query($sql, false);
|
||||
}
|
||||
|
||||
$ini_paymethod = get_type_inicis_paymethod($od_settle_case);
|
||||
|
||||
if ($ini_paymethod){
|
||||
$args = array(
|
||||
'paymethod' => $ini_paymethod,
|
||||
'tid' => $tno,
|
||||
'msg' => 'DB FAIL' // 취소사유
|
||||
);
|
||||
|
||||
$response = inicis_tid_cancel($args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/HttpClient.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/json_lib.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/properties.php');
|
||||
|
||||
$inicis_pay_result = false;
|
||||
|
||||
$prop = new properties();
|
||||
|
||||
try {
|
||||
|
||||
//#############################
|
||||
// 인증결과 파라미터 일괄 수신
|
||||
//#############################
|
||||
// $var = $_REQUEST["data"];
|
||||
|
||||
//#####################
|
||||
// 인증이 성공일 경우만
|
||||
//#####################
|
||||
if (isset($_REQUEST['resultCode']) && strcmp('0000', $_REQUEST['resultCode']) == 0) {
|
||||
|
||||
//############################################
|
||||
// 1.전문 필드 값 설정(***가맹점 개발수정***)
|
||||
//############################################
|
||||
|
||||
$charset = 'UTF-8'; // 리턴형식[UTF-8,EUC-KR](가맹점 수정후 고정)
|
||||
|
||||
$format = 'JSON'; // 리턴형식[XML,JSON,NVP](가맹점 수정후 고정)
|
||||
// 추가적 noti가 필요한 경우(필수아님, 공백일 경우 미발송, 승인은 성공시, 실패시 모두 Noti발송됨) 미사용
|
||||
//String notiUrl = "";
|
||||
|
||||
$authToken = $_REQUEST['authToken']; // 취소 요청 tid에 따라서 유동적(가맹점 수정후 고정)
|
||||
|
||||
$authUrl = $_REQUEST['authUrl']; // 승인요청 API url(수신 받은 값으로 설정, 임의 세팅 금지)
|
||||
|
||||
$netCancel = $_REQUEST['netCancelUrl']; // 망취소 API url(수신 받은f값으로 설정, 임의 세팅 금지)
|
||||
|
||||
///$mKey = $util->makeHash(signKey, "sha256"); // 가맹점 확인을 위한 signKey를 해시값으로 변경 (SHA-256방식 사용)
|
||||
$mKey = hash("sha256", $signKey);
|
||||
|
||||
//##########################################################################
|
||||
// 승인요청 API url (authUrl) 리스트 는 properties 에 세팅하여 사용합니다.
|
||||
// idc_name 으로 수신 받은 센터 네임을 properties 에서 include 하여 승인요청하시면 됩니다.
|
||||
//##########################################################################
|
||||
$idc_name = $_REQUEST["idc_name"];
|
||||
$authUrl = $prop->getAuthUrl($idc_name);
|
||||
|
||||
if (strcmp($authUrl, $_REQUEST["authUrl"]) != 0) {
|
||||
|
||||
die("authUrl check Fail\n");
|
||||
}
|
||||
|
||||
//#####################
|
||||
// 2.signature 생성
|
||||
//#####################
|
||||
$signParam['authToken'] = $authToken; // 필수
|
||||
$signParam['timestamp'] = $timestamp; // 필수
|
||||
// signature 데이터 생성 (모듈에서 자동으로 signParam을 알파벳 순으로 정렬후 NVP 방식으로 나열해 hash)
|
||||
$signature = $util->makeSignature($signParam);
|
||||
|
||||
|
||||
//#####################
|
||||
// 3.API 요청 전문 생성
|
||||
//#####################
|
||||
$authMap['mid'] = $mid; // 필수
|
||||
$authMap['authToken'] = $authToken; // 필수
|
||||
$authMap['signature'] = $signature; // 필수
|
||||
$authMap['timestamp'] = $timestamp; // 필수
|
||||
$authMap['charset'] = $charset; // default=UTF-8
|
||||
$authMap['format'] = $format; // default=XML
|
||||
//if(null != notiUrl && notiUrl.length() > 0){
|
||||
// authMap.put("notiUrl" ,notiUrl);
|
||||
//}
|
||||
|
||||
|
||||
try {
|
||||
|
||||
$httpUtil = new HttpClient();
|
||||
|
||||
//#####################
|
||||
// 4.API 통신 시작
|
||||
//#####################
|
||||
|
||||
$authResultString = "";
|
||||
if ($httpUtil->processHTTP($authUrl, $authMap)) {
|
||||
$authResultString = $httpUtil->body;
|
||||
} else {
|
||||
echo "Http Connect Error\n";
|
||||
echo $httpUtil->errormsg;
|
||||
|
||||
throw new Exception("Http Connect Error");
|
||||
}
|
||||
|
||||
//############################################################
|
||||
//5.API 통신결과 처리(***가맹점 개발수정***)
|
||||
//############################################################
|
||||
|
||||
$resultMap = json_decode($authResultString, true);
|
||||
|
||||
$tid = $resultMap['tid'];
|
||||
$oid = preg_replace('/[^A-Za-z0-9\-_]/', '', $resultMap['MOID']);
|
||||
|
||||
/************************* 결제보안 추가 2016-05-18 START ****************************/
|
||||
$secureMap['mid'] = $mid; //mid
|
||||
$secureMap['tstamp'] = $timestamp; //timestemp
|
||||
$secureMap['MOID'] = $resultMap['MOID']; //MOID
|
||||
$secureMap['TotPrice'] = $resultMap['TotPrice']; //TotPrice
|
||||
|
||||
// signature 데이터 생성
|
||||
$secureSignature = $util->makeSignatureAuth($secureMap);
|
||||
/************************* 결제보안 추가 2016-05-18 END ****************************/
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$oid' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$data = isset($row['dt_data']) ? unserialize(base64_decode($row['dt_data'])) : array();
|
||||
|
||||
if(isset($data['pp_id']) && $data['pp_id']) {
|
||||
$page_return_url = G5_SHOP_URL.'/personalpayform.php?pp_id='.$data['pp_id'];
|
||||
} else {
|
||||
$page_return_url = G5_SHOP_URL.'/orderform.php';
|
||||
if(get_session('ss_direct'))
|
||||
$page_return_url .= '?sw_direct=1';
|
||||
}
|
||||
|
||||
if ((strcmp('0000', $resultMap['resultCode']) == 0) && (strcmp($secureSignature, $resultMap['authSignature']) == 0) ) { //결제보안 추가 2016-05-18
|
||||
/* * ***************************************************************************
|
||||
* 여기에 가맹점 내부 DB에 결제 결과를 반영하는 관련 프로그램 코드를 구현한다.
|
||||
|
||||
[중요!] 승인내용에 이상이 없음을 확인한 뒤 가맹점 DB에 해당건이 정상처리 되었음을 반영함
|
||||
처리중 에러 발생시 망취소를 한다.
|
||||
* **************************************************************************** */
|
||||
|
||||
//최종결제요청 결과 성공 DB처리
|
||||
$tno = $resultMap['tid'];
|
||||
$amount = $resultMap['TotPrice'];
|
||||
$app_time = $resultMap['applDate'].$resultMap['applTime'];
|
||||
$pay_method = $resultMap['payMethod'];
|
||||
$pay_type = $PAY_METHOD[$pay_method];
|
||||
$depositor = isset($resultMap['VACT_InputName']) ? $resultMap['VACT_InputName'] : '';
|
||||
$commid = '';
|
||||
$mobile_no = isset($resultMap['HPP_Num']) ? $resultMap['HPP_Num'] : '';
|
||||
$app_no = isset($resultMap['applNum']) ? $resultMap['applNum'] : '';
|
||||
$card_name = isset($resultMap['CARD_Code']) ? $CARD_CODE[$resultMap['CARD_Code']] : '';
|
||||
switch($pay_type) {
|
||||
case '계좌이체':
|
||||
$bank_name = isset($BANK_CODE[$resultMap['ACCT_BankCode']]) ? $BANK_CODE[$resultMap['ACCT_BankCode']] : '';
|
||||
if ($default['de_escrow_use'] == 1)
|
||||
$escw_yn = 'Y';
|
||||
break;
|
||||
case '가상계좌':
|
||||
$bankname = isset($BANK_CODE[$resultMap['VACT_BankCode']]) ? $BANK_CODE[$resultMap['VACT_BankCode']] : '';
|
||||
$account = $resultMap['VACT_Num'].' '.$resultMap['VACT_Name'];
|
||||
$app_no = $resultMap['VACT_Num'];
|
||||
if ($default['de_escrow_use'] == 1)
|
||||
$escw_yn = 'Y';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
$inicis_pay_result = true;
|
||||
|
||||
} else {
|
||||
$s = '(오류코드:'.$resultMap['resultCode'].') '.$resultMap['resultMsg'];
|
||||
alert($s, $page_return_url);
|
||||
}
|
||||
|
||||
// 수신결과를 파싱후 resultCode가 "0000"이면 승인성공 이외 실패
|
||||
// 가맹점에서 스스로 파싱후 내부 DB 처리 후 화면에 결과 표시
|
||||
// payViewType을 popup으로 해서 결제를 하셨을 경우
|
||||
// 내부처리후 스크립트를 이용해 opener의 화면 전환처리를 하세요
|
||||
//throw new Exception("강제 Exception");
|
||||
} catch (Exception $e) {
|
||||
// $s = $e->getMessage() . ' (오류코드:' . $e->getCode() . ')';
|
||||
//####################################
|
||||
// 실패시 처리(***가맹점 개발수정***)
|
||||
//####################################
|
||||
//---- db 저장 실패시 등 예외처리----//
|
||||
$s = $e->getMessage() . ' (오류코드:' . $e->getCode() . ')';
|
||||
echo $s;
|
||||
|
||||
//#####################
|
||||
// 망취소 API
|
||||
//#####################
|
||||
|
||||
$netcancelResultString = ""; // 망취소 요청 API url(고정, 임의 세팅 금지)
|
||||
$netCancel = $prop->getNetCancel($idc_name);
|
||||
|
||||
if (strcmp($netCancel, $_REQUEST["netCancelUrl"]) == 0) {
|
||||
|
||||
if ($httpUtil->processHTTP($netCancel, $authMap)) {
|
||||
$netcancelResultString = $httpUtil->body;
|
||||
} else {
|
||||
echo "Http Connect Error\n";
|
||||
echo $httpUtil->errormsg;
|
||||
|
||||
throw new Exception("Http Connect Error");
|
||||
}
|
||||
|
||||
echo "<br/>## 망취소 API 결과 ##<br/>";
|
||||
|
||||
/*##XML output##*/
|
||||
//$netcancelResultString = str_replace("<", "<", $$netcancelResultString);
|
||||
//$netcancelResultString = str_replace(">", ">", $$netcancelResultString);
|
||||
|
||||
// 취소 결과 확인
|
||||
echo "<p>". $netcancelResultString . "</p>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
//#############
|
||||
// 인증 실패시
|
||||
//#############
|
||||
echo "<br/>";
|
||||
echo "####인증실패####";
|
||||
|
||||
ob_start();
|
||||
|
||||
$debug_msg = ob_get_contents();
|
||||
ob_clean();
|
||||
|
||||
echo "<pre>" . strip_tags($debug_msg) . "</pre>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$s = $e->getMessage() . ' (오류코드:' . $e->getCode() . ')';
|
||||
echo $s;
|
||||
}
|
||||
|
||||
if( !$inicis_pay_result ){
|
||||
die("<br><br>결제 에러가 일어났습니다. 에러 이유는 위와 같습니다.");
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/HttpClient.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/json_lib.php');
|
||||
|
||||
@header("Progma:no-cache");
|
||||
@header("Cache-Control:no-cache,must-revalidate");
|
||||
|
||||
$request_mid = isset($_POST['mid']) ? clean_xss_tags($_POST['mid']) : '';
|
||||
|
||||
if( ($request_mid != $default['de_inicis_mid']) ){
|
||||
alert("요청된 mid 와 설정된 mid 가 틀립니다.");
|
||||
}
|
||||
|
||||
$orderNumber = isset($_POST['orderNumber']) ? preg_replace("/[ #\&\+%@=\/\\\:;,\.'\"\^`~|\!\?\*$#<>()\[\]\{\}]/i", "", strip_tags($_POST['orderNumber'])) : 0;
|
||||
$session_order_num = get_session('ss_order_inicis_id');
|
||||
|
||||
if( !$orderNumber ){
|
||||
alert("주문번호가 없습니다.");
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$orderNumber' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if( empty($row) ){
|
||||
alert("임시 주문정보가 저장되지 않았습니다.");
|
||||
}
|
||||
|
||||
$data = unserialize(base64_decode($row['dt_data']));
|
||||
|
||||
$params = array();
|
||||
$var_datas = array();
|
||||
|
||||
foreach($data as $key=>$value) {
|
||||
if(is_array($value)) {
|
||||
foreach($value as $k=>$v) {
|
||||
$_POST[$key][$k] = $params[$key][$k] = clean_xss_tags(strip_tags($v));
|
||||
}
|
||||
} else {
|
||||
if(in_array($key, array('od_memo'))){
|
||||
$_POST[$key] = $params[$key] = clean_xss_tags(strip_tags($value), 0, 0, 0, 0);
|
||||
} else {
|
||||
$_POST[$key] = $params[$key] = clean_xss_tags(strip_tags($value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data['pp_id']) && $data['pp_id']) { //개인결제
|
||||
|
||||
foreach($params as $key=>$value){
|
||||
|
||||
if( in_array($key, array('pp_name', 'pp_email', 'pp_hp', 'pp_settle_case')) ){
|
||||
|
||||
$var_datas[$key] = $value;
|
||||
|
||||
$$key = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/personalpayformupdate.php');
|
||||
|
||||
} else { //상점주문
|
||||
|
||||
foreach($params as $key=>$value){
|
||||
|
||||
if( in_array($key, array('od_price', 'od_name', 'od_tel', 'od_hp', 'od_email', 'od_memo', 'od_settle_case', 'max_temp_point', 'od_temp_point', 'od_bank_account', 'od_deposit_name', 'od_test', 'od_ip', 'od_zip', 'od_addr1', 'od_addr2', 'od_addr3', 'od_addr_jibeon', 'od_b_name', 'od_b_tel', 'od_b_hp', 'od_b_addr1', 'od_b_addr2', 'od_b_addr3', 'od_b_addr_jibeon', 'od_b_zip', 'od_send_cost', 'od_send_cost2', 'od_hope_date')) ){
|
||||
|
||||
$var_datas[$key] = $value;
|
||||
|
||||
$$key = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$od_send_cost = (int) $_POST['od_send_cost'];
|
||||
$od_send_cost2 = (int) $_POST['od_send_cost2'];
|
||||
|
||||
include_once(G5_SHOP_PATH.'/orderformupdate.php');
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
class CreateIdModule {
|
||||
|
||||
function makeTid($payMetod, $mid, $mobileType) {
|
||||
date_default_timezone_set('Asia/Seoul');
|
||||
$date = new DateTime();
|
||||
|
||||
$prefix = "";
|
||||
|
||||
if ($mobileType) {
|
||||
$prefix = "StdMX_";
|
||||
} else {
|
||||
$prefix = "Stdpay";
|
||||
}
|
||||
|
||||
|
||||
/////////////
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
$time = date("YmdHis", $sec) . intval(round($usec * 1000));
|
||||
if (strlen($time) == 17) {
|
||||
|
||||
} elseif (strlen($time) == 16) {
|
||||
$time = $time . "0";
|
||||
} else {
|
||||
$time = $time . "00";
|
||||
}
|
||||
/////////////
|
||||
|
||||
$tid = $prefix . $this->getPGID($payMetod) . $mid . $time . $this->makeRandNum();
|
||||
|
||||
|
||||
return $tid;
|
||||
}
|
||||
|
||||
function getPGID($payMethod) {
|
||||
$pgid = "";
|
||||
|
||||
if ($payMethod == "Card") {
|
||||
$pgid = "CARD";
|
||||
} elseif ($payMethod == "Account") {
|
||||
$pgid = "ACCT";
|
||||
} elseif ($payMethod == "DirectBank") {
|
||||
$pgid = "DBNK";
|
||||
} elseif ($payMethod == "OCBPoint") {
|
||||
$pgid = "OCBP";
|
||||
} elseif ($payMethod == "VCard") {
|
||||
$pgid = "ISP_";
|
||||
} elseif ($payMethod == "HPP") {
|
||||
$pgid = "HPP_";
|
||||
} elseif ($payMethod == "Nemo") {
|
||||
$pgid = "NEMO";
|
||||
} elseif ($payMethod == "ArsBill") {
|
||||
$pgid = "ARSB";
|
||||
} elseif ($payMethod == "PhoneBill") {
|
||||
$pgid = "PHNB";
|
||||
} elseif ($payMethod == "Ars1588Bill") {
|
||||
$pgid = "1588";
|
||||
} elseif ($payMethod == "VBank") {
|
||||
$pgid = "VBNK";
|
||||
} elseif ($payMethod == "Culture") {
|
||||
$pgid = "CULT";
|
||||
} elseif ($payMethod == "CMS") {
|
||||
$pgid = "CMS_";
|
||||
} elseif ($payMethod == "AUTH") {
|
||||
$pgid = "AUTH";
|
||||
} elseif ($payMethod == "INIcard") {
|
||||
$pgid = "INIC";
|
||||
} elseif ($payMethod == "MDX") {
|
||||
$pgid = "MDX_";
|
||||
} elseif ($payMethod == "CASH") {
|
||||
$pgid = "CASH";
|
||||
} elseif (strlen($payMethod) > 4) {
|
||||
$pgid = strtoupper($payMethod);
|
||||
$pgid = substr($pgid, 0, 4);
|
||||
} else {
|
||||
$pgid = trim($pgid);
|
||||
}
|
||||
|
||||
return $pgid;
|
||||
}
|
||||
|
||||
//랜덤 숫자 생성
|
||||
function makeRandNum() {
|
||||
$strNum = "";
|
||||
$randNum = rand(0, 300);
|
||||
|
||||
if ($randNum < 10) {
|
||||
$strNum = $strNum . "00" . $randNum;
|
||||
} elseif ($randNum < 100) {
|
||||
$strNum = $strNum . "0" . $randNum;
|
||||
} else {
|
||||
$strNum = $randNum;
|
||||
}
|
||||
|
||||
return $strNum;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
define("CONNECT_TIMEOUT", 5);
|
||||
define("READ_TIMEOUT", 15);
|
||||
//$explode_data = explode('/', $P_REQ_URL);
|
||||
//$host = $explode_data[2];
|
||||
//$path = "/" . $explode_data[3] . "/" . $explode_data[4];
|
||||
|
||||
class HttpClient {
|
||||
|
||||
var $sock = 0;
|
||||
var $ssl;
|
||||
var $host;
|
||||
var $port;
|
||||
var $path;
|
||||
var $status;
|
||||
var $headers = "";
|
||||
var $body = "";
|
||||
var $reqeust;
|
||||
var $errorcode;
|
||||
var $errormsg;
|
||||
|
||||
function processHTTP($url, $param) {
|
||||
|
||||
$data = "";
|
||||
foreach ($param as $key => $value) {
|
||||
$key2 = urlencode($key);
|
||||
$value2 = urlencode($value);
|
||||
$data .= "&$key2=$value2";
|
||||
}
|
||||
|
||||
$data = substr($data, 1); // remove leading "&"
|
||||
$url_data = parse_url($url);
|
||||
|
||||
// host 가 .inicis.com 의 주소가 아니라면 false 반환
|
||||
// [scheme] => https
|
||||
// [host] => fcstdpay.inicis.com || stdpay.inicis.com || ksstdpay.inicis.com
|
||||
// [path] => /api/payAuth
|
||||
if (! is_inicis_url_return($url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($url_data["scheme"] == "https") {
|
||||
$this->ssl = "ssl://";
|
||||
$this->port = 443;
|
||||
}
|
||||
|
||||
$this->host = $url_data["host"];
|
||||
/*
|
||||
|
||||
if (is_null($url_data["port"])) {
|
||||
$this->port = "80";
|
||||
} else {
|
||||
$this->port = $url_data["port"];
|
||||
}
|
||||
*/
|
||||
|
||||
$this->path = $url_data["path"];
|
||||
|
||||
if (!$this->sock = @fsockopen($this->ssl . $this->host, $this->port, $errno, $errstr, CONNECT_TIMEOUT)) {
|
||||
|
||||
switch ($errno) {
|
||||
case -3:
|
||||
$this->errormsg = 'Socket creation failed (-3)';
|
||||
case -4:
|
||||
$this->errormsg = 'DNS lookup failure (-4)';
|
||||
case -5:
|
||||
$this->errormsg = 'Connection refused or timed out (-5)';
|
||||
default:
|
||||
$this->errormsg = 'Connection failed (' . $errno . ')';
|
||||
$this->errormsg .= ' ' . $errstr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->headers = "";
|
||||
$this->body = "";
|
||||
|
||||
/* Write */
|
||||
$request = "POST " . $this->path . " HTTP/1.0\r\n";
|
||||
$request .= "Connection: close\r\n";
|
||||
$request .= "Host: " . $this->host . "\r\n";
|
||||
$request .= "Content-type: application/x-www-form-urlencoded\r\n";
|
||||
$request .= "Content-length: " . strlen($data) . "\r\n";
|
||||
$request .= "Accept: */*\r\n";
|
||||
$request .= "\r\n";
|
||||
$request .= $data . "\r\n";
|
||||
$request .= "\r\n";
|
||||
fwrite($this->sock, $request);
|
||||
|
||||
/* Read */
|
||||
stream_set_blocking($this->sock, FALSE);
|
||||
$atStart = true;
|
||||
$IsHeader = true;
|
||||
$timeout = false;
|
||||
$start_time = time();
|
||||
while (!feof($this->sock) && !$timeout) {
|
||||
$line = fgets($this->sock, 4096);
|
||||
$diff = time() - $start_time;
|
||||
if ($diff >= READ_TIMEOUT) {
|
||||
$timeout = true;
|
||||
}
|
||||
if ($IsHeader) {
|
||||
if ($line == "") {
|
||||
continue;
|
||||
}
|
||||
if (substr($line, 0, 2) == "\r\n") {
|
||||
$IsHeader = false;
|
||||
continue;
|
||||
}
|
||||
$this->headers .= $line;
|
||||
if ($atStart) {
|
||||
$atStart = false;
|
||||
if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
|
||||
$this->errormsg = "Status code line invalid: " . htmlentities($line) . $m[1] . $m[2] . $m[3];
|
||||
fclose($this->sock);
|
||||
return false;
|
||||
}
|
||||
$http_version = $m[1];
|
||||
$this->status = $m[2];
|
||||
$status_string = $m[3];
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$this->body .= $line;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fclose($this->sock);
|
||||
|
||||
if ($timeout) {
|
||||
$this->errorcode = READ_TIMEOUT_ERR;
|
||||
$this->errormsg = "Socket Timeout(" . $diff . "SEC)";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
// return false;
|
||||
}
|
||||
|
||||
function getErrorCode() {
|
||||
return $this->errorcode;
|
||||
}
|
||||
|
||||
function getErrorMsg() {
|
||||
return $this->errormsg;
|
||||
}
|
||||
|
||||
function getBody() {
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
class INIStdPayUtil {
|
||||
|
||||
function getTimestamp() {
|
||||
// timezone 을 설정하지 않으면 getTimestapme() 실행시 오류가 발생한다.
|
||||
// php.ini 에 timezone 설정이 되어 잇으면 아래 코드가 필요없다.
|
||||
// php 5.3 이후로는 반드시 timezone 설정을 해야하기 때문에 아래 코드가 필요없을 수 있음. 나중에 확인 후 수정필요.
|
||||
// 이니시스 플로우에서 timestamp 값이 중요하게 사용되는 것으로 보이기 때문에 정확한 timezone 설정후 timestamp 값이 필요하지 않을까 함.
|
||||
|
||||
/**********php5
|
||||
date_default_timezone_set('Asia/Seoul');
|
||||
$date = new DateTime();
|
||||
*/
|
||||
|
||||
putenv('TZ=Asia/Seoul');
|
||||
|
||||
$milliseconds = round(microtime(true) * 1000);
|
||||
$tempValue1 = round($milliseconds / 1000); //max integer 자릿수가 9이므로 뒤 3자리를 뺀다
|
||||
$tempValue2 = round((float) microtime(false) * 1000); //뒤 3자리를 저장
|
||||
switch (strlen($tempValue2)) {
|
||||
case '3':
|
||||
break;
|
||||
case '2':
|
||||
$tempValue2 = "0" . $tempValue2;
|
||||
break;
|
||||
case '1':
|
||||
$tempValue2 = "00" . $tempValue2;
|
||||
break;
|
||||
default:
|
||||
$tempValue2 = "000";
|
||||
break;
|
||||
}
|
||||
|
||||
return "" . $tempValue1 . $tempValue2;
|
||||
}
|
||||
|
||||
/*
|
||||
//*** 위변조 방지체크를 signature 생성 ***
|
||||
|
||||
mid, price, timestamp 3개의 키와 값을
|
||||
key=value 형식으로 하여 '&'로 연결한 하여 SHA-256 Hash로 생성 된값
|
||||
ex) mid=INIpayTest&price=819000×tamp=2012-02-01 09:19:04.004
|
||||
|
||||
* key기준 알파벳 정렬
|
||||
* timestamp는 반드시 signature생성에 사용한 timestamp 값을 timestamp input에 그데로 사용하여야함
|
||||
*/
|
||||
|
||||
function makeSignature($signParam) {
|
||||
ksort($signParam);
|
||||
$string = "";
|
||||
foreach ($signParam as $key => $value) {
|
||||
$string .= "&$key=$value";
|
||||
}
|
||||
$string = substr($string, 1); // remove leading "&"
|
||||
|
||||
$sign = hash( "sha256", $string);
|
||||
|
||||
return $sign;
|
||||
}
|
||||
|
||||
function makeHash($data, $alg) {
|
||||
// $s = hash_hmac('sha256', $data, 'secret', true);
|
||||
// return base64_encode($s);
|
||||
|
||||
///$ret = openssl_digest($data, $alg);
|
||||
$ret = hash($alg, $data);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
//
|
||||
function makeSignatureAuth($parameters) {
|
||||
|
||||
if ($parameters == null || sizeof($parameters) == 0) {
|
||||
throw new Exception("<p>Parameters can not be empty.</P>");
|
||||
}
|
||||
|
||||
$stringToSign = ""; //반환용 text
|
||||
$mid = $parameters["mid"]; //mid
|
||||
$tstamp = $parameters["tstamp"]; //auth timestamp
|
||||
$MOID = $parameters["MOID"]; //OID
|
||||
$TotPrice = $parameters["TotPrice"]; //total price
|
||||
$tstampKey = substr($parameters["tstamp"], strlen($parameters["tstamp"]) - 1); // timestamp 마지막 자리 1자리 숫자
|
||||
|
||||
switch (intval($tstampKey)){
|
||||
case 1 :
|
||||
$stringToSign = "MOID=" . $MOID . "&mid=" . $mid . "&tstamp=" . $tstamp ;
|
||||
break;
|
||||
case 2 :
|
||||
$stringToSign = "MOID=" . $MOID . "&tstamp=" . $tstamp . "&mid=" . $mid ;
|
||||
break;
|
||||
case 3 :
|
||||
$stringToSign = "mid=" . $mid . "&MOID=" . $MOID . "&tstamp=" . $tstamp ;
|
||||
break;
|
||||
case 4 :
|
||||
$stringToSign = "mid=" . $mid . "&tstamp=" . $tstamp . "&MOID=" . $MOID ;
|
||||
break;
|
||||
case 5 :
|
||||
$stringToSign = "tstamp=" . $tstamp . "&mid=" . $mid . "&MOID=" . $MOID ;
|
||||
break;
|
||||
case 6 :
|
||||
$stringToSign = "tstamp=" . $tstamp . "&MOID=" . $MOID . "&mid=" . $mid ;
|
||||
break;
|
||||
case 7 :
|
||||
$stringToSign = "TotPrice=" . $TotPrice . "&mid=" . $mid . "&tstamp=" . $tstamp ;
|
||||
break;
|
||||
case 8 :
|
||||
$stringToSign = "TotPrice=" . $TotPrice . "&tstamp=" . $tstamp . "&mid=" . $mid ;
|
||||
break;
|
||||
case 9 :
|
||||
$stringToSign = "TotPrice=" . $TotPrice . "&MOID=" . $MOID . "&tstamp=" . $tstamp ;
|
||||
break;
|
||||
case 0 :
|
||||
$stringToSign = "TotPrice=" . $TotPrice . "&tstamp=" . $tstamp . "&MOID=" . $MOID ;
|
||||
break;
|
||||
}
|
||||
|
||||
$signature = hash("sha256", $stringToSign); // sha256 처리하여 hash 암호화
|
||||
//$signature = $this->makeHash($stringToSign, "sha256"); // sha256 처리하여 hash 암호화
|
||||
|
||||
return $signature;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
require_once('../libs/INIStdPayUtil.php');
|
||||
|
||||
$SignatureUtil = new INIStdPayUtil();
|
||||
|
||||
$input = "oid=" . $_REQUEST["oid"] . "&price=" . $_REQUEST["price"] . "×tamp=" . $_REQUEST["timestamp"];
|
||||
|
||||
$output['signature'] = array(
|
||||
///'signature' => $SignatureUtil->makeHash($input, "sha256")
|
||||
'signature' => hash("sha256", $input)
|
||||
);
|
||||
|
||||
echo json_encode($output);
|
||||
@@ -0,0 +1,804 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
||||
* format. It is easy for humans to read and write. It is easy for machines
|
||||
* to parse and generate. It is based on a subset of the JavaScript
|
||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
||||
* This feature can also be found in Python. JSON is a text format that is
|
||||
* completely language independent but uses conventions that are familiar
|
||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
||||
* ideal data-interchange language.
|
||||
*
|
||||
* This package provides a simple encoder and decoder for JSON notation. It
|
||||
* is intended for use with client-side Javascript applications that make
|
||||
* use of HTTPRequest to perform server communication functions - data can
|
||||
* be encoded into JSON notation for use in a client-side javascript, or
|
||||
* decoded from incoming Javascript requests. JSON format is native to
|
||||
* Javascript, and can be directly eval()'ed with no further parsing
|
||||
* overhead
|
||||
*
|
||||
* All strings should be in ASCII or UTF-8 format!
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met: Redistributions of source code must retain the
|
||||
* above copyright notice, this list of conditions and the following
|
||||
* disclaimer. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* @category
|
||||
* @package Services_JSON
|
||||
* @author Michal Migurski <mike-json@teczno.com>
|
||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
||||
* @copyright 2005 Michal Migurski
|
||||
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_SLICE', 1);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_STR', 2);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_ARR', 3);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_OBJ', 4);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_CMT', 5);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_LOOSE_TYPE', 16);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* Brief example of use:
|
||||
*
|
||||
* <code>
|
||||
* // create a new instance of Services_JSON
|
||||
* $json = new Services_JSON();
|
||||
*
|
||||
* // convert a complexe value to JSON notation, and send it to the browser
|
||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
||||
* $output = $json->encode($value);
|
||||
*
|
||||
* print($output);
|
||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
||||
*
|
||||
* // accept incoming POST data, assumed to be in JSON notation
|
||||
* $input = file_get_contents('php://input', 1000000);
|
||||
* $value = $json->decode($input);
|
||||
* </code>
|
||||
*/
|
||||
class Services_JSON
|
||||
{
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
* @param int $use object behavior flags; combine with boolean-OR
|
||||
*
|
||||
* possible values:
|
||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
||||
* "{...}" syntax creates associative arrays
|
||||
* instead of objects in decode().
|
||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
||||
* Values which can't be encoded (e.g. resources)
|
||||
* appear as NULL instead of throwing errors.
|
||||
* By default, a deeply-nested resource will
|
||||
* bubble up with an error, so all return values
|
||||
* from encode() should be checked with isError()
|
||||
*/
|
||||
function Services_JSON($use = 0)
|
||||
{
|
||||
$this->use = $use;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-16 char to one UTF-8 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf16 UTF-16 character
|
||||
* @return string UTF-8 character
|
||||
* @access private
|
||||
*/
|
||||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
|
||||
|
||||
switch(true) {
|
||||
case ((0x7F & $bytes) == $bytes):
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x7F & $bytes);
|
||||
|
||||
case (0x07FF & $bytes) == $bytes:
|
||||
// return a 2-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
|
||||
case (0xFFFF & $bytes) == $bytes:
|
||||
// return a 3-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-8 char to one UTF-16 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf8 UTF-8 character
|
||||
* @return string UTF-16 character
|
||||
* @access private
|
||||
*/
|
||||
function utf82utf16($utf8)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
}
|
||||
|
||||
switch(strlen($utf8)) {
|
||||
case 1:
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x07 & (ord($utf8[0]) >> 2))
|
||||
. chr((0xC0 & (ord($utf8[0]) << 6))
|
||||
| (0x3F & ord($utf8[1])));
|
||||
|
||||
case 3:
|
||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr((0xF0 & (ord($utf8[0]) << 4))
|
||||
| (0x0F & (ord($utf8[1]) >> 2)))
|
||||
. chr((0xC0 & (ord($utf8[1]) << 6))
|
||||
| (0x7F & ord($utf8[2])));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
||||
* if var is a strng, note that encode() always expects it
|
||||
* to be in ASCII or UTF-8 format!
|
||||
*
|
||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
||||
* @access public
|
||||
*/
|
||||
function encode($var)
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'integer':
|
||||
return (int) $var;
|
||||
|
||||
case 'double':
|
||||
case 'float':
|
||||
return (float) $var;
|
||||
|
||||
case 'string':
|
||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
||||
$ascii = '';
|
||||
$strlen_var = strlen($var);
|
||||
|
||||
/*
|
||||
* Iterate over every character in the string,
|
||||
* escaping with a slash or encoding to UTF-8 where necessary
|
||||
*/
|
||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||
|
||||
$ord_var_c = ord($var[$c]);
|
||||
|
||||
switch (true) {
|
||||
case $ord_var_c == 0x08:
|
||||
$ascii .= '\b';
|
||||
break;
|
||||
case $ord_var_c == 0x09:
|
||||
$ascii .= '\t';
|
||||
break;
|
||||
case $ord_var_c == 0x0A:
|
||||
$ascii .= '\n';
|
||||
break;
|
||||
case $ord_var_c == 0x0C:
|
||||
$ascii .= '\f';
|
||||
break;
|
||||
case $ord_var_c == 0x0D:
|
||||
$ascii .= '\r';
|
||||
break;
|
||||
|
||||
case $ord_var_c == 0x22:
|
||||
case $ord_var_c == 0x2F:
|
||||
case $ord_var_c == 0x5C:
|
||||
// double quote, slash, slosh
|
||||
$ascii .= '\\'.$var[$c];
|
||||
break;
|
||||
|
||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||
$ascii .= $var[$c];
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xE0) == 0xC0):
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c, ord($var[$c + 1]));
|
||||
$c += 1;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF0) == 0xE0):
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var[$c + 1]),
|
||||
ord($var[$c + 2]));
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF8) == 0xF0):
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var[$c + 1]),
|
||||
ord($var[$c + 2]),
|
||||
ord($var[$c + 3]));
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFC) == 0xF8):
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var[$c + 1]),
|
||||
ord($var[$c + 2]),
|
||||
ord($var[$c + 3]),
|
||||
ord($var[$c + 4]));
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFE) == 0xFC):
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var[$c + 1]),
|
||||
ord($var[$c + 2]),
|
||||
ord($var[$c + 3]),
|
||||
ord($var[$c + 4]),
|
||||
ord($var[$c + 5]));
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '"'.$ascii.'"';
|
||||
|
||||
case 'array':
|
||||
/*
|
||||
* As per JSON spec if any array key is not an integer
|
||||
* we must treat the the whole array as an object. We
|
||||
* also try to catch a sparsely populated associative
|
||||
* array with numeric keys here because some JS engines
|
||||
* will create an array with empty indexes up to
|
||||
* max_index which can cause memory issues and because
|
||||
* the keys, which may be relevant, will be remapped
|
||||
* otherwise.
|
||||
*
|
||||
* As per the ECMA and JSON specification an object may
|
||||
* have any string as a property. Unfortunately due to
|
||||
* a hole in the ECMA specification if the key is a
|
||||
* ECMA reserved word or starts with a digit the
|
||||
* parameter is only accessible using ECMAScript's
|
||||
* bracket notation.
|
||||
*/
|
||||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
}
|
||||
|
||||
// treat it like a regular array
|
||||
$elements = array_map(array($this, 'encode'), $var);
|
||||
|
||||
foreach($elements as $element) {
|
||||
if(Services_JSON::isError($element)) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
return '[' . join(',', $elements) . ']';
|
||||
|
||||
case 'object':
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
|
||||
default:
|
||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||
? 'null'
|
||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
||||
*
|
||||
* @param string $name name of key to use
|
||||
* @param mixed $value reference to an array element to be encoded
|
||||
*
|
||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
||||
* @access private
|
||||
*/
|
||||
function name_value($name, $value)
|
||||
{
|
||||
$encoded_value = $this->encode($value);
|
||||
|
||||
if(Services_JSON::isError($encoded_value)) {
|
||||
return $encoded_value;
|
||||
}
|
||||
|
||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduce a string by removing leading and trailing comments and whitespace
|
||||
*
|
||||
* @param $str string string value to strip of comments and whitespace
|
||||
*
|
||||
* @return string string value stripped of comments and whitespace
|
||||
* @access private
|
||||
*/
|
||||
function reduce_string($str)
|
||||
{
|
||||
$str = preg_replace(array(
|
||||
|
||||
// eliminate single line comments in '// ...' form
|
||||
'#^\s*//(.+)$#m',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
||||
'#^\s*/\*(.+)\*/#Us',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
||||
'#/\*(.+)\*/\s*$#Us'
|
||||
|
||||
), '', $str);
|
||||
|
||||
// eliminate extraneous space
|
||||
return trim($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
* @return mixed number, boolean, string, array, or object
|
||||
* corresponding to given JSON input string.
|
||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
||||
* Note that decode() always returns strings
|
||||
* in ASCII or UTF-8 format!
|
||||
* @access public
|
||||
*/
|
||||
function decode($str)
|
||||
{
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case 'null':
|
||||
return null;
|
||||
|
||||
default:
|
||||
$m = array();
|
||||
|
||||
if (is_numeric($str)) {
|
||||
// Lookie-loo, it's a number
|
||||
|
||||
// This would work on its own, but I'm trying to be
|
||||
// good about returning integers where appropriate:
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||
$delim = substr($str, 0, 1);
|
||||
$chrs = substr($str, 1, -1);
|
||||
$utf8 = '';
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
$ord_chrs_c = ord($chrs[$c]);
|
||||
|
||||
switch (true) {
|
||||
case $substr_chrs_c_2 == '\b':
|
||||
$utf8 .= chr(0x08);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\t':
|
||||
$utf8 .= chr(0x09);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\n':
|
||||
$utf8 .= chr(0x0A);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\f':
|
||||
$utf8 .= chr(0x0C);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\r':
|
||||
$utf8 .= chr(0x0D);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case $substr_chrs_c_2 == '\\"':
|
||||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
$utf8 .= $chrs[++$c];
|
||||
}
|
||||
break;
|
||||
|
||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
||||
// single, escaped unicode character
|
||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
||||
$utf8 .= $this->utf162utf8($utf16);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||
$utf8 .= $chrs[$c];
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 2);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 3);
|
||||
$c += 2;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 4);
|
||||
$c += 3;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 5);
|
||||
$c += 4;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 6);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $utf8;
|
||||
|
||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||
// array, or object notation
|
||||
|
||||
if ($str[0] == '[') {
|
||||
$stk = array(SERVICES_JSON_IN_ARR);
|
||||
$arr = array();
|
||||
} else {
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = array();
|
||||
} else {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
|
||||
$chrs = substr($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
||||
if ($chrs == '') {
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("\nparsing {$chrs}\n");
|
||||
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
||||
|
||||
$top = end($stk);
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
|
||||
if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||
// found a comma that is not inside a string, array, etc.,
|
||||
// OR we've reached the end of the character list
|
||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
// we are in an array, so just push an element onto the stack
|
||||
array_push($arr, $this->decode($slice));
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
// we are in an object, so figure
|
||||
// out the property name and set an
|
||||
// element in an associative array,
|
||||
// for now
|
||||
$parts = array();
|
||||
|
||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// "name":value pair
|
||||
$key = $this->decode($parts[1]);
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// name:value pair, where name is unquoted
|
||||
$key = $parts[1];
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||
// found a quote, and we are not inside a string
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c]));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs[$c] == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs[$c] == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
||||
} elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||
// found a right-bracket, and we're in an array
|
||||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs[$c] == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
||||
} elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||
// found a right-brace, and we're in an object
|
||||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
//print("Found start of comment at {$c}\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
||||
// found a comment end, and we're in one now
|
||||
array_pop($stk);
|
||||
$c++;
|
||||
|
||||
for ($i = $top['where']; $i <= $c; ++$i)
|
||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
||||
|
||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this should just call PEAR::isError()
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists('PEAR_Error')) {
|
||||
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
||||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
function get_inicis_iniapi_key() {
|
||||
global $default;
|
||||
|
||||
// iniapi_key 는 전체취소, 부분취소, 현금영수증, 에스크로 배송등록에 사용됨
|
||||
if ($default['de_card_test']) { // 테스트결제이면
|
||||
if ($default['de_inicis_mid'] === 'iniescrow0') { // 에스크로 테스트용 mid
|
||||
return 'yERbIlJ3NhTeObsA';
|
||||
} else if ($default['de_inicis_mid'] === 'INIpayTest'){ // 일반 테스트용 mid
|
||||
return 'ItEQKi3rY7uvDS8l';
|
||||
}
|
||||
}
|
||||
|
||||
return $default['de_inicis_iniapi_key'];
|
||||
}
|
||||
|
||||
function get_inicis_iniapi_iv() {
|
||||
global $default;
|
||||
|
||||
// iniapi_iv 는 현금영수증 발급에 사용됨
|
||||
if ($default['de_card_test']) { // 테스트결제이면
|
||||
if ($default['de_inicis_mid'] === 'iniescrow0') { // 에스크로 테스트용 mid
|
||||
return 'tOGDXbfoajk2DQ==';
|
||||
} else if ($default['de_inicis_mid'] === 'INIpayTest'){ // 일반 테스트용 mid
|
||||
return 'HYb3yQ4f65QL89==';
|
||||
}
|
||||
}
|
||||
|
||||
return $default['de_inicis_iniapi_iv'];
|
||||
}
|
||||
|
||||
// KG 이니시스 일반 주문 취소 함수
|
||||
// $args 변수의 타입은 array, $is_part 변수는 부분취소 구분 변수
|
||||
function inicis_tid_cancel($args, $is_part=false){
|
||||
global $default;
|
||||
|
||||
// step1. 요청을 위한 파라미터 설정
|
||||
// 가맹점관리자 > 상점정보 > 계약정보 > 부가정보 > INIAPI key 생성조회
|
||||
$key = isset($args['key']) ? $args['key'] : get_inicis_iniapi_key();
|
||||
$type = "Refund"; // 고정
|
||||
$paymethod = isset($args['paymethod']) ? $args['paymethod'] : "Card";
|
||||
$timestamp = isset($args['timestamp']) ? $args['timestamp'] : date("YmdHis");
|
||||
$clientIp = isset($args['clientIp']) ? $args['clientIp'] : $_SERVER['SERVER_ADDR'];
|
||||
$mid = isset($args['mid']) ? $args['mid'] : $default['de_inicis_mid'];
|
||||
$tid = $args['tid'];
|
||||
$msg = $args['msg'];
|
||||
|
||||
// 부분취소인 경우
|
||||
if ($is_part){
|
||||
$type = 'PartialRefund';
|
||||
$price = $args['price'];
|
||||
$confirmPrice = $args['confirmPrice'];
|
||||
|
||||
// INIAPIKey + type + paymethod + timestamp + clientIp + mid + tid + price + confirmPrice
|
||||
$hashData = hash("sha512",(string)$key.(string)$type.(string)$paymethod.(string)$timestamp.(string)$clientIp.(string)$mid.(string)$tid.(string)$price.(string)$confirmPrice); // hash 암호화
|
||||
|
||||
//step2. key=value 로 post 요청
|
||||
$data = array(
|
||||
'type' => $type,
|
||||
'paymethod' => $paymethod,
|
||||
'timestamp' => $timestamp,
|
||||
'clientIp' => $clientIp,
|
||||
'mid' => $mid,
|
||||
'tid' => $tid,
|
||||
'price' => $price,
|
||||
'confirmPrice' => $confirmPrice,
|
||||
'msg' => $msg,
|
||||
'hashData'=> $hashData
|
||||
);
|
||||
} else {
|
||||
// 전체취소인 경우
|
||||
// INIAPIKey + type + paymethod + timestamp + clientIp + mid + tid
|
||||
$hashData = hash("sha512", (string)$key.(string)$type.(string)$paymethod.(string)$timestamp.(string)$clientIp.(string)$mid.(string)$tid); // hash 암호화
|
||||
|
||||
//step2. key=value 로 post 요청
|
||||
$data = array(
|
||||
'type' => $type,
|
||||
'paymethod' => $paymethod,
|
||||
'timestamp' => $timestamp,
|
||||
'clientIp' => $clientIp,
|
||||
'mid' => $mid,
|
||||
'tid' => $tid,
|
||||
'msg' => $msg,
|
||||
'hashData'=> $hashData
|
||||
);
|
||||
}
|
||||
|
||||
$url = "https://iniapi.inicis.com/api/v1/refund";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=utf-8'));
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
//step3. 요청 결과
|
||||
return $response;
|
||||
}
|
||||
|
||||
function get_type_inicis_paymethod($od_settle_case){
|
||||
$ini_paymethod = '';
|
||||
|
||||
switch ($od_settle_case) {
|
||||
case '신용카드':
|
||||
case '간편결제':
|
||||
$ini_paymethod = 'Card';
|
||||
break;
|
||||
case '가상계좌':
|
||||
$ini_paymethod = 'GVacct'; // 가상계좌 (입금전, 채번취소 시 사용)
|
||||
break;
|
||||
case '계좌이체':
|
||||
$ini_paymethod = 'Acct';
|
||||
break;
|
||||
case '휴대폰':
|
||||
$ini_paymethod = 'HPP';
|
||||
break;
|
||||
}
|
||||
|
||||
if (! $ini_paymethod) {
|
||||
if (is_inicis_order_pay($od_settle_case)) {
|
||||
$ini_paymethod = 'Card';
|
||||
}
|
||||
}
|
||||
|
||||
return $ini_paymethod;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2015-11-05
|
||||
* Time: 오후 2:59
|
||||
*/
|
||||
|
||||
if (!function_exists('json_decode')) {
|
||||
function json_decode($content, $assoc=false) {
|
||||
require_once 'JSON.php';
|
||||
if ($assoc) {
|
||||
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
|
||||
}
|
||||
else {
|
||||
$json = new Services_JSON;
|
||||
}
|
||||
return $json->decode($content);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('json_encode')) {
|
||||
function json_encode($content) {
|
||||
require_once 'JSON.php';
|
||||
$json = new Services_JSON;
|
||||
return $json->encode($content);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
class properties {
|
||||
|
||||
function getAuthUrl($idc_name) {
|
||||
$url = "stdpay.inicis.com/api/payAuth";
|
||||
switch ($idc_name) {
|
||||
case 'fc':
|
||||
$authUrl = "https://fc".$url;
|
||||
break;
|
||||
case 'ks':
|
||||
$authUrl = "https://ks".$url;
|
||||
break;
|
||||
case 'stg':
|
||||
$authUrl = "https://stg".$url;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $authUrl;
|
||||
}
|
||||
|
||||
function getNetCancel($idc_name) {
|
||||
$url = "stdpay.inicis.com/api/netCancel";
|
||||
switch ($idc_name) {
|
||||
case 'fc':
|
||||
$netCancel = "https://fc".$url;
|
||||
break;
|
||||
case 'ks':
|
||||
$netCancel = "https://ks".$url;
|
||||
break;
|
||||
case 'stg':
|
||||
$netCancel = "https://stg".$url;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $netCancel;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,411 @@
|
||||
<?php
|
||||
/*
|
||||
* Transparent SHA-256 Implementation for PHP 4 and PHP 5
|
||||
*
|
||||
* Author: Perry McGee (pmcgee@nanolink.ca)
|
||||
* Website: http://www.nanolink.ca/pub/sha256
|
||||
*
|
||||
* Copyright (C) 2006,2007,2008,2009 Nanolink Solutions
|
||||
*
|
||||
* Created: Feb 11, 2006
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
* or see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Include:
|
||||
*
|
||||
* require_once("[path/]sha256.inc.php");
|
||||
*
|
||||
* Usage Options:
|
||||
*
|
||||
* 1) $shaStr = hash('sha256', $string_to_hash);
|
||||
*
|
||||
* 2) $shaStr = sha256($string_to_hash[, bool ignore_php5_hash = false]);
|
||||
*
|
||||
* 3) $obj = new nanoSha2([bool $upper_case_output = false]);
|
||||
* $shaStr = $obj->hash($string_to_hash[, bool $ignore_php5_hash = false]);
|
||||
*
|
||||
* Reference: http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html
|
||||
*
|
||||
* 2007-12-13: Cleaned up for initial public release
|
||||
* 2008-05-10: Moved all helper functions into a class. API access unchanged.
|
||||
* 2009-06-23: Created abstraction of hash() routine
|
||||
* 2009-07-23: Added detection of 32 vs 64bit platform, and patches.
|
||||
* Ability to define "_NANO_SHA2_UPPER" to yeild upper case hashes.
|
||||
* 2009-08-01: Added ability to attempt to use mhash() prior to running pure
|
||||
* php code.
|
||||
* 2022-05-19: PHP 8.1 부터 deprecate 되는 mhash() 삭제
|
||||
*
|
||||
* NOTE: Some sporadic versions of PHP do not handle integer overflows the
|
||||
* same as the majority of builds. If you get hash results of:
|
||||
* 7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff7fffffff
|
||||
*
|
||||
* If you do not have permissions to change PHP versions (if you did
|
||||
* you'd probably upgrade to PHP 5 anyway) it is advised you install a
|
||||
* module that will allow you to use their hashing routines, examples are:
|
||||
* - mhash module : http://ca3.php.net/mhash
|
||||
* - Suhosin : http://www.hardened-php.net/suhosin/
|
||||
*
|
||||
* If you install the Suhosin module, this script will transparently
|
||||
* use their routine and define the PHP routine as _nano_sha256().
|
||||
*
|
||||
* If the mhash module is present, and $ignore_php5_hash = false the
|
||||
* script will attempt to use the output from mhash prior to running
|
||||
* the PHP code.
|
||||
*/
|
||||
if (!class_exists('nanoSha2'))
|
||||
{
|
||||
class nanoSha2
|
||||
{
|
||||
// php 4 - 5 compatable class properties
|
||||
var $toUpper;
|
||||
var $platform;
|
||||
|
||||
// Php 4 - 6 compatable constructor
|
||||
// PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP
|
||||
// function nanoSha2($toUpper = false) {
|
||||
function __construct($toUpper = false) {
|
||||
// Determine if the caller wants upper case or not.
|
||||
$this->toUpper = is_bool($toUpper)
|
||||
? $toUpper
|
||||
: ((defined('_NANO_SHA2_UPPER')) ? true : false);
|
||||
|
||||
// Deteremine if the system is 32 or 64 bit.
|
||||
$tmpInt = (int)4294967295;
|
||||
$this->platform = ($tmpInt > 0) ? 64 : 32;
|
||||
}
|
||||
|
||||
// Do the SHA-256 Padding routine (make input a multiple of 512 bits)
|
||||
function char_pad($str)
|
||||
{
|
||||
$tmpStr = $str;
|
||||
|
||||
$l = strlen($tmpStr)*8; // # of bits from input string
|
||||
|
||||
$tmpStr .= "\x80"; // append the "1" bit followed by 7 0's
|
||||
|
||||
$k = (512 - (($l + 8 + 64) % 512)) / 8; // # of 0 bytes to append
|
||||
$k += 4; // PHP Strings will never exceed (2^31)-1, 1st 32bits of
|
||||
// the 64-bit value representing $l can be all 0's
|
||||
|
||||
for ($x = 0; $x < $k; $x++) {
|
||||
$tmpStr .= "\0";
|
||||
}
|
||||
|
||||
// append the 32-bits representing # of bits from input string ($l)
|
||||
$tmpStr .= chr((($l>>24) & 0xFF));
|
||||
$tmpStr .= chr((($l>>16) & 0xFF));
|
||||
$tmpStr .= chr((($l>>8) & 0xFF));
|
||||
$tmpStr .= chr(($l & 0xFF));
|
||||
|
||||
return $tmpStr;
|
||||
}
|
||||
|
||||
// Here are the bitwise and functions as defined in FIPS180-2 Standard
|
||||
function addmod2n($x, $y, $n = 4294967296) // Z = (X + Y) mod 2^32
|
||||
{
|
||||
$mask = 0x80000000;
|
||||
|
||||
if ($x < 0) {
|
||||
$x &= 0x7FFFFFFF;
|
||||
$x = (float)$x + $mask;
|
||||
}
|
||||
|
||||
if ($y < 0) {
|
||||
$y &= 0x7FFFFFFF;
|
||||
$y = (float)$y + $mask;
|
||||
}
|
||||
|
||||
$r = $x + $y;
|
||||
|
||||
if ($r >= $n) {
|
||||
while ($r >= $n) {
|
||||
$r -= $n;
|
||||
}
|
||||
}
|
||||
|
||||
return (int)$r;
|
||||
}
|
||||
|
||||
// Logical bitwise right shift (PHP default is arithmetic shift)
|
||||
function SHR($x, $n) // x >> n
|
||||
{
|
||||
if ($n >= 32) { // impose some limits to keep it 32-bit
|
||||
return (int)0;
|
||||
}
|
||||
|
||||
if ($n <= 0) {
|
||||
return (int)$x;
|
||||
}
|
||||
|
||||
$mask = 0x40000000;
|
||||
|
||||
if ($x < 0) {
|
||||
$x &= 0x7FFFFFFF;
|
||||
$mask = $mask >> ($n-1);
|
||||
return ($x >> $n) | $mask;
|
||||
}
|
||||
|
||||
return (int)$x >> (int)$n;
|
||||
}
|
||||
|
||||
function ROTR($x, $n) { return (int)(($this->SHR($x, $n) | ($x << (32-$n)) & 0xFFFFFFFF)); }
|
||||
function Ch($x, $y, $z) { return ($x & $y) ^ ((~$x) & $z); }
|
||||
function Maj($x, $y, $z) { return ($x & $y) ^ ($x & $z) ^ ($y & $z); }
|
||||
function Sigma0($x) { return (int) ($this->ROTR($x, 2)^$this->ROTR($x, 13)^$this->ROTR($x, 22)); }
|
||||
function Sigma1($x) { return (int) ($this->ROTR($x, 6)^$this->ROTR($x, 11)^$this->ROTR($x, 25)); }
|
||||
function sigma_0($x) { return (int) ($this->ROTR($x, 7)^$this->ROTR($x, 18)^$this->SHR($x, 3)); }
|
||||
function sigma_1($x) { return (int) ($this->ROTR($x, 17)^$this->ROTR($x, 19)^$this->SHR($x, 10)); }
|
||||
|
||||
/*
|
||||
* Custom functions to provide PHP support
|
||||
*/
|
||||
// split a byte-string into integer array values
|
||||
function int_split($input)
|
||||
{
|
||||
$l = strlen($input);
|
||||
|
||||
if ($l <= 0) {
|
||||
return (int)0;
|
||||
}
|
||||
|
||||
if (($l % 4) != 0) { // invalid input
|
||||
return false;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $l; $i += 4)
|
||||
{
|
||||
$int_build = (ord($input[$i]) << 24);
|
||||
$int_build += (ord($input[$i+1]) << 16);
|
||||
$int_build += (ord($input[$i+2]) << 8);
|
||||
$int_build += (ord($input[$i+3]));
|
||||
|
||||
$result[] = $int_build;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process and return the hash.
|
||||
*
|
||||
* @param $str Input string to hash
|
||||
* @param $ig_func Option param to ignore checking for php > 5.1.2
|
||||
* @return string Hexadecimal representation of the message digest
|
||||
*/
|
||||
function hash($str, $ig_func = false)
|
||||
{
|
||||
unset($binStr); // binary representation of input string
|
||||
unset($hexStr); // 256-bit message digest in readable hex format
|
||||
|
||||
// check for php's internal sha256 function, ignore if ig_func==true
|
||||
if ($ig_func == false) {
|
||||
return hash("sha256", $str, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-256 Constants
|
||||
* Sequence of sixty-four constant 32-bit words representing the
|
||||
* first thirty-two bits of the fractional parts of the cube roots
|
||||
* of the first sixtyfour prime numbers.
|
||||
*/
|
||||
$K = array((int)0x428a2f98, (int)0x71374491, (int)0xb5c0fbcf,
|
||||
(int)0xe9b5dba5, (int)0x3956c25b, (int)0x59f111f1,
|
||||
(int)0x923f82a4, (int)0xab1c5ed5, (int)0xd807aa98,
|
||||
(int)0x12835b01, (int)0x243185be, (int)0x550c7dc3,
|
||||
(int)0x72be5d74, (int)0x80deb1fe, (int)0x9bdc06a7,
|
||||
(int)0xc19bf174, (int)0xe49b69c1, (int)0xefbe4786,
|
||||
(int)0x0fc19dc6, (int)0x240ca1cc, (int)0x2de92c6f,
|
||||
(int)0x4a7484aa, (int)0x5cb0a9dc, (int)0x76f988da,
|
||||
(int)0x983e5152, (int)0xa831c66d, (int)0xb00327c8,
|
||||
(int)0xbf597fc7, (int)0xc6e00bf3, (int)0xd5a79147,
|
||||
(int)0x06ca6351, (int)0x14292967, (int)0x27b70a85,
|
||||
(int)0x2e1b2138, (int)0x4d2c6dfc, (int)0x53380d13,
|
||||
(int)0x650a7354, (int)0x766a0abb, (int)0x81c2c92e,
|
||||
(int)0x92722c85, (int)0xa2bfe8a1, (int)0xa81a664b,
|
||||
(int)0xc24b8b70, (int)0xc76c51a3, (int)0xd192e819,
|
||||
(int)0xd6990624, (int)0xf40e3585, (int)0x106aa070,
|
||||
(int)0x19a4c116, (int)0x1e376c08, (int)0x2748774c,
|
||||
(int)0x34b0bcb5, (int)0x391c0cb3, (int)0x4ed8aa4a,
|
||||
(int)0x5b9cca4f, (int)0x682e6ff3, (int)0x748f82ee,
|
||||
(int)0x78a5636f, (int)0x84c87814, (int)0x8cc70208,
|
||||
(int)0x90befffa, (int)0xa4506ceb, (int)0xbef9a3f7,
|
||||
(int)0xc67178f2);
|
||||
|
||||
// Pre-processing: Padding the string
|
||||
$binStr = $this->char_pad($str);
|
||||
|
||||
// Parsing the Padded Message (Break into N 512-bit blocks)
|
||||
$M = str_split($binStr, 64);
|
||||
|
||||
// Set the initial hash values
|
||||
$h[0] = (int)0x6a09e667;
|
||||
$h[1] = (int)0xbb67ae85;
|
||||
$h[2] = (int)0x3c6ef372;
|
||||
$h[3] = (int)0xa54ff53a;
|
||||
$h[4] = (int)0x510e527f;
|
||||
$h[5] = (int)0x9b05688c;
|
||||
$h[6] = (int)0x1f83d9ab;
|
||||
$h[7] = (int)0x5be0cd19;
|
||||
|
||||
// loop through message blocks and compute hash. ( For i=1 to N : )
|
||||
$N = count($M);
|
||||
for ($i = 0; $i < $N; $i++)
|
||||
{
|
||||
// Break input block into 16 32bit words (message schedule prep)
|
||||
$MI = $this->int_split($M[$i]);
|
||||
|
||||
// Initialize working variables
|
||||
$_a = (int)$h[0];
|
||||
$_b = (int)$h[1];
|
||||
$_c = (int)$h[2];
|
||||
$_d = (int)$h[3];
|
||||
$_e = (int)$h[4];
|
||||
$_f = (int)$h[5];
|
||||
$_g = (int)$h[6];
|
||||
$_h = (int)$h[7];
|
||||
unset($_s0);
|
||||
unset($_s1);
|
||||
unset($_T1);
|
||||
unset($_T2);
|
||||
$W = array();
|
||||
|
||||
// Compute the hash and update
|
||||
for ($t = 0; $t < 16; $t++)
|
||||
{
|
||||
// Prepare the first 16 message schedule values as we loop
|
||||
$W[$t] = $MI[$t];
|
||||
|
||||
// Compute hash
|
||||
$_T1 = $this->addmod2n($this->addmod2n($this->addmod2n($this->addmod2n($_h, $this->Sigma1($_e)), $this->Ch($_e, $_f, $_g)), $K[$t]), $W[$t]);
|
||||
$_T2 = $this->addmod2n($this->Sigma0($_a), $this->Maj($_a, $_b, $_c));
|
||||
|
||||
// Update working variables
|
||||
$_h = $_g; $_g = $_f; $_f = $_e; $_e = $this->addmod2n($_d, $_T1);
|
||||
$_d = $_c; $_c = $_b; $_b = $_a; $_a = $this->addmod2n($_T1, $_T2);
|
||||
}
|
||||
|
||||
for (; $t < 64; $t++)
|
||||
{
|
||||
// Continue building the message schedule as we loop
|
||||
$_s0 = $W[($t+1)&0x0F];
|
||||
$_s0 = $this->sigma_0($_s0);
|
||||
$_s1 = $W[($t+14)&0x0F];
|
||||
$_s1 = $this->sigma_1($_s1);
|
||||
|
||||
$W[$t&0xF] = $this->addmod2n($this->addmod2n($this->addmod2n($W[$t&0xF], $_s0), $_s1), $W[($t+9)&0x0F]);
|
||||
|
||||
// Compute hash
|
||||
$_T1 = $this->addmod2n($this->addmod2n($this->addmod2n($this->addmod2n($_h, $this->Sigma1($_e)), $this->Ch($_e, $_f, $_g)), $K[$t]), $W[$t&0xF]);
|
||||
$_T2 = $this->addmod2n($this->Sigma0($_a), $this->Maj($_a, $_b, $_c));
|
||||
|
||||
// Update working variables
|
||||
$_h = $_g; $_g = $_f; $_f = $_e; $_e = $this->addmod2n($_d, $_T1);
|
||||
$_d = $_c; $_c = $_b; $_b = $_a; $_a = $this->addmod2n($_T1, $_T2);
|
||||
}
|
||||
|
||||
$h[0] = $this->addmod2n($h[0], $_a);
|
||||
$h[1] = $this->addmod2n($h[1], $_b);
|
||||
$h[2] = $this->addmod2n($h[2], $_c);
|
||||
$h[3] = $this->addmod2n($h[3], $_d);
|
||||
$h[4] = $this->addmod2n($h[4], $_e);
|
||||
$h[5] = $this->addmod2n($h[5], $_f);
|
||||
$h[6] = $this->addmod2n($h[6], $_g);
|
||||
$h[7] = $this->addmod2n($h[7], $_h);
|
||||
}
|
||||
|
||||
// Convert the 32-bit words into human readable hexadecimal format.
|
||||
$hexStr = sprintf("%08x%08x%08x%08x%08x%08x%08x%08x", $h[0], $h[1], $h[2], $h[3], $h[4], $h[5], $h[6], $h[7]);
|
||||
|
||||
return ($this->toUpper) ? strtoupper($hexStr) : $hexStr;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_split'))
|
||||
{
|
||||
/**
|
||||
* Splits a string into an array of strings with specified length.
|
||||
* Compatability with older verions of PHP
|
||||
*/
|
||||
function str_split($string, $split_length = 1)
|
||||
{
|
||||
$sign = ($split_length < 0) ? -1 : 1;
|
||||
$strlen = strlen($string);
|
||||
$split_length = abs($split_length);
|
||||
|
||||
if (($split_length == 0) || ($strlen == 0)) {
|
||||
$result = false;
|
||||
} elseif ($split_length >= $strlen) {
|
||||
$result[] = $string;
|
||||
} else {
|
||||
$length = $split_length;
|
||||
|
||||
for ($i = 0; $i < $strlen; $i++)
|
||||
{
|
||||
$i = (($sign < 0) ? $i + $length : $i);
|
||||
$result[] = substr($string, $sign*$i, $length);
|
||||
$i--;
|
||||
$i = (($sign < 0) ? $i : $i + $length);
|
||||
|
||||
$length = (($i + $split_length) > $strlen)
|
||||
? ($strlen - ($i + 1))
|
||||
: $split_length;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main routine called from an application using this include.
|
||||
*
|
||||
* General usage:
|
||||
* require_once('sha256.inc.php');
|
||||
* $hashstr = sha256('abc');
|
||||
*
|
||||
* Note:
|
||||
* PHP Strings are limitd to (2^31)-1, so it is not worth it to
|
||||
* check for input strings > 2^64 as the FIPS180-2 defines.
|
||||
*/
|
||||
// 2009-07-23: Added check for function as the Suhosin plugin adds this routine.
|
||||
if (!function_exists('sha256')) {
|
||||
function sha256($str, $ig_func = false) {
|
||||
$obj = new nanoSha2((defined('_NANO_SHA2_UPPER')) ? true : false);
|
||||
return $obj->hash($str, $ig_func);
|
||||
}
|
||||
} else {
|
||||
function _nano_sha256($str, $ig_func = false) {
|
||||
$obj = new nanoSha2((defined('_NANO_SHA2_UPPER')) ? true : false);
|
||||
return $obj->hash($str, $ig_func);
|
||||
}
|
||||
}
|
||||
|
||||
// support to give php4 the hash() routine which abstracts this code.
|
||||
if (!function_exists('hash'))
|
||||
{
|
||||
function hash($algo, $data)
|
||||
{
|
||||
if (empty($algo) || !is_string($algo) || !is_string($data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (function_exists($algo)) {
|
||||
return $algo($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
//삼성페이 또는 Lpay 또는 이니시스 카카오페이 사용시에만 해당함
|
||||
if( ! ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) || ('inicis' == $default['de_pg_service']) ){ //PG가 이니시스인 경우 아래 내용 사용 안함
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
//이니시스 lpay 사용시에만 해당함
|
||||
if( ! ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) || ('inicis' == $default['de_pg_service']) ){ //PG가 이니시스인 경우 아래 내용 사용 안함
|
||||
return;
|
||||
}
|
||||
|
||||
add_javascript('<script language="javascript" type="text/javascript" src="'.$stdpay_js_url.'" charset="UTF-8"></script>', 10);
|
||||
?>
|
||||
|
||||
<form name="inicis_pay_form" id="inicis_pay_form" method="POST">
|
||||
|
||||
<?php /* 주문폼 자바스크립트 에러 방지를 위해 추가함 */ ?>
|
||||
<input type="hidden" name="good_mny" value="">
|
||||
<?php
|
||||
if($default['de_tax_flag_use']) {
|
||||
?>
|
||||
<input type="hidden" name="comm_tax_mny" value=""> <!-- 과세금액 -->
|
||||
<input type="hidden" name="comm_vat_mny" value=""> <!-- 부가세 -->
|
||||
<input type="hidden" name="comm_free_mny" value=""> <!-- 비과세 금액 -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<input type="hidden" name="version" value="1.0" >
|
||||
<input type="hidden" name="mid" value="<?php echo $mid; ?>">
|
||||
<input type="hidden" name="oid" value="<?php echo $od_id; ?>">
|
||||
<input type="hidden" name="goodname" value="">
|
||||
<input type="hidden" name="price" value="">
|
||||
<input type="hidden" name="buyername" value="">
|
||||
<input type="hidden" name="buyeremail" value="">
|
||||
<input type="hidden" name="parentemail" value="">
|
||||
<input type="hidden" name="buyertel" value="">
|
||||
<input type="hidden" name="recvname" value="">
|
||||
<input type="hidden" name="recvtel" value="">
|
||||
<input type="hidden" name="recvaddr" value="">
|
||||
<input type="hidden" name="recvpostnum" value="">
|
||||
|
||||
<!-- 기타설정 -->
|
||||
<input type="hidden" name="currency" value="WON">
|
||||
|
||||
<!-- 결제방법 -->
|
||||
<input type="hidden" name="gopaymethod" value="">
|
||||
|
||||
<!--
|
||||
SKIN : 플러그인 스킨 칼라 변경 기능 - 6가지 칼라(ORIGINAL, GREEN, ORANGE, BLUE, KAKKI, GRAY)
|
||||
HPP : 컨텐츠 또는 실물 결제 여부에 따라 HPP(1)과 HPP(2)중 선택 적용(HPP(1):컨텐츠, HPP(2):실물).
|
||||
Card(0): 신용카드 지불시에 이니시스 대표 가맹점인 경우에 필수적으로 세팅 필요 ( 자체 가맹점인 경우에는 카드사의 계약에 따라 설정) - 자세한 내용은 메뉴얼 참조.
|
||||
OCB : OK CASH BAG 가맹점으로 신용카드 결제시에 OK CASH BAG 적립을 적용하시기 원하시면 "OCB" 세팅 필요 그 외에 경우에는 삭제해야 정상적인 결제 이루어짐.
|
||||
no_receipt : 은행계좌이체시 현금영수증 발행여부 체크박스 비활성화 (현금영수증 발급 계약이 되어 있어야 사용가능)
|
||||
-->
|
||||
<input type="hidden" name="acceptmethod" value="<?php echo $acceptmethod; ?>">
|
||||
|
||||
<!--
|
||||
플러그인 좌측 상단 상점 로고 이미지 사용
|
||||
이미지의 크기 : 90 X 34 pixels
|
||||
플러그인 좌측 상단에 상점 로고 이미지를 사용하실 수 있으며,
|
||||
주석을 풀고 이미지가 있는 URL을 입력하시면 플러그인 상단 부분에 상점 이미지를 삽입할수 있습니다.
|
||||
-->
|
||||
<!--input type="hidden" name="ini_logoimage_url" value="http://[사용할 이미지주소]"-->
|
||||
|
||||
<!--
|
||||
좌측 결제메뉴 위치에 이미지 추가
|
||||
이미지의 크기 : 단일 결제 수단 - 91 X 148 pixels, 신용카드/ISP/계좌이체/가상계좌 - 91 X 96 pixels
|
||||
좌측 결제메뉴 위치에 미미지를 추가하시 위해서는 담당 영업대표에게 사용여부 계약을 하신 후
|
||||
주석을 풀고 이미지가 있는 URL을 입력하시면 플러그인 좌측 결제메뉴 부분에 이미지를 삽입할수 있습니다.
|
||||
-->
|
||||
<!--input type="hidden" name="ini_menuarea_url" value="http://[사용할 이미지주소]"-->
|
||||
|
||||
<!--
|
||||
플러그인에 의해서 값이 채워지거나, 플러그인이 참조하는 필드들
|
||||
삭제/수정 불가
|
||||
-->
|
||||
<input type="hidden" name="timestamp" value="">
|
||||
<input type="hidden" name="signature" value="">
|
||||
<input type="hidden" name="returnUrl" value="<?php echo $returnUrl; ?>">
|
||||
<input type="hidden" name="mKey" value="">
|
||||
<input type="hidden" name="charset" value="UTF-8">
|
||||
<input type="hidden" name="payViewType" value="overlay">
|
||||
<input type="hidden" name="closeUrl" value="<?php echo $closeUrl; ?>">
|
||||
<input type="hidden" name="popupUrl" value="<?php echo $popupUrl; ?>">
|
||||
<input type="hidden" name="nointerest" value="<?php echo $cardNoInterestQuota; ?>">
|
||||
<input type="hidden" name="quotabase" value="<?php echo $cardQuotaBase; ?>">
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
<input type="hidden" name="tax" value="">
|
||||
<input type="hidden" name="taxfree" value="">
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
<script language=javascript>
|
||||
function make_signature(frm)
|
||||
{
|
||||
// 데이터 암호화 처리
|
||||
var result = true;
|
||||
$.ajax({
|
||||
url: g5_url+"/shop/inicis/makesignature.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
price : frm.good_mny.value
|
||||
},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
cache: false,
|
||||
success: function(data) {
|
||||
if(data.error == "") {
|
||||
frm.timestamp.value = data.timestamp;
|
||||
frm.signature.value = data.sign;
|
||||
frm.mKey.value = data.mKey;
|
||||
} else {
|
||||
alert(data.error);
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function paybtn(f) {
|
||||
INIStdPay.pay(f.id);
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
//삼성페이 또는 L.pay 또는 이니시스 카카오페이 사용시에만 해당함
|
||||
if( ! ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) || ('inicis' == $default['de_pg_service']) ){ //PG가 이니시스인 경우 아래 내용 사용 안함
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
jQuery(function($){
|
||||
$( document ).ready(function() {
|
||||
var pf = document.forderform;
|
||||
|
||||
$(pf).on("form_sumbit_order_samsungpay", inicis_pay_form_submit);
|
||||
|
||||
function inicis_pay_form_submit(){
|
||||
var $form = $(this),
|
||||
pf = $form[0],
|
||||
inicis_pay_form = document.inicis_pay_form,
|
||||
inicis_settle_case = jQuery("input[name='od_settle_case']:checked").val();
|
||||
|
||||
inicis_pay_form.gopaymethod.value = (inicis_settle_case === "inicis_kakaopay") ? "onlykakaopay" : "onlylpay";
|
||||
inicis_pay_form.acceptmethod.value = "cardonly";
|
||||
|
||||
inicis_pay_form.price.value = inicis_pay_form.good_mny.value = pf.good_mny.value;
|
||||
inicis_pay_form.goodname.value = pf.od_goods_name.value;
|
||||
|
||||
inicis_pay_form.buyername.value = pf.od_name.value;
|
||||
inicis_pay_form.buyeremail.value = pf.od_email.value;
|
||||
inicis_pay_form.buyertel.value = pf.od_hp.value ? pf.od_hp.value : pf.od_tel.value;
|
||||
inicis_pay_form.recvname.value = pf.od_b_name.value;
|
||||
inicis_pay_form.recvtel.value = pf.od_b_hp.value ? pf.od_b_hp.value : pf.od_b_tel.value;
|
||||
inicis_pay_form.recvpostnum.value = pf.od_b_zip.value;
|
||||
inicis_pay_form.recvaddr.value = pf.od_b_addr1.value + " " +pf.od_b_addr2.value;
|
||||
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
inicis_pay_form.comm_tax_mny.value = pf.comm_tax_mny.value;
|
||||
inicis_pay_form.comm_vat_mny.value = pf.comm_vat_mny.value;
|
||||
inicis_pay_form.comm_free_mny.value = pf.comm_free_mny.value;
|
||||
inicis_pay_form.tax.value = pf.comm_vat_mny.value;
|
||||
inicis_pay_form.taxfree.value = pf.comm_free_mny.value;
|
||||
<?php } ?>
|
||||
|
||||
// 주문 정보 임시저장
|
||||
var order_data = $(pf).serialize();
|
||||
var save_result = "";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: order_data,
|
||||
url: g5_url+"/shop/ajax.orderdatasave.php",
|
||||
cache: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
save_result = data;
|
||||
}
|
||||
});
|
||||
|
||||
if(save_result) {
|
||||
alert(save_result);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!make_signature(inicis_pay_form))
|
||||
return false;
|
||||
|
||||
setTimeout(function(){
|
||||
paybtn(inicis_pay_form);
|
||||
}, 1);
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
if($default['de_pg_service'] != 'inicis' && ! ($default['de_inicis_lpay_use'] || $default['de_inicis_kakaopay_use']) )
|
||||
die(json_encode(array('error'=>'올바른 방법으로 이용해 주십시오.')));
|
||||
|
||||
$orderNumber = get_session('ss_order_inicis_id');
|
||||
$price = preg_replace('#[^0-9]#', '', $_POST['price']);
|
||||
|
||||
if(strlen($price) < 1)
|
||||
die(json_encode(array('error'=>'가격이 올바르지 않습니다.')));
|
||||
|
||||
//
|
||||
//###################################
|
||||
// 2. 가맹점 확인을 위한 signKey를 해시값으로 변경 (SHA-256방식 사용)
|
||||
//###################################
|
||||
$mKey = hash("sha256", $signKey);
|
||||
|
||||
/*
|
||||
//*** 위변조 방지체크를 signature 생성 ***
|
||||
oid, price, timestamp 3개의 키와 값을
|
||||
key=value 형식으로 하여 '&'로 연결한 하여 SHA-256 Hash로 생성 된값
|
||||
ex) oid=INIpayTest_1432813606995&price=819000×tamp=2012-02-01 09:19:04.004
|
||||
* key기준 알파벳 정렬
|
||||
* timestamp는 반드시 signature생성에 사용한 timestamp 값을 timestamp input에 그대로 사용하여야함
|
||||
*/
|
||||
$params = "oid=" . $orderNumber . "&price=" . $price . "×tamp=" . $timestamp;
|
||||
$sign = hash("sha256", $params);
|
||||
|
||||
die(json_encode(array('error'=>'', 'mKey'=>$mKey, 'timestamp'=>$timestamp, 'sign'=>$sign)));
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 전자결제를 사용할 때만 실행
|
||||
if($default['de_iche_use'] || $default['de_vbank_use'] || $default['de_hp_use'] || $default['de_card_use'] || $default['de_easy_pay_use']) {
|
||||
add_javascript('<script language="javascript" type="text/javascript" src="'.$stdpay_js_url.'" charset="UTF-8"></script>', 10);
|
||||
?>
|
||||
|
||||
<script language=javascript>
|
||||
function make_signature(frm)
|
||||
{
|
||||
// 데이터 암호화 처리
|
||||
var result = true;
|
||||
$.ajax({
|
||||
url: g5_url+"/shop/inicis/makesignature.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
price : frm.good_mny.value
|
||||
},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
cache: false,
|
||||
success: function(data) {
|
||||
if(data.error == "") {
|
||||
frm.timestamp.value = data.timestamp;
|
||||
frm.signature.value = data.sign;
|
||||
frm.mKey.value = data.mKey;
|
||||
} else {
|
||||
alert(data.error);
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function paybtn(f) {
|
||||
INIStdPay.pay(f.id);
|
||||
}
|
||||
</script>
|
||||
<?php }
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<?php /* 주문폼 자바스크립트 에러 방지를 위해 추가함 */ ?>
|
||||
<input type="hidden" name="good_mny" value="<?php echo $tot_price; ?>">
|
||||
<?php
|
||||
if($default['de_tax_flag_use']) {
|
||||
?>
|
||||
<input type="hidden" name="comm_tax_mny" value="<?php echo $comm_tax_mny; ?>"> <!-- 과세금액 -->
|
||||
<input type="hidden" name="comm_vat_mny" value="<?php echo $comm_vat_mny; ?>"> <!-- 부가세 -->
|
||||
<input type="hidden" name="comm_free_mny" value="<?php echo $comm_free_mny; ?>"> <!-- 비과세 금액 -->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<input type="hidden" name="version" value="1.0" >
|
||||
<input type="hidden" name="mid" value="<?php echo $mid; ?>">
|
||||
<input type="hidden" name="oid" value="<?php echo $od_id; ?>">
|
||||
<input type="hidden" name="goodname" value="<?php echo $goods; ?>">
|
||||
<input type="hidden" name="price" value="<?php echo $tot_price; ?>">
|
||||
<input type="hidden" name="buyername" value="">
|
||||
<input type="hidden" name="buyeremail" value="">
|
||||
<input type="hidden" name="parentemail" value="">
|
||||
<input type="hidden" name="buyertel" value="">
|
||||
<input type="hidden" name="recvname" value="">
|
||||
<input type="hidden" name="recvtel" value="">
|
||||
<input type="hidden" name="recvaddr" value="">
|
||||
<input type="hidden" name="recvpostnum" value="">
|
||||
|
||||
<!-- 기타설정 -->
|
||||
<input type="hidden" name="currency" value="WON">
|
||||
|
||||
<!-- 결제방법 -->
|
||||
<input type="hidden" name="gopaymethod" value="">
|
||||
|
||||
<!--
|
||||
SKIN : 플러그인 스킨 칼라 변경 기능 - 6가지 칼라(ORIGINAL, GREEN, ORANGE, BLUE, KAKKI, GRAY)
|
||||
HPP : 컨텐츠 또는 실물 결제 여부에 따라 HPP(1)과 HPP(2)중 선택 적용(HPP(1):컨텐츠, HPP(2):실물).
|
||||
Card(0): 신용카드 지불시에 이니시스 대표 가맹점인 경우에 필수적으로 세팅 필요 ( 자체 가맹점인 경우에는 카드사의 계약에 따라 설정) - 자세한 내용은 메뉴얼 참조.
|
||||
OCB : OK CASH BAG 가맹점으로 신용카드 결제시에 OK CASH BAG 적립을 적용하시기 원하시면 "OCB" 세팅 필요 그 외에 경우에는 삭제해야 정상적인 결제 이루어짐.
|
||||
no_receipt : 은행계좌이체시 현금영수증 발행여부 체크박스 비활성화 (현금영수증 발급 계약이 되어 있어야 사용가능)
|
||||
-->
|
||||
<input type="hidden" name="acceptmethod" value="<?php echo $acceptmethod; ?>">
|
||||
|
||||
<!--
|
||||
플러그인 좌측 상단 상점 로고 이미지 사용
|
||||
이미지의 크기 : 90 X 34 pixels
|
||||
플러그인 좌측 상단에 상점 로고 이미지를 사용하실 수 있으며,
|
||||
주석을 풀고 이미지가 있는 URL을 입력하시면 플러그인 상단 부분에 상점 이미지를 삽입할수 있습니다.
|
||||
-->
|
||||
<!--input type="hidden" name="ini_logoimage_url" value="http://[사용할 이미지주소]"-->
|
||||
|
||||
<!--
|
||||
좌측 결제메뉴 위치에 이미지 추가
|
||||
이미지의 크기 : 단일 결제 수단 - 91 X 148 pixels, 신용카드/ISP/계좌이체/가상계좌 - 91 X 96 pixels
|
||||
좌측 결제메뉴 위치에 미미지를 추가하시 위해서는 담당 영업대표에게 사용여부 계약을 하신 후
|
||||
주석을 풀고 이미지가 있는 URL을 입력하시면 플러그인 좌측 결제메뉴 부분에 이미지를 삽입할수 있습니다.
|
||||
-->
|
||||
<!--input type="hidden" name="ini_menuarea_url" value="http://[사용할 이미지주소]"-->
|
||||
|
||||
<!--
|
||||
플러그인에 의해서 값이 채워지거나, 플러그인이 참조하는 필드들
|
||||
삭제/수정 불가
|
||||
-->
|
||||
<input type="hidden" name="timestamp" value="">
|
||||
<input type="hidden" name="signature" value="">
|
||||
<input type="hidden" name="returnUrl" value="<?php echo $returnUrl; ?>">
|
||||
<input type="hidden" name="mKey" value="">
|
||||
<input type="hidden" name="charset" value="UTF-8">
|
||||
<input type="hidden" name="payViewType" value="overlay">
|
||||
<input type="hidden" name="closeUrl" value="<?php echo $closeUrl; ?>">
|
||||
<input type="hidden" name="popupUrl" value="<?php echo $popupUrl; ?>">
|
||||
<input type="hidden" name="nointerest" value="<?php echo $cardNoInterestQuota; ?>">
|
||||
<input type="hidden" name="quotabase" value="<?php echo $cardQuotaBase; ?>">
|
||||
<?php if($default['de_tax_flag_use']) { ?>
|
||||
<input type="hidden" name="tax" value="<?php echo $comm_vat_mny; ?>">
|
||||
<input type="hidden" name="taxfree" value="<?php echo $comm_free_mny; ?>">
|
||||
<?php }
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<div id="display_pay_button" class="btn_confirm">
|
||||
<input type="button" value="주문하기" onclick="forderform_check(this.form);" class="btn_submit">
|
||||
<a href="javascript:history.go(-1);" class="btn01">취소</a>
|
||||
</div>
|
||||
<div id="display_pay_process" style="display:none">
|
||||
<img src="<?php echo G5_URL; ?>/shop/img/loading.gif" alt="">
|
||||
<span>주문완료 중입니다. 잠시만 기다려 주십시오.</span>
|
||||
</div>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가;
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if($od['od_pg'] != 'inicis') return;
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
$vat_mny = round((int)$tax_mny / 1.1);
|
||||
|
||||
$currency = 'WON';
|
||||
$oldtid = $od['od_tno'];
|
||||
$price = (int)$tax_mny + (int)$free_mny; // 취소요청 금액
|
||||
$confirm_price = (int)$od['od_receipt_price'] - (int)$od['od_refund_price'] - $price; // 부분취소 후 남은금액
|
||||
$buyeremail = $od['od_email'];
|
||||
$tax = (int)$tax_mny - $vat_mny; // 부가세
|
||||
$taxfree = (int)$free_mny; // 비과세
|
||||
|
||||
$args = array(
|
||||
'paymethod' => get_type_inicis_paymethod($od['od_settle_case']),
|
||||
'tid' => $od['od_tno'],
|
||||
'msg' => $od['od_id'].' '.$mod_memo,
|
||||
'price' => $price,
|
||||
'confirmPrice' => $confirm_price,
|
||||
'tax' => $tax,
|
||||
'taxFree' => $taxfree
|
||||
);
|
||||
|
||||
$response = inicis_tid_cancel($args, true); // KG 이니시스 부분취소일 경우 inicis_tid_cancel 함수 2번째 인자값을 true로
|
||||
$result = json_decode($response, true);
|
||||
|
||||
if(isset($result['resultCode']) && $result['resultCode'] == '00') {
|
||||
// 환불금액기록
|
||||
$tno = $result['prtcTid'];
|
||||
$re_price = $result['prtcPrice'];
|
||||
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_refund_price = od_refund_price + '$re_price',
|
||||
od_shop_memo = concat(od_shop_memo, \"$mod_memo\")
|
||||
where od_id = '{$od['od_id']}'
|
||||
and od_tno = '$tno' ";
|
||||
sql_query($sql);
|
||||
|
||||
// 미수금 등의 정보 업데이트
|
||||
$info = get_order_info($od_id);
|
||||
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_misu = '{$info['od_misu']}',
|
||||
od_tax_mny = '{$info['od_tax_mny']}',
|
||||
od_vat_mny = '{$info['od_vat_mny']}',
|
||||
od_free_mny = '{$info['od_free_mny']}'
|
||||
where od_id = '$od_id' ";
|
||||
sql_query($sql);
|
||||
} else {
|
||||
if (isset($result['resultCode'])){
|
||||
alert($result['resultMsg'].' 코드 : '.$result['resultCode']);
|
||||
} else {
|
||||
alert('curl 오류로 부분환불에 실패했습니다.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<script language="javascript" type="text/javascript" src="https://stdpay.inicis.com/stdjs/INIStdPay_popup.js" charset="UTF-8"></script>
|
||||
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<script>
|
||||
// 현금영수증 MAIN FUNC
|
||||
function jsf__pay_cash( form )
|
||||
{
|
||||
jsf__show_progress(true);
|
||||
|
||||
if ( jsf__chk_cash( form ) == false )
|
||||
{
|
||||
jsf__show_progress(false);
|
||||
return;
|
||||
}
|
||||
|
||||
form.submit();
|
||||
}
|
||||
|
||||
// 진행 바
|
||||
function jsf__show_progress( show )
|
||||
{
|
||||
if ( show == true )
|
||||
{
|
||||
window.show_pay_btn.style.display = "none";
|
||||
window.show_progress.style.display = "inline";
|
||||
}
|
||||
else
|
||||
{
|
||||
window.show_pay_btn.style.display = "inline";
|
||||
window.show_progress.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
// 포맷 체크
|
||||
function jsf__chk_cash( form )
|
||||
{
|
||||
if ( form.tr_code[0].checked )
|
||||
{
|
||||
if ( form.id_info.value.length != 10 &&
|
||||
form.id_info.value.length != 11 &&
|
||||
form.id_info.value.length != 13 )
|
||||
{
|
||||
alert("주민번호 또는 휴대폰번호를 정확히 입력해 주시기 바랍니다.");
|
||||
form.id_info.select();
|
||||
form.id_info.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ( form.tr_code[1].checked )
|
||||
{
|
||||
if ( form.id_info.value.length != 10 )
|
||||
{
|
||||
alert("사업자번호를 정확히 입력해 주시기 바랍니다.");
|
||||
form.id_info.select();
|
||||
form.id_info.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function jsf__chk_tr_code( form )
|
||||
{
|
||||
var span_tr_code_0 = document.getElementById( "span_tr_code_0" );
|
||||
var span_tr_code_1 = document.getElementById( "span_tr_code_1" );
|
||||
|
||||
if ( form.tr_code[0].checked )
|
||||
{
|
||||
span_tr_code_0.style.display = "inline";
|
||||
span_tr_code_1.style.display = "none";
|
||||
}
|
||||
else if (form.tr_code[1].checked )
|
||||
{
|
||||
span_tr_code_0.style.display = "none";
|
||||
span_tr_code_1.style.display = "inline";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="scash" class="new_win">
|
||||
<h1 id="win_title"><?php echo $g5['title']; ?></h1>
|
||||
|
||||
<section>
|
||||
<h2>주문정보</h2>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col class="grid_3">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">주문 번호</th>
|
||||
<td><?php echo $od_id; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">상품 정보</th>
|
||||
<td><?php echo $goods_name; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">주문자 이름</th>
|
||||
<td><?php echo $od_name; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">주문자 E-Mail</th>
|
||||
<td><?php echo $od_email; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">주문자 전화번호</th>
|
||||
<td><?php echo $od_tel; ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>현금영수증 발급 정보</h2>
|
||||
|
||||
<form method="post" action="<?php echo G5_SHOP_URL; ?>/inicis/taxsave_result.php">
|
||||
<input type="hidden" name="tx" value="<?php echo $tx; ?>">
|
||||
<input type="hidden" name="od_id" value="<?php echo $od_id; ?>">
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col class="grid_3">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">원 거래 시각</th>
|
||||
<td><?php echo $trad_time; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">발행 용도</th>
|
||||
<td>
|
||||
<input type="radio" name="tr_code" value="0" id="tr_code1" onClick="jsf__chk_tr_code( this.form )" checked>
|
||||
<label for="tr_code1">소득공제용</label>
|
||||
<input type="radio" name="tr_code" value="1" id="tr_code2" onClick="jsf__chk_tr_code( this.form )">
|
||||
<label for="tr_code2">지출증빙용</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="id_info">
|
||||
<span id="span_tr_code_0" style="display:inline">주민(휴대폰)번호</span>
|
||||
<span id="span_tr_code_1" style="display:none">사업자번호</span>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="id_info" id="id_info" class="frm_input" size="16" maxlength="13"> ("-" 생략)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="buyeremail">이메일</label></th>
|
||||
<td><input type="text" name="buyeremail" id="buyeremail" value="<?php echo $od_email; ?>" required class="required frm_input" size="30"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="buyertel">휴대폰</label></th>
|
||||
<td><input type="text" name="buyertel" id="buyertel" value="" required class="required frm_input" size="20"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">거래금액 총합</th>
|
||||
<td><?php echo number_format($amt_tot); ?>원</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">공급가액</th>
|
||||
<td><?php echo number_format($amt_sup); ?>원<!-- ((거래금액 총합 * 10) / 11) --></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">봉사료</th>
|
||||
<td><?php echo number_format($amt_svc); ?>원</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">부가가치세</th>
|
||||
<td><?php echo number_format($amt_tax); ?>원<!-- 거래금액 총합 - 공급가액 - 봉사료 --></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="scash_apply">
|
||||
<span id="show_pay_btn">
|
||||
<button type="button" onclick="jsf__pay_cash( this.form )">등록요청</button>
|
||||
</span>
|
||||
<span id="show_progress" style="display:none">
|
||||
<b>등록 진행중입니다. 잠시만 기다려주십시오</b>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
$iv = get_inicis_iniapi_iv();
|
||||
if (strlen($iv) !== 16){
|
||||
alert('쇼핑몰설정 < KG이니시스 INIAPI IV 값을 16자리로 설정 후 이용해 주세요.');
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* 현금결제(실시간 은행계좌이체, 무통장입금)에 대한 현금결제 영수증 발행 요청한다.
|
||||
*
|
||||
*
|
||||
* http://www.inicis.com
|
||||
* http://support.inicis.com
|
||||
*/
|
||||
|
||||
$companynumber = isset($_REQUEST['companynumber']) ? clean_xss_tags($_REQUEST['companynumber'], 1, 1) : '';
|
||||
|
||||
if($tx == 'personalpay') {
|
||||
$od = sql_fetch(" select * from {$g5['g5_shop_personalpay_table']} where pp_id = '$od_id' ");
|
||||
if (!$od)
|
||||
die('<p id="scash_empty">개인결제 내역이 존재하지 않습니다.</p>');
|
||||
|
||||
if($od['pp_cash'] == 1)
|
||||
alert('이미 등록된 현금영수증 입니다.');
|
||||
|
||||
$buyername = $od['pp_name'];
|
||||
$goodname = $od['pp_name'].'님 개인결제';
|
||||
$amt_tot = (int)$od['pp_receipt_price'];
|
||||
$amt_sup = (int)round(($amt_tot * 10) / 11);
|
||||
$amt_svc = 0;
|
||||
$amt_tax = (int)($amt_tot - $amt_sup);
|
||||
} else {
|
||||
$od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
|
||||
if (!$od)
|
||||
die('<p id="scash_empty">주문서가 존재하지 않습니다.</p>');
|
||||
|
||||
if($od['od_cash'] == 1)
|
||||
alert('이미 등록된 현금영수증 입니다.');
|
||||
|
||||
$buyername = $od['od_name'];
|
||||
$goods = get_goods($od['od_id']);
|
||||
$goodname = $goods['full_name'];
|
||||
$amt_tot = (int)$od['od_tax_mny'] + (int)$od['od_vat_mny'] + (int)$od['od_free_mny'];
|
||||
$amt_sup = (int)$od['od_tax_mny'] + (int)$od['od_free_mny'];
|
||||
$amt_tax = (int)$od['od_vat_mny'];
|
||||
$amt_svc = 0;
|
||||
}
|
||||
|
||||
|
||||
$reg_num = $id_info;
|
||||
$useopt = $tr_code;
|
||||
$currency = 'WON';
|
||||
|
||||
//step1. 요청을 위한 파라미터 설정
|
||||
// 가맹점관리자 > 상점정보 > 계약정보 > 부가정보 > INIAPI key 생성조회, IV 도 조회 가능
|
||||
$key = get_inicis_iniapi_key();
|
||||
$iv = get_inicis_iniapi_iv();
|
||||
$type = "Issue";// 고정
|
||||
$paymethod = "Receipt";// 고정
|
||||
$timestamp = date("YmdHis");
|
||||
$clientIp = $_SERVER['SERVER_ADDR'];// 가맹점 요청 서버IP (추후 거래 확인 등에 사용됨)
|
||||
$mid = $default['de_inicis_mid'];
|
||||
$goodName = $goodname; // 상품명
|
||||
$crPrice = $amt_tot;// 총 현금결제 금액
|
||||
$supPrice = $amt_sup;// 공급가액
|
||||
$tax = $amt_tax;// 부가세
|
||||
$srcvPrice = $amt_svc;// 봉사료
|
||||
$buyerName = $buyername;// 구매자 성명
|
||||
$buyerEmail = $buyeremail;// 구매자 이메일 주소
|
||||
$buyerTel = $buyertel;// 구매자 전화번호
|
||||
$useOpt = $useopt;// 현금영수증 발행용도 ("1" - 소비자 소득공제용, "2" - 사업자 지출증빙용)
|
||||
$regNum = $reg_num;// 현금결제자 주민등록번호
|
||||
|
||||
// AES 암호화 (regNum)
|
||||
if (function_exists('openssl_encrypt')) {
|
||||
$enregNum = base64_encode(openssl_encrypt($regNum, 'aes-128-cbc', $key, OPENSSL_RAW_DATA, $iv));
|
||||
} else if (function_exists('mcrypt_encrypt')) {
|
||||
$padSize = 16 - (strlen($regNum) % 16);
|
||||
$value = $regNum.str_repeat(chr($padSize), $padSize);
|
||||
$enregNum = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $value, MCRYPT_MODE_CBC, $iv));
|
||||
} else {
|
||||
alert('openssl_encrypt 함수가 없어서 실행할수 없습니다.');
|
||||
}
|
||||
|
||||
// SHA512 Hash 암호화
|
||||
// INIAPIKey + type + paymethod + timestamp + clientIp + mid + tid + crPrice + supPrice + srcvPrice + enregNum
|
||||
$hashData = hash("sha512", (string)$key.(string)$type.(string)$paymethod.(string)$timestamp.(string)$clientIp.(string)$mid.(string)$crPrice.(string)$supPrice.(string)$srcvPrice.(string)$enregNum);
|
||||
|
||||
//step2. key=value 로 post 요청
|
||||
|
||||
$data = array(
|
||||
'type' => $type,
|
||||
'paymethod' => $paymethod,
|
||||
'timestamp' => $timestamp,
|
||||
'clientIp' => $clientIp,
|
||||
'mid' => $mid,
|
||||
'goodName' => $goodName,
|
||||
'crPrice' => $crPrice,
|
||||
'supPrice' => $supPrice,
|
||||
'tax' => $tax,
|
||||
'srcvPrice' => $srcvPrice,
|
||||
'buyerName' => $buyerName,
|
||||
'buyerEmail' => $buyerEmail,
|
||||
'buyerTel' => $buyerTel,
|
||||
'regNum' => $enregNum,
|
||||
'useOpt' => $useOpt,
|
||||
'compayNumber' => $companynumber,
|
||||
'hashData'=> $hashData
|
||||
);
|
||||
|
||||
$url = "https://iniapi.inicis.com/api/v1/receipt";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=utf-8'));
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
//step3. 요청 결과
|
||||
$ini_result = json_decode($response, true);
|
||||
|
||||
if (isset($ini_result['resultCode']) && $ini_result['resultCode'] == '00') {
|
||||
// DB 반영
|
||||
$cash_no = $ini_result['authNo']; // 현금영수증 승인번호
|
||||
|
||||
$cash = array();
|
||||
$cash['TID'] = $ini_result['tid'];
|
||||
$cash['ApplNum'] = $cash_no;
|
||||
$cash['ApplDate'] = $ini_result['authDate'];
|
||||
$cash['ApplTime'] = $ini_result['authTime'];
|
||||
$cash['CSHR_Type'] = $ini_result['authUseOpt'];
|
||||
$cash_info = serialize($cash);
|
||||
|
||||
if($tx == 'personalpay') {
|
||||
$sql = " update {$g5['g5_shop_personalpay_table']}
|
||||
set pp_cash = '1',
|
||||
pp_cash_no = '$cash_no',
|
||||
pp_cash_info = '$cash_info'
|
||||
where pp_id = '$od_id' ";
|
||||
} else {
|
||||
$sql = " update {$g5['g5_shop_order_table']}
|
||||
set od_cash = '1',
|
||||
od_cash_no = '$cash_no',
|
||||
od_cash_info = '$cash_info'
|
||||
where od_id = '$od_id' ";
|
||||
}
|
||||
|
||||
$result = sql_query($sql, false);
|
||||
|
||||
}
|
||||
|
||||
$g5['title'] = '현금영수증 발급';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<script>
|
||||
function showreceipt() // 현금 영수증 출력
|
||||
{
|
||||
var showreceiptUrl = "https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid=<?php echo($ini_result['tid']); ?>" + "&clpaymethod=22";
|
||||
window.open(showreceiptUrl,"showreceipt","width=380,height=540, scrollbars=no,resizable=no");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="lg_req_tx" class="new_win">
|
||||
<h1 id="win_title">현금영수증 - KG이니시스</h1>
|
||||
|
||||
<div class="tbl_head01 tbl_wrap">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col class="grid_4">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">결과코드</th>
|
||||
<td><?php echo $ini_result['resultCode']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">결과 메세지</th>
|
||||
<td><?php echo $ini_result['resultMsg']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">현금영수증 거래번호</th>
|
||||
<td><?php echo $ini_result['tid']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">현금영수증 승인번호</th>
|
||||
<td><?php echo $ini_result['authNo']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">승인시간</th>
|
||||
<td><?php echo preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3 \\4:\\5:\\6",$ini_result['authDate'].$ini_result['authTime']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">현금영수증 URL</th>
|
||||
<td>
|
||||
<button type="button" name="receiptView" class="btn_frmline" onClick="javascript:showreceipt();">영수증 확인</button>
|
||||
<p>영수증 확인은 실 등록의 경우에만 가능합니다.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,304 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/item.php');
|
||||
return;
|
||||
}
|
||||
|
||||
$it_id = isset($_GET['it_id']) ? get_search_string(trim($_GET['it_id'])) : '';
|
||||
$it_seo_title = isset($it_seo_title) ? $it_seo_title : '';
|
||||
|
||||
$it = get_shop_item_with_category($it_id, $it_seo_title);
|
||||
|
||||
if (! (isset($it['it_id']) && $it['it_id']))
|
||||
alert('자료가 없습니다.');
|
||||
|
||||
$it_id = $_REQUEST['it_id'] = $it['it_id'];
|
||||
|
||||
if( isset($row['it_seo_title']) && ! $row['it_seo_title'] ){
|
||||
shop_seo_title_update($row['it_id']);
|
||||
}
|
||||
|
||||
if (function_exists('check_case_exist_title')) check_case_exist_title($it, G5_SHOP_DIR, true);
|
||||
|
||||
if (!($it['ca_use'] && $it['it_use'])) {
|
||||
if (!$is_admin)
|
||||
alert('현재 판매가능한 상품이 아닙니다.');
|
||||
}
|
||||
|
||||
// 레벨확인
|
||||
if(!$is_admin) {
|
||||
|
||||
if(isset($it['it_level']) && $it['it_level'] > 0) {
|
||||
|
||||
if(isset($it['it_level_opt']) && $it['it_level_opt'] == 2) {
|
||||
if (isset($it['it_level']) && $it['it_level'] != $member['mb_level']) {
|
||||
alert('권한이 없습니다.', G5_URL);
|
||||
}
|
||||
} else {
|
||||
if (isset($it['it_level']) && $it['it_level'] > $member['mb_level']) {
|
||||
alert('권한이 없습니다.', G5_URL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
include_once(G5_LIB_PATH.'/iteminfo.lib.php');
|
||||
|
||||
// 분류 테이블에서 분류 상단, 하단 코드를 얻음
|
||||
$sql = " select ca_skin_dir, ca_include_head, ca_include_tail, ca_cert_use, ca_adult_use from {$g5['g5_shop_category_table']} where ca_id = '{$it['ca_id']}' ";
|
||||
$ca = sql_fetch($sql);
|
||||
|
||||
// 본인인증, 성인인증체크
|
||||
if(!$is_admin) {
|
||||
$msg = shop_member_cert_check($it_id, 'item');
|
||||
if($msg)
|
||||
alert($msg, G5_SHOP_URL);
|
||||
}
|
||||
|
||||
// 오늘 본 상품 저장 시작
|
||||
// tv 는 today view 약자
|
||||
$saved = false;
|
||||
$tv_idx = (int)get_session("ss_tv_idx");
|
||||
if ($tv_idx > 0) {
|
||||
for ($i=1; $i<=$tv_idx; $i++) {
|
||||
if (get_session("ss_tv[$i]") == $it_id) {
|
||||
$saved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$saved) {
|
||||
$tv_idx++;
|
||||
set_session("ss_tv_idx", $tv_idx);
|
||||
set_session("ss_tv[$tv_idx]", $it_id);
|
||||
}
|
||||
// 오늘 본 상품 저장 끝
|
||||
|
||||
// 조회수 증가
|
||||
if (get_cookie('ck_it_id') != $it_id) {
|
||||
sql_query(" update {$g5['g5_shop_item_table']} set it_hit = it_hit + 1 where it_id = '$it_id' "); // 1증가
|
||||
set_cookie("ck_it_id", $it_id, 3600); // 1시간동안 저장
|
||||
}
|
||||
|
||||
// 스킨경로
|
||||
$skin_dir = G5_SHOP_SKIN_PATH;
|
||||
$ca_dir_check = true;
|
||||
|
||||
if($it['it_skin']) {
|
||||
if(preg_match('#^theme/(.+)$#', $it['it_skin'], $match))
|
||||
$skin_dir = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/shop/'.$match[1];
|
||||
else
|
||||
$skin_dir = G5_PATH.'/'.G5_SKIN_DIR.'/shop/'.$it['it_skin'];
|
||||
|
||||
if(is_dir($skin_dir)) {
|
||||
$form_skin_file = $skin_dir.'/item.form.skin.php';
|
||||
|
||||
if(is_file($form_skin_file))
|
||||
$ca_dir_check = false;
|
||||
}
|
||||
}
|
||||
|
||||
if($ca_dir_check) {
|
||||
if($ca['ca_skin_dir']) {
|
||||
if(preg_match('#^theme/(.+)$#', $ca['ca_skin_dir'], $match))
|
||||
$skin_dir = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/shop/'.$match[1];
|
||||
else
|
||||
$skin_dir = G5_PATH.'/'.G5_SKIN_DIR.'/shop/'.$ca['ca_skin_dir'];
|
||||
|
||||
if(is_dir($skin_dir)) {
|
||||
$form_skin_file = $skin_dir.'/item.form.skin.php';
|
||||
|
||||
if(!is_file($form_skin_file))
|
||||
$skin_dir = G5_SHOP_SKIN_PATH;
|
||||
} else {
|
||||
$skin_dir = G5_SHOP_SKIN_PATH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define('G5_SHOP_CSS_URL', str_replace(G5_PATH, G5_URL, $skin_dir));
|
||||
|
||||
$g5['title'] = $it['it_name'].' > '.$it['ca_name'];
|
||||
|
||||
// 분류 상단 코드가 있으면 출력하고 없으면 기본 상단 코드 출력
|
||||
if ($ca['ca_include_head'] && is_include_path_check($ca['ca_include_head']))
|
||||
@include_once($ca['ca_include_head']);
|
||||
else
|
||||
include_once(G5_SHOP_PATH.'/_head.php');
|
||||
|
||||
// 분류 위치
|
||||
// HOME > 1단계 > 2단계 ... > 6단계 분류
|
||||
$ca_id = $it['ca_id'];
|
||||
$nav_skin = $skin_dir.'/navigation.skin.php';
|
||||
if(!is_file($nav_skin))
|
||||
$nav_skin = G5_SHOP_SKIN_PATH.'/navigation.skin.php';
|
||||
include $nav_skin;
|
||||
|
||||
if(defined('G5_THEME_USE_ITEM_CATEGORY') && G5_THEME_USE_ITEM_CATEGORY){
|
||||
// 이 분류에 속한 하위분류 출력
|
||||
$cate_skin = $skin_dir.'/listcategory.skin.php';
|
||||
if(!is_file($cate_skin))
|
||||
$cate_skin = G5_SHOP_SKIN_PATH.'/listcategory.skin.php';
|
||||
include $cate_skin;
|
||||
}
|
||||
|
||||
if ($is_admin) {
|
||||
echo '<div class="sit_admin"><a href="'.G5_ADMIN_URL.'/shop_admin/itemform.php?w=u&it_id='.$it_id.'" class="btn_admin btn" title="상품 관리"><span class="sound_only">상품 관리</span><i class="fa fa-cog fa-spin fa-fw"></i></a></div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- 상품 상세보기 시작 { -->
|
||||
<?php
|
||||
// 상단 HTML
|
||||
echo run_replace('shop_it_head_html', '<div id="sit_hhtml">'.conv_content($it['it_head_html'], 1).'</div>', $it);
|
||||
|
||||
// 보안서버경로
|
||||
if (G5_HTTPS_DOMAIN)
|
||||
$action_url = G5_HTTPS_DOMAIN.'/'.G5_SHOP_DIR.'/cartupdate.php';
|
||||
else
|
||||
$action_url = G5_SHOP_URL.'/cartupdate.php';
|
||||
|
||||
|
||||
// 이전 상품보기
|
||||
$sql = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id > '$it_id' and SUBSTRING(ca_id,1,4) = '".substr($it['ca_id'],0,4)."' and it_use = '1' order by it_id asc limit 1 ";
|
||||
$row = sql_fetch($sql);
|
||||
if (isset($row['it_id']) && $row['it_id']) {
|
||||
$prev_title = '이전상품<span class="sound_only"> '.$row['it_name'].'</span>';
|
||||
$prev_href = '<a href="'.get_pretty_url('shop', $row['it_id']).'" id="siblings_prev">';
|
||||
$prev_href2 = '</a>'.PHP_EOL;
|
||||
} else {
|
||||
$prev_title = '';
|
||||
$prev_href = '';
|
||||
$prev_href2 = '';
|
||||
}
|
||||
|
||||
// 다음 상품보기
|
||||
$sql = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id < '$it_id' and SUBSTRING(ca_id,1,4) = '".substr($it['ca_id'],0,4)."' and it_use = '1' order by it_id desc limit 1 ";
|
||||
$row = sql_fetch($sql);
|
||||
if (isset($row['it_id']) && $row['it_id']) {
|
||||
$next_title = '다음 상품<span class="sound_only"> '.$row['it_name'].'</span>';
|
||||
$next_href = '<a href="'.get_pretty_url('shop', $row['it_id']).'" id="siblings_next">';
|
||||
$next_href2 = '</a>'.PHP_EOL;
|
||||
} else {
|
||||
$next_title = '';
|
||||
$next_href = '';
|
||||
$next_href2 = '';
|
||||
}
|
||||
|
||||
// 고객선호도 별점수
|
||||
$star_score = get_star_image($it['it_id']);
|
||||
|
||||
// 관리자가 확인한 사용후기의 개수를 얻음
|
||||
$sql = " select count(*) as cnt from `{$g5['g5_shop_item_use_table']}` where it_id = '{$it_id}' and is_confirm = '1' ";
|
||||
$row = sql_fetch($sql);
|
||||
$item_use_count = $row['cnt'];
|
||||
|
||||
// 상품문의의 개수를 얻음
|
||||
$sql = " select count(*) as cnt from `{$g5['g5_shop_item_qa_table']}` where it_id = '{$it_id}' ";
|
||||
$row = sql_fetch($sql);
|
||||
$item_qa_count = $row['cnt'];
|
||||
|
||||
// 관련상품의 개수를 얻음
|
||||
if($default['de_rel_list_use']) {
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_item_relation_table']} a left join {$g5['g5_shop_item_table']} b on (a.it_id2=b.it_id) where a.it_id = '{$it['it_id']}' and b.it_use='1' ";
|
||||
$row = sql_fetch($sql);
|
||||
$item_relation_count = $row['cnt'];
|
||||
}
|
||||
|
||||
// 소셜 관련
|
||||
$sns_title = get_text($it['it_name']).' | '.get_text($config['cf_title']);
|
||||
$sns_url = shop_item_url($it['it_id']);
|
||||
$sns_share_links = get_sns_share_link('facebook', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/facebook.png').' ';
|
||||
$sns_share_links .= get_sns_share_link('twitter', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/twitter.png').' ';
|
||||
|
||||
// 상품품절체크
|
||||
if(G5_SOLDOUT_CHECK)
|
||||
$is_soldout = is_soldout($it['it_id']);
|
||||
|
||||
// 주문가능체크
|
||||
$is_orderable = true;
|
||||
if(!$it['it_use'] || $it['it_tel_inq'] || $is_soldout)
|
||||
$is_orderable = false;
|
||||
|
||||
$option_item = $supply_item = '';
|
||||
|
||||
if($is_orderable) {
|
||||
if(defined('G5_THEME_USE_OPTIONS_TRTD') && G5_THEME_USE_OPTIONS_TRTD){
|
||||
$option_item = get_item_options($it['it_id'], $it['it_option_subject'], '');
|
||||
$supply_item = get_item_supply($it['it_id'], $it['it_supply_subject'], '');
|
||||
} else {
|
||||
// 선택 옵션 ( 기존의 tr td 태그로 가져오려면 'div' 를 '' 로 바꾸거나 또는 지워주세요 )
|
||||
$option_item = get_item_options($it['it_id'], $it['it_option_subject'], 'div', 1);
|
||||
|
||||
// 추가 옵션 ( 기존의 tr td 태그로 가져오려면 'div' 를 '' 로 바꾸거나 또는 지워주세요 )
|
||||
$supply_item = get_item_supply($it['it_id'], $it['it_supply_subject'], 'div', 1);
|
||||
}
|
||||
|
||||
// 상품 선택옵션 수
|
||||
$option_count = 0;
|
||||
if($it['it_option_subject']) {
|
||||
$temp = explode(',', $it['it_option_subject']);
|
||||
$option_count = count($temp);
|
||||
}
|
||||
|
||||
// 상품 추가옵션 수
|
||||
$supply_count = 0;
|
||||
if($it['it_supply_subject']) {
|
||||
$temp = explode(',', $it['it_supply_subject']);
|
||||
$supply_count = count($temp);
|
||||
}
|
||||
}
|
||||
|
||||
function pg_anchor($anc_id) {
|
||||
global $default;
|
||||
global $item_use_count, $item_qa_count, $item_relation_count;
|
||||
?>
|
||||
<ul class="sanchor">
|
||||
<li><a href="#sit_inf" <?php if ($anc_id == 'inf') echo 'class="sanchor_on"'; ?>>상품정보</a></li>
|
||||
<li><a href="#sit_use" <?php if ($anc_id == 'use') echo 'class="sanchor_on"'; ?>>사용후기 <span class="item_use_count"><?php echo $item_use_count; ?></span></a></li>
|
||||
<li><a href="#sit_qa" <?php if ($anc_id == 'qa') echo 'class="sanchor_on"'; ?>>상품문의 <span class="item_qa_count"><?php echo $item_qa_count; ?></span></a></li>
|
||||
<?php if ($default['de_baesong_content']) { ?><li><a href="#sit_dvr" <?php if ($anc_id == 'dvr') echo 'class="sanchor_on"'; ?>>배송정보</a></li><?php } ?>
|
||||
<?php if ($default['de_change_content']) { ?><li><a href="#sit_ex" <?php if ($anc_id == 'ex') echo 'class="sanchor_on"'; ?>>교환정보</a></li><?php } ?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
|
||||
$naverpay_button_js = '';
|
||||
include_once(G5_SHOP_PATH.'/settle_naverpay.inc.php');
|
||||
?>
|
||||
|
||||
<?php if($is_orderable) { ?>
|
||||
<script src="<?php echo G5_JS_URL; ?>/shop.js?ver=<?php echo G5_JS_VER; ?>"></script>
|
||||
<?php } ?>
|
||||
|
||||
<div id="sit">
|
||||
|
||||
<?php
|
||||
// 상품 구입폼
|
||||
include_once($skin_dir.'/item.form.skin.php');
|
||||
?>
|
||||
|
||||
<?php
|
||||
// 상품 상세정보
|
||||
$info_skin = $skin_dir.'/item.info.skin.php';
|
||||
if(!is_file($info_skin))
|
||||
$info_skin = G5_SHOP_SKIN_PATH.'/item.info.skin.php';
|
||||
include $info_skin;
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// 하단 HTML
|
||||
echo run_replace('shop_it_tail_html', conv_content($it['it_tail_html'], 1), $it);
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($ca['ca_include_tail'] && is_include_path_check($ca['ca_include_tail']))
|
||||
@include_once($ca['ca_include_tail']);
|
||||
else
|
||||
include_once(G5_SHOP_PATH.'/_tail.php');
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/iteminfo.php');
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$pattern = '#[/\'\"%=*\#\(\)\|\+\&\!\$~\{\}\[\]`;:\?\^\,]#';
|
||||
|
||||
$it_id = isset($_POST['it_id']) ? preg_replace($pattern, '', $_POST['it_id']) : '';
|
||||
//$opt_id = isset($_POST['opt_id']) ? preg_replace($pattern, '', $_POST['opt_id']) : '';
|
||||
$opt_id = isset($_POST['opt_id']) ? addslashes(sql_real_escape_string(preg_replace(G5_OPTION_ID_FILTER, '', $_POST['opt_id']))) : '';
|
||||
$idx = isset($_POST['idx']) ? preg_replace('#[^0-9]#', '', $_POST['idx']) : 0;
|
||||
$sel_count = isset($_POST['sel_count']) ? preg_replace('#[^0-9]#', '', $_POST['sel_count']) : 0;
|
||||
$op_title = isset($_POST['op_title']) ? strip_tags($_POST['op_title']) : '';
|
||||
|
||||
$it = get_shop_item($it_id, true);
|
||||
|
||||
if( !$it ){
|
||||
die('');
|
||||
}
|
||||
|
||||
/*
|
||||
옵션명 비슷한 부분 오류 수정
|
||||
수정자 : IT FOR ONE
|
||||
수정 내용 : and io_id like '$opt_id%' => and io_id like '$opt_id".chr(30)."'
|
||||
*/
|
||||
$sql = " select * from {$g5['g5_shop_item_option_table']}
|
||||
where io_type = '0'
|
||||
and it_id = '$it_id'
|
||||
and io_use = '1'
|
||||
and io_id like '$opt_id".chr(30)."%'
|
||||
order by io_no asc ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$option_title = '선택';
|
||||
|
||||
if( $op_title && ($op_title !== $option_title) && $it['it_option_subject'] ){
|
||||
$array_tmps = explode(',', $it['it_option_subject']);
|
||||
if( isset($array_tmps[$idx+1]) && $array_tmps[$idx+1] ){
|
||||
$option_title = $array_tmps[$idx+1];
|
||||
}
|
||||
}
|
||||
|
||||
$str = '<option value="">'.$option_title.'</option>';
|
||||
$opt = array();
|
||||
|
||||
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||
$val = explode(chr(30), $row['io_id']);
|
||||
$key = $idx + 1;
|
||||
|
||||
if(!strlen($val[$key]))
|
||||
continue;
|
||||
|
||||
$continue = false;
|
||||
foreach($opt as $v) {
|
||||
if(strval($v) === strval($val[$key])) {
|
||||
$continue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($continue)
|
||||
continue;
|
||||
|
||||
$opt[] = strval($val[$key]);
|
||||
|
||||
if($key + 1 < $sel_count) {
|
||||
$str .= PHP_EOL.'<option value="'.$val[$key].'">'.$val[$key].'</option>';
|
||||
} else {
|
||||
if($row['io_price'] >= 0)
|
||||
$price = ' + '.number_format($row['io_price']).'원';
|
||||
else
|
||||
$price = ' '.number_format($row['io_price']).'원';
|
||||
|
||||
$io_stock_qty = get_option_stock_qty($it_id, $row['io_id'], $row['io_type']);
|
||||
|
||||
if($io_stock_qty < 1)
|
||||
$soldout = ' [품절]';
|
||||
else
|
||||
$soldout = '';
|
||||
|
||||
$str .= PHP_EOL.'<option value="'.$val[$key].','.$row['io_price'].','.$io_stock_qty.'">'.$val[$key].$price.$soldout.'</option>';
|
||||
}
|
||||
}
|
||||
|
||||
echo $str;
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
|
||||
if( !isset($it) && !get_session("ss_tv_idx") ){
|
||||
if( !headers_sent() ){ //헤더를 보내기 전이면 검색엔진에서 제외합니다.
|
||||
echo '<meta name="robots" content="noindex, nofollow">';
|
||||
}
|
||||
/*
|
||||
if( !G5_IS_MOBILE ){ //PC 에서는 검색엔진 화면에 노출하지 않도록 수정
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/itemqa.php');
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
|
||||
|
||||
// 현재페이지, 총페이지수, 한페이지에 보여줄 행, URL
|
||||
function itemqa_page($write_pages, $cur_page, $total_page, $url, $add="")
|
||||
{
|
||||
//$url = preg_replace('#&page=[0-9]*(&page=)$#', '$1', $url);
|
||||
$url = preg_replace('#&page=[0-9]*#', '', $url) . '&page=';
|
||||
|
||||
$str = '';
|
||||
if ($cur_page > 1) {
|
||||
$str .= '<a href="'.$url.'1'.$add.'" class="qa_page pg_start">처음</a>'.PHP_EOL;
|
||||
}
|
||||
|
||||
$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
|
||||
$end_page = $start_page + $write_pages - 1;
|
||||
|
||||
if ($end_page >= $total_page) $end_page = $total_page;
|
||||
|
||||
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="qa_page pg_prev">이전</a>'.PHP_EOL;
|
||||
|
||||
if ($total_page > 1) {
|
||||
for ($k=$start_page;$k<=$end_page;$k++) {
|
||||
if ($cur_page != $k)
|
||||
$str .= '<a href="'.$url.$k.$add.'" class="qa_page">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
|
||||
else
|
||||
$str .= '<span class="sound_only">열린</span><strong class="pg_current">'.$k.'</strong><span class="sound_only">페이지</span>'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="qa_page pg_next">다음</a>'.PHP_EOL;
|
||||
|
||||
if ($cur_page < $total_page) {
|
||||
$str .= '<a href="'.$url.$total_page.$add.'" class="qa_page pg_end">맨끝</a>'.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($str)
|
||||
return "<nav class=\"pg_wrap\"><span class=\"pg\">{$str}</span></nav>";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
$itemqa_list = G5_SHOP_URL."/itemqalist.php";
|
||||
$itemqa_form = G5_SHOP_URL."/itemqaform.php?it_id=".$it_id;
|
||||
$itemqa_formupdate = G5_SHOP_URL."/itemqaformupdate.php?it_id=".$it_id;
|
||||
|
||||
$sql_common = " from `{$g5['g5_shop_item_qa_table']}` where it_id = '{$it_id}' ";
|
||||
|
||||
// 테이블의 전체 레코드수만 얻음
|
||||
$sql = " select COUNT(*) as cnt " . $sql_common;
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$rows = 5;
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 레코드 구함
|
||||
|
||||
$sql = "select * $sql_common order by iq_id desc limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$itemqa_skin = G5_SHOP_SKIN_PATH.'/itemqa.skin.php';
|
||||
|
||||
if(!file_exists($itemqa_skin)) {
|
||||
echo str_replace(G5_PATH.'/', '', $itemqa_skin).' 스킨 파일이 존재하지 않습니다.';
|
||||
} else {
|
||||
include_once($itemqa_skin);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$w = isset($_REQUEST['w']) ? preg_replace('/[^0-9a-z]/i', '', trim($_REQUEST['w'])) : '';
|
||||
$it_id = isset($_REQUEST['it_id']) ? get_search_string(trim($_REQUEST['it_id'])) : '';
|
||||
$iq_id = isset($_REQUEST['iq_id']) ? preg_replace('/[^0-9]/', '', trim($_REQUEST['iq_id'])) : 0;
|
||||
$qa = array('iq_subject'=>'', 'iq_question'=>'');
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/itemqaform.php');
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_EDITOR_LIB);
|
||||
|
||||
if (!$is_member) {
|
||||
alert_close("상품문의는 회원만 작성 가능합니다.");
|
||||
}
|
||||
|
||||
// 상품정보체크
|
||||
$row = get_shop_item($it_id, true);
|
||||
if(! (isset($row['it_id']) && $row['it_id']))
|
||||
alert_close('상품정보가 존재하지 않습니다.');
|
||||
|
||||
$chk_secret = '';
|
||||
|
||||
if($w == '') {
|
||||
$qa['iq_email'] = $member['mb_email'];
|
||||
$qa['iq_hp'] = $member['mb_hp'];
|
||||
}
|
||||
|
||||
if ($w == "u")
|
||||
{
|
||||
$qa = sql_fetch(" select * from {$g5['g5_shop_item_qa_table']} where iq_id = '$iq_id' ");
|
||||
if (!$qa) {
|
||||
alert_close("상품문의 정보가 없습니다.");
|
||||
}
|
||||
|
||||
$it_id = $qa['it_id'];
|
||||
|
||||
if (!$is_admin && $qa['mb_id'] != $member['mb_id']) {
|
||||
alert_close("자신의 상품문의만 수정이 가능합니다.");
|
||||
}
|
||||
|
||||
if($qa['iq_secret'])
|
||||
$chk_secret = 'checked="checked"';
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$is_dhtml_editor = false;
|
||||
// 모바일에서는 DHTML 에디터 사용불가
|
||||
if ($config['cf_editor'] && (!is_mobile() || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE)) {
|
||||
$is_dhtml_editor = true;
|
||||
}
|
||||
$editor_html = editor_html('iq_question', get_text(html_purifier($qa['iq_question']), 0), $is_dhtml_editor);
|
||||
$editor_js = '';
|
||||
$editor_js .= get_editor_js('iq_question', $is_dhtml_editor);
|
||||
$editor_js .= chk_editor_js('iq_question', $is_dhtml_editor);
|
||||
|
||||
$itemqaform_skin = G5_SHOP_SKIN_PATH.'/itemqaform.skin.php';
|
||||
|
||||
if(!file_exists($itemqaform_skin)) {
|
||||
echo str_replace(G5_PATH.'/', '', $itemqaform_skin).' 스킨 파일이 존재하지 않습니다.';
|
||||
} else {
|
||||
include_once($itemqaform_skin);
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$is_member) {
|
||||
alert_close("상품문의는 회원만 작성이 가능합니다.");
|
||||
}
|
||||
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
$iq_id = isset($_REQUEST['iq_id']) ? (int) $_REQUEST['iq_id'] : 0;
|
||||
$iq_subject = isset($_POST['iq_subject']) ? trim($_POST['iq_subject']) : '';
|
||||
$iq_question = isset($_POST['iq_question']) ? trim($_POST['iq_question']) : '';
|
||||
$iq_question = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $iq_question);
|
||||
$iq_answer = isset($_POST['iq_answer']) ? trim($_POST['iq_answer']) : '';
|
||||
$hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : '';
|
||||
$get_editor_img_mode = $config['cf_editor'] ? false : true;
|
||||
|
||||
$iq_secret = isset($_POST['iq_secret']) ? (int) $_POST['iq_secret'] : 0;
|
||||
$iq_email = isset($_POST['iq_email']) ? clean_xss_tags($_POST['iq_email'], 1, 1) : '';
|
||||
$iq_hp = isset($_POST['iq_hp']) ? clean_xss_tags($_POST['iq_hp'], 1, 1) : '';
|
||||
$is_mobile_shop = isset($_REQUEST['is_mobile_shop']) ? (int) $_REQUEST['is_mobile_shop'] : 0;
|
||||
|
||||
if ($w == "" || $w == "u") {
|
||||
$iq_name = addslashes(strip_tags($member['mb_name']));
|
||||
$iq_password = $member['mb_password'];
|
||||
|
||||
if (!$iq_subject) alert("제목을 입력하여 주십시오.");
|
||||
if (!$iq_question) alert("질문을 입력하여 주십시오.");
|
||||
}
|
||||
|
||||
if($is_mobile_shop)
|
||||
$url = './iteminfo.php?it_id='.$it_id.'&info=qa';
|
||||
else
|
||||
$url = shop_item_url($it_id, "_=".get_token()."#sit_qa");
|
||||
|
||||
if ($w == "")
|
||||
{
|
||||
$sql = "insert {$g5['g5_shop_item_qa_table']}
|
||||
set it_id = '$it_id',
|
||||
mb_id = '{$member['mb_id']}',
|
||||
iq_secret = '$iq_secret',
|
||||
iq_name = '$iq_name',
|
||||
iq_email = '$iq_email',
|
||||
iq_hp = '$iq_hp',
|
||||
iq_password = '$iq_password',
|
||||
iq_subject = '$iq_subject',
|
||||
iq_question = '$iq_question',
|
||||
iq_time = '".G5_TIME_YMDHIS."',
|
||||
iq_ip = '".$_SERVER['REMOTE_ADDR']."' ";
|
||||
sql_query($sql);
|
||||
$iq_id = sql_insert_id();
|
||||
run_event('shop_item_qa_created', $iq_id, $it_id);
|
||||
|
||||
$alert_msg = '상품문의가 등록 되었습니다.';
|
||||
|
||||
/* 20250612 리빌더 { */
|
||||
$item_info = get_shop_item($it_id);
|
||||
$msg_cont = "[".$item_info['it_name']."] 상품에 문의가 등록 되었습니다.";
|
||||
memo_auto_send($msg_cont, shop_item_url($it_id), $config['cf_admin'], "system-msg");
|
||||
|
||||
if(isset($item_info['it_partner']) && $item_info['it_partner']) {
|
||||
memo_auto_send($msg_cont, shop_item_url($it_id), $item_info['it_partner'], "system-msg");
|
||||
}
|
||||
/* } */
|
||||
|
||||
}
|
||||
else if ($w == "u")
|
||||
{
|
||||
if (!$is_admin)
|
||||
{
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (!$row['cnt'])
|
||||
alert("자신의 상품문의만 수정하실 수 있습니다.");
|
||||
|
||||
$sql = " select iq_answer from `{$g5['g5_shop_item_qa_table']}` where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if (isset($row['iq_answer']) && $row['iq_answer']) {
|
||||
alert("답변이 있는 상품문의는 수정하실 수 없습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " update {$g5['g5_shop_item_qa_table']}
|
||||
set iq_secret = '$iq_secret',
|
||||
iq_email = '$iq_email',
|
||||
iq_hp = '$iq_hp',
|
||||
iq_subject = '$iq_subject',
|
||||
iq_question = '$iq_question'
|
||||
where iq_id = '$iq_id' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_item_qa_updated', $iq_id, $it_id);
|
||||
|
||||
$alert_msg = '상품문의가 수정 되었습니다.';
|
||||
}
|
||||
else if ($w == "d")
|
||||
{
|
||||
if (!$is_admin)
|
||||
{
|
||||
$sql = " select iq_answer from {$g5['g5_shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (!$row)
|
||||
alert("자신의 상품문의만 삭제하실 수 있습니다.");
|
||||
|
||||
if ($row['iq_answer'])
|
||||
alert("답변이 있는 상품문의는 삭제하실 수 없습니다.");
|
||||
}
|
||||
|
||||
// 에디터로 첨부된 썸네일 이미지만 삭제
|
||||
$sql = " select iq_question, iq_answer from {$g5['g5_shop_item_qa_table']} where iq_id = '$iq_id' and md5(concat(iq_id,iq_time,iq_ip)) = '{$hash}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$imgs = get_editor_image($row['iq_question'], $get_editor_img_mode);
|
||||
|
||||
for($i=0;$i<count($imgs[1]);$i++) {
|
||||
$p = parse_url($imgs[1][$i]);
|
||||
if(strpos($p['path'], "/data/") != 0)
|
||||
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
|
||||
else
|
||||
$data_path = $p['path'];
|
||||
|
||||
if( preg_match('/(gif|jpe?g|bmp|png)$/i', strtolower(end(explode('.', $data_path))) ) ){
|
||||
|
||||
$destfile = ( ! preg_match('/\w+\/\.\.\//', $data_path) ) ? G5_PATH.$data_path : '';
|
||||
|
||||
if ($destfile && preg_match('/\/data\/editor\/[A-Za-z0-9_]{1,20}\//', $destfile) && is_file($destfile)) {
|
||||
delete_item_thumbnail(dirname($destfile), basename($destfile));
|
||||
//@unlink($destfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$imgs = get_editor_image($row['iq_answer'], $get_editor_img_mode);
|
||||
|
||||
$imgs_count = (isset($imgs[1]) && is_array($imgs[1])) ? count($imgs[1]) : 0;
|
||||
|
||||
for($i=0;$i<$imgs_count;$i++) {
|
||||
$p = parse_url($imgs[1][$i]);
|
||||
if(strpos($p['path'], "/data/") != 0)
|
||||
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
|
||||
else
|
||||
$data_path = $p['path'];
|
||||
|
||||
if( preg_match('/(gif|jpe?g|bmp|png)$/i', strtolower(end(explode('.', $data_path))) ) ){
|
||||
|
||||
$destfile = ( ! preg_match('/\w+\/\.\.\//', $data_path) ) ? G5_PATH.$data_path : '';
|
||||
|
||||
if ($destfile && preg_match('/\/data\/editor\/[A-Za-z0-9_]{1,20}\//', $destfile) && is_file($destfile)) {
|
||||
delete_item_thumbnail(dirname($destfile), basename($destfile));
|
||||
// @unlink($destfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_item_qa_table']} where iq_id = '$iq_id' and md5(concat(iq_id,iq_time,iq_ip)) = '{$hash}' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_item_qa_deleted', $iq_id, $it_id);
|
||||
|
||||
$alert_msg = '상품문의가 삭제 되었습니다.';
|
||||
}
|
||||
|
||||
if($w == 'd')
|
||||
alert($alert_msg, $url);
|
||||
else
|
||||
alert_opener($alert_msg, $url);
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if( isset($sfl) && ! in_array($sfl, array('b.it_name', 'a.it_id', 'a.iq_subject', 'a.iq_question', 'a.iq_name', 'a.mb_id')) ){
|
||||
//다른값이 들어가있다면 초기화
|
||||
$sfl = '';
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/itemqalist.php');
|
||||
return;
|
||||
}
|
||||
|
||||
$g5['title'] = '상품문의';
|
||||
include_once('./_head.php');
|
||||
|
||||
$sql_common = " from `{$g5['g5_shop_item_qa_table']}` a join `{$g5['g5_shop_item_table']}` b on (a.it_id=b.it_id) ";
|
||||
$sql_search = " where (1) ";
|
||||
|
||||
if(!$sfl)
|
||||
$sfl = 'b.it_name';
|
||||
|
||||
if ($stx) {
|
||||
$sql_search .= " and ( ";
|
||||
switch ($sfl) {
|
||||
case "a.it_id" :
|
||||
$sql_search .= " ($sfl like '$stx%') ";
|
||||
break;
|
||||
case "a.iq_name" :
|
||||
case "a.mb_id" :
|
||||
$sql_search .= " ($sfl = '$stx') ";
|
||||
break;
|
||||
default :
|
||||
$sql_search .= " ($sfl like '%$stx%') ";
|
||||
break;
|
||||
}
|
||||
$sql_search .= " ) ";
|
||||
}
|
||||
|
||||
if (!$sst) {
|
||||
$sst = "a.iq_id";
|
||||
$sod = "desc";
|
||||
}
|
||||
$sql_order = " order by $sst $sod ";
|
||||
|
||||
$sql = " select count(*) as cnt
|
||||
$sql_common
|
||||
$sql_search
|
||||
$sql_order ";
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$rows = $config['cf_page_rows'];
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||
|
||||
$sql = " select a.*, b.it_name
|
||||
$sql_common
|
||||
$sql_search
|
||||
$sql_order
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$itemqalist_skin = G5_SHOP_SKIN_PATH.'/itemqalist.skin.php';
|
||||
|
||||
if(!file_exists($itemqalist_skin)) {
|
||||
echo str_replace(G5_PATH.'/', '', $itemqalist_skin).' 스킨 파일이 존재하지 않습니다.';
|
||||
} else {
|
||||
include_once($itemqalist_skin);
|
||||
}
|
||||
|
||||
include_once('./_tail.php');
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/itemrecommend.php');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$is_member)
|
||||
alert_close('회원만 메일을 발송할 수 있습니다.');
|
||||
|
||||
// 스팸을 발송할 수 없도록 세션에 아무값이나 저장하여 hidden 으로 넘겨서 다음 페이지에서 비교함
|
||||
$token = md5(uniqid(rand(), true));
|
||||
set_session("ss_token", $token);
|
||||
|
||||
$sql = " select it_name from {$g5['g5_shop_item_table']} where it_id='$it_id' ";
|
||||
$it = sql_fetch($sql);
|
||||
if (!$it['it_name'])
|
||||
alert_close("등록된 상품이 아닙니다.");
|
||||
|
||||
$g5['title'] = $it['it_name'].' - 추천하기';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
?>
|
||||
|
||||
<!-- 상품 추천하기 시작 { -->
|
||||
<div id="sit_rec_new" class="new_win">
|
||||
<h1 id="win_title"><?php echo $g5['title']; ?></h1>
|
||||
|
||||
<form name="fitemrecommend" method="post" action="./itemrecommendmail.php" autocomplete="off" onsubmit="return fitemrecommend_check(this);">
|
||||
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
||||
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
|
||||
|
||||
<div class="tbl_wrap">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label for="to_email">추천받는 분<br>E-mail<strong class="sound_only"> 필수</strong></label></th>
|
||||
<td><input type="text" name="to_email" id="to_email" required class="frm_input full_input required" size="51"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="subject">제목<strong class="sound_only"> 필수</strong></label></th>
|
||||
<td><input type="text" name="subject" id="subject" required class="frm_input full_input required" size="51"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="content">내용<strong class="sound_only"> 필수</strong></label></th>
|
||||
<td><textarea name="content" id="content" required class="frm_input required"></textarea></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="win_btn">
|
||||
<button type="submit" id="btn_submit" class="btn_submit">보내기</button>
|
||||
<button onclick="javascript:window.close();" class="btn_close">닫기</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function fitemrecommend_check(f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
<!-- } 상품 추천하기 끝 -->
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_LIB_PATH.'/mailer.lib.php');
|
||||
|
||||
if (!$is_member)
|
||||
alert_close('회원만 메일을 발송할 수 있습니다.');
|
||||
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
|
||||
// 스팸으로 인한 코드 수정 060809
|
||||
//if (substr_count($to_email, "@") > 3) alert("최대 3명까지만 메일을 발송할 수 있습니다.");
|
||||
if (substr_count($to_email, "@") > 1) alert('메일 주소는 하나씩만 입력해 주십시오.');
|
||||
|
||||
if ($_SESSION["ss_recommend_datetime"] >= (G5_SERVER_TIME - 120))
|
||||
alert("너무 빠른 시간내에 메일을 연속해서 보낼 수 없습니다.");
|
||||
set_session("ss_recommend_datetime", G5_SERVER_TIME);
|
||||
|
||||
$recommendmail_count = (int)get_session('ss_recommendmail_count') + 1;
|
||||
if ($recommendmail_count > 3)
|
||||
alert_close('한번 접속후 일정수의 메일만 발송할 수 있습니다.\\n\\n계속해서 메일을 보내시려면 다시 로그인 또는 접속하여 주십시오.');
|
||||
set_session('ss_recommendmail_count', $recommendmail_count);
|
||||
|
||||
// 세션에 저장된 토큰과 폼값으로 넘어온 토큰을 비교하여 틀리면 메일을 발송할 수 없다.
|
||||
if (isset($_POST["token"]) && get_session("ss_token") === $_POST["token"]) {
|
||||
// 맞으면 세션을 지워 다시 입력폼을 통해서 들어오도록 한다.
|
||||
set_session("ss_token", "");
|
||||
} else {
|
||||
alert_close("메일 발송시 오류가 발생하였습니다.");
|
||||
exit;
|
||||
}
|
||||
|
||||
// 상품
|
||||
$it = get_shop_item($it_id, true);
|
||||
if (! (isset($it['it_id']) && $it['it_id']))
|
||||
alert("등록된 상품이 아닙니다.");
|
||||
|
||||
$subject = isset($_POST['subject']) ? stripslashes($_POST['subject']) : '';
|
||||
$content = isset($_POST['content']) ? nl2br(stripslashes($_POST['content'])) : '';
|
||||
|
||||
$from_name = get_text($member['mb_name']);
|
||||
$from_email = $member['mb_email'];
|
||||
$it_id = $it['it_id'];
|
||||
$it_name = $it['it_name'];
|
||||
$it_mimg = get_it_image($it_id, $default['de_mimg_width'], $default['de_mimg_height']);
|
||||
|
||||
ob_start();
|
||||
include G5_SHOP_PATH.'/mail/itemrecommend.mail.php';
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
mailer($from_name, $from_email, $to_email, $subject, $content, 1);
|
||||
|
||||
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">";
|
||||
?>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<script language="JavaScript">
|
||||
alert("메일을 전달하였습니다");
|
||||
window.close();
|
||||
</script>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
|
||||
$g5['title'] = '상품 재입고 알림 (SMS)';
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
// 상품정보
|
||||
$it = get_shop_item($it_id, true);
|
||||
|
||||
if(! (isset($it['it_id']) && $it['it_id']))
|
||||
alert_close('상품정보가 존재하지 않습니다.');
|
||||
|
||||
if(!$it['it_soldout'] || !$it['it_stock_sms'])
|
||||
alert_close('재입고SMS 알림을 신청할 수 없는 상품입니다.');
|
||||
|
||||
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">', 0);
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_MSHOP_SKIN_URL.'/style.css">', 0);
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="sit_sms_new" class="new_win">
|
||||
<h1 id="win_title"><?php echo $g5['title']; ?></h1>
|
||||
|
||||
<form name="fstocksms" method="post" action="<?php echo G5_HTTPS_SHOP_URL; ?>/itemstocksmsupdate.php" onsubmit="return fstocksms_submit(this);" autocomplete="off">
|
||||
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
|
||||
|
||||
<div class="form_01">
|
||||
<ul>
|
||||
<li class="prd_name">
|
||||
<?php echo $it['it_name']; ?>
|
||||
</li>
|
||||
<li>
|
||||
<label for="ss_hp" class="sound_only">휴대폰번호<strong> 필수</strong></label>
|
||||
<input type="text" name="ss_hp" value="<?php echo $member['mb_hp']; ?>" id="ss_hp" required class="required frm_input full_input" placeholder="휴대폰번호">
|
||||
</li>
|
||||
<li>
|
||||
<strong>개인정보처리방침안내</strong>
|
||||
<textarea readonly><?php echo get_text($config['cf_privacy']) ?></textarea>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="sms_agree" class="chk_box">
|
||||
<input type="checkbox" name="agree" value="1" id="agree" class="selec_chk">
|
||||
<label for="agree"><span></span>개인정보처리방침안내의 내용에 동의합니다.</label>
|
||||
</div>
|
||||
|
||||
<div class="win_btn">
|
||||
<button type="submit" class="btn_submit">확인</button>
|
||||
<button type="button" onclick="window.close();" class="btn_close">닫기</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function fstocksms_submit(f)
|
||||
{
|
||||
if(!f.agree.checked) {
|
||||
alert("개인정보처리방침안내에 동의해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(confirm("재입고SMS 알림 요청을 등록하시겠습니까?")) {
|
||||
return true;
|
||||
} else {
|
||||
window.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$it_id = isset($_POST['it_id']) ? safe_replace_regex($_POST['it_id'], 'it_id') : '';
|
||||
$ss_hp = isset($_POST['ss_hp']) ? $_POST['ss_hp'] : '';
|
||||
|
||||
// 상품정보
|
||||
$it = get_shop_item($it_id, true);
|
||||
|
||||
if(! (isset($it['it_id']) && $it['it_id']))
|
||||
alert_close('상품정보가 존재하지 않습니다.');
|
||||
|
||||
if(!$it['it_soldout'] || !$it['it_stock_sms'])
|
||||
alert_close('재입고SMS 알림을 신청할 수 없는 상품입니다.');
|
||||
|
||||
$ss_hp = hyphen_hp_number($ss_hp);
|
||||
if(!$ss_hp)
|
||||
alert('휴대폰번호를 입력해 주십시오.');
|
||||
|
||||
if(!$agree)
|
||||
alert('개인정보처리방침안내에 동의해 주십시오.');
|
||||
|
||||
// 중복등록 체크
|
||||
$sql = " select count(*) as cnt
|
||||
from {$g5['g5_shop_item_stocksms_table']}
|
||||
where it_id = '$it_id'
|
||||
and ss_hp = '$ss_hp'
|
||||
and ss_send = '0' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if($row['cnt'])
|
||||
alert_close('해당 상품에 대하여 이전에 알림 요청을 등록한 내역이 있습니다.');
|
||||
|
||||
// 정보입력
|
||||
$sql = " insert into {$g5['g5_shop_item_stocksms_table']}
|
||||
set it_id = '$it_id',
|
||||
ss_hp = '$ss_hp',
|
||||
ss_ip = '{$_SERVER['REMOTE_ADDR']}',
|
||||
ss_datetime = '".G5_TIME_YMDHIS."' ";
|
||||
sql_query($sql);
|
||||
|
||||
alert_close('재입고SMS 알림 요청 등록이 완료됐습니다.');
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
|
||||
if( !isset($it) && !get_session("ss_tv_idx") ){
|
||||
if( !headers_sent() ){ //헤더를 보내기 전이면 검색엔진에서 제외합니다.
|
||||
echo '<meta name="robots" content="noindex, nofollow">';
|
||||
}
|
||||
/*
|
||||
if( !G5_IS_MOBILE ){ //PC 에서는 검색엔진 화면에 노출하지 않도록 수정
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/itemuse.php');
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
|
||||
|
||||
// 현재페이지, 총페이지수, 한페이지에 보여줄 행, URL
|
||||
function itemuse_page($write_pages, $cur_page, $total_page, $url, $add="")
|
||||
{
|
||||
//$url = preg_replace('#&page=[0-9]*(&page=)$#', '$1', $url);
|
||||
$url = preg_replace('#&page=[0-9]*#', '', $url) . '&page=';
|
||||
|
||||
$str = '';
|
||||
if ($cur_page > 1) {
|
||||
$str .= '<a href="'.$url.'1'.$add.'" class="pg_page pg_start">처음</a>'.PHP_EOL;
|
||||
}
|
||||
|
||||
$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
|
||||
$end_page = $start_page + $write_pages - 1;
|
||||
|
||||
if ($end_page >= $total_page) $end_page = $total_page;
|
||||
|
||||
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="pg_page pg_prev">이전</a>'.PHP_EOL;
|
||||
|
||||
if ($total_page > 1) {
|
||||
for ($k=$start_page;$k<=$end_page;$k++) {
|
||||
if ($cur_page != $k)
|
||||
$str .= '<a href="'.$url.$k.$add.'" class="pg_page">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
|
||||
else
|
||||
$str .= '<span class="sound_only">열린</span><strong class="pg_current">'.$k.'</strong><span class="sound_only">페이지</span>'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="pg_page pg_next">다음</a>'.PHP_EOL;
|
||||
|
||||
if ($cur_page < $total_page) {
|
||||
$str .= '<a href="'.$url.$total_page.$add.'" class="pg_page pg_end">맨끝</a>'.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($str)
|
||||
return "<nav class=\"pg_wrap\"><span class=\"pg\">{$str}</span></nav>";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
$itemuse_list = G5_SHOP_URL."/itemuselist.php";
|
||||
$itemuse_form = G5_SHOP_URL."/itemuseform.php?it_id=".$it_id;
|
||||
$itemuse_formupdate = G5_SHOP_URL."/itemuseformupdate.php?it_id=".$it_id;
|
||||
|
||||
$sql_common = " from `{$g5['g5_shop_item_use_table']}` where it_id = '{$it_id}' and is_confirm = '1' ";
|
||||
|
||||
// 테이블의 전체 레코드수만 얻음
|
||||
$sql = " select COUNT(*) as cnt " . $sql_common;
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$rows = 5;
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 레코드 구함
|
||||
|
||||
$sql = "select * $sql_common order by is_id desc limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$itemuse_skin = G5_SHOP_SKIN_PATH.'/itemuse.skin.php';
|
||||
|
||||
if(!file_exists($itemuse_skin)) {
|
||||
echo str_replace(G5_PATH.'/', '', $itemuse_skin).' 스킨 파일이 존재하지 않습니다.';
|
||||
} else {
|
||||
include_once($itemuse_skin);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
$w = isset($_REQUEST['w']) ? preg_replace('/[^0-9a-z]/i', '', trim($_REQUEST['w'])) : '';
|
||||
$it_id = isset($_REQUEST['it_id']) ? get_search_string(trim($_REQUEST['it_id'])) : '';
|
||||
$is_id = isset($_REQUEST['is_id']) ? preg_replace('/[^0-9]/', '', trim($_REQUEST['is_id'])) : 0;
|
||||
$use = array('is_subject'=>'', 'is_content'=>'');
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/itemuseform.php');
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_EDITOR_LIB);
|
||||
|
||||
if (!$is_member) {
|
||||
alert_close("사용후기는 회원만 작성 가능합니다.");
|
||||
}
|
||||
|
||||
// 상품정보체크
|
||||
$row = get_shop_item($it_id, true);
|
||||
|
||||
if(! (isset($row['it_id']) && $row['it_id']))
|
||||
alert_close('상품정보가 존재하지 않습니다.');
|
||||
|
||||
if ($w == "") {
|
||||
$is_score = 5;
|
||||
|
||||
// 사용후기 작성 설정에 따른 체크
|
||||
check_itemuse_write($it_id, $member['mb_id']);
|
||||
} else if ($w == "u") {
|
||||
$use = sql_fetch(" select * from {$g5['g5_shop_item_use_table']} where is_id = '$is_id' ");
|
||||
if (!$use) {
|
||||
alert_close("사용후기 정보가 없습니다.");
|
||||
}
|
||||
|
||||
$it_id = $use['it_id'];
|
||||
$is_score = $use['is_score'];
|
||||
|
||||
if (!$is_admin && $use['mb_id'] != $member['mb_id']) {
|
||||
alert_close("자신의 사용후기만 수정이 가능합니다.");
|
||||
}
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/head.sub.php');
|
||||
|
||||
$is_dhtml_editor = false;
|
||||
// 모바일에서는 DHTML 에디터 사용불가
|
||||
if ($config['cf_editor'] && (!is_mobile() || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE)) {
|
||||
$is_dhtml_editor = true;
|
||||
}
|
||||
$editor_html = editor_html('is_content', get_text(html_purifier($use['is_content']), 0), $is_dhtml_editor);
|
||||
$editor_js = '';
|
||||
$editor_js .= get_editor_js('is_content', $is_dhtml_editor);
|
||||
$editor_js .= chk_editor_js('is_content', $is_dhtml_editor);
|
||||
|
||||
$itemuseform_skin = G5_SHOP_SKIN_PATH.'/itemuseform.skin.php';
|
||||
|
||||
if(!file_exists($itemuseform_skin)) {
|
||||
echo str_replace(G5_PATH.'/', '', $itemuseform_skin).' 스킨 파일이 존재하지 않습니다.';
|
||||
} else {
|
||||
include_once($itemuseform_skin);
|
||||
}
|
||||
|
||||
include_once(G5_PATH.'/tail.sub.php');
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!$is_member) {
|
||||
alert_close("사용후기는 회원만 작성이 가능합니다.");
|
||||
}
|
||||
|
||||
$it_id = isset($_REQUEST['it_id']) ? safe_replace_regex($_REQUEST['it_id'], 'it_id') : '';
|
||||
$is_subject = isset($_POST['is_subject']) ? trim($_POST['is_subject']) : '';
|
||||
$is_content = isset($_POST['is_content']) ? trim($_POST['is_content']) : '';
|
||||
$is_content = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $is_content);
|
||||
$is_name = isset($_POST['is_name']) ? trim($_POST['is_name']) : '';
|
||||
$is_password = isset($_POST['is_password']) ? trim($_POST['is_password']) : '';
|
||||
$is_score = isset($_POST['is_score']) ? (int) $_POST['is_score'] : 0;
|
||||
$is_score = ($is_score > 5 || $is_score < 1) ? 1 : $is_score;
|
||||
$get_editor_img_mode = $config['cf_editor'] ? false : true;
|
||||
$is_id = isset($_REQUEST['is_id']) ? (int) $_REQUEST['is_id'] : 0;
|
||||
$is_mobile_shop = isset($_REQUEST['is_mobile_shop']) ? (int) $_REQUEST['is_mobile_shop'] : 0;
|
||||
|
||||
// 사용후기 작성 설정에 따른 체크
|
||||
check_itemuse_write($it_id, $member['mb_id']);
|
||||
|
||||
if ($w == "" || $w == "u") {
|
||||
$is_name = addslashes(strip_tags($member['mb_name']));
|
||||
$is_password = $member['mb_password'];
|
||||
|
||||
if (!$is_subject) alert("제목을 입력하여 주십시오.");
|
||||
if (!$is_content) alert("내용을 입력하여 주십시오.");
|
||||
}
|
||||
|
||||
if($is_mobile_shop)
|
||||
$url = './iteminfo.php?it_id='.$it_id.'&info=use';
|
||||
else
|
||||
$url = shop_item_url($it_id, "_=".get_token()."#sit_use");
|
||||
|
||||
if ($w == "")
|
||||
{
|
||||
/*
|
||||
$sql = " select max(is_id) as max_is_id from {$g5['g5_shop_item_use_table']} ";
|
||||
$row = sql_fetch($sql);
|
||||
$max_is_id = $row['max_is_id'];
|
||||
|
||||
$sql = " select max(is_id) as max_is_id from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' and mb_id = '{$member['mb_id']}' ";
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['max_is_id'] && $row['max_is_id'] == $max_is_id)
|
||||
alert("같은 상품에 대하여 계속해서 평가하실 수 없습니다.");
|
||||
*/
|
||||
|
||||
$sql = "insert {$g5['g5_shop_item_use_table']}
|
||||
set it_id = '$it_id',
|
||||
mb_id = '{$member['mb_id']}',
|
||||
is_score = '$is_score',
|
||||
is_name = '$is_name',
|
||||
is_password = '$is_password',
|
||||
is_subject = '$is_subject',
|
||||
is_content = '$is_content',
|
||||
is_time = '".G5_TIME_YMDHIS."',
|
||||
is_ip = '{$_SERVER['REMOTE_ADDR']}' ";
|
||||
if (!$default['de_item_use_use'])
|
||||
$sql .= ", is_confirm = '1' ";
|
||||
sql_query($sql);
|
||||
$is_id = sql_insert_id();
|
||||
run_event('shop_item_use_created', $is_id, $it_id);
|
||||
|
||||
/* 20250612 리빌더 { */
|
||||
$item_info = get_shop_item($it_id);
|
||||
$msg_cont = "[".$item_info['it_name']."] 상품에 구매후기가 등록 되었습니다.";
|
||||
memo_auto_send($msg_cont, shop_item_url($it_id), $config['cf_admin'], "system-msg");
|
||||
|
||||
if(isset($item_info['it_partner']) && $item_info['it_partner']) {
|
||||
memo_auto_send($msg_cont, shop_item_url($it_id), $item_info['it_partner'], "system-msg");
|
||||
}
|
||||
/* } */
|
||||
|
||||
if ($default['de_item_use_use']) {
|
||||
$alert_msg = "평가하신 글은 관리자가 확인한 후에 출력됩니다.";
|
||||
} else {
|
||||
$alert_msg = "사용후기가 등록 되었습니다.";
|
||||
}
|
||||
}
|
||||
else if ($w == "u")
|
||||
{
|
||||
$sql = " select is_password from {$g5['g5_shop_item_use_table']} where is_id = '$is_id' ";
|
||||
|
||||
$row = sql_fetch($sql);
|
||||
if ($row['is_password'] != $is_password)
|
||||
alert("비밀번호가 틀리므로 수정하실 수 없습니다.");
|
||||
|
||||
$sql = " update {$g5['g5_shop_item_use_table']}
|
||||
set is_subject = '$is_subject',
|
||||
is_content = '$is_content',
|
||||
is_score = '$is_score'
|
||||
where is_id = '$is_id' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_item_use_updated', $is_id, $it_id);
|
||||
|
||||
$alert_msg = "사용후기가 수정 되었습니다.";
|
||||
}
|
||||
else if ($w == "d")
|
||||
{
|
||||
if (!$is_admin)
|
||||
{
|
||||
$sql = " select count(*) as cnt from {$g5['g5_shop_item_use_table']} where mb_id = '{$member['mb_id']}' and is_id = '$is_id' ";
|
||||
$row = sql_fetch($sql);
|
||||
if (!$row['cnt'])
|
||||
alert("자신의 사용후기만 삭제하실 수 있습니다.");
|
||||
}
|
||||
|
||||
// 에디터로 첨부된 썸네일 이미지 삭제
|
||||
$sql = " select is_content from {$g5['g5_shop_item_use_table']} where is_id = '$is_id' and md5(concat(is_id,is_time,is_ip)) = '{$hash}' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
$imgs = get_editor_image($row['is_content'], $get_editor_img_mode);
|
||||
|
||||
for($i=0;$i<count($imgs[1]);$i++) {
|
||||
$p = parse_url($imgs[1][$i]);
|
||||
if(strpos($p['path'], "/data/") != 0)
|
||||
$data_path = preg_replace("/^\/.*\/data/", "/data", $p['path']);
|
||||
else
|
||||
$data_path = $p['path'];
|
||||
|
||||
|
||||
if( preg_match('/(gif|jpe?g|bmp|png)$/i', strtolower(end(explode('.', $data_path))) ) ){
|
||||
|
||||
$destfile = ( ! preg_match('/\w+\/\.\.\//', $data_path) ) ? G5_PATH.$data_path : '';
|
||||
|
||||
if ($destfile && preg_match('/\/data\/editor\/[A-Za-z0-9_]{1,20}\//', $destfile) && is_file($destfile)) {
|
||||
delete_item_thumbnail(dirname($destfile), basename($destfile));
|
||||
//@unlink($destfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " delete from {$g5['g5_shop_item_use_table']} where is_id = '$is_id' and md5(concat(is_id,is_time,is_ip)) = '{$hash}' ";
|
||||
sql_query($sql);
|
||||
run_event('shop_item_use_deleted', $is_id, $it_id);
|
||||
|
||||
$alert_msg = "사용후기를 삭제 하였습니다.";
|
||||
}
|
||||
|
||||
//쇼핑몰 설정에서 사용후기가 즉시 출력일 경우
|
||||
if( ! $default['de_item_use_use'] ){
|
||||
update_use_cnt($it_id);
|
||||
update_use_avg($it_id);
|
||||
}
|
||||
|
||||
if($w == 'd')
|
||||
alert($alert_msg, $url);
|
||||
else
|
||||
alert_opener($alert_msg, $url);
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if( isset($sfl) && ! in_array($sfl, array('b.it_name', 'a.it_id', 'a.is_subject', 'a.is_content', 'a.is_name', 'a.mb_id')) ){
|
||||
//다른값이 들어가있다면 초기화
|
||||
$sfl = '';
|
||||
}
|
||||
|
||||
if (G5_IS_MOBILE) {
|
||||
include_once(G5_MSHOP_PATH.'/itemuselist.php');
|
||||
return;
|
||||
}
|
||||
|
||||
$g5['title'] = '사용후기';
|
||||
include_once('./_head.php');
|
||||
|
||||
$sql_common = " from `{$g5['g5_shop_item_use_table']}` a join `{$g5['g5_shop_item_table']}` b on (a.it_id=b.it_id) ";
|
||||
$sql_search = " where a.is_confirm = '1' ";
|
||||
|
||||
if(!$sfl)
|
||||
$sfl = 'b.it_name';
|
||||
|
||||
if ($stx) {
|
||||
$sql_search .= " and ( ";
|
||||
switch ($sfl) {
|
||||
case "a.it_id" :
|
||||
$sql_search .= " ($sfl like '$stx%') ";
|
||||
break;
|
||||
case "a.is_name" :
|
||||
case "a.mb_id" :
|
||||
$sql_search .= " ($sfl = '$stx') ";
|
||||
break;
|
||||
default :
|
||||
$sql_search .= " ($sfl like '%$stx%') ";
|
||||
break;
|
||||
}
|
||||
$sql_search .= " ) ";
|
||||
}
|
||||
|
||||
if (!$sst) {
|
||||
$sst = "a.is_id";
|
||||
$sod = "desc";
|
||||
}
|
||||
$sql_order = " order by $sst $sod ";
|
||||
|
||||
$sql = " select count(*) as cnt
|
||||
$sql_common
|
||||
$sql_search
|
||||
$sql_order ";
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$rows = $config['cf_page_rows'];
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||
|
||||
$sql = " select *
|
||||
$sql_common
|
||||
$sql_search
|
||||
$sql_order
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
$itemuselist_skin = G5_SHOP_SKIN_PATH.'/itemuselist.skin.php';
|
||||
|
||||
if(!file_exists($itemuselist_skin)) {
|
||||
echo str_replace(G5_PATH.'/', '', $itemuselist_skin).' 스킨 파일이 존재하지 않습니다.';
|
||||
} else {
|
||||
include_once($itemuselist_skin);
|
||||
}
|
||||
|
||||
include_once('./_tail.php');
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
include_once('../../common.php');
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 카카오페이를 사용하지 않을 경우 return;
|
||||
if( ! $default['de_kakaopay_enckey'] ) return;
|
||||
|
||||
if( !isset($is_mobile_order) ){
|
||||
$is_mobile_order = is_mobile();
|
||||
}
|
||||
|
||||
if( $is_mobile_order ){
|
||||
include_once(G5_MSHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
if ( $default['de_card_test']) {
|
||||
if ($default['de_escrow_use'] == 1) {
|
||||
$default['de_kakaopay_mid'] = 'iniescrow0';
|
||||
$default['de_kakaopay_cancelpwd'] = '1111';
|
||||
} else {
|
||||
$default['de_kakaopay_mid'] = 'INIpayTest';
|
||||
$default['de_kakaopay_cancelpwd'] = '1111';
|
||||
}
|
||||
} else {
|
||||
$default['de_kakaopay_mid'] = 'SIRK'.$default['de_kakaopay_mid'];
|
||||
}
|
||||
|
||||
$noti_url = G5_SHOP_URL.'/kakaopay/mobile_settle_common.php';
|
||||
$next_url = G5_SHOP_URL.'/kakaopay/mobile_pay_approval.php';
|
||||
$return_url = G5_SHOP_URL.'/kakaopay/mobile_pay_return.php?oid=';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/settle_inicis.inc.php');
|
||||
|
||||
if ($default['de_card_test']) {
|
||||
if ($default['de_escrow_use'] == 1) {
|
||||
$default['de_kakaopay_mid'] = 'iniescrow0';
|
||||
$default['de_kakaopay_key'] = 'SU5JTElURV9UUklQTEVERVNfS0VZU1RS';
|
||||
$default['de_kakaopay_cancelpwd'] = '1111';
|
||||
} else {
|
||||
$default['de_kakaopay_mid'] = 'INIpayTest';
|
||||
$default['de_kakaopay_key'] = 'SU5JTElURV9UUklQTEVERVNfS0VZU1RS';
|
||||
$default['de_kakaopay_cancelpwd'] = '1111';
|
||||
}
|
||||
|
||||
if( !(isset($stdpay_js_url) && $stdpay_js_url) ){
|
||||
$stdpay_js_url = 'https://stgstdpay.inicis.com/stdjs/INIStdPay.js';
|
||||
}
|
||||
} else {
|
||||
$default['de_kakaopay_mid'] = 'SIRK'.$default['de_kakaopay_mid'];
|
||||
|
||||
// 실 결제 URL
|
||||
if( !(isset($stdpay_js_url) && $stdpay_js_url) ){
|
||||
$stdpay_js_url = 'https://stdpay.inicis.com/stdjs/INIStdPay.js';
|
||||
}
|
||||
}
|
||||
|
||||
$returnUrl = G5_SHOP_URL.'/kakaopay/inicis_kk_return.php';
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G5_SHOP_PATH.'/kakaopay/incKakaopayCommon.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/HttpClient.php');
|
||||
require_once(G5_SHOP_PATH.'/inicis/libs/json_lib.php');
|
||||
|
||||
// 카카오페이를 사용하지 않을 경우
|
||||
if( ! $default['de_kakaopay_enckey'] ) die('카카오페이를 사용하지 않습니다.');
|
||||
|
||||
@header("Progma:no-cache");
|
||||
@header("Cache-Control:no-cache,must-revalidate");
|
||||
|
||||
$request_mid = isset($_POST['mid']) ? clean_xss_tags($_POST['mid']) : '';
|
||||
|
||||
if( ($request_mid != $default['de_kakaopay_mid']) ){
|
||||
alert("요청된 mid 와 설정된 mid 가 틀립니다.");
|
||||
}
|
||||
|
||||
$orderNumber = isset($_POST['orderNumber']) ? preg_replace("/[ #\&\+%@=\/\\\:;,\.'\"\^`~|\!\?\*$#<>()\[\]\{\}]/i", "", strip_tags($_POST['orderNumber'])) : 0;
|
||||
$session_order_num = get_session('ss_order_id');
|
||||
|
||||
if( !$orderNumber ){
|
||||
alert("주문번호가 없습니다.");
|
||||
}
|
||||
|
||||
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$orderNumber' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if( empty($row) ){
|
||||
alert("임시 주문정보가 저장되지 않았습니다.");
|
||||
}
|
||||
|
||||
if ( base64_encode(base64_decode($row['dt_data'], true)) === $row['dt_data']){
|
||||
$data = unserialize(base64_decode($row['dt_data']));
|
||||
} else {
|
||||
$data = unserialize($row['dt_data']);
|
||||
}
|
||||
|
||||
$params = array();
|
||||
$var_datas = array();
|
||||
|
||||
foreach($data as $key=>$value) {
|
||||
if(is_array($value)) {
|
||||
foreach($value as $k=>$v) {
|
||||
$_POST[$key][$k] = $params[$key][$k] = clean_xss_tags(strip_tags($v));
|
||||
}
|
||||
} else {
|
||||
$_POST[$key] = $params[$key] = clean_xss_tags(strip_tags($value));
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data['pp_id']) && $data['pp_id']) { //개인결제
|
||||
|
||||
foreach($params as $key=>$value){
|
||||
|
||||
if( in_array($key, array('pp_name', 'pp_email', 'pp_hp', 'pp_settle_case')) ){
|
||||
|
||||
$var_datas[$key] = $value;
|
||||
|
||||
$$key = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
include_once(G5_SHOP_PATH.'/personalpayformupdate.php');
|
||||
|
||||
} else { //상점주문
|
||||
|
||||
foreach($params as $key=>$value){
|
||||
|
||||
if( in_array($key, array('od_price', 'od_name', 'od_tel', 'od_hp', 'od_email', 'od_memo', 'od_settle_case', 'max_temp_point', 'od_temp_point', 'od_bank_account', 'od_deposit_name', 'od_test', 'od_ip', 'od_zip', 'od_addr1', 'od_addr2', 'od_addr3', 'od_addr_jibeon', 'od_b_name', 'od_b_tel', 'od_b_hp', 'od_b_addr1', 'od_b_addr2', 'od_b_addr3', 'od_b_addr_jibeon', 'od_b_zip', 'od_send_cost', 'od_send_cost2', 'od_hope_date')) ){
|
||||
|
||||
$var_datas[$key] = $value;
|
||||
|
||||
$$key = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$od_send_cost = (int) $_POST['od_send_cost'];
|
||||
$od_send_cost2 = (int) $_POST['od_send_cost2'];
|
||||
|
||||
include_once(G5_SHOP_PATH.'/orderformupdate.php');
|
||||
}
|
||||