'{$write['wr_id']}' and wr_num = '{$write['wr_num']}' and wr_is_comment = 0 "; $row = sql_fetch($sql); if ($row['cnt'] && !$is_admin) alert('이 글과 관련된 답변글이 존재하므로 삭제 할 수 없습니다.'."\n\n".'우선 답변글부터 삭제하여 주십시오.'); // 코멘트 달린 원글의 삭제 여부 $sql = " select count(*) as cnt from $write_table where wr_parent = '$wr_id' and mb_id <> '{$member['mb_id']}' and wr_is_comment = 1 "; $row = sql_fetch($sql); if ($row['cnt'] >= $board['bo_count_delete'] && !$is_admin) alert('이 글과 관련된 코멘트가 존재하므로 삭제 할 수 없습니다.'."\n\n".'코멘트가 '.$board['bo_count_delete'].'건 이상 달린 원글은 삭제할 수 없습니다.'); // 사용자 코드 실행 @include_once($board_skin_path.'/delete.skin.php'); // 나라오름님 수정 : 원글과 코멘트수가 정상적으로 업데이트 되지 않는 오류를 잡아 주셨습니다. //$sql = " select wr_id, mb_id, wr_comment from $write_table where wr_parent = '$write[wr_id]' order by wr_id "; $sql = " select wr_id, mb_id, wr_is_comment, wr_content from $write_table where wr_parent = '{$write['wr_id']}' order by wr_id "; $result = sql_query($sql); while ($row = sql_fetch_array($result)) { // 원글이라면 if (!$row['wr_is_comment']) { // 원글 포인트 삭제 if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '쓰기')) insert_point($row['mb_id'], $board['bo_write_point'] * (-1), "{$board['bo_subject']} {$row['wr_id']} 글삭제"); // 업로드된 파일이 있다면 파일삭제 $sql2 = " select * from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "; $result2 = sql_query($sql2); while ($row2 = sql_fetch_array($result2)) { @unlink(G4_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']); // 썸네일삭제 if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) { delete_board_thumbnail($bo_table, $row2['bf_file']); } } // 에디터 썸네일 삭제 delete_editor_thumbnail($row['wr_content']); // 파일테이블 행 삭제 sql_query(" delete from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "); // syndication ping include G4_SYNDI_PATH.'/include/include.bbs.delete.php'; $count_write++; } else { // 코멘트 포인트 삭제 if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '코멘트')) insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 코멘트삭제"); $count_comment++; } } // 게시글 삭제 sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' "); // 최근게시물 삭제 sql_query(" delete from {$g4['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' "); // 스크랩 삭제 sql_query(" delete from {$g4['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' "); // 공지사항 삭제 $notice_array = explode("\n", trim($board['bo_notice'])); $bo_notice = ""; for ($k=0; $k 0 || $count_comment > 0) sql_query(" update {$g4['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' "); @include_once($board_skin_path.'/delete.tail.skin.php'); delete_cache_latest($bo_table); goto_url('./board.php?bo_table='.$bo_table.'&page='.$page.$qstr); ?>