From ec295b169c7fb0def54afbb4df3b869a22afbee0 Mon Sep 17 00:00:00 2001 From: chicpro Date: Wed, 20 Feb 2013 18:51:40 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=EC=8B=9C=20=EC=8D=B8=EB=84=A4=EC=9D=BC=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/delete.php | 18 +++++++++++++++--- bbs/delete_all.php | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/bbs/delete.php b/bbs/delete.php index 9d38fda5e..b2df50c36 100644 --- a/bbs/delete.php +++ b/bbs/delete.php @@ -79,8 +79,22 @@ while ($row = sql_fetch_array($result)) // 업로드된 파일이 있다면 파일삭제 $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)) + while ($row2 = sql_fetch_array($result2)) { @unlink(G4_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']); + // 썸네일삭제 + $dir = G4_DATA_PATH.'/file/'.$bo_table; + if($dh = opendir($dir)) { + while(($file = readdir($dh)) !== false) { + if($file == "." || $file == "..") + continue; + + $filename = preg_replace("/\.[^\.]+$/i", "", $row2['bf_file']); + if(strstr($file, $filename) && strpos($file, $filename) != 0) { + @unlink($dir.'/'.$file); + } + } + } + } // 파일테이블 행 삭제 sql_query(" delete from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "); @@ -121,7 +135,5 @@ if ($count_write > 0 || $count_comment > 0) @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); ?> diff --git a/bbs/delete_all.php b/bbs/delete_all.php index 06ae7bfbf..de4d0905e 100644 --- a/bbs/delete_all.php +++ b/bbs/delete_all.php @@ -90,10 +90,25 @@ for ($i=count($tmp_array)-1; $i>=0; $i--) // 업로드된 파일이 있다면 $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)) + while ($row2 = sql_fetch_array($result2)) { // 파일삭제 @unlink(G4_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']); + // 썸네일삭제 + $dir = G4_DATA_PATH.'/file/'.$bo_table; + if($dh = opendir($dir)) { + while(($file = readdir($dh)) !== false) { + if($file == "." || $file == "..") + continue; + + $filename = preg_replace("/\.[^\.]+$/i", "", $row2['bf_file']); + if(strstr($file, $filename) && strpos($file, $filename) != 0) { + @unlink($dir.'/'.$file); + } + } + } + } + // 파일테이블 행 삭제 sql_query(" delete from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");