diff --git a/adm/board_copy_update.php b/adm/board_copy_update.php index f94af52a8..772758484 100644 --- a/adm/board_copy_update.php +++ b/adm/board_copy_update.php @@ -160,6 +160,8 @@ if ($copy_case == 'schema_data_both') { } } $d->close(); + + run_event('admin_board_copy_file', $bo_table, $target_table); // 글복사 $sql = " insert into {$g5['write_prefix']}$target_table select * from {$g5['write_prefix']}$bo_table "; @@ -181,6 +183,9 @@ if ($copy_case == 'schema_data_both') { if (count($file_copy)) { for ($i=0; $i diff --git a/adm/dbupgrade.php b/adm/dbupgrade.php index 771d3214e..f10bf1b43 100644 --- a/adm/dbupgrade.php +++ b/adm/dbupgrade.php @@ -147,6 +147,20 @@ if(!isset($member['mb_memo_cnt'])) { $is_check = true; } +// 파일테이블에 추가 칼럼 + +$sql = " SHOW COLUMNS FROM `{$g5['board_file_table']}` LIKE 'bf_fileurl' "; +$row = sql_fetch($sql); + +if( !$row ) { + sql_query(" ALTER TABLE `{$g5['board_file_table']}` + ADD COLUMN `bf_fileurl` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bf_content`, + ADD COLUMN `bf_thumburl` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bf_fileurl`, + ADD COLUMN `bf_storage` VARCHAR(50) NOT NULL DEFAULT '' AFTER `bf_thumburl`", true); + + $is_check = true; +} + $is_check = run_replace('admin_dbupgrade', $is_check); $db_upgrade_msg = $is_check ? 'DB 업그레이드가 완료되었습니다.' : '더 이상 업그레이드 할 내용이 없습니다.
현재 DB 업그레이드가 완료된 상태입니다.'; diff --git a/bbs/delete.php b/bbs/delete.php index 81690c3c2..1c28e9fcd 100644 --- a/bbs/delete.php +++ b/bbs/delete.php @@ -80,7 +80,11 @@ while ($row = sql_fetch_array($result)) $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.'/'.str_replace('../', '', $row2['bf_file'])); + + $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($delete_file); + } // 썸네일삭제 if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) { delete_board_thumbnail($bo_table, $row2['bf_file']); diff --git a/bbs/delete_all.php b/bbs/delete_all.php index 5fa17c855..178cca355 100644 --- a/bbs/delete_all.php +++ b/bbs/delete_all.php @@ -98,7 +98,10 @@ for ($i=$chk_count-1; $i>=0; $i--) $result2 = sql_query($sql2); while ($row2 = sql_fetch_array($result2)) { // 파일삭제 - @unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.str_replace('../', '',$row2['bf_file'])); + $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($delete_file); + } // 썸네일삭제 if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) { diff --git a/bbs/download.php b/bbs/download.php index 1d9d7676c..e4f7fa3fe 100644 --- a/bbs/download.php +++ b/bbs/download.php @@ -17,7 +17,7 @@ if (!get_session('ss_view_'.$bo_table.'_'.$wr_id)) if($board['bo_download_point'] < 0 && $is_guest) alert('다운로드 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL.'/login.php?wr_id='.$wr_id.'&'.$qstr.'&url='.urlencode(get_pretty_url($bo_table, $wr_id))); -$sql = " select bf_source, bf_file from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$no' "; +$sql = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$no' "; $file = sql_fetch($sql); if (!$file['bf_file']) alert_close('파일 정보가 존재하지 않습니다.'); @@ -47,8 +47,11 @@ if ($member['mb_level'] < $board['bo_download_level']) { $filepath = G5_DATA_PATH.'/file/'.$bo_table.'/'.$file['bf_file']; $filepath = addslashes($filepath); -if (!is_file($filepath) || !file_exists($filepath)) +$file_exist_check = (!is_file($filepath) || !file_exists($filepath)) ? false : true; + +if ( false === run_replace('download_file_exist_check', $file_exist_check, $file) ){ alert('파일이 존재하지 않습니다.'); +} // 사용자 코드 실행 @include_once($board_skin_path.'/download.skin.php'); @@ -101,6 +104,8 @@ $original = urlencode($file['bf_source']); @include_once($board_skin_path.'/download.tail.skin.php'); +run_event('download_file_header', $file, $file_exist_check); + if(preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT']) && preg_match("/5\.5/", $_SERVER['HTTP_USER_AGENT'])) { header("content-type: doesn/matter"); header("content-length: ".filesize("$filepath")); diff --git a/bbs/move_update.php b/bbs/move_update.php index 667698455..b3c28f09c 100644 --- a/bbs/move_update.php +++ b/bbs/move_update.php @@ -126,8 +126,13 @@ while ($row = sql_fetch_array($result)) // 원본파일을 복사하고 퍼미션을 변경 // 제이프로님 코드제안 적용 $copy_file_name = ($bo_table !== $move_bo_table) ? $row3['bf_file'] : $row2['wr_id'].'_copy_'.$insert_id.'_'.$row3['bf_file']; - @copy($src_dir.'/'.$row3['bf_file'], $dst_dir.'/'.$copy_file_name); - @chmod($dst_dir.'/'.$copy_file_name, G5_FILE_PERMISSION); + $is_exist_file = is_file($src_dir.'/'.$row3['bf_file']) && file_exists($src_dir.'/'.$row3['bf_file']); + if( $is_exist_file ){ + @copy($src_dir.'/'.$row3['bf_file'], $dst_dir.'/'.$copy_file_name); + @chmod($dst_dir.'/'.$row3['bf_file'], G5_FILE_PERMISSION); + } + + $row3 = run_replace('bbs_move_update_file', $row3, $copy_file_name, $bo_table, $move_bo_table, $insert_id); } $sql = " insert into {$g5['board_file_table']} @@ -138,6 +143,9 @@ while ($row = sql_fetch_array($result)) bf_file = '$copy_file_name', bf_download = '{$row3['bf_download']}', bf_content = '".addslashes($row3['bf_content'])."', + bf_fileurl = '".addslashes($row3['bf_fileurl'])."', + bf_thumburl = '".addslashes($row3['bf_thumburl'])."', + bf_storage = '".addslashes($row3['bf_storage'])."', bf_filesize = '{$row3['bf_filesize']}', bf_width = '{$row3['bf_width']}', bf_height = '{$row3['bf_height']}', @@ -200,7 +208,11 @@ if ($sw == 'move') { if( isset($save[$i]['bf_file']) && $save[$i]['bf_file'] ){ for ($k=0; $k$bo_table, 'wr_id'=>$wr_id, 'data_path'=>$data_path, 'edt'=>$edt, 'filename'=>$filename, 'filepath'=>$filepath, 'thumb_width'=>$thumb_width, 'thumb_height'=>$thumb_height, 'is_create'=>$is_create, 'is_crop'=>$is_crop, 'crop_mode'=>$crop_mode, 'is_sharpen'=>$is_sharpen, 'um_value'=>$um_value)) ){ + return $thumbnail_info; + } + $tname = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value); if($tname) { @@ -73,6 +79,20 @@ function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_ return $thumb; } +// 게시글보기 파일 썸네일 리턴 +function get_file_thumbnail($file){ + + if( ! is_array($file) ) return ''; + + if( $contents = run_replace('get_file_thumbnail_tags', '', $file) ){ + return $contents; + } else if ($file['view']) { + return get_view_thumbnail($file['view']); + } + + return $file['view']; +} + // 게시글보기 썸네일 생성 function get_view_thumbnail($contents, $thumb_width=0) { diff --git a/mobile/skin/board/basic/view.skin.php b/mobile/skin/board/basic/view.skin.php index a5664f176..78c0a067d 100644 --- a/mobile/skin/board/basic/view.skin.php +++ b/mobile/skin/board/basic/view.skin.php @@ -84,10 +84,7 @@ jQuery(function($){ echo "
\n"; for ($i=0; $i<=count($view['file']); $i++) { - if ($view['file'][$i]['view']) { - //echo $view['file'][$i]['view']; - echo get_view_thumbnail($view['file'][$i]['view']); - } + echo get_file_thumbnail($view['file'][$i]); } echo "
\n"; } diff --git a/mobile/skin/board/gallery/view.skin.php b/mobile/skin/board/gallery/view.skin.php index 5a4f06801..1141e1d12 100644 --- a/mobile/skin/board/gallery/view.skin.php +++ b/mobile/skin/board/gallery/view.skin.php @@ -86,10 +86,7 @@ jQuery(function($){ echo "
\n"; for ($i=0; $i<=count($view['file']); $i++) { - if ($view['file'][$i]['view']) { - //echo $view['file'][$i]['view']; - echo get_view_thumbnail($view['file'][$i]['view']); - } + echo get_file_thumbnail($view['file'][$i]); } echo "
\n"; } diff --git a/plugin/editor/cheditor5/imageUpload/delete.php b/plugin/editor/cheditor5/imageUpload/delete.php index 35c6928de..82e65bedb 100644 --- a/plugin/editor/cheditor5/imageUpload/delete.php +++ b/plugin/editor/cheditor5/imageUpload/delete.php @@ -34,6 +34,10 @@ if( $file_arr[1] !== che_get_file_passname() ){ $filepath = SAVE_DIR . '/' . $filesrc; $r = false; +if( function_exists('run_event') ){ + run_event('delete_editor_file', $filepath, $r); +} + if (file_exists($filepath)) { $r = unlink($filepath); if ($r) { diff --git a/plugin/editor/cheditor5/imageUpload/upload.php b/plugin/editor/cheditor5/imageUpload/upload.php index 73e3700a2..96d7d51ab 100644 --- a/plugin/editor/cheditor5/imageUpload/upload.php +++ b/plugin/editor/cheditor5/imageUpload/upload.php @@ -117,9 +117,14 @@ try { } catch (Exception $e) { } -$rdata = sprintf('{"fileUrl": "%s/%s", "filePath": "%s", "fileName": "%s", "fileSize": "%d" }', - SAVE_URL, - $filename, +$file_url = SAVE_URL.'/'.$filename; + +if( function_exists('run_replace') ){ + $file_url = run_replace('get_editor_upload_url', $file_url, $savefile, array()); +} + +$rdata = sprintf('{"fileUrl": "%s", "filePath": "%s", "fileName": "%s", "fileSize": "%d" }', + $file_url, $savefile, $filename, $filesize ); diff --git a/plugin/editor/smarteditor2/photo_uploader/popup/php/UploadHandler.php b/plugin/editor/smarteditor2/photo_uploader/popup/php/UploadHandler.php index 6ae20946f..7e72ebafd 100644 --- a/plugin/editor/smarteditor2/photo_uploader/popup/php/UploadHandler.php +++ b/plugin/editor/smarteditor2/photo_uploader/popup/php/UploadHandler.php @@ -1176,6 +1176,10 @@ class UploadHandler $image_width_height = $this->get_image_size($file_path); $file->width = $image_width_height[0]; $file->height = $image_width_height[1]; + + if( function_exists('run_replace') ){ + $file->url = run_replace('get_editor_upload_url', $file->url, $file_path, $file); + } } else { //로빈아빠님이 알려주심, 이미지 업로드 체크 unlink($file_path); $file->error = $this->get_error_message('accept_file_types'); @@ -1441,6 +1445,11 @@ class UploadHandler if( substr($file_name, 0 , 32) != $this->get_file_passname() ) continue; //session_id() 와 비교하여 틀리면 지우지 않음 $file_path = $this->get_upload_path($file_name); $success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path); + + if( function_exists('run_event') ){ + run_event('delete_editor_file', $file_path, $success); + } + if ($success) { foreach($this->options['image_versions'] as $version => $options) { if (!empty($version)) { diff --git a/skin/board/basic/view.skin.php b/skin/board/basic/view.skin.php index 7e9bab2a3..789b7b211 100644 --- a/skin/board/basic/view.skin.php +++ b/skin/board/basic/view.skin.php @@ -94,10 +94,7 @@ add_stylesheet('', 0 echo "
\n"; for ($i=0; $i<=count($view['file']); $i++) { - if ($view['file'][$i]['view']) { - //echo $view['file'][$i]['view']; - echo get_view_thumbnail($view['file'][$i]['view']); - } + echo get_file_thumbnail($view['file'][$i]); } echo "
\n"; diff --git a/skin/board/gallery/view.skin.php b/skin/board/gallery/view.skin.php index 4532af836..b7200e762 100644 --- a/skin/board/gallery/view.skin.php +++ b/skin/board/gallery/view.skin.php @@ -94,10 +94,7 @@ add_stylesheet('', 0 echo "
\n"; for ($i=0; $i<=count($view['file']); $i++) { - if ($view['file'][$i]['view']) { - //echo $view['file'][$i]['view']; - echo get_view_thumbnail($view['file'][$i]['view']); - } + echo get_file_thumbnail($view['file'][$i]); } echo "
\n"; diff --git a/skin/latest/pic_list/latest.skin.php b/skin/latest/pic_list/latest.skin.php index e95445430..71b48d042 100644 --- a/skin/latest/pic_list/latest.skin.php +++ b/skin/latest/pic_list/latest.skin.php @@ -4,8 +4,8 @@ include_once(G5_LIB_PATH.'/thumbnail.lib.php'); // add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨 add_stylesheet('', 0); -$thumb_width = 210; -$thumb_height = 150; +$thumb_width = 297; +$thumb_height = 212; ?>
diff --git a/theme/basic/mobile/skin/board/basic/view.skin.php b/theme/basic/mobile/skin/board/basic/view.skin.php index a5664f176..78c0a067d 100644 --- a/theme/basic/mobile/skin/board/basic/view.skin.php +++ b/theme/basic/mobile/skin/board/basic/view.skin.php @@ -84,10 +84,7 @@ jQuery(function($){ echo "
\n"; for ($i=0; $i<=count($view['file']); $i++) { - if ($view['file'][$i]['view']) { - //echo $view['file'][$i]['view']; - echo get_view_thumbnail($view['file'][$i]['view']); - } + echo get_file_thumbnail($view['file'][$i]); } echo "
\n"; } diff --git a/theme/basic/mobile/skin/board/gallery/view.skin.php b/theme/basic/mobile/skin/board/gallery/view.skin.php index 5a4f06801..1141e1d12 100644 --- a/theme/basic/mobile/skin/board/gallery/view.skin.php +++ b/theme/basic/mobile/skin/board/gallery/view.skin.php @@ -86,10 +86,7 @@ jQuery(function($){ echo "
\n"; for ($i=0; $i<=count($view['file']); $i++) { - if ($view['file'][$i]['view']) { - //echo $view['file'][$i]['view']; - echo get_view_thumbnail($view['file'][$i]['view']); - } + echo get_file_thumbnail($view['file'][$i]); } echo "
\n"; } diff --git a/theme/basic/skin/board/basic/view.skin.php b/theme/basic/skin/board/basic/view.skin.php index 7e9bab2a3..789b7b211 100644 --- a/theme/basic/skin/board/basic/view.skin.php +++ b/theme/basic/skin/board/basic/view.skin.php @@ -94,10 +94,7 @@ add_stylesheet('', 0 echo "
\n"; for ($i=0; $i<=count($view['file']); $i++) { - if ($view['file'][$i]['view']) { - //echo $view['file'][$i]['view']; - echo get_view_thumbnail($view['file'][$i]['view']); - } + echo get_file_thumbnail($view['file'][$i]); } echo "
\n"; diff --git a/theme/basic/skin/board/gallery/view.skin.php b/theme/basic/skin/board/gallery/view.skin.php index 4532af836..b7200e762 100644 --- a/theme/basic/skin/board/gallery/view.skin.php +++ b/theme/basic/skin/board/gallery/view.skin.php @@ -94,10 +94,7 @@ add_stylesheet('', 0 echo "
\n"; for ($i=0; $i<=count($view['file']); $i++) { - if ($view['file'][$i]['view']) { - //echo $view['file'][$i]['view']; - echo get_view_thumbnail($view['file'][$i]['view']); - } + echo get_file_thumbnail($view['file'][$i]); } echo "
\n"; diff --git a/theme/basic/skin/latest/pic_list/latest.skin.php b/theme/basic/skin/latest/pic_list/latest.skin.php index e95445430..71b48d042 100644 --- a/theme/basic/skin/latest/pic_list/latest.skin.php +++ b/theme/basic/skin/latest/pic_list/latest.skin.php @@ -4,8 +4,8 @@ include_once(G5_LIB_PATH.'/thumbnail.lib.php'); // add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨 add_stylesheet('', 0); -$thumb_width = 210; -$thumb_height = 150; +$thumb_width = 297; +$thumb_height = 212; ?>