diff --git a/adm/board_copy.php b/adm/board_copy.php index f0588585a..87036222d 100644 --- a/adm/board_copy.php +++ b/adm/board_copy.php @@ -6,6 +6,11 @@ auth_check_menu($auth, $sub_menu, 'w'); $g5['title'] = '게시판 복사'; include_once(G5_PATH.'/head.sub.php'); + +$bo_table = $_REQUEST['bo_table']; +if (empty($bo_table)) { + alert_close("정상적인 방법으로 이용해주세요."); +} ?> @@ -59,9 +64,10 @@ include_once(G5_PATH.'/head.sub.php'); function fboardcopy_check(f) { diff --git a/adm/board_copy_update.php b/adm/board_copy_update.php index a0452345f..ef53e30d1 100644 --- a/adm/board_copy_update.php +++ b/adm/board_copy_update.php @@ -8,23 +8,29 @@ auth_check_menu($auth, $sub_menu, 'w'); check_admin_token(); +$bo_table = isset($_POST['bo_table']) ? $_POST['bo_table'] : null; $target_table = isset($_POST['target_table']) ? trim($_POST['target_table']) : ''; $target_subject = isset($_POST['target_subject']) ? trim($_POST['target_subject']) : ''; $target_subject = strip_tags(clean_xss_attributes($target_subject)); +if (empty($bo_table)) { + alert("원본 테이블 정보가 없습니다."); +} + if (!preg_match('/[A-Za-z0-9_]{1,20}/', $target_table)) { alert('게시판 TABLE명은 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (20자 이내)'); } // 게시판명이 금지된 단어로 되어 있으면 -if ( $w == '' && in_array($target_table, get_bo_table_banned_word()) ){ +if ($w == '' && in_array($target_table, get_bo_table_banned_word())) { alert('입력한 게시판 TABLE명을 사용할수 없습니다. 다른 이름으로 입력해 주세요.'); } $row = sql_fetch(" select count(*) as cnt from {$g5['board_table']} where bo_table = '$target_table' "); -if ($row['cnt']) +if ($row['cnt']) { alert($target_table.'은(는) 이미 존재하는 게시판 테이블명 입니다.\\n복사할 테이블명으로 사용할 수 없습니다.'); +} // 게시판 테이블 생성 $sql = get_table_define($g5['write_prefix'] . $bo_table); @@ -146,22 +152,25 @@ $copy_file = 0; if ($copy_case == 'schema_data_both') { $d = dir(G5_DATA_PATH.'/file/'.$bo_table); while ($entry = $d->read()) { - if ($entry == '.' || $entry == '..') continue; + if ($entry == '.' || $entry == '..') { + continue; + } // 김선용 201007 : - if(is_dir(G5_DATA_PATH.'/file/'.$bo_table.'/'.$entry)){ + if (is_dir(G5_DATA_PATH.'/file/'.$bo_table.'/'.$entry)) { $dd = dir(G5_DATA_PATH.'/file/'.$bo_table.'/'.$entry); @mkdir(G5_DATA_PATH.'/file/'.$target_table.'/'.$entry, G5_DIR_PERMISSION); @chmod(G5_DATA_PATH.'/file/'.$target_table.'/'.$entry, G5_DIR_PERMISSION); while ($entry2 = $dd->read()) { - if ($entry2 == '.' || $entry2 == '..') continue; + if ($entry2 == '.' || $entry2 == '..') { + continue; + } @copy(G5_DATA_PATH.'/file/'.$bo_table.'/'.$entry.'/'.$entry2, G5_DATA_PATH.'/file/'.$target_table.'/'.$entry.'/'.$entry2); @chmod(G5_DATA_PATH.'/file/'.$target_table.'/'.$entry.'/'.$entry2, G5_DIR_PERMISSION); $copy_file++; } $dd->close(); - } - else { + } else { @copy(G5_DATA_PATH.'/file/'.$bo_table.'/'.$entry, G5_DATA_PATH.'/file/'.$target_table.'/'.$entry); @chmod(G5_DATA_PATH.'/file/'.$target_table.'/'.$entry, G5_DIR_PERMISSION); $copy_file++; @@ -185,13 +194,13 @@ if ($copy_case == 'schema_data_both') { // 위의 코드는 같은 테이블명을 사용하였다는 오류가 발생함. (희한하네 ㅡㅡ;) $sql = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' "; $result = sql_query($sql, false); - for ($i=0; $row=sql_fetch_array($result); $i++) + for ($i=0; $row=sql_fetch_array($result); $i++) { $file_copy[$i] = $row; + } } if (count($file_copy)) { for ($i=0; $i