Merge branch 'master' of github.com:gnuboard/yc4s

This commit is contained in:
gnuboard
2013-07-31 17:32:42 +09:00
23 changed files with 501 additions and 206 deletions

View File

@ -65,7 +65,7 @@ if(!isset($config['cf_mobile_pages'])) {
if(!isset($config['cf_facebook_appid'])) {
sql_query(" ALTER TABLE `{$g4['config_table']}`
ADD `cf_facebook_appid` VARCHAR(255) NOT NULL AFTER `cf_kcpcert_use`,
ADD `cf_facebook_appid` VARCHAR(255) NOT NULL AFTER `cf_kcpcert_use`,
ADD `cf_facebook_secret` VARCHAR(255) NOT NULL AFTER `cf_facebook_appid`,
ADD `cf_twitter_key` VARCHAR(255) NOT NULL AFTER `cf_facebook_secret`,
ADD `cf_twitter_secret` VARCHAR(255) NOT NULL AFTER `cf_twitter_key`,
@ -333,6 +333,13 @@ $pg_anchor = '<ul class="anchor">
<input type="checkbox" name="cf_use_copy_log" value="1" id="cf_use_copy_log" <?php echo $config['cf_use_copy_log']?'checked':''; ?>> 남김
</td>
</tr>
<tr>
<th scope="row"><label for="cf_point_term">포인트 유효기간</label></th>
<td colspan="3">
<?php echo help('기간을 0으로 설정시 포인트 유효기간이 적용되지 않습니다.') ?>
<input type="text" name="cf_point_term" value="<?php echo $config['cf_point_term']; ?>" id="cf_point_term" required class="required frm_input" size="5"> 일
</td>
</tr>
<tr>
<th scope="row"><label for="cf_possible_ip">접근가능 IP</label></th>
<td>

View File

@ -23,6 +23,7 @@ $sql = " update {$g4['config_table']}
cf_include_tail = '{$_POST['cf_include_tail']}',
cf_add_script = '{$_POST['cf_add_script']}',
cf_use_point = '{$_POST['cf_use_point']}',
cf_point_term = '{$_POST['cf_point_term']}',
cf_use_norobot = '{$_POST['cf_use_norobot']}',
cf_use_copy_log = '{$_POST['cf_use_copy_log']}',
cf_use_email_certify = '{$_POST['cf_use_email_certify']}',

View File

@ -9,6 +9,7 @@ $token = get_token();
$sql_common = " from {$g4['point_table']} ";
$sql_search = " where (1) ";
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
@ -58,7 +59,17 @@ if ($sfl == 'mb_id' && $stx)
$g4['title'] = '포인트관리';
include_once ('./admin.head.php');
$colspan = 8;
$colspan = 9;
$po_expire_term = '';
if($config['cf_point_term'] > 0) {
$po_expire_term = $config['cf_point_term'];
}
if (strstr($sfl, "mb_id"))
$mb_id = $stx;
else
$mb_id = "";
?>
<script>
@ -125,9 +136,10 @@ function point_clear()
<th scope="col">회원아이디</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>
<th scope="col">만료일</th>
<th scope="col">포인트합</th>
</tr>
</thead>
@ -146,6 +158,10 @@ function point_clear()
$link1 = '<a href="'.G4_BBS_URL.'/board.php?bo_table='.$row['po_rel_table'].'&amp;wr_id='.$row['po_rel_id'].'" target="_blank">';
$link2 = '</a>';
}
$expr = '';
if($row['po_expired'] == 1)
$expr = ' txt_expired';
?>
<tr>
@ -158,10 +174,15 @@ function point_clear()
<td class="td_mbid"><a href="?sfl=mb_id&amp;stx=<?php echo $row['mb_id'] ?>"><?php echo $row['mb_id'] ?></a></td>
<td class="td_mbname"><?php echo $row2['mb_name'] ?></td>
<td class="td_name sv_use"><div><?php echo $mb_nick ?></div></td>
<td class="td_time"><?php echo $row['po_datetime'] ?></td>
<td class="td_pt_log"><?php echo $link1 ?><?php echo $row['po_content'] ?><?php echo $link2 ?></td>
<td class="td_num td_pt"><?php echo number_format($row['po_point']) ?></td>
<td class="td_bignum td_pt"><?php echo number_format($row2['mb_point']) ?></td>
<td class="td_time"><?php echo $row['po_datetime'] ?></td>
<td class="td_date<?php echo $expr; ?>">
<?php if ($row['po_expired'] == 1) { ?>
만료<?php echo date('ymd', strtotime($row['po_expire_date'])); ?>
<?php } else echo $row['po_expire_date'] == '9999-12-31' ? '&nbsp;' : $row['po_expire_date']; ?>
</td>
<td class="td_num td_pt"><?php echo number_format($row['po_mb_point']) ?></td>
</tr>
<?php
@ -211,6 +232,12 @@ function point_clear()
<th scope="row"><label for="po_point">포인트<strong class="sound_only">필수</strong></label></th>
<td><input type="text" name="po_point" id="po_point" required class="required frm_input"></td>
</tr>
<?php if($config['cf_point_term'] > 0) { ?>
<tr>
<th scope="row"><label for="po_expire_term">포인트 유효기간</label></th>
<td><input type="text" name="po_expire_term" value="<?php echo $po_expire_term; ?>" id="po_expire_term" class="frm_input" size="5"> 일</td>
</tr>
<?php } ?>
</tbody>
</table>

View File

@ -1,5 +1,5 @@
<?php
$sub_menu = "200200";
$sub_menu = '200200';
include_once('./_common.php');
check_demo();
@ -10,23 +10,50 @@ check_token();
$count = count($_POST['chk']);
if(!$count)
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
alert($_POST['act_button'].' 하실 항목을 하나 이상 체크하세요.');
for ($i=0; $i<$count; $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
// 포인트 내역정보
$sql = " select * from {$g4['point_table']} where po_id = '{$_POST['po_id'][$k]}' ";
$row = sql_fetch($sql);
if(!$row['po_id'])
continue;
if($row['po_point'] < 0) {
$mb_id = $row['mb_id'];
$po_point = abs($row['po_point']);
if($row['po_rel_table'] == '@expire')
delete_expire_point($mb_id, $po_point);
else
delete_use_point($mb_id, $po_point);
} else {
if($row['po_use_point'] > 0) {
insert_use_point($row['mb_id'], $row['po_use_point'], $row['po_id']);
}
}
// 포인트 내역삭제
$sql = " delete from {$g4['point_table']} where po_id = '{$_POST['po_id'][$k]}' ";
sql_query($sql);
$sql = " select sum(po_point) as sum_po_point from {$g4['point_table']} where mb_id = '{$_POST['mb_id'][$k]}' ";
$row = sql_fetch($sql);
$sum_point = $row['sum_po_point'];
// po_mb_point에 반영
$sql = " update {$g4['point_table']}
set po_mb_point = po_mb_point - '{$row['po_point']}'
where mb_id = '{$_POST['mb_id'][$k]}'
and po_id > '{$_POST['po_id'][$k]}' ";
sql_query($sql);
$sql= " update {$g4['member_table']} set mb_point = '{$sum_point}' where mb_id = '{$_POST['mb_id'][$k]}' ";
// 포인트 UPDATE
$sum_point = get_point_sum($_POST['mb_id'][$k]);
$sql= " update {$g4['member_table']} set mb_point = '$sum_point' where mb_id = '{$_POST['mb_id'][$k]}' ";
sql_query($sql);
}
goto_url('./point_list.php?'.$qstr);
?>
?>

View File

@ -9,6 +9,7 @@ check_token();
$mb_id = $_POST['mb_id'];
$po_point = $_POST['po_point'];
$po_content = $_POST['po_content'];
$expire = preg_replace('/[^0-9]/', '', $_POST['po_expire_term']);
$mb = get_member($mb_id);
@ -18,7 +19,7 @@ if (!$mb['mb_id'])
if (($po_point < 0) && ($po_point * (-1) > $mb['mb_point']))
alert('포인트를 깎는 경우 현재 포인트보다 작으면 안됩니다.', './point_list.php?'.$qstr);
insert_point($mb_id, $po_point, $po_content, '@passive', $mb_id, $member['mb_id']."-".uniqid(""));
insert_point($mb_id, $po_point, $po_content, '@passive', $mb_id, $member['mb_id'].'-'.uniqid(''), $expire);
goto_url('./point_list.php?'.$qstr);
?>

View File

@ -101,8 +101,8 @@ while ($row = sql_fetch_array($result))
else
{
// 코멘트 포인트 삭제
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '코멘트'))
insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 코멘트삭제");
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '댓글'))
insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 댓글삭제");
$count_comment++;
}

View File

@ -114,8 +114,8 @@ for ($i=count($tmp_array)-1; $i>=0; $i--)
else
{
// 코멘트 포인트 삭제
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '코멘트'))
insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 코멘트삭제");
if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '댓글'))
insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 댓글삭제");
$count_comment++;
}

View File

@ -58,9 +58,9 @@ $row = sql_fetch($sql);
if ($row['cnt'] && !$is_admin)
alert('이 코멘트와 관련된 답변코멘트가 존재하므로 삭제 할 수 없습니다.');
// 코멘트 삭제
// 코멘트 포인트 삭제
if (!delete_point($write['mb_id'], $bo_table, $comment_id, '댓글'))
insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_parent']}-{$comment_id} 코멘트삭제");
insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_parent']}-{$comment_id} 댓글삭제");
// 코멘트 삭제
sql_query(" delete from {$write_table} where wr_id = '{$comment_id}' ");

View File

@ -40,6 +40,14 @@ set_session('ss_mb_id', $mb['mb_id']);
// FLASH XSS 공격에 대응하기 위하여 회원의 고유키를 생성해 놓는다. 관리자에서 검사함 - 110106
set_session('ss_mb_key', md5($mb['mb_datetime'] . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']));
// 포인트 체크
if($config['cf_use_point']) {
$sum_point = get_point_sum($mb['mb_id']);
$sql= " update {$g4['member_table']} set mb_point = '$sum_point' where mb_id = '{$mb['mb_id']}' ";
sql_query($sql);
}
// 3.26
// 아이디 쿠키에 한달간 저장
if ($auto_login) {

View File

@ -20,21 +20,6 @@ $rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
// 포인트소계
$sql = " select po_point
{$sql_common}
{$sql_order}
limit {$from_record}, {$rows} ";
$result = sql_query($sql);
$sum_point1 = $sum_point2 = 0;
for($i=0; $row=sql_fetch_array($result); $i++) {
if($row['po_point'] >= 0) {
$sum_point1 += $row['po_point'];
} else {
$sum_point2 += $row['po_point'];
}
}
?>
<div id="point" class="new_win">
@ -50,20 +35,9 @@ for($i=0; $row=sql_fetch_array($result); $i++) {
<th scope="col">사용포인트</th>
</tr>
</thead>
<tfoot>
<tr>
<th scope="row" colspan="2">소계</th>
<td><?php echo number_format($sum_point1) ?></td>
<td><?php echo number_format($sum_point2) ?></td>
</tr>
<tr>
<th scope="row" colspan="2">보유포인트</th>
<td colspan="2"><?php echo number_format($member['mb_point']) ?></td>
</tr>
</tfoot>
<tbody>
<?php
$sum_point1 = $sum_point2 = 0;
$sum_point1 = $sum_point2 = $sum_point3 = 0;
$sql = " select *
{$sql_common}
@ -80,12 +54,13 @@ for($i=0; $row=sql_fetch_array($result); $i++) {
$sum_point2 += $row['po_point'];
}
$po_content = $row['po_content'];
?>
<tr>
<td class="td_datetime"><?php echo $row['po_datetime'] ?></td>
<td><?php echo $row['po_content'] ?></td>
<td class="td_bignum"><?php echo $point1 ?></td>
<td class="td_bignum"><?php echo $point2 ?></td>
<td class="td_datetime"><?php echo $row['po_datetime']; ?></td>
<td><?php echo $po_content; ?></td>
<td class="td_bignum"><?php echo $point1; ?></td>
<td class="td_bignum"><?php echo $point2; ?></td>
</tr>
<?php
}
@ -99,6 +74,17 @@ for($i=0; $row=sql_fetch_array($result); $i++) {
}
?>
</tbody>
<tfoot>
<tr>
<th scope="row" colspan="2">소계</th>
<td><?php echo $sum_point1; ?></td>
<td><?php echo $sum_point2; ?></td>
</tr>
<tr>
<th scope="row" colspan="2">보유포인트</th>
<td colspan="2"><?php echo number_format($member['mb_point']); ?></td>
</tr>
</tfoot>
</table>

View File

@ -25,7 +25,7 @@ if (!get_magic_quotes_gpc()) {
foreach ($value as &$v) $fn($v, $fn);
}
');
// Escape data
$addslashes_deep($_POST, $addslashes_deep);
$addslashes_deep($_GET, $addslashes_deep);
@ -95,7 +95,7 @@ if (file_exists($dbconfig_file)) {
$connect_db = sql_connect(G4_MYSQL_HOST, G4_MYSQL_USER, G4_MYSQL_PASSWORD) or die('MySQL Connect Error!!!');
$select_db = sql_select_db(G4_MYSQL_DB, $connect_db) or die('MySQL DB Error!!!');
@mysql_query(" set names utf8 ");
if (defined(G4_TIMEZONE)) @mysql_query(" set time_zone = '".G4_TIMEZONE."'");
if (defined(G4_TIMEZONE)) @mysql_query(" set time_zone = '".G4_TIMEZONE."'");
} else {
?>
@ -165,7 +165,7 @@ $config = sql_fetch(" select * from {$g4['config_table']} ");
define('G4_HTTP_BBS_URL', https_url(G4_BBS_DIR, false));
define('G4_HTTPS_BBS_URL', https_url(G4_BBS_DIR, true));
if ($config['cf_editor'])
if ($config['cf_editor'])
define('G4_EDITOR_LIB', G4_EDITOR_PATH."/{$config['cf_editor']}/editor.lib.php");
else
define('G4_EDITOR_LIB', G4_LIB_PATH."/editor.lib.php");
@ -182,7 +182,7 @@ if (G4_USE_MOBILE) {
$is_mobile = false;
else if ($_REQUEST['device']=='mobile')
$is_mobile = true;
else if (isset($_SESSION['ss_is_mobile']))
else if (isset($_SESSION['ss_is_mobile']))
$is_mobile = $_SESSION['ss_is_mobile'];
else if (is_mobile())
$is_mobile = true;
@ -263,7 +263,7 @@ if (isset($_REQUEST['spt'])) { // search part (검색 파트[구간])
if (isset($_REQUEST['page'])) { // 리스트 페이지
$page = (int)$_REQUEST['page'];
if ($page)
if ($page)
$qstr .= '&amp;page=' . urlencode($page);
} else {
$page = '';

View File

@ -554,6 +554,7 @@ td {padding:8px 5px 6px;border-top:1px solid #e9e9e9;border-bottom:1px solid #e9
/* 공통 */
.tr_bg {background:#f5f6fa}
.td_addr {text-align:left !important}
.td_chk {width:30px;text-align:center}
.td_smallstat {width:50px;text-align:center}
.td_num {width:60px;text-align:center}
@ -564,9 +565,10 @@ td {padding:8px 5px 6px;border-top:1px solid #e9e9e9;border-bottom:1px solid #e9
.td_odrnum3 {width:110px;text-align:center}
.td_grid {width:60px;text-align:center}
.td_mbid, .td_name, .td_mbname {width:100px;text-align:left !important}
.td_addr {text-align:left !important}
.td_date {width:80px;text-align:center}
.td_time {width:150px;text-align:center}
.td_date {width:70px;text-align:center}
.td_time {width:130px;text-align:center}
.td_boolean {width:50px;text-align:center}
.td_pt {text-align:right !important}
.td_sendcost_by {width:50px;text-align:center}
@ -579,8 +581,14 @@ td {padding:8px 5px 6px;border-top:1px solid #e9e9e9;border-bottom:1px solid #e9
.txt_true {color:#e8180c}
.txt_false {color:#ccc}
.banner_or_img {margin:10px 0 0}
.banner_or_img button {display:block;margin:5px 0 0}
.txt_active {color:#5d910b}
.txt_expired {color:#ccc}
/* 환경설정 */
.cf_cert_kcp_hide {display:none}
/* 관리권한설정 */
#add_admin fieldset {margin-top:20px}

View File

@ -374,6 +374,16 @@ if(!sql_query(" select od_tax_flag from {$g4['shop_order_table']} limit 1 ", fal
}
*/
/*
// notax 필드추가
$sql = " select ct_notax from {$g4['shop_cart_table']} limit 1 ";
$result = sql_query($sql, false);
if(!$result) {
sql_query(" ALTER TABLE `{$g4['shop_cart_table']}`
ADD `ct_notax` TINYINT(4) NOT NULL DEFAULT '0' AFTER `ct_num` ", true);
}
*/
// 쇼핑몰 스킨 필드 추가
if (!isset($default['de_shop_skin'])) {
sql_query(" ALTER TABLE `{$g4['shop_default_table']}`

View File

@ -197,6 +197,7 @@ CREATE TABLE IF NOT EXISTS `g4s_config` (
`cf_include_tail` varchar(255) NOT NULL DEFAULT '',
`cf_add_script` text NOT NULL,
`cf_use_point` tinyint(4) NOT NULL DEFAULT '0',
`cf_point_term` int(11) NOT NULL DEFAULT '0',
`cf_use_norobot` tinyint(4) NOT NULL DEFAULT '0',
`cf_use_copy_log` tinyint(4) NOT NULL DEFAULT '0',
`cf_use_email_certify` tinyint(4) NOT NULL DEFAULT '0',
@ -492,11 +493,16 @@ CREATE TABLE IF NOT EXISTS `g4s_point` (
`po_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
`po_content` varchar(255) NOT NULL default '',
`po_point` int(11) NOT NULL default '0',
`po_use_point` int(11) NOT NULL default '0',
`po_expired` tinyint(4) NOT NULL default '0',
`po_expire_date` date NOT NULL default '0000-00-00',
`po_mb_point` int(11) NOT NULL default '0',
`po_rel_table` varchar(20) NOT NULL default '',
`po_rel_id` varchar(20) NOT NULL default '',
`po_rel_action` varchar(255) NOT NULL default '',
PRIMARY KEY (`po_id`),
KEY `index1` (`mb_id`,`po_rel_table`,`po_rel_id`,`po_rel_action`)
KEY `index1` (`mb_id`,`po_rel_table`,`po_rel_id`,`po_rel_action`),
KEY `index2` (`po_expire_date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------

View File

@ -554,7 +554,7 @@ function html_purifier($html)
// 첫행이 # 이면 주석 처리
if (!preg_match("/^#/", $domain)) {
$domain = trim($domain);
if ($domain)
if ($domain)
array_push($domains, $domain);
}
}
@ -866,7 +866,7 @@ function get_yn_select($name, $selected='1', $event='')
// 포인트 부여
function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='')
function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='', $expire=0)
{
global $config;
global $g4;
@ -883,6 +883,9 @@ function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $r
$mb = sql_fetch(" select mb_id from {$g4['member_table']} where mb_id = '$mb_id' ");
if (!$mb['mb_id']) { return 0; }
// 회원포인트
$mb_point = get_point_sum($mb_id);
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
@ -897,28 +900,251 @@ function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $r
}
// 포인트 건별 생성
$po_expire_date = '9999-12-31';
if($config['cf_point_term'] > 0) {
if($expire > 0)
$po_expire_date = date('Y-m-d', strtotime('+'.($expire - 1).' days', G4_SERVER_TIME));
else
$po_expire_date = date('Y-m-d', strtotime('+'.($config['cf_point_term'] - 1).' days', G4_SERVER_TIME));
}
$po_expired = 0;
if($point < 0) {
$po_expired = 1;
$po_expire_date = G4_TIME_YMD;
}
$po_mb_point = $mb_point + $point;
$sql = " insert into {$g4['point_table']}
set mb_id = '$mb_id',
po_datetime = '".G4_TIME_YMDHIS."',
po_content = '".addslashes($content)."',
po_point = '$point',
po_use_point = '0',
po_mb_point = '$po_mb_point',
po_expired = '$po_expired',
po_expire_date = '$po_expire_date',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from {$g4['point_table']} where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row['sum_po_point'];
// 포인트를 사용한 경우 포인트 내역에 사용금액 기록
if($point < 0) {
insert_use_point($mb_id, $point);
}
// 포인트 UPDATE
$sql = " update {$g4['member_table']} set mb_point = '$sum_point' where mb_id = '$mb_id' ";
$sql = " update {$g4['member_table']} set mb_point = '$po_mb_point' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
}
// 사용포인트 입력
function insert_use_point($mb_id, $point, $po_id='')
{
global $g4, $config;
if($config['cf_point_term'])
$sql_order = " order by po_expire_date asc, po_id asc ";
else
$sql_order = " order by po_id asc ";
$point1 = abs($point);
$sql = " select po_id, po_point, po_use_point
from {$g4['point_table']}
where mb_id = '$mb_id'
and po_id <> '$po_id'
and po_expired = '0'
and po_point > po_use_point
$sql_order ";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
$point2 = $row['po_point'];
$point3 = $row['po_use_point'];
if(($point2 - $point3) > $point1) {
$sql = " update {$g4['point_table']}
set po_use_point = po_use_point + '$point1'
where po_id = '{$row['po_id']}' ";
sql_query($sql);
break;
} else {
$point4 = $point2 - $point3;
$sql = " update {$g4['point_table']}
set po_use_point = po_use_point + '$point4',
po_expired = '100'
where po_id = '{$row['po_id']}' ";
sql_query($sql);
$point1 -= $point4;
}
}
}
// 사용포인트 삭제
function delete_use_point($mb_id, $point)
{
global $g4, $config;
if($config['cf_point_term'])
$sql_order = " order by po_expire_date desc, po_id desc ";
else
$sql_order = " order by po_id desc ";
$point1 = abs($point);
$sql = " select po_id, po_use_point, po_expired, po_expire_date
from {$g4['point_table']}
where mb_id = '$mb_id'
and po_expired <> '1'
and po_use_point > 0
$sql_order ";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
$point2 = $row['po_use_point'];
$po_expired = $row['po_expired'];
if($row['po_expired'] == 100 && ($row['po_expire_date'] == '9999-12-31' || $row['po_expire_date'] >= G4_TIME_YMD))
$po_expired = 0;
if($point2 > $point1) {
$sql = " update {$g4['point_table']}
set po_use_point = po_use_point - '$point1',
po_expired = '$po_expired'
where po_id = '{$row['po_id']}' ";
sql_query($sql);
break;
} else {
$sql = " update {$g4['point_table']}
set po_use_point = '0',
po_expired = '$po_expired'
where po_id = '{$row['po_id']}' ";
sql_query($sql);
$point1 -= $point2;
}
}
}
// 소멸포인트 삭제
function delete_expire_point($mb_id, $point)
{
global $g4, $config;
$point1 = abs($point);
$sql = " select po_id, po_use_point, po_expired, po_expire_date
from {$g4['point_table']}
where mb_id = '$mb_id'
and po_expired = '1'
and po_point >= 0
and po_use_point > 0
order by po_expire_date desc, po_id desc ";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
$point2 = $row['po_use_point'];
$po_expired = '0';
$po_expire_date = '9999-12-31';
if($config['cf_point_term'] > 0)
$po_expire_date = date('Y-m-d', strtotime('+'.($config['cf_point_term'] - 1).' days', G4_SERVER_TIME));
if($point2 > $point1) {
$sql = " update {$g4['point_table']}
set po_use_point = po_use_point - '$point1',
po_expired = '$po_expired',
po_expire_date = '$po_expire_date'
where po_id = '{$row['po_id']}' ";
sql_query($sql);
break;
} else {
$sql = " update {$g4['point_table']}
set po_use_point = '0',
po_expired = '$po_expired',
po_expire_date = '$po_expire_date'
where po_id = '{$row['po_id']}' ";
sql_query($sql);
$point1 -= $point2;
}
}
}
// 포인트 내역 합계
function get_point_sum($mb_id)
{
global $g4, $config;
if($config['cf_point_term'] > 0) {
// 소멸포인트가 있으면 내역 추가
$expire_point = get_expire_point($mb_id);
if($expire_point > 0) {
$mb = get_member($mb_id, 'mb_point');
$content = '포인트 소멸';
$rel_table = '@expire';
$rel_id = $mb_id;
$rel_action = 'expire'.'-'.uniqid('');
$point = $expire_point * (-1);
$po_mb_point = $mb['mb_point'] + $point;
$po_expire_date = G4_TIME_YMD;
$po_expired = 1;
$sql = " insert into {$g4['point_table']}
set mb_id = '$mb_id',
po_datetime = '".G4_TIME_YMDHIS."',
po_content = '".addslashes($content)."',
po_point = '$point',
po_use_point = '0',
po_mb_point = '$po_mb_point',
po_expired = '$po_expired',
po_expire_date = '$po_expire_date',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 포인트를 사용한 경우 포인트 내역에 사용금액 기록
if($point < 0) {
insert_use_point($mb_id, $point);
}
}
// 유효기간이 있을 때 기간이 지난 포인트 expired 체크
$sql = " update {$g4['point_table']}
set po_expired = '1'
where mb_id = '$mb_id'
and po_expired <> '1'
and po_expire_date <> '9999-12-31'
and po_expire_date < '".G4_TIME_YMD."' ";
sql_query($sql);
}
// 포인트합
$sql = " select sum(po_point) as sum_po_point
from {$g4['point_table']}
where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
return $row['sum_po_point'];
}
// 소멸 포인트
function get_expire_point($mb_id)
{
global $g4, $config;
if($config['cf_point_term'] == 0)
return 0;
$sql = " select sum(po_point - po_use_point) as sum_point
from {$g4['point_table']}
where mb_id = '$mb_id'
and po_expired = '0'
and po_expire_date <> '9999-12-31'
and po_expire_date < '".G4_TIME_YMD."' ";
$row = sql_fetch($sql);
return $row['sum_point'];
}
// 포인트 삭제
function delete_point($mb_id, $rel_table, $rel_id, $rel_action)
{
@ -927,16 +1153,40 @@ function delete_point($mb_id, $rel_table, $rel_id, $rel_action)
$result = false;
if ($rel_table || $rel_id || $rel_action)
{
// 포인트 내역정보
$sql = " select * from {$g4['point_table']}
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if($row['po_point'] < 0) {
$mb_id = $row['mb_id'];
$po_point = abs($row['po_point']);
delete_use_point($mb_id, $po_point);
} else {
if($row['po_use_point'] > 0) {
insert_use_point($row['mb_id'], $row['po_use_point'], $row['po_id']);
}
}
$result = sql_query(" delete from {$g4['point_table']}
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ", false);
// po_mb_point에 반영
$sql = " update {$g4['point_table']}
set po_mb_point = po_mb_point - '{$row['po_point']}'
where mb_id = '$mb_id'
and po_id > '{$row['po_id']}' ";
sql_query($sql);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from {$g4['point_table']} where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row['sum_po_point'];
$sum_point = get_point_sum($mb_id);
// 포인트 UPDATE
$sql = " update {$g4['member_table']} set mb_point = '$sum_point' where mb_id = '$mb_id' ";
@ -978,11 +1228,11 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름
$tmp_name = $tmp_name.' '.$name;
} else {
$tmp_name = $tmp_name." ".$name;
}
} else {
$tmp_name = $tmp_name.' '.$name;
} else {
$tmp_name = $tmp_name." ".$name;
}
} else {
$tmp_name = $tmp_name.' '.$name;
}
$tmp_name .= '</a>';
@ -2022,7 +2272,7 @@ function board_notice($bo_notice, $wr_id, $insert=false)
// goo.gl 짧은주소 만들기
function googl_short_url($longUrl)
function googl_short_url($longUrl)
{
global $config;

View File

@ -53,7 +53,7 @@ class item_list
// select 에 사용되는 필드
protected $fields = "*";
// 분류코드로만 사용하는 경우 상품유형($type)을 0 으로 설정하면 됩니다.
// 분류코드로만 사용하는 경우 상품유형($type)을 0 으로 설정하면 됩니다.
protected $ca_id = "";
protected $ca_id2 = "";
protected $ca_id3 = "";
@ -83,7 +83,7 @@ class item_list
protected $view_sns = false; // SNS
// 몇번째 class 호출인지를 저장합니다.
protected $count = 0;
protected $count = 0;
// true 인 경우 페이지를 구한다.
protected $is_page = false;
@ -128,7 +128,7 @@ class item_list
// 분류코드로 검색을 하고자 하는 경우 아래와 같이 인수를 넘겨줍니다.
// 1단계 분류는 (분류코드, 1)
// 2단계 분류는 (분류코드, 2)
// 3단계 분류는 (분류코드, 3)
// 3단계 분류는 (분류코드, 3)
function set_category($ca_id, $level=1) {
if ($level == 2) {
$this->ca_id2 = $ca_id;
@ -141,7 +141,7 @@ class item_list
// 이벤트코드를 인수로 넘기게 되면 해당 이벤트에 속한 상품을 노출합니다.
function set_event($ev_id) {
$this->event = $ev_id;
$this->event = $ev_id;
}
// 리스트 스킨을 바꾸고자 하는 경우에 사용합니다.
@ -176,7 +176,7 @@ class item_list
} else {
$this->list_row = $list_row ? $list_row : $default['de_type'.$this->type.'_list_row'];
}
if (!$this->list_row)
if (!$this->list_row)
$this->list_row = 1;
}
@ -224,13 +224,13 @@ class item_list
// anchor 태그에 하이퍼링크를 다른 주소로 걸거나 아예 링크를 걸지 않을 수 있습니다.
// 인수를 "" 공백으로 넘기면 링크를 걸지 않습니다.
function set_href($href) {
$this->href = $href;
$this->href = $href;
}
// ul 태그의 css 를 교체할수 있다. "sct sct_abc" 를 인수로 넘기게 되면
// ul 태그의 css 를 교체할수 있다. "sct sct_abc" 를 인수로 넘기게 되면
// 기존의 ul 태그에 걸린 css 는 무시되며 인수로 넘긴 css 가 사용됩니다.
function set_css($css) {
$this->css = $css;
$this->css = $css;
}
// 페이지를 노출하기 위해 true 로 설정할때 사용합니다.
@ -254,7 +254,7 @@ class item_list
global $g4, $config, $member, $default;
if ($this->query) {
$sql = $this->query;
$result = sql_query($sql);
$this->total_count = @mysql_num_rows($result);
@ -265,7 +265,7 @@ class item_list
if ($this->use) {
$where[] = " it_use = '1' ";
}
if ($this->type) {
$where[] = " it_type{$this->type} = '1' ";
}
@ -338,11 +338,16 @@ class item_list
// 장바구니 건수 검사
function get_cart_count($uq_id)
{
global $g4;
global $g4, $default;
$sql = " select count(ct_id) as cnt from {$g4['shop_cart_table']} where uq_id = '$uq_id' ";
if($default['de_cart_keep_term']) {
$ctime = date('Y-m-d H:i:s', G4_SERVER_TIME - ($default['de_cart_keep_term'] * 86400));
$sql .= " and ct_time > '$ctime' ";
}
$row = sql_fetch($sql);
return (int)$row['cnt'];
$cnt = (int)$row['cnt'];
return $cnt;
}
@ -1360,19 +1365,19 @@ function item_icon($it)
if ($stock <= 0)
$icon .= '<img src="'.G4_SHOP_URL.'/img/icon_soldout.gif" alt="품절"> ';
if ($it['it_type1'])
if ($it['it_type1'])
$icon .= '<img src="'.G4_SHOP_URL.'/img/icon_hit.gif" alt="최신상품">';
if ($it['it_type2'])
if ($it['it_type2'])
$icon .= '<img src="'.G4_SHOP_URL.'/img/icon_rec.gif" alt="히트상품">';
if ($it['it_type3'])
if ($it['it_type3'])
$icon .= '<img src="'.G4_SHOP_URL.'/img/icon_new.gif" alt="추천상품">';
if ($it['it_type4'])
if ($it['it_type4'])
$icon .= '<img src="'.G4_SHOP_URL.'/img/icon_best.gif" alt="인기상품">';
if ($it['it_type5'])
if ($it['it_type5'])
$icon .= '<img src="'.G4_SHOP_URL.'/img/icon_discount.gif" alt="할인상품">';
$icon .= '</span>';

View File

@ -163,8 +163,6 @@ else
<form name="fitem" action="<?php echo $action_url; ?>" method="post">
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
<input type="hidden" name="it_name" value="<?php echo $it['it_name']; ?>">
<input type="hidden" name="total_price" value="">
<input type="hidden" name="sw_direct">
<input type="hidden" name="url">
@ -311,7 +309,7 @@ else
<tr>
<th scope="row">판매가격</th>
<td>
<?php echo number_format($it['it_price']); ?> 원
<?php echo number_format(get_price($it)); ?> 원
<input type="hidden" name="it_price" value="<?php echo get_price($it); ?>">
</td>
</tr>
@ -333,7 +331,6 @@ else
$it_point = get_item_point($it);
echo number_format($it_point);
?> 점
<input type="hidden" name="it_point" value="<?php echo $it_point; ?>">
</td>
</tr>
<?php } ?>

View File

@ -1052,7 +1052,7 @@ function calculate_temp_point()
var send_cost = parseInt($("input[name=od_send_cost]").val());
var point_per = <?php echo $default['de_point_per']; ?>;
var temp_point = parseInt((sell_amount + send_cost) * (point_per / 100) / 100) * 100;
var point = <?php echo $member_point; ?>
var point = <?php echo (int)$member_point; ?>
if(temp_point > point)
temp_point = point;

View File

@ -65,9 +65,6 @@ include_once(G4_MSHOP_PATH.'/_head.php');
<?php } else { //품절이 아니면 체크할수 있도록한다 ?>
<input type="checkbox" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>" onclick="out_cd_check(this, '<?php echo $out_cd; ?>');">
<?php } ?>
<input type="hidden" name="it_name[<?php echo $i; ?>]" value="<?php echo $row['it_name']; ?>">
<input type="hidden" name="it_price[<?php echo $i; ?>]" value="<?php echo $it_price; ?>">
<input type="hidden" name="it_point[<?php echo $i; ?>]" value="<?php echo $it_point; ?>">
<input type="hidden" name="ct_qty[<?php echo $i; ?>]" value="1">
</td>
<td class="td_smallmng"><a href="<?php echo G4_SHOP_URL; ?>/wishupdate.php?w=d&amp;wi_id=<?php echo $row['wi_id']; ?>">삭제</a></td>

View File

@ -24,16 +24,6 @@ if ($member['mb_level'] < $default['de_level_sell'])
alert('상품을 구입할 수 있는 권한이 없습니다.');
}
/*
// notax 필드추가
$sql = " select ct_notax from {$g4['shop_cart_table']} limit 1 ";
$result = sql_query($sql, false);
if(!$result) {
sql_query(" ALTER TABLE `{$g4['shop_cart_table']}`
ADD `ct_notax` TINYINT(4) NOT NULL DEFAULT '0' AFTER `ct_num` ", true);
}
*/
if($act == "buy")
{
if(!count($_POST['ct_chk']))
@ -86,7 +76,7 @@ else if ($act == "seldelete") // 선택삭제
}
else if ($act == "multi") // 여러개의 상품이 한꺼번에 들어옴.
{
$fldcnt = count($_POST['it_name']);
$fldcnt = count($_POST['it_id']);
$arr_item = array();
// 재고등을 검사
@ -104,24 +94,18 @@ else if ($act == "multi") // 여러개의 상품이 한꺼번에 들어옴.
continue;
}
//--------------------------------------------------------
// 변조 검사
//--------------------------------------------------------
// 상품정보
$sql = " select * from {$g4['shop_item_table']} where it_id = '{$_POST['it_id'][$i]}' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
continue;
$arr_item[$i]['id'] = $it['it_id'];
$arr_item[$i]['name'] = $it['it_name'];
$arr_item[$i]['price'] = get_price($it);
$arr_item[$i]['point'] = $config['cf_use_point'] ? get_item_point($it) : 0;
$arr_item[$i]['notax'] = $it['it_notax'];
$price = get_price($it);
// 상품가격이 다름
if ((int)$price !== (int)$_POST['it_price'][$i])
die("Error..");
$point = get_item_point($it);
// 포인트가 다름
if ((int)$point !== (int)$_POST['it_point'][$i] && $config['cf_use_point'])
die("Error...");
//--------------------------------------------------------
// 이미 장바구니에 있는 같은 상품의 수량합계를 구한다.
$sql = " select SUM(ct_qty) as cnt from {$g4['shop_cart_table']} where it_id = '{$_POST['it_id'][$i]}' and uq_id = '$tmp_uq_id' ";
$row = sql_fetch($sql);
@ -154,9 +138,6 @@ else if ($act == "multi") // 여러개의 상품이 한꺼번에 들어옴.
if($arr_item[$i]['opt_skip'])
continue;
// 포인트 사용하지 않는다면
if (!$config['cf_use_point']) $_POST['it_point'][$i] = 0;
// 동일옵션의 상품이 있으면 수량 더함
$sql2 = " select ct_id
from {$g4['shop_cart_table']}
@ -173,7 +154,7 @@ else if ($act == "multi") // 여러개의 상품이 한꺼번에 들어옴.
continue;
}
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$_POST['it_id'][$i]}', '{$_POST['it_name'][$i]}', '쇼핑', '{$_POST['it_price'][$i]}', '{$_POST['it_point'][$i]}', '0', '0', '{$_POST['it_name'][$i]}', '{$_POST['ct_qty'][$i]}', '0', '{$arr_item[$i]['notax']}', '', '0', '0', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$arr_item[$i]['id']}', '{$arr_item[$i]['name']}', '쇼핑', '{$arr_item[$i]['price']}', '{$arr_item[$i]['point']}', '0', '0', '{$arr_item[$i]['name']}', '{$_POST['ct_qty'][$i]}', '0', '{$arr_item[$i]['notax']}', '', '0', '0', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$comma = ' , ';
$ct_count++;
}
@ -197,47 +178,26 @@ else if ($act == "optionmod") // 장바구니에서 옵션변경
alert('수량은 1 이상 입력해 주십시오.');
}
//--------------------------------------------------------
// 변조 검사
//--------------------------------------------------------
$total_price = 0;
// 상품정보
$sql = " select * from {$g4['shop_item_table']} where it_id = '{$_POST['it_id']}' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
alert('상품정보가 존재하지 않습니다.');
// 옵션정보를 얻어서 배열에 저장
$opt_list = array();
$sql = " select * from {$g4['shop_item_option_table']} where it_id = '{$_POST['it_id']}' and io_use = '1' order by io_no asc ";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
$opt_list[$row['io_type']][$row['io_id']]['id'] = $row['io_id'];
$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'];
}
for($i=0; $i<$option_count; $i++) {
$opt_id = $_POST['io_id'][$i];
$opt_type = $_POST['io_type'][$i];
$opt_price = $_POST['io_price'][$i];
$opt_qty = $_POST['ct_qty'][$i];
if((int)$opt_price !== (int)$opt_list[$opt_type][$opt_id]['price'])
die("Option Price Mismatch");
if($opt_type == 1)
$total_price += $opt_price * $opt_qty;
else
$total_price += ($it['it_price'] + $opt_price) * $opt_qty;
}
// 상품 총금액이 다름
if ((int)$_POST['total_price'] !== (int)$total_price)
die("Error..");
$point = get_item_point($it);
// 포인트가 다름
if ((int)$point !== (int)$_POST['it_point'] && $config['cf_use_point'])
die("Error...");
//--------------------------------------------------------
// 포인트
$point = 0;
if($config['cf_use_point'])
$point = get_item_point($it);
//--------------------------------------------------------
// 재고 검사
@ -268,17 +228,24 @@ else if ($act == "optionmod") // 장바구니에서 옵션변경
// 기존 장바구니 자료를 먼저 삭제
sql_query(" delete from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' and it_id = '$it_id' ");
// 포인트 사용하지 않는다면
if (!$config['cf_use_point']) { $_POST['it_point'] = 0; }
// 장바구니에 Insert
$comma = '';
$sql = " INSERT INTO {$g4['shop_cart_table']}
( uq_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, ct_notax, io_id, io_type, io_price, ct_time, ct_ip, ct_direct, ct_send_cost )
( uq_id, mb_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, ct_notax, io_id, io_type, io_price, ct_time, ct_ip, ct_direct, ct_send_cost )
VALUES ";
for($i=0; $i<$option_count; $i++) {
$sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$i', '{$it['it_notax']}', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct', '$ct_send_cost' )";
$opt_id = $_POST['io_id'][$i];
$opt_type = $_POST['io_type'][$i];
// 옵션테이블에 정보가 없으면 건너뜀
if($opt_id && !$opt_list[$opt_type][$opt_id]['id'])
continue;
$opt_price = $opt_list[$opt_type][$opt_id]['price'];
$opt_qty = $_POST['ct_qty'][$i];
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$it['it_id']}', '{$it['it_name']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '{$_POST['io_value'][$i]}', '$opt_qty', '$i', '{$it['it_notax']}', '$opt_id', '$opt_type', '$opt_price', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct', '$ct_send_cost' )";
$comma = ' , ';
}
@ -303,47 +270,27 @@ else // 장바구니에 담기
alert('수량은 1 이상 입력해 주십시오.');
}
//--------------------------------------------------------
// 변조 검사
//--------------------------------------------------------
// 상품정보
$total_price = 0;
$sql = " select * from {$g4['shop_item_table']} where it_id = '{$_POST['it_id']}' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
alert('상품정보가 존재하지 않습니다.');
// 옵션정보를 얻어서 배열에 저장
$opt_list = array();
$sql = " select * from {$g4['shop_item_option_table']} where it_id = '{$_POST['it_id']}' and io_use = '1' order by io_no asc ";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
$opt_list[$row['io_type']][$row['io_id']]['id'] = $row['io_id'];
$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'];
}
for($i=0; $i<$option_count; $i++) {
$opt_id = $_POST['io_id'][$i];
$opt_type = $_POST['io_type'][$i];
$opt_price = $_POST['io_price'][$i];
$opt_qty = $_POST['ct_qty'][$i];
if((int)$opt_price !== (int)$opt_list[$opt_type][$opt_id]['price'])
die("Option Price Mismatch");
if($opt_type == 1)
$total_price += $opt_price * $opt_qty;
else
$total_price += ($it['it_price'] + $opt_price) * $opt_qty;
}
// 상품 총금액이 다름
if ((int)$_POST['total_price'] !== (int)$total_price)
die("Error..");
$point = get_item_point($it);
// 포인트가 다름
if ((int)$point !== (int)$_POST['it_point'] && $config['cf_use_point'])
die("Error...");
//--------------------------------------------------------
// 포인트
$point = 0;
if($config['cf_use_point'])
$point = get_item_point($it);
//--------------------------------------------------------
// 재고 검사
@ -372,14 +319,7 @@ else // 장바구니에 담기
//--------------------------------------------------------
// 바로구매에 있던 장바구니 자료를 지운다.
$result = sql_query(" delete from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' and ct_direct = 1 ", false);
if (!$result) {
// 삭제중 에러가 발생했다면 필드가 없다는 것이므로 바로구매 필드를 생성한다.
sql_query(" ALTER TABLE `{$g4['shop_cart_table']}` ADD `ct_direct` TINYINT NOT NULL ");
}
// 포인트 사용하지 않는다면
if (!$config['cf_use_point']) { $_POST['it_point'] = 0; }
sql_query(" delete from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' and ct_direct = 1 ", false);
// 장바구니에 Insert
$sql = " select ct_num
@ -405,6 +345,16 @@ else // 장바구니에 담기
VALUES ";
for($i=0; $i<$option_count; $i++) {
$opt_id = $_POST['io_id'][$i];
$opt_type = $_POST['io_type'][$i];
// 옵션테이블에 정보가 없으면 건너뜀
if($opt_id && !$opt_list[$opt_type][$opt_id]['id'])
continue;
$opt_price = $opt_list[$opt_type][$opt_id]['price'];
$opt_qty = $_POST['ct_qty'][$i];
// 동일옵션의 상품이 있으면 수량 더함
$sql2 = " select ct_id
from {$g4['shop_cart_table']}
@ -422,7 +372,7 @@ else // 장바구니에 담기
continue;
}
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$ct_num', '{$it['it_notax']}', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$it['it_id']}', '{$it['it_name']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '{$_POST['io_value'][$i]}', '$opt_qty', '$ct_num', '{$it['it_notax']}', '$opt_id', '$opt_type', '$opt_price', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$comma = ' , ';
$ct_num++;
$ct_count++;

View File

@ -163,8 +163,6 @@ else
<form name="fitem" action="<?php echo $action_url; ?>" method="post">
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
<input type="hidden" name="it_name" value="<?php echo $it['it_name']; ?>">
<input type="hidden" name="total_price" value="">
<input type="hidden" name="sw_direct">
<input type="hidden" name="url">
@ -323,7 +321,6 @@ else
$it_point = get_item_point($it);
echo number_format($it_point);
?> 점
<input type="hidden" name="it_point" value="<?php echo $it_point; ?>">
</td>
</tr>
<?php } ?>

View File

@ -65,9 +65,6 @@ include_once('./_head.php');
<?php } else { //품절이 아니면 체크할수 있도록한다 ?>
<input type="checkbox" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>" onclick="out_cd_check(this, '<?php echo $out_cd; ?>');">
<?php } ?>
<input type="hidden" name="it_name[<?php echo $i; ?>]" value="<?php echo $row['it_name']; ?>">
<input type="hidden" name="it_price[<?php echo $i; ?>]" value="<?php echo $it_price; ?>">
<input type="hidden" name="it_point[<?php echo $i; ?>]" value="<?php echo $it_point; ?>">
<input type="hidden" name="ct_qty[<?php echo $i; ?>]" value="1">
</td>
<td class="sod_ws_img"><?php echo $image; ?></td>

21
upgrade.php Normal file
View File

@ -0,0 +1,21 @@
<?php
include_once('./_common.php');
// 포인트유효기간 필드추가
if(!sql_query(" select cf_point_term from {$g4['config_table']} ", false)) {
sql_query(" ALTER TABLE `{$g4['config_table']}`
ADD `cf_point_term` int(11) NOT NULL DEFAULT '0' AFTER `cf_use_point` ", true);
sql_query(" ALTER TABLE `{$g4['point_table']}`
ADD `po_use_point` int(11) NOT NULL DEFAULT '0' AFTER `po_point`,
ADD `po_expired` tinyint(4) NOT NULL DEFAULT '0' AFTER `po_use_point`,
ADD `po_expire_date` date NOT NULL DEFAULT '0000-00-00' AFTER `po_expired`,
ADD `po_mb_point` int(11) NOT NULL DEFAULT '0' AFTER `po_expire_date`,
ADD KEY `index2` (`po_expire_date`) ", true);
sql_query(" update {$g4['point_table']}
set po_expire_date = '9999-12-31'
where po_expire_date = '0000-00-00' ");
}
die("테이블 또는 필드 추가 업그레이드가 완료 되었습니다.");
?>