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

This commit is contained in:
whitedot
2013-02-01 17:28:16 +09:00
9 changed files with 74 additions and 39 deletions

View File

@ -5,14 +5,14 @@ include_once("./_common.php");
auth_check($auth[$sub_menu], "r"); auth_check($auth[$sub_menu], "r");
$g4[title] = "상품 복사"; $g4[title] = "상품 복사";
include_once("$g4[path]/head.sub.php"); include_once(G4_PATH.'/head.sub.php');
?> ?>
<link rel='stylesheet' href='./admin.style.css' type='text/css'> <link rel='stylesheet' href='./admin.style.css' type='text/css'>
<table width=100% cellpadding=8><tr><td> <table width=100% cellpadding=8><tr><td>
<?=subtitle($g4[title]);?> <?=subtitle($g4['title']);?>
<table cellpadding=4 cellspacing=1 width=100%> <table cellpadding=4 cellspacing=1 width=100%>
<tr><td colspan=2 height=3 bgcolor=0E87F9></td></tr> <tr><td colspan=2 height=3 bgcolor=0E87F9></td></tr>
<tr align=center> <tr align=center>
@ -39,5 +39,5 @@ function _copy(link)
</script> </script>
<? <?
include_once("$g4[path]/tail.sub.php"); include_once(G4_PATH.'/tail.sub.php');
?> ?>

View File

@ -20,7 +20,7 @@ $cp = sql_fetch($sql);
// 상품테이블의 필드가 추가되어도 수정하지 않도록 필드명을 추출하여 insert 퀴리를 생성한다. (상품코드만 새로운것으로 대체) // 상품테이블의 필드가 추가되어도 수정하지 않도록 필드명을 추출하여 insert 퀴리를 생성한다. (상품코드만 새로운것으로 대체)
$sql_common = ""; $sql_common = "";
$fields = mysql_list_fields($mysql_db, $g4[yc4_item_table]); $fields = mysql_list_fields(G4_MYSQL_DB, $g4[yc4_item_table]);
$columns = mysql_num_fields($fields); $columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) { for ($i = 0; $i < $columns; $i++) {
$fld = mysql_field_name($fields, $i); $fld = mysql_field_name($fields, $i);
@ -35,6 +35,13 @@ $sql = " insert $g4[yc4_item_table]
sql_query($sql); sql_query($sql);
// 선택옵션정보 copy // 선택옵션정보 copy
$opt_sql = " insert ignore into {$g4['yc4_option_table']} ( opt_id, it_id, opt_amount, opt_qty, opt_notice, opt_use )
select opt_id, '$new_it_id', opt_amount, opt_qty, opt_notice, opt_use
from {$g4['yc4_option_table']}
where it_id = '$it_id'
order by opt_no asc ";
sql_query($opt_sql);
/*
$opt_sql = " select * from `{$g4['yc4_option_table']}` where it_id = '$it_id' order by opt_no asc "; $opt_sql = " select * from `{$g4['yc4_option_table']}` where it_id = '$it_id' order by opt_no asc ";
$opt_result = sql_query($opt_sql); $opt_result = sql_query($opt_sql);
for($j = 0; $opt_row = sql_fetch_array($opt_result); $j++) { for($j = 0; $opt_row = sql_fetch_array($opt_result); $j++) {
@ -48,8 +55,16 @@ for($j = 0; $opt_row = sql_fetch_array($opt_result); $j++) {
opt_use = '{$opt_row['opt_use']}' "; opt_use = '{$opt_row['opt_use']}' ";
sql_query($ins_sql); sql_query($ins_sql);
} }
*/
// 추가옵션정보 copy // 추가옵션정보 copy
$sp_sql = " insert ignore into {$g4['yc4_supplement_table']} ( sp_id, it_id, sp_amount, sp_qty, sp_notice, sp_use )
select sp_id, '$new_it_id', sp_amount, sp_qty, sp_notice, sp_use
from {$g4['yc4_supplement_table']}
where it_id = '$it_id'
order by sp_no asc ";
sql_query($sp_sql);
/*
$sp_sql = " select * from `{$g4['yc4_supplement_table']}` where it_id = '$it_id' order by sp_no asc "; $sp_sql = " select * from `{$g4['yc4_supplement_table']}` where it_id = '$it_id' order by sp_no asc ";
$sp_result = sql_query($sp_sql); $sp_result = sql_query($sp_sql);
for($j = 0; $sp_row = sql_fetch_array($sp_result); $j++) { for($j = 0; $sp_row = sql_fetch_array($sp_result); $j++) {
@ -63,23 +78,43 @@ for($j = 0; $sp_row = sql_fetch_array($sp_result); $j++) {
sp_use = '{$sp_row['sp_use']}' "; sp_use = '{$sp_row['sp_use']}' ";
sql_query($ins_sql); sql_query($ins_sql);
} }
*/
$img_path = "$g4[path]/data/item/"; // 상품이미지 복사
function copy_directory($src_dir, $dest_dir)
{
if($src_dir == $dest_dir)
return false;
for($i=1; $i<6; $i++) { if(!is_dir($src_dir))
$limg = $it_id."_l".$i; return false;
if(is_file($img_path.$limg))
copy($img_path.$limg,$img_path.$new_it_id."_l".$i);
if(!is_dir($dest_dir)) {
@mkdir($dest_dir, 0707);
@chmod($dest_dir, 0707);
}
$dir = opendir($src_dir);
while (false !== ($filename = readdir($dir))) {
if($filename == "." || $filename == "..")
continue;
$files[] = $filename;
}
for($i=0; $i<count($files); $i++) {
$src_file = $src_dir.'/'.$files[$i];
$dest_file = $dest_dir.'/'.$files[$i];
if(is_file($src_file)) {
copy($src_file, $dest_file);
@chmod($dest_file, 0606);
}
}
} }
$simg = $it_id."_s"; // 파일복사
if(is_file($img_path.$simg)) $data_path = G4_DATA_PATH.'/item';
copy($img_path.$simg,$img_path.$new_it_id."_s"); copy_directory($data_path.'/'.$it_id, $data_path.'/'.$new_it_id);
$mimg = $it_id."_m";
if(is_file($img_path.$mimg))
copy($img_path.$mimg,$img_path.$new_it_id."_m");
//$qstr = "$ca_id=$ca_id&$qstr"; //$qstr = "$ca_id=$ca_id&$qstr";
$qstr = "$ca_id=$ca_id&sfl=$sfl&sca=$sca&page=$page&stx=".urlencode($stx)."&save_stx=".urlencode($save_stx); $qstr = "$ca_id=$ca_id&sfl=$sfl&sca=$sca&page=$page&stx=".urlencode($stx)."&save_stx=".urlencode($save_stx);

View File

@ -117,6 +117,9 @@ function itemdelete($it_id)
// 디렉토리내 파일 리스트 배열로 얻기 // 디렉토리내 파일 리스트 배열로 얻기
function scan_dir($path) function scan_dir($path)
{ {
if(!is_dir($path))
return;
$dir = opendir($path); $dir = opendir($path);
while (false !== ($filename = readdir($dir))) { while (false !== ($filename = readdir($dir))) {
if($filename == "." || $filename == "..") if($filename == "." || $filename == "..")

View File

@ -8,10 +8,10 @@ if ($board['bo_use_category']) {
$is_category = true; $is_category = true;
$category_location = './board.php?bo_table='.$bo_table.'&amp;sca='; $category_location = './board.php?bo_table='.$bo_table.'&amp;sca=';
$categorys = explode('|', $board['bo_category_list']); // 구분자가 , 로 되어 있음 $categories = explode('|', $board['bo_category_list']); // 구분자가 , 로 되어 있음
for ($i=0; $i<count($categorys); $i++) { for ($i=0; $i<count($categories); $i++) {
if (trim($categorys[$i])) if (trim($categories[$i]))
$category_option .= '<li>'.$categorys[$i].'</li>'; $category_option .= '<li>'.$categories[$i].'</li>';
} }
} }

View File

@ -224,6 +224,7 @@ if ($is_guest || ($is_admin && $w == 'u' && $member['mb_id'] != $write['mb_id'])
} }
$is_category = false; $is_category = false;
$category_option = '';
if ($board['bo_use_category']) { if ($board['bo_use_category']) {
$ca_name = ""; $ca_name = "";
if (isset($write['ca_name'])) if (isset($write['ca_name']))

View File

@ -124,10 +124,7 @@ function no_comma(data)
function del(href) function del(href)
{ {
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) { if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
if (g4_charset.toUpperCase() == 'EUC-KR') document.location.href = encodeURI(href);
document.location.href = href;
else
document.location.href = encodeURI(href);
} }
} }

View File

@ -797,17 +797,17 @@ function get_category_option($bo_table='', $ca_name='')
{ {
global $g4, $board; global $g4, $board;
$arr = explode("|", $board['bo_category_list']); // 구분자가 , 로 되어 있음 $categories = explode("|", $board['bo_category_list']); // 구분자가 , 로 되어 있음
$str = ""; $str = "";
for ($i=0; $i<count($arr); $i++) { for ($i=0; $i<count($categories); $i++) {
$category = trim($arr[$i]); $category = trim($categories[$i]);
if (!$category) continue; if (!$category) continue;
$str .= "<lioption value=\"$arr[$i]\""; $str .= "<option value=\"$categories[$i]\"";
if ($category == $ca_name) { if ($category == $ca_name) {
$str .= ' selected="selected"'; $str .= ' selected="selected"';
} }
$str .= ">$arr[$i]</option>\n"; $str .= ">$categories[$i]</option>\n";
} }
return $str; return $str;

View File

@ -15,10 +15,10 @@ if ($is_nogood) $colspan++;
<div id="bo_cate"> <div id="bo_cate">
<? if ($is_category) { ?> <? if ($is_category) { ?>
<form id="fcategory" name="fcategory" method="get"> <form id="fcategory" name="fcategory" method="get">
<select name="sca" onchange="location='<?=$category_location?>'+<?=strtolower($g4['charset'])=='utf-8' ? "encodeURIComponent(this.value)" : "this.value"?>;"> <ul>
<option value=''>전체</option> <li>전체</li>
<?=$category_option?> <?=$category_option?>
</select> </ul>
</form> </form>
<? } ?> <? } ?>
</div> </div>

View File

@ -152,13 +152,12 @@ echo $option_hidden;
// 관리자라면 분류 선택에 '공지' 옵션을 추가함 // 관리자라면 분류 선택에 '공지' 옵션을 추가함
if ($is_admin) if ($is_admin)
{ {
echo " echo '
if (typeof(document.fwrite.ca_name) != 'undefined') if (ca_name_select = document.getElementById("ca_name")) {
{ ca_name_select.options.length += 1;
document.fwrite.ca_name.options.length += 1; ca_name_select.options[ca_name_select.options.length-1].value = "공지";
document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].value = '공지'; ca_name_select.options[ca_name_select.options.length-1].text = "공지";
document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].text = '공지'; }';
}";
} }
?> ?>