g4를 g5로 변경
This commit is contained in:
@ -14,17 +14,17 @@ $t_it_id = preg_replace("/[A-Za-z0-9\-_]/", "", $new_it_id);
|
||||
if($t_it_id)
|
||||
alert("상품코드는 영문자, 숫자, -, _ 만 사용할 수 있습니다.");
|
||||
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g4['shop_item_table']} where it_id = '$new_it_id' ");
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g5['shop_item_table']} where it_id = '$new_it_id' ");
|
||||
if ($row['cnt'])
|
||||
alert('이미 존재하는 상품코드 입니다.');
|
||||
|
||||
$sql = " select * from {$g4['shop_item_table']} where it_id = '$it_id' limit 1 ";
|
||||
$sql = " select * from {$g5['shop_item_table']} where it_id = '$it_id' limit 1 ";
|
||||
$cp = sql_fetch($sql);
|
||||
|
||||
|
||||
// 상품테이블의 필드가 추가되어도 수정하지 않도록 필드명을 추출하여 insert 퀴리를 생성한다. (상품코드만 새로운것으로 대체)
|
||||
$sql_common = "";
|
||||
$fields = mysql_list_fields(G4_MYSQL_DB, $g4['shop_item_table']);
|
||||
$fields = mysql_list_fields(G5_MYSQL_DB, $g5['shop_item_table']);
|
||||
$columns = mysql_num_fields($fields);
|
||||
for ($i = 0; $i < $columns; $i++) {
|
||||
$fld = mysql_field_name($fields, $i);
|
||||
@ -33,15 +33,15 @@ for ($i = 0; $i < $columns; $i++) {
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " insert {$g4['shop_item_table']}
|
||||
$sql = " insert {$g5['shop_item_table']}
|
||||
set it_id = '$new_it_id'
|
||||
$sql_common ";
|
||||
sql_query($sql);
|
||||
|
||||
// 선택/추가 옵션 copy
|
||||
$opt_sql = " insert ignore into {$g4['shop_item_option_table']} ( io_id, io_type, it_id, io_price, io_stock_qty, io_noti_qty, io_use )
|
||||
$opt_sql = " insert ignore into {$g5['shop_item_option_table']} ( io_id, io_type, it_id, io_price, io_stock_qty, io_noti_qty, io_use )
|
||||
select io_id, io_type, '$new_it_id', io_price, io_stock_qty, io_noti_qty, io_use
|
||||
from {$g4['shop_item_option_table']}
|
||||
from {$g5['shop_item_option_table']}
|
||||
where it_id = '$it_id'
|
||||
order by io_no asc ";
|
||||
sql_query($opt_sql);
|
||||
@ -58,7 +58,7 @@ if($cp['it_explan']) {
|
||||
else
|
||||
$src_path = $p['path'];
|
||||
|
||||
$srcfile = G4_PATH.$src_path;
|
||||
$srcfile = G5_PATH.$src_path;
|
||||
$dstfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $srcfile);
|
||||
|
||||
if(is_file($srcfile)) {
|
||||
@ -69,7 +69,7 @@ if($cp['it_explan']) {
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " update {$g4['shop_item_table']} set it_explan = '{$cp['it_explan']}' where it_id = '$new_it_id' ";
|
||||
$sql = " update {$g5['shop_item_table']} set it_explan = '{$cp['it_explan']}' where it_id = '$new_it_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ if($cp['it_mobile_explan']) {
|
||||
else
|
||||
$src_path = $p['path'];
|
||||
|
||||
$srcfile = G4_PATH.$src_path;
|
||||
$srcfile = G5_PATH.$src_path;
|
||||
$dstfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $srcfile);
|
||||
|
||||
if(is_file($srcfile)) {
|
||||
@ -95,7 +95,7 @@ if($cp['it_mobile_explan']) {
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " update {$g4['shop_item_table']} set it_mobile_explan = '{$cp['it_mobile_explan']}' where it_id = '$new_it_id' ";
|
||||
$sql = " update {$g5['shop_item_table']} set it_mobile_explan = '{$cp['it_mobile_explan']}' where it_id = '$new_it_id' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
@ -109,8 +109,8 @@ function copy_directory($src_dir, $dest_dir)
|
||||
return false;
|
||||
|
||||
if(!is_dir($dest_dir)) {
|
||||
@mkdir($dest_dir, G4_DIR_PERMISSION);
|
||||
@chmod($dest_dir, G4_DIR_PERMISSION);
|
||||
@mkdir($dest_dir, G5_DIR_PERMISSION);
|
||||
@chmod($dest_dir, G5_DIR_PERMISSION);
|
||||
}
|
||||
|
||||
$dir = opendir($src_dir);
|
||||
@ -126,26 +126,26 @@ function copy_directory($src_dir, $dest_dir)
|
||||
$dest_file = $dest_dir.'/'.$files[$i];
|
||||
if(is_file($src_file)) {
|
||||
copy($src_file, $dest_file);
|
||||
@chmod($dest_file, G4_FILE_PERMISSION);
|
||||
@chmod($dest_file, G5_FILE_PERMISSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 파일복사
|
||||
$dest_path = G4_DATA_PATH.'/item/'.$new_it_id;
|
||||
@mkdir($dest_path, G4_DIR_PERMISSION);
|
||||
@chmod($dest_path, G4_DIR_PERMISSION);
|
||||
$dest_path = G5_DATA_PATH.'/item/'.$new_it_id;
|
||||
@mkdir($dest_path, G5_DIR_PERMISSION);
|
||||
@chmod($dest_path, G5_DIR_PERMISSION);
|
||||
$comma = '';
|
||||
$sql_img = '';
|
||||
|
||||
for($i=1; $i<=10; $i++) {
|
||||
$file = G4_DATA_PATH.'/item/'.$cp['it_img'.$i];
|
||||
$file = G5_DATA_PATH.'/item/'.$cp['it_img'.$i];
|
||||
$new_img = '';
|
||||
|
||||
if(is_file($file)) {
|
||||
$dstfile = $dest_path.'/'.basename($file);
|
||||
copy($file, $dstfile);
|
||||
@chmod($dstfile, G4_FILE_PERMISSION);
|
||||
@chmod($dstfile, G5_FILE_PERMISSION);
|
||||
$new_img = $new_it_id.'/'.basename($file);
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ for($i=1; $i<=10; $i++) {
|
||||
$comma = ',';
|
||||
}
|
||||
|
||||
$sql = " update {$g4['shop_item_table']}
|
||||
$sql = " update {$g5['shop_item_table']}
|
||||
set $sql_img
|
||||
where it_id = '$new_it_id' ";
|
||||
sql_query($sql);
|
||||
|
||||
Reference in New Issue
Block a user