Skip to content

Commit

Permalink
새글 페이지와 썸네일 파일의 잘못된 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
thisgun committed Mar 15, 2021
1 parent 5a30804 commit d0b2d68
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion adm/admin.head.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function imageview(id, w, h)
foreach($amenu as $key=>$value) {
$href1 = $href2 = '';

if ($menu['menu'.$key][0][2]) {
if (isset($menu['menu'.$key][0][2]) && $menu['menu'.$key][0][2]) {
$href1 = '<a href="'.$menu['menu'.$key][0][2].'" class="gnb_1da">';
$href2 = '</a>';
} else {
Expand Down
2 changes: 1 addition & 1 deletion adm/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if( ! $is_admin ){
$sql = " select count(*) as cnt from {$g5['auth_table']} where mb_id = '{$member['mb_id']}' ";
$row = sql_fetch($sql);
if ( ! $row['cnt']) {
if (! (isset($row['cnt']) && $row['cnt'])) {
return;
}
}
Expand Down
24 changes: 16 additions & 8 deletions bbs/new_delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,27 @@
// 업로드된 파일이 있다면 파일삭제
$sql2 = " select * from {$g5['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(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']);

while ($row2 = sql_fetch_array($result2)){

$delete_file = run_replace('delete_file_path', G5_DATA_PATH.'/file/'.$bo_table.'/'.str_replace('../', '', $row2['bf_file']), $row2);
if( file_exists($delete_file) ){
@unlink(G5_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']);
}
}
// 파일테이블 행 삭제
sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' ");

$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']} 코멘트삭제");
// 댓글 포인트 삭제
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++;
}
Expand Down Expand Up @@ -120,8 +128,8 @@
$comment_reply = substr($write['wr_comment_reply'], 0, $len);

// 코멘트 삭제
if (!delete_point($write['mb_id'], $bo_table, $comment_id, '코멘트')) {
insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_parent']}-{$comment_id} 코멘트삭제");
if (!delete_point($write['mb_id'], $bo_table, $comment_id, '댓글')) {
insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_parent']}-{$comment_id} 댓글삭제");
}

// 코멘트 삭제
Expand Down
2 changes: 1 addition & 1 deletion lib/thumbnail.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
return;

$size = @getimagesize($source_file);
if($size[2] < 1 || $size[2] > 3) // gif, jpg, png 에 대해서만 적용
if(!isset($size[2]) || $size[2] < 1 || $size[2] > 3) // gif, jpg, png 에 대해서만 적용
return;

if (!is_dir($target_path)) {
Expand Down

0 comments on commit d0b2d68

Please sign in to comment.