bo_table 선언 및 예외처리 추가
This commit is contained in:
@ -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("정상적인 방법으로 이용해주세요.");
|
||||
}
|
||||
?>
|
||||
|
||||
<script src="<?php echo G5_ADMIN_URL ?>/admin.js?ver=<?php echo G5_JS_VER; ?>"></script>
|
||||
@ -59,9 +64,10 @@ include_once(G5_PATH.'/head.sub.php');
|
||||
function fboardcopy_check(f)
|
||||
{
|
||||
<?php
|
||||
if(!$w){
|
||||
$js_array = get_bo_table_banned_word();
|
||||
echo "var banned_array = ". json_encode($js_array) . ";\n";
|
||||
|
||||
if (!$w) {
|
||||
$js_array = get_bo_table_banned_word();
|
||||
echo "var banned_array = ". json_encode($js_array) . ";\n";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -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<count($file_copy); $i++) {
|
||||
|
||||
$file_copy[$i] = run_replace('admin_copy_update_file', $file_copy[$i], $file_copy[$i]['bf_file'], $bo_table, $target_table);
|
||||
|
||||
$sql = " insert into {$g5['board_file_table']}
|
||||
|
||||
Reference in New Issue
Block a user