$srcfile, 'new' => $dstfile ); } } $sql = " update {$g5['g5_shop_item_table']} set it_explan = '".addslashes($cp['it_explan'])."' where it_id = '$new_it_id' "; sql_query($sql); } if($cp['it_mobile_explan']) { $matchs = get_editor_image($cp['it_mobile_explan'], false); $count_matchs = (isset($matchs[1]) && is_array($matchs[1])) ? count($matchs[1]) : 0; // 파일의 경로를 얻어 복사 for($i=0;$i<$count_matchs;$i++) { $p = parse_url($matchs[1][$i]); if(strpos($p['path'], "/data/") != 0) $src_path = preg_replace("/^\/.*\/data/", "/data", $p['path']); else $src_path = $p['path']; $srcfile = G5_PATH.$src_path; $dstfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $srcfile); if(is_file($srcfile)) { copy($srcfile, $dstfile); $newfile = preg_replace("/\.([^\.]+)$/", "_".$new_it_id.".\\1", $matchs[1][$i]); $cp['it_mobile_explan'] = str_replace($matchs[1][$i], $newfile, $cp['it_mobile_explan']); $copied_editor_images[] = array( 'original' => $srcfile, 'new' => $dstfile ); } } $sql = " update {$g5['g5_shop_item_table']} set it_mobile_explan = '".addslashes($cp['it_mobile_explan'])."' where it_id = '$new_it_id' "; sql_query($sql); } // 상품이미지 복사 function copy_directory($src_dir, $dest_dir) { if($src_dir == $dest_dir) return false; if(!is_dir($src_dir)) return false; if(!is_dir($dest_dir)) { @mkdir($dest_dir, G5_DIR_PERMISSION); @chmod($dest_dir, G5_DIR_PERMISSION); } $dir = opendir($src_dir); while (false !== ($filename = readdir($dir))) { if($filename == "." || $filename == "..") continue; $files[] = $filename; } for($i=0; $i $file, 'new' => $dstfile, ); } $sql_img .= $comma." it_img{$i} = '$new_img' "; $comma = ','; } $sql = " update {$g5['g5_shop_item_table']} set $sql_img where it_id = '$new_it_id' "; sql_query($sql); if( function_exists('shop_seo_title_update') ) shop_seo_title_update($new_it_id, true); /** * 아이템 복사 처리 후 Event Hook * @var string $it_id 원본 아이템 ID * @var string $new_it_id 복사한 새로운 아이템 ID * @var array $cp 복사한 아이템 정보 * @var array $copied_item_files 복사한 파일 목록 * @var array $copied_editor_images 복사한 에디터 이미지 목록 */ run_event('shop_admin_itemcopy', array( 'it_id' => (string) $it_id, 'new_it_id' => (string) $new_it_id, 'cp' => $cp, 'copied_item_files' => $copied_item_files, 'copied_editor_images' => $copied_editor_images )); $qstr = "ca_id=$ca_id&sfl=$sfl&sca=$sca&page=$page&stx=".urlencode($stx); goto_url("itemlist.php?$qstr");