이미지 확장자일때만 썸네일 삭제하도록 수정

This commit is contained in:
chicpro
2013-02-21 11:43:40 +09:00
parent 926bbb2e5f
commit f0da6d73e3
2 changed files with 20 additions and 16 deletions

View File

@ -82,6 +82,7 @@ while ($row = sql_fetch_array($result))
while ($row2 = sql_fetch_array($result2)) { while ($row2 = sql_fetch_array($result2)) {
@unlink(G4_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']); @unlink(G4_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']);
// 썸네일삭제 // 썸네일삭제
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file']) {
$dir = G4_DATA_PATH.'/file/'.$bo_table; $dir = G4_DATA_PATH.'/file/'.$bo_table;
if($dh = opendir($dir)) { if($dh = opendir($dir)) {
while(($file = readdir($dh)) !== false) { while(($file = readdir($dh)) !== false) {
@ -95,6 +96,7 @@ while ($row = sql_fetch_array($result))
} }
} }
} }
}
// 파일테이블 행 삭제 // 파일테이블 행 삭제
sql_query(" delete from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "); sql_query(" delete from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");

View File

@ -95,6 +95,7 @@ for ($i=count($tmp_array)-1; $i>=0; $i--)
@unlink(G4_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']); @unlink(G4_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']);
// 썸네일삭제 // 썸네일삭제
if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file']) {
$dir = G4_DATA_PATH.'/file/'.$bo_table; $dir = G4_DATA_PATH.'/file/'.$bo_table;
if($dh = opendir($dir)) { if($dh = opendir($dir)) {
while(($file = readdir($dh)) !== false) { while(($file = readdir($dh)) !== false) {
@ -108,6 +109,7 @@ for ($i=count($tmp_array)-1; $i>=0; $i--)
} }
} }
} }
}
// 파일테이블 행 삭제 // 파일테이블 행 삭제
sql_query(" delete from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "); sql_query(" delete from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");