Skip to content

Commit

Permalink
QA에서 질문글 삭제 시 답변글의 첨부파일 및 썸네일을 삭제하지 못하는 문제 수정
Browse files Browse the repository at this point in the history
답변글의 정보를 잘못 가져오는 문제로 답변글의 첨부파일, 첨부파일의 썸네일, 에디터 이미지의 썸네일을 삭제하지 못하는 문제 고침
  • Loading branch information
kkigomi committed Aug 11, 2023
1 parent 6416560 commit bcbabf5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions bbs/qadelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,22 @@
delete_editor_thumbnail($row['qa_content']);

// 답변이 있는 질문글이라면 답변글 삭제
if(!$row['qa_type'] && $row['qa_status']) {
$row2 = sql_fetch(" select qa_content, qa_file1, qa_file2 from {$g5['qa_content_table']} where qa_parent = '$qa_id' ");
if (!$row['qa_type'] && $row['qa_status']) {
$answer = sql_fetch(" SELECT qa_id, qa_content, qa_file1, qa_file2 from {$g5['qa_content_table']} where qa_type = 1 AND qa_parent = {$qa_id} ");
// 첨부파일 삭제
for($k=1; $k<=2; $k++) {
@unlink(G5_DATA_PATH.'/qa/'.clean_relative_paths($row2['qa_file'.$k]));
for ($k = 1; $k <= 2; $k++) {
@unlink(G5_DATA_PATH . '/qa/' . clean_relative_paths($answer['qa_file' . $k]));
// 썸네일삭제
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['qa_file'.$k])) {
delete_qa_thumbnail($row2['qa_file'.$k]);
if (preg_match("/\.({$config['cf_image_extension']})$/i", $answer['qa_file' . $k])) {
delete_qa_thumbnail($answer['qa_file' . $k]);
}
}

// 에디터 썸네일 삭제
delete_editor_thumbnail($row2['qa_content']);
delete_editor_thumbnail($answer['qa_content']);

sql_query(" delete from {$g5['qa_content_table']} where qa_type = '1' and qa_parent = '$qa_id' ");
// 답변글 삭제
sql_query(" DELETE from {$g5['qa_content_table']} where qa_type = 1 and qa_parent = {$qa_id} ");
}

// 답변글 삭제시 질문글의 상태변경
Expand Down

0 comments on commit bcbabf5

Please sign in to comment.